Package Pmv :: Module APBSCommands
[hide private]
[frames] | no frames]

Source Code for Module Pmv.APBSCommands

   1  # An Adaptive Poisson-Boltzmann Solver Graphic User Interface for the Python  
   2  # Molecule Viewer: (APBS GUI for PMV) 
   3  # Authors: Hovig Bayandorian, Jessica Swanson, Sophie Coon, Michel Sanner,  
   4  # Sargis Dallakyan (sargis@scripps.edu) 
   5   
   6  #$Header: /opt/cvs/python/packages/share1.5/Pmv/APBSCommands.py,v 1.99.2.9 2007/09/19 18:34:05 sargis Exp $ 
   7  # 
   8  #$Id: APBSCommands.py,v 1.99.2.9 2007/09/19 18:34:05 sargis Exp $ 
   9   
  10  """ GUI for Adaptive Poisson-Boltzmann Solver  
  11   
  12  Minimal documentation follows.  
  13  Consult APBS or PMV documentation for more detail.  
  14  More documentation is planned for later releases. 
  15   
  16  How to set up an APBS run: 
  17   
  18  1. (Calculation tab) There are three types of calculations available: 
  19     electrostatic potential, binding energy, and solvation energy. 
  20     Select whichever is of interest. 
  21  2. (Calculation tab) Under Molecules, select PQR files corresponding to 
  22     the molecules of interest. Note that binding energy requires three PQRs: 
  23     one for the complex, and one for each compound. 
  24  3. (Grid tab) Autocenter and Autosize generate grid parameters based on 
  25     the current selection in PMV. You may also manually set these parameters. 
  26     It is wise to check that your machine has the system resources required to 
  27     perform the run. 
  28  4. (Physics tab) Enter the ions of interest and change the listed parameters 
  29     as desired. 
  30  5. (Calculation tab) All files will be stored in the specified project folder. 
  31     Unique project folder names are automatically generated. 
  32  6. (Calculation tab) If you wish to modify the the run you created in the GUI 
  33     later, save the profile. 
  34  7. (Calculation tab) To run APBS separately from the GUI, use the write APBS 
  35     parameter file button, which writes to the project folder. Then call apbs 
  36     (in say, a shell) on that file. 
  37  8. (Calculation tab) Run APBS! 
  38   
  39  :see: `The epydoc webpage <http://epydoc.sourceforge.net>`__ 
  40   
  41  """  
  42   
  43  import string, os, pickle, sys, threading, select, time, shutil 
  44  import Numeric, Tkinter, Pmw 
  45   
  46  from mglutil.gui.InputForm.Tk.gui import InputFormDescr, InputForm, \ 
  47  CallBackFunction 
  48  from mglutil.gui.BasicWidgets.Tk.thumbwheel import ThumbWheel 
  49  from mglutil.gui.BasicWidgets.Tk.customizedWidgets import LoadButton, \ 
  50  SaveButton, SliderWidget, ExtendedSliderWidget 
  51  from mglutil.gui.BasicWidgets.Tk.progressBar import ProgressBar 
  52  from mglutil.util.callback import CallBackFunction 
  53   
  54  from Pmv.mvCommand import MVCommand 
  55  from ViewerFramework.VFCommand import CommandGUI 
  56  from MolKit.pdbParser import PQRParser 
  57  from MolKit.molecule import Atom 
  58  import MolKit 
  59  import tkMessageBox 
  60   
  61  global APBS_ssl  
  62  APBS_ssl = False # Flags whether to run Secured APBS Web Services  
  63  from mglutil.util.packageFilePath import getResourceFolderWithVersion 
  64  ResourceFolder = getResourceFolderWithVersion() 
  65  #Proxy retrieved  from the GAMA service 
  66  APBS_proxy = ResourceFolder + os.sep + 'ws' + os.sep + 'proxy_gama' 
67 -def closestMatch(value, _set):
68 """Returns an element of the set that is closest to the supplied value""" 69 a = 0 70 element = _set[0] 71 while(a<len(_set)): 72 if((_set[a]-value)*(_set[a]-value)<(element-value)*(element-value)): 73 element=_set[a] 74 a = a + 1 75 return element
76 77 PROFILES = ('Default',) 78 79 from MolKit.APBSParameters import * 80 81 try: 82 import sys, webbrowser, urllib, httplib 83 84 APBSservicesFound = True 85 from Pmv.APBSService_services import * 86 from Pmv.APBSService_services_types import ns1, ns2
87 - class APBSCmdToWebService:
88 """ 89 This object takes an APBSParams instance the Pmv.APBSCommands.py 90 """
91 - def __init__(self, params, mol_1, mol_2 = None, _complex = None, 92 Parallel_flag = False, npx = 2, npy = 1, npz = 1, ofrac = 0.1):
93 """ 94 Constructor for class APBSCmdToWebService 95 params is APBSPrams instance 96 mol_1,mol_2 and complex are molecule instances 97 Parallel_flag used to indicate parallel mode 98 npx npy npz are number of processors in x-, y- and z-directions 99 ofrac is the amount of overlap between processor meshes 100 """ 101 # set the parameters for the request 102 if params.calculationType == 'Electrostatic potential': 103 self.req = calculateElectrostaticPotentialRequestWrapper() 104 elif params.calculationType == 'Solvation energy': 105 self.req = calculateSolvationEnergyRequestWrapper() 106 elif params.calculationType == 'Binding energy': 107 self.req = calculateBindingEnergyRequestWrapper() 108 else: 109 tkMessageBox.showerror("Error!",params.calculationType + \ 110 " is not supported") 111 112 self._params = ns2.ParameterType_Def() 113 # set the calculation params 114 self.cp = ns2.CalculationParamsType_Def() 115 116 if params.pbeType=='Linearized': 117 self.cp._equationType = 'LINEARIZED' 118 else: 119 self.cp._equationType = 'NON_LINEAR' 120 121 if params.boundaryConditions=='Zero E': 122 self.cp._boundaryConditions = 'ZERO_E' 123 elif params.boundaryConditions=='Single Debye-Huckel': 124 self.cp._boundaryConditions = 'SINGLE_DEBYE_HUCKEL' 125 else: 126 self.cp._boundaryConditions = 'MULTIPLE_DEBYE_HUCKEL' 127 128 if params.chargeDiscretization=='Trilinear hat-function': 129 self.cp._chargeDiscretization = 'TRI_LINEAR_HAT' 130 else: 131 self.cp._chargeDiscretization = 'CUBIC_B_SPLINE' 132 133 if params.surfaceCalculation=='No smoothing': 134 self.cp._surfaceCoefficients = 'NO_SMOOTHING' 135 136 elif(params.surfaceCalculation=='Harmonic Average'): 137 self.cp._surfaceCoefficients = 'HARMONIC_AVERAGE' 138 else: 139 self.cp._surfaceCoefficients = 'SPLINE_BASED' 140 141 if(params.energyOutput=='Total'): 142 self.cp._energyOutput = 'TOTAL' 143 elif(params.energyOutput=='Total and Individual'): 144 self.cp._energyOutput = 'TOTAL_INDIVIDUAL' 145 146 oft = [] 147 148 _oft_ = ns2.OutputFilesType_Def() 149 _oft_._fileOutput = 'POTENTIAL' 150 if params.potentialFile=='OpenDX': 151 _oft_._fileFormat = 'OPEN_DX' 152 oft.append (_oft_) 153 elif params.potentialFile=='AVS_UCD': 154 _oft_._fileFormat = 'AVS UCD' 155 oft.append (_oft_) 156 elif params.potentialFile=='UHBD': 157 _oft_._fileFormat = 'UHBD' 158 oft.append (_oft_) 159 160 _oft_ = ns2.OutputFilesType_Def() 161 _oft_._fileOutput = 'SPLINE_BASED_ACCESSIBILITY' 162 if params.splineBasedAccessibilityFile=='OpenDX': 163 _oft_._fileFormat = 'OPEN_DX' 164 oft.append (_oft_) 165 elif params.splineBasedAccessibilityFile=='AVS_UCD': 166 _oft_._fileFormat = 'AVS_UCD' 167 oft.append (_oft_) 168 elif params.splineBasedAccessibilityFile=='UHBD': 169 _oft_._fileFormat = 'UHBD' 170 oft.append (_oft_) 171 172 _oft_ = ns2.OutputFilesType_Def() 173 _oft_._fileOutput = 'VDW_ACCESSIBILITY' 174 if params.VDWAccessibilityFile=='OpenDX': 175 _oft_._fileFormat = 'OPEN_DX' 176 oft.append (_oft_) 177 elif params.VDWAccessibilityFile=='AVS_UCD': 178 _oft_._fileFormat = 'AVS_UCD' 179 oft.append (_oft_) 180 elif params.VDWAccessibilityFile=='UHBD': 181 _oft_._fileFormat = 'UHBD' 182 oft.append (_oft_) 183 184 _oft_ = ns2.OutputFilesType_Def() 185 _oft_._fileOutput = 'ION_ACCESSIBILITY' 186 if params.ionAccessibilityFile=='OpenDX': 187 _oft_._fileFormat = 'OPEN_DX' 188 oft.append (_oft_) 189 elif params.ionAccessibilityFile=='AVS_UCD': 190 _oft_._fileFormat = 'AVS_UCD' 191 oft.append (_oft_) 192 elif params.ionAccessibilityFile=='UHBD': 193 _oft_._fileFormat = 'UHBD' 194 oft.append (_oft_) 195 196 _oft_ = ns2.OutputFilesType_Def() 197 _oft_._fileOutput = 'LAPLACIAN_POTENTIAL' 198 if params.laplacianOfPotentialFile=='OpenDX': 199 _oft_._fileFormat = 'OPEN_DX' 200 oft.append (_oft_) 201 elif params.laplacianOfPotentialFile=='AVS_UCD': 202 _oft_._fileFormat = 'AVS_UCD' 203 oft.append (_oft_) 204 elif params.laplacianOfPotentialFile=='UHBD': 205 _oft_._fileFormat = 'UHBD' 206 oft.append (_oft_) 207 208 _oft_ = ns2.OutputFilesType_Def() 209 _oft_._fileOutput = 'ENERGY_DENSITY' 210 if params.energyDensityFile=='OpenDX': 211 _oft_._fileFormat = 'OPEN_DX' 212 oft.append (_oft_) 213 elif params.energyDensityFile=='AVS_UCD': 214 _oft_._fileFormat = 'AVS_UCD' 215 oft.append (_oft_) 216 elif params.energyDensityFile=='UHBD': 217 _oft_._fileFormat = 'UHBD' 218 oft.append (_oft_) 219 220 _oft_ = ns2.OutputFilesType_Def() 221 _oft_._fileOutput = 'ION_NUMBER' 222 if params.ionNumberFile=='OpenDX': 223 _oft_._fileFormat = 'OPEN_DX' 224 oft.append (_oft_) 225 _oft_._fileFormat = 'AVS_UCD' 226 oft.append (_oft_) 227 elif params.ionNumberFile=='UHBD': 228 _oft_._fileFormat = 'UHBD' 229 oft.append (_oft_) 230 231 _oft_ = ns2.OutputFilesType_Def() 232 _oft_._fileOutput = 'ION_CHARGE_DENSITY' 233 if params.ionChargeDensityFile=='OpenDX': 234 _oft_._fileFormat = 'OPEN_DX' 235 oft.append (_oft_) 236 elif params.ionChargeDensityFile=='AVS_UCD': 237 _oft_._fileFormat = 'AVS_UCD' 238 oft.append (_oft_) 239 elif params.ionChargeDensityFile=='UHBD': 240 _oft_._fileFormat = 'UHBD' 241 oft.append (_oft_) 242 243 _oft_ = ns2.OutputFilesType_Def() 244 _oft_._fileOutput = 'X_SHIFTED_DIELECTRIC' 245 if params.xShiftedDielectricFile=='OpenDX': 246 _oft_._fileFormat = 'OPEN_DX' 247 oft.append (_oft_) 248 elif params.xShiftedDielectricFile=='AVS_UCD': 249 _oft_._fileFormat = 'AVS_UCD' 250 oft.append (_oft_) 251 elif params.xShiftedDielectricFile=='UHBD': 252 _oft_._fileFormat = 'UHBD' 253 oft.append (_oft_) 254 255 256 _oft_ = ns2.OutputFilesType_Def() 257 _oft_._fileOutput = 'Y_SHIFTED_DIELECTRIC' 258 if params.yShiftedDielectricFile=='OpenDX': 259 _oft_._fileFormat = 'OPEN_DX' 260 oft.append (_oft_) 261 elif params.yShiftedDielectricFile=='AVS_UCD': 262 _oft_._fileFormat = 'AVS_UCD' 263 oft.append (_oft_) 264 elif params.yShiftedDielectricFile=='UHBD': 265 _oft_._fileFormat = 'UHBD' 266 oft.append (_oft_) 267 268 _oft_ = ns2.OutputFilesType_Def() 269 _oft_._fileOutput = 'Z_SHIFTED_DIELECTRIC' 270 if params.zShiftedDielectricFile=='OpenDX': 271 _oft_._fileFormat = 'OPEN_DX' 272 oft.append (_oft_) 273 elif params.zShiftedDielectricFile=='AVS_UCD': 274 _oft_._fileFormat = 'AVS_UCD' 275 oft.append (_oft_) 276 elif params.zShiftedDielectricFile=='UHBD': 277 _oft_._fileFormat = 'UHBD' 278 oft.append (_oft_) 279 280 _oft_ = ns2.OutputFilesType_Def() 281 _oft_._fileOutput = 'KAPPA_FUNCTION' 282 if params.kappaFunctionFile=='OpenDX': 283 _oft_._fileFormat = 'OPEN_DX' 284 oft.append (_oft_) 285 elif params.kappaFunctionFile=='AVS_UCD': 286 _oft_._fileFormat = 'AVS_UCD' 287 oft.append (_oft_) 288 elif params.kappaFunctionFile=='UHBD': 289 _oft_._fileFormat = 'UHBD' 290 oft.append (_oft_) 291 292 self.cp._outputFiles = oft 293 294 # create the list of molecule 295 296 molecule = ns1.MoleculeType_Def() 297 molecule._moleculeName = mol_1.name 298 atoms = [] 299 for at in mol_1.allAtoms: 300 atom = ns1.AtomType_Def() 301 atom._fieldName = 'ATOM' 302 atom._atomNumber = at.number 303 atom._atomName = at.element 304 atom._residueName = at.parent.name 305 atom._residueNumber = int(at.parent.number) 306 307 coord = ns1.CoordinateType_Def() 308 coord._x, coord._y, coord._z = at.coords 309 atom._coordinates = coord 310 311 atom._charge = at.charge 312 atom._radius = at.pqrRadius 313 314 atoms.append(atom) 315 316 molecule._atom = atoms 317 318 if params.calculationType == 'Binding energy': 319 molecule2 = ns1.MoleculeType_Def() 320 molecule2._moleculeName = mol_2.name 321 atoms = [] 322 for at in mol_2.allAtoms: 323 atom = ns1.AtomType_Def() 324 atom._fieldName = 'ATOM' 325 atom._atomNumber = at.number 326 atom._atomName = at.element 327 atom._residueName = at.parent.name 328 atom._residueNumber = int(at.parent.number) 329 330 coord = ns1.CoordinateType_Def() 331 coord._x, coord._y, coord._z = at.coords 332 atom._coordinates = coord 333 334 atom._charge = at.charge 335 atom._radius = at.pqrRadius 336 337 atoms.append(atom) 338 339 molecule2._atom = atoms 340 341 342 _complex = ns1.MoleculeType_Def() 343 _complex._moleculeName = _complex.name 344 atoms = [] 345 for at in _complex.allAtoms: 346 atom = ns1.AtomType_Def() 347 atom._fieldName = 'ATOM' 348 atom._atomNumber = at.number 349 atom._atomName = at.element 350 atom._residueName = at.parent.name 351 atom._residueNumber = int(at.parent.number) 352 353 coord = ns1.CoordinateType_Def() 354 coord._x, coord._y, coord._z = at.coords 355 atom._coordinates = coord 356 357 atom._charge = at.charge 358 atom._radius = at.pqrRadius 359 360 atoms.append(atom) 361 362 _complex._atom = atoms 363 self.req._molecule1 = molecule 364 self.req._molecule2 = molecule2 365 self.req._complex = _complex 366 else: 367 self.req._molecule = molecule 368 369 self._params._calculationParams = self.cp 370 371 # set the Grid params # see apbsWriteGridParams 372 gp = ns2.GridParamsType_Def() 373 gpt = ns2.GridCardinalityType_Def() 374 gpt._x = params.gridPointsX 375 gpt._y = params.gridPointsY 376 gpt._z = params.gridPointsZ 377 gp._numGridPoints = gpt 378 379 coarse = ns2.GridType_Def() 380 cl = ns1.CoordinateType_Def() 381 cl._x = params.coarseLengthX 382 cl._y = params.coarseLengthY 383 cl._z = params.coarseLengthZ 384 coarse._length = cl 385 cc = ns1.CoordinateType_Def() 386 cc._x = params.coarseCenterX 387 cc._y = params.coarseCenterY 388 cc._z = params.coarseCenterZ 389 coarse._centerCoords = cc 390 gp._coarseGrid = coarse 391 392 fine = ns2.GridType_Def() 393 fl = ns1.CoordinateType_Def() 394 fl._x = params.fineLengthX 395 fl._y = params.fineLengthY 396 fl._z = params.fineLengthZ 397 fine._length = fl 398 fc = ns1.CoordinateType_Def() 399 fc._x = params.fineCenterX 400 fc._y = params.fineCenterY 401 fc._z = params.fineCenterZ 402 fine._centerCoords = fc 403 gp._fineGrid = fine 404 405 self._params._gridParams = gp 406 407 if Parallel_flag: 408 pp = ns2.ParallelParamsType_Def() 409 pg = ns2.GridCardinalityType_Def() 410 pg._x = npx 411 pg._y = npy 412 pg._z = npz 413 pp._procGrid = pg 414 pp._overlapFactor = ofrac 415 self._params._parallelParams = pp 416 # set the Physics params # see apbsWritePhysicsParams 417 pp = ns2.PhysicsParamsType_Def() 418 pp._proteinDielectric = params.proteinDielectric 419 pp._solventDielectric = params.solventDielectric 420 pp._solventRadius = params.solventRadius 421 pp._systemTemperature = params.systemTemperature 422 423 self._params._physicsParams = pp 424 self.req._params = self._params
425
426 - def run(self, portAddress):
427 """Runs APBS through Web Services""" 428 # retrieve a reference to the remote port 429 import httplib 430 self.apbsLocator = APBSServiceLocator() 431 global APBS_ssl 432 portAddress +="/axis/services/APBSJobSubPort" 433 if APBS_ssl: 434 self.apbsPort = self.apbsLocator.getAPBSJobSubPortType\ 435 (portAddress, ssl = 1, cert_file = APBS_proxy, 436 key_file = APBS_proxy, transport=httplib.HTTPSConnection) 437 else: 438 self.apbsPort = self.apbsLocator.getAPBSJobSubPortType\ 439 (portAddress) 440 # make remote invocation 441 if isinstance(self.req, calculateBindingEnergyRequestWrapper): 442 resp =self.apbsPort.calculateEnergyBlocking(self.req) 443 elif isinstance(self.req, calculateElectrostaticPotentialRequestWrapper): 444 resp =self.apbsPort.calculateElectrostaticPotential(self.req) 445 elif isinstance(self.req, calculateSolvationEnergyRequestWrapper): 446 resp =self.apbsPort.calculateSolvationEnergy(self.req) 447 else: 448 tkMessageBox.showerror("Error!",self.req + " is not supported") 449 return resp
450 451 except ImportError: 452 APBSservicesFound = False 453 454 state_GUI = 'disabled' 455 blinker = 0
456 -class APBSSetup(MVCommand):
457 """APBSSetup setups all necessary parameters for Adaptive Poisson-Boltzmann 458 Solver (APBS)\n 459 \nPackage : Pmv 460 \nModule : APBSCommands 461 \nClass : APBSSetup 462 \nCommand name : APBSSetup 463 \nSynopsis:\n 464 None <--- APBSSetup(**kw)\n 465 \nDescription:\n 466 Pmv-->APBS-->Setup creates Pmw.NoteBook with three tabbed pages:\n 467 Calculation, Grid and Physics. 468 469 Calculation page contains the following groups: 470 471 Mathematics - is used to setup up Calculation type (kw['calculationType']), 472 Poisson-Boltzmann equation type (kw['pbeType']), Boundary conditions 473 (kw['boundaryConditions']),Charge discretization (kw['chargeDiscretization']) 474 Surface-based coefficients (kw['surfaceCalculation']), and Spline window in 475 Angstroms (kw['splineWindow'], present only when surfaceCalculation is set to 476 'Spline-based') 477 Molecules - allows to select molecule(s) 478 Output - sets output file formats 479 Profiles - is used to add, remove, load, save and run different profiles 480 APBS Web Services - is present only when APBSService_services module is 481 installed. It allows APBS to be run remotely 482 483 Grid page contains the following groups: 484 485 General - lets you select number of grid point along X, Y and Z directions 486 Coarse Grid - allows changing the length and the center of the coarse grid. 487 It also allows to autoceter, autosize as well as visualize the coarse grid. 488 Fine Grid - dos the same for the fine grid 489 System Resources - shows total grid point and memory to be allocated for APBS 490 491 Grid page contains the following groups: 492 493 Parameters - allows to change protein and solevent dielectric constants, 494 solvent radius and system temperature 495 Ions - allows to add and/or remove different ions 496 """
497 - def __init__(self, func=None):
498 """Constructor for class APBSSetup""" 499 MVCommand.__init__(self) 500 self.params = APBSParams() 501 self.cmp_APBSParams = APBSParams() 502 self.flag_grid_changed = False 503 self.RememberLogin_var = Tkinter.BooleanVar() 504 self.salt_var =Tkinter.BooleanVar() 505 self.salt_var.set(1)
506
507 - def doit(self,**kw):
508 """doit function""" 509 self.cmp_APBSParams.Set(**kw)
510
511 - def __call__(self, **kw):
512 """Call method""" 513 self.params.Set(**kw) 514 self.refreshAll()
515
516 - def onAddObjectToViewer(self, object):
517 """Called when object is added to viewer""" 518 if self.cmdForms.has_key('default'): 519 try: 520 ebn = self.cmdForms['moleculeSelect'].descr.entryByName 521 w = ebn['moleculeListSelect']['widget'] 522 molNames = self.vf.Mols.name 523 w.setlist(molNames) 524 descr = self.cmdForms['default'].descr 525 descr.entryByName['APBSservicesLabel1']['widget'].\ 526 configure(text = "") 527 descr.entryByName['APBSservicesLabel2']['widget'].\ 528 configure(text = "") 529 530 except KeyError: 531 pass 532 object.APBSParams = {}
533 534 # object.APBSParams['Default'] = APBSParams() 535
536 - def onRemoveObjectFromViewer(self, object):
537 """Called when object is removed from viewer""" 538 if self.cmdForms.has_key('default'): 539 try: 540 ebn = self.cmdForms['moleculeSelect'].descr.entryByName 541 w = ebn['moleculeListSelect']['widget'] 542 molNames = self.vf.Mols.name 543 w.setlist(molNames) 544 except KeyError: 545 pass
546
547 - def onAddCmdToViewer(self):
548 """Called when APBSSetup are added to viewer""" 549 if self.vf.hasGui: 550 from DejaVu.bitPatterns import patternList 551 from opengltk.OpenGL import GL 552 from DejaVu import viewerConst 553 from DejaVu.Box import Box 554 555 face=((0,3,2,1),(3,7,6,2),(7,4,5,6),(0,1,5,4),(1,2,6,5),(0,4,7,3)) 556 coords=((1,1,-1),(-1,1,-1),(-1,-1,-1),(1,-1,-1),(1,1,1),(-1,1,1), 557 (-1,-1,1),(1,-1,1)) 558 materials=((0,0,1),(0,1,0),(0,0,1),(0,1,0),(1,0,0),(1,0,0)) 559 560 box=Box('CoarseAPBSbox', materials=materials, vertices=coords, 561 faces=face, listed=0, inheritMaterial=0) 562 box.Set(frontPolyMode=GL.GL_FILL, tagModified=False) 563 box.polygonstipple.Set(pattern=patternList[0]) 564 box.Set(matBind=viewerConst.PER_PART, visible=0, 565 inheritStipplePolygons=0, shading=GL.GL_FLAT, inheritShading=0, 566 stipplePolygons=1, frontPolyMode=GL.GL_FILL, 567 tagModified=False) 568 box.oldFPM = None 569 self.coarseBox = box 570 self.vf.GUI.VIEWER.AddObject(box, redo=0) 571 572 box=Box('FineAPBSbox', materials=materials, vertices=coords, 573 faces=face, listed=0, inheritMaterial=0) 574 box.polygonstipple.Set(pattern=patternList[3]) 575 box.Set(matBind=viewerConst.PER_PART, visible=0, 576 inheritStipplePolygons=0, shading=GL.GL_FLAT, 577 inheritShading=0, stipplePolygons=1, 578 frontPolyMode=GL.GL_FILL, tagModified=False) 579 box.oldFPM = None 580 self.fineBox = box 581 self.vf.GUI.VIEWER.AddObject(box, redo=0)
582
583 - def guiCallback(self):
584 """GUI callback for APBSSetup""" 585 self.refreshAll() 586 mainform = self.showForm('default', modal=0, blocking=1, 587 initFunc=self.refreshAll) 588 if mainform: 589 # self.paramUpdateAll() 590 tmp_dict = {} 591 for key, value in self.params.__dict__.items(): 592 if self.params.__dict__[key] != \ 593 self.cmp_APBSParams.__dict__[key]: 594 if type(value) is types.TupleType: 595 value = value[0] 596 if key == 'ions': 597 for ion in value: 598 self.vf.message("self.APBSSetup.params.ions.\ 599 append(Pmv.APBSCommands.Ion("+ion.toString()+"))") 600 self.vf.log("self.APBSSetup.params.ions.\ 601 append(Pmv.APBSCommands.Ion("+ion.toString()+"))") 602 self.cmp_APBSParams.ions = self.params.ions 603 continue 604 tmp_dict[key] = value 605 if len(tmp_dict) != 0: 606 self.doitWrapper(**tmp_dict)
607
608 - def dismiss(self, event = None):
609 """Withdraws 'default' GUI""" 610 self.cmdForms['default'].withdraw()
611
612 - def coarseResolutionX(self):
613 """Returns coarse grid resolution in X direction""" 614 return self.params.coarseLengthX/float(self.params.gridPointsX-1)
615
616 - def coarseResolutionY(self):
617 """Returns coarse grid resolution in Y direction""" 618 return self.params.coarseLengthY/float(self.params.gridPointsY-1)
619
620 - def coarseResolutionZ(self):
621 """Returns coarse grid resolution in Z direction""" 622 return self.params.coarseLengthZ/float(self.params.gridPointsZ-1)
623
624 - def fineResolutionX(self):
625 """Returns fine grid resolution in X direction""" 626 return self.params.fineLengthX/float(self.params.gridPointsX-1)
627
628 - def fineResolutionY(self):
629 """Returns fine grid resolution in Y direction""" 630 return self.params.fineLengthY/float(self.params.gridPointsY-1)
631
632 - def fineResolutionZ(self):
633 """Returns fine grid resolution in Z direction""" 634 return self.params.fineLengthZ/float(self.params.gridPointsZ-1)
635
636 - def memoryToBeAllocated(self):
637 """Returns memory to be allocated for APBS run""" 638 return self.params.MEGABYTES_PER_GRID_POINT*self.totalGridPoints()
639
640 - def totalGridPoints(self):
641 """Returns total number of grid points""" 642 return self.params.gridPointsX*self.params.gridPointsY*\ 643 self.params.gridPointsZ
644
645 - def autocenterCoarseGrid(self):
646 """Autocenters coarse grid""" 647 coords = self.getCoords() 648 center=(Numeric.maximum.reduce(coords)+Numeric.minimum.reduce(coords))*0.5 649 center = center.tolist() 650 self.params.coarseCenterX = round(center[0],4) 651 self.params.coarseCenterY = round(center[1],4) 652 self.params.coarseCenterZ = round(center[2],4) 653 self.refreshGridPage()
654
655 - def autosizeCoarseGrid(self):
656 """Autosizes coarse grid""" 657 coords = self.getCoords() 658 length = Numeric.maximum.reduce(coords) - Numeric.minimum.reduce(coords) 659 self.params.coarseLengthX = self.params.CFAC*(length.tolist())[0] + 10. 660 self.params.coarseLengthY = self.params.CFAC*(length.tolist())[1] + 10. 661 self.params.coarseLengthZ = self.params.CFAC*(length.tolist())[2] + 10. 662 self.refreshGridPage()
663
664 - def autocenterFineGrid(self):
665 """Autocenters fine grid""" 666 coords = self.getCoords() 667 center=(Numeric.maximum.reduce(coords)+Numeric.minimum.reduce(coords))*0.5 668 center = center.tolist() 669 self.params.fineCenterX = round(center[0],4) 670 self.params.fineCenterY = round(center[1],4) 671 self.params.fineCenterZ = round(center[2],4) 672 self.refreshGridPage()
673
674 - def autosizeFineGrid(self):
675 """Autosizes fine grid""" 676 coords = self.getCoords() 677 length=Numeric.maximum.reduce(coords)-Numeric.minimum.reduce(coords) 678 self.params.fineLengthX = (length.tolist())[0] + 10.0 679 self.params.fineLengthY = (length.tolist())[1] + 10.0 680 self.params.fineLengthZ = (length.tolist())[2] + 10.0 681 self.refreshGridPage()
682
683 - def getCoords(self):
684 """Returns coordinates of atoms included in calculation""" 685 molName=os.path.splitext(self.params.molecule1Path)[0].split("/")[-1] 686 mol = self.vf.getMolFromName(molName) 687 coords = mol.findType(Atom).coords 688 if self.params.calculationType == 'Binding energy': 689 molName=os.path.splitext(self.params.molecule2Path)[0].split("/")[-1] 690 mol = self.vf.getMolFromName(molName) 691 if mol: 692 coords += mol.findType(Atom).coords 693 molName=os.path.splitext(self.params.complexPath)[0].split("/")[-1] 694 mol = self.vf.getMolFromName(molName) 695 if mol: 696 coords += mol.findType(Atom).coords 697 return coords
698 699 # Callbacks
700 - def refreshCalculationPage(self):
701 """Refreshes calculation page""" 702 if self.cmdForms.has_key('default'): 703 descr = self.cmdForms['default'].descr 704 705 if(self.params.calculationType=='Binding energy'): 706 apply(descr.entryByName['molecule2Select']['widget'].grid, 707 (), descr.entryByName['molecule2Select']['gridcfg']) 708 apply(descr.entryByName['molecule2']['widget'].grid, (), 709 descr.entryByName['molecule2']['gridcfg']) 710 apply(descr.entryByName['complexSelect']['widget'].grid, (), 711 descr.entryByName['complexSelect']['gridcfg']) 712 apply(descr.entryByName['complex']['widget'].grid, (), 713 descr.entryByName['complex']['gridcfg']) 714 self.params.energyOutput = 'Total' 715 elif(self.params.calculationType=='Solvation energy'): 716 descr.entryByName['molecule2Select']['widget'].grid_forget() 717 descr.entryByName['molecule2']['widget'].grid_forget() 718 descr.entryByName['complexSelect']['widget'].grid_forget() 719 descr.entryByName['complex']['widget'].grid_forget() 720 self.params.energyOutput = 'Total' 721 elif(self.params.calculationType=='Electrostatic potential'): 722 descr.entryByName['molecule2Select']['widget'].grid_forget() 723 descr.entryByName['molecule2']['widget'].grid_forget() 724 descr.entryByName['complexSelect']['widget'].grid_forget() 725 descr.entryByName['complex']['widget'].grid_forget() 726 727 descr.entryByName['calculationType']['widget'].\ 728 selectitem(self.params.calculationType) 729 descr.entryByName['pbeType']['widget'].\ 730 selectitem(self.params.pbeType) 731 descr.entryByName['boundaryConditions']['widget'].\ 732 selectitem(self.params.boundaryConditions) 733 descr.entryByName['chargeDiscretization']['widget'].\ 734 selectitem(self.params.chargeDiscretization) 735 descr.entryByName['surfaceCalculation']['widget'].\ 736 selectitem(self.params.surfaceCalculation) 737 descr.entryByName['sdens']['widget'].setentry(self.params.sdens) 738 descr.entryByName['splineWindow']['widget'].\ 739 setentry(self.params.splineWindow) 740 741 if self.params.surfaceCalculation == 'Cubic B-spline' or \ 742 self.params.surfaceCalculation == '7th Order Polynomial': 743 apply(descr.entryByName['splineWindowLabel']['widget'].grid, 744 (), descr.entryByName['splineWindowLabel']['gridcfg']) 745 apply(descr.entryByName['splineWindow']['widget'].grid, (), 746 descr.entryByName['splineWindow']['gridcfg']) 747 descr.entryByName['sdensLabel']['widget'].grid_forget() 748 descr.entryByName['sdens']['widget'].grid_forget() 749 750 else: 751 apply(descr.entryByName['sdensLabel']['widget'].grid, 752 (), descr.entryByName['sdensLabel']['gridcfg']) 753 apply(descr.entryByName['sdens']['widget'].grid, (), 754 descr.entryByName['sdens']['gridcfg']) 755 descr.entryByName['splineWindowLabel']['widget'].grid_forget() 756 descr.entryByName['splineWindow']['widget'].grid_forget() 757 758 descr.entryByName['molecule1']['widget'].\ 759 setentry(self.params.molecule1Path) 760 descr.entryByName['molecule2']['widget'].\ 761 setentry(self.params.molecule2Path) 762 descr.entryByName['complex']['widget'].\ 763 setentry(self.params.complexPath) 764 765 descr.entryByName['energyOutput']['widget'].\ 766 selectitem(self.params.energyOutput) 767 descr.entryByName['forceOutput']['widget'].\ 768 selectitem(self.params.forceOutput) 769 descr.entryByName['forceOutput']['widget'].\ 770 selectitem(self.params.forceOutput) 771 descr.entryByName['Profiles']['widget'].\ 772 selectitem(self.params.name)
773
774 - def testCalculationWidgets(self):
775 """Tests calculation widgets""" 776 if self.cmdForms.has_key('default'): 777 descr = self.cmdForms['default'].descr 778 779 if(descr.entryByName['splineWindow']['widget'].get() == ''): 780 self.errorMsg = 'You must enter a spline window value.' 781 errorform = self.showForm('error',modal=1,blocking=1,force = 1) 782 return 1 783 return 0
784
785 - def calculationParamUpdate(self, selectItem=0):
786 """Updates calculation parameters""" 787 if self.cmdForms.has_key('default'): 788 if selectItem == 'Binding energy': 789 self.params.calculationType = 'Binding energy' 790 self.refreshCalculationPage() 791 return 792 descr = self.cmdForms['default'].descr 793 # Prevent forcing a particular calculation type on the user 794 self.params.calculationType = descr.entryByName\ 795 ['calculationType']['widget'].get() 796 if self.testCalculationWidgets()==0: 797 self.params.calculationType = descr.entryByName\ 798 ['calculationType']['widget'].get() 799 self.params.pbeType = descr.entryByName['pbeType']['widget'].\ 800 get() 801 self.params.boundaryConditions = descr.entryByName\ 802 ['boundaryConditions']['widget'].get() 803 self.params.chargeDiscretization = descr.entryByName\ 804 ['chargeDiscretization']['widget'].get() 805 self.params.surfaceCalculation = descr.entryByName\ 806 ['surfaceCalculation']['widget'].get() 807 self.params.sdens = float(descr.entryByName['sdens']['widget'].\ 808 get()) 809 self.params.splineWindow = float(descr.entryByName\ 810 ['splineWindow']['widget'].get()) 811 self.params.molecule1Path = descr.entryByName['molecule1']\ 812 ['widget'].get() 813 self.params.molecule2Path = descr.entryByName['molecule2']\ 814 ['widget'].get() 815 self.params.complexPath = descr.entryByName['complex']\ 816 ['widget'].get() 817 self.params.energyOutput = descr.entryByName['energyOutput']\ 818 ['widget'].get() 819 self.params.forceOutput = descr.entryByName['forceOutput']\ 820 ['widget'].get() 821 self.params.name = descr.entryByName['Profiles']['widget'].\ 822 get() 823 else: 824 return "ERROR" 825 self.refreshCalculationPage()
826
827 - def refreshGridPage(self):
828 """Refreshes grid page""" 829 if self.cmdForms.has_key('default'): 830 descr = self.cmdForms['default'].descr 831 descr.entryByName['gridPointsX']['widget'].set(closestMatch(self. 832 params.gridPointsX, self.params.GRID_VALUES), update = 0) 833 descr.entryByName['gridPointsY']['widget'].set(closestMatch(self. 834 params.gridPointsY, self.params.GRID_VALUES), update = 0) 835 descr.entryByName['gridPointsZ']['widget'].set(closestMatch(self. 836 params.gridPointsZ, self.params.GRID_VALUES), update = 0) 837 descr.entryByName['coarseLengthX']['widget'].set(self.params. 838 coarseLengthX, update = 0) 839 descr.entryByName['coarseLengthY']['widget'].set(self.params. 840 coarseLengthY, update = 0) 841 descr.entryByName['coarseLengthZ']['widget'].set(self.params. 842 coarseLengthZ, update = 0) 843 descr.entryByName['coarseCenterX']['widget'].set(self.params. 844 coarseCenterX, update = 0) 845 descr.entryByName['coarseCenterY']['widget'].set(self.params. 846 coarseCenterY, update = 0) 847 descr.entryByName['coarseCenterZ']['widget'].set(self.params. 848 coarseCenterZ, update = 0) 849 descr.entryByName['coarseResolutionX']['widget'].configure(text = 850 "%5.3f"%self.coarseResolutionX()) 851 descr.entryByName['coarseResolutionY']['widget'].configure(text = 852 "%5.3f"%self.coarseResolutionY()) 853 descr.entryByName['coarseResolutionZ']['widget'].configure(text = 854 "%5.3f"%self.coarseResolutionZ()) 855 descr.entryByName['fineLengthX']['widget'].set(self.params. 856 fineLengthX, update = 0) 857 descr.entryByName['fineLengthY']['widget'].set(self.params. 858 fineLengthY, update = 0) 859 descr.entryByName['fineLengthZ']['widget'].set(self.params. 860 fineLengthZ, update = 0) 861 descr.entryByName['fineCenterX']['widget'].set(self.params. 862 fineCenterX, update = 0) 863 descr.entryByName['fineCenterY']['widget'].set(self. 864 params.fineCenterY, update = 0) 865 descr.entryByName['fineCenterZ']['widget'].set(self.params. 866 fineCenterZ, update = 0) 867 descr.entryByName['fineResolutionX']['widget'].configure(text = 868 "%5.3f"%self.fineResolutionX()) 869 descr.entryByName['fineResolutionY']['widget'].configure(text = 870 "%5.3f"%self.fineResolutionY()) 871 descr.entryByName['fineResolutionZ']['widget'].configure(text = 872 "%5.3f"%self.fineResolutionZ()) 873 descr.entryByName['gridPointsNumberLabel']['widget'].\ 874 configure(text = "%d"%self.totalGridPoints()) 875 descr.entryByName['mallocSizeLabel']['widget'].configure(text = 876 "%5.3f"%self.memoryToBeAllocated()) 877 self.coarseBox.Set(visible = descr.\ 878 entryByName['showCoarseGrid']['wcfg']['variable'].get(), 879 xside = self.params.coarseLengthX, 880 yside = self.params.coarseLengthY, 881 zside = self.params.coarseLengthZ, 882 center = [self.params.coarseCenterX, self.params.coarseCenterY, 883 self.params.coarseCenterZ], tagModified=False) 884 self.fineBox.Set(visible = descr.\ 885 entryByName['showFineGrid']['wcfg']['variable'].get(), 886 xside = self.params.fineLengthX,yside = self.params.fineLengthY, 887 zside = self.params.fineLengthZ, 888 center = [self.params.fineCenterX, self.params.fineCenterY, 889 self.params.fineCenterZ], tagModified=False) 890 self.vf.GUI.VIEWER.Redraw()
891
892 - def testGridWidgets(self):
893 """Tests grid widget""" 894 if self.cmdForms.has_key('default'): 895 descr = self.cmdForms['default'].descr 896 #Boundary check: make sure coarse grid encloses fine grid 897 ccx = descr.entryByName['coarseCenterX']['widget'].value 898 ccy = descr.entryByName['coarseCenterY']['widget'].value 899 ccz = descr.entryByName['coarseCenterZ']['widget'].value 900 clx = descr.entryByName['coarseLengthX']['widget'].value/2 901 cly = descr.entryByName['coarseLengthY']['widget'].value/2 902 clz = descr.entryByName['coarseLengthZ']['widget'].value/2 903 fcx = descr.entryByName['fineCenterX']['widget'].value 904 fcy = descr.entryByName['fineCenterY']['widget'].value 905 fcz = descr.entryByName['fineCenterZ']['widget'].value 906 flx = descr.entryByName['fineLengthX']['widget'].value/2 907 fly = descr.entryByName['fineLengthY']['widget'].value/2 908 flz = descr.entryByName['fineLengthZ']['widget'].value/2 909 if (fcx+flx>ccx+clx) or (fcx-flx<ccx-clx) or (fcy+fly>ccy+cly) or \ 910 (fcy-fly<ccy-cly) or (fcz+flz>ccz+clz) or (fcz-flz<ccz-clz): 911 self.errorMsg = 'The coarse grid must enclose the fine grid.' 912 errorform = self.showForm('error',modal=1,blocking=1,force=1) 913 return 1 914 return 0 915 else : 916 #Boundary check: make sure coarse grid encloses fine grid 917 ccx = self.params.coarseCenterX 918 ccy = self.params.coarseCenterY 919 ccz = self.params.coarseCenterZ 920 clx = self.params.coarseLengthX 921 cly = self.params.coarseLengthY 922 clz = self.params.coarseLengthZ 923 fcx = self.params.fineCenterX 924 fcy = self.params.fineCenterY 925 fcz = self.params.fineCenterZ 926 flx = self.params.fineLengthX 927 fly = self.params.fineLengthY 928 flz = self.params.fineLengthZ 929 if (fcx+flx>ccx+clx) or (fcx-flx<ccx-clx) or (fcy+fly>ccy+cly) or \ 930 (fcy-fly<ccy-cly) or (fcz+flz>ccz+clz) or (fcz-flz<ccz-clz): 931 self.errorMsg = 'The coarse grid must enclose the fine grid.' 932 errorform = self.showForm('error',modal=1,blocking=1,force=1) 933 return 1 934 return 0
935
936 - def gridParamUpdate(self, selectItem=0):
937 """Updates grid parameters. Returns "ERROR" is failed""" 938 if self.testGridWidgets() == 0: 939 if self.cmdForms.has_key('default'): 940 descr = self.cmdForms['default'].descr 941 942 self.params.gridPointsX = closestMatch(descr.entryByName 943 ['gridPointsX']['widget'].get(), self.params.GRID_VALUES) 944 self.params.gridPointsY = closestMatch(descr.entryByName 945 ['gridPointsY']['widget'].get(), self.params.GRID_VALUES) 946 self.params.gridPointsZ = closestMatch(descr.entryByName 947 ['gridPointsZ']['widget'].get(), self.params.GRID_VALUES) 948 949 self.params.coarseLengthX = descr.entryByName['coarseLengthX']\ 950 ['widget'].value 951 self.params.coarseLengthY = descr.entryByName['coarseLengthY']\ 952 ['widget'].value 953 self.params.coarseLengthZ = descr.entryByName['coarseLengthZ']\ 954 ['widget'].value 955 self.params.coarseCenterX = descr.entryByName['coarseCenterX']\ 956 ['widget'].value 957 self.params.coarseCenterY = descr.entryByName['coarseCenterY']\ 958 ['widget'].value 959 self.params.coarseCenterZ = descr.entryByName['coarseCenterZ']\ 960 ['widget'].value 961 self.params.fineLengthX = descr.entryByName['fineLengthX']\ 962 ['widget'].value 963 self.params.fineLengthY = descr.entryByName['fineLengthY']\ 964 ['widget'].value 965 self.params.fineLengthZ = descr.entryByName['fineLengthZ']\ 966 ['widget'].value 967 self.params.fineCenterX = descr.entryByName['fineCenterX']\ 968 ['widget'].value 969 self.params.fineCenterY = descr.entryByName['fineCenterY']\ 970 ['widget'].value 971 self.params.fineCenterZ = descr.entryByName['fineCenterZ']\ 972 ['widget'].value 973 self.flag_grid_changed = True 974 else: 975 return "ERROR" 976 self.refreshGridPage()
977
978 - def refreshPhysicsPage(self):
979 """Refreshes physics page""" 980 if self.cmdForms.has_key('default'): 981 descr = self.cmdForms['default'].descr 982 983 descr.entryByName['proteinDielectric']['widget'].\ 984 setentry(self.params.proteinDielectric) 985 descr.entryByName['solventDielectric']['widget'].\ 986 setentry(self.params.solventDielectric) 987 descr.entryByName['solventRadius']['widget'].\ 988 setentry(self.params.solventRadius) 989 descr.entryByName['systemTemperature']['widget'].\ 990 setentry(self.params.systemTemperature) 991 descr.entryByName['ionsList']['widget'].clear() 992 for i in range(len(self.params.ions)): 993 descr.entryByName['ionsList']['widget'].\ 994 insert('end', self.params.ions[i].toString()) 995 if self.params.saltConcentration: 996 self.salt_var.set(1) 997 else: 998 self.salt_var.set(0)
999
1000 - def testPhysicsWidgets(self):
1001 """Tests physics widget""" 1002 if self.cmdForms.has_key('default'): 1003 descr = self.cmdForms['default'].descr 1004 1005 if(descr.entryByName['proteinDielectric']['widget'].get() == ''): 1006 self.errorMsg = 'You must enter a protein dielectric\ 1007 value.' 1008 errorform = self.showForm('error', modal=1, blocking=1, 1009 force = 1) 1010 return 1 1011 if(descr.entryByName['solventDielectric']['widget'].get() == ''): 1012 self.errorMsg = 'You must enter a solvent dielectric\ 1013 value.' 1014 errorform = self.showForm('error', modal=1, blocking=1, 1015 force = 1) 1016 return 1 1017 if(descr.entryByName['solventRadius']['widget'].get() == ''): 1018 self.errorMsg = 'You must enter a solvent radius value.' 1019 errorform = self.showForm('error', modal=1, blocking=1, 1020 force = 1) 1021 return 1 1022 if(descr.entryByName['systemTemperature']['widget'].get() == ''): 1023 self.errorMsg = 'You must enter a system temperature \ 1024 value.' 1025 errorform = self.showForm('error', modal=1, blocking=1, 1026 force = 1) 1027 return 1 1028 return 0
1029
1030 - def physicsParamUpdate(self):
1031 """Updates physics parameter. Returns "ERROR" is failed""" 1032 if self.testPhysicsWidgets() != 1: 1033 if self.cmdForms.has_key('default'): 1034 descr = self.cmdForms['default'].descr 1035 1036 self.params.proteinDielectric = float(descr.entryByName\ 1037 ['proteinDielectric']['widget'].get()) 1038 self.params.solventDielectric = float(descr.entryByName\ 1039 ['solventDielectric']['widget'].get()) 1040 self.params.solventRadius = float(descr.entryByName\ 1041 ['solventRadius']['widget'].get()) 1042 self.params.systemTemperature = float(descr.entryByName\ 1043 ['systemTemperature']['widget'].get()) 1044 salt = self.salt_var.get() 1045 if salt: 1046 self.params.saltConcentration = float(descr.entryByName\ 1047 ['saltConcentration']['widget'].get()) 1048 else: 1049 self.params.saltConcentration = 0 1050 else: 1051 return "ERROR" 1052 self.refreshPhysicsPage()
1053
1054 - def refreshAll(self,cmdForm = None):
1055 """Refreshes calculation, grid and physics pages""" 1056 if cmdForm: 1057 self.cmdForms['default'] = cmdForm 1058 descr = cmdForm.descr 1059 if APBSservicesFound: 1060 ResourceFolder = getResourceFolderWithVersion() 1061 if os.path.isdir(ResourceFolder): 1062 pass 1063 else: 1064 os.mkdir(ResourceFolder) 1065 self.rc_apbs = ResourceFolder + os.sep + "ws" 1066 if os.path.isdir(self.rc_apbs): 1067 pass 1068 else: 1069 os.mkdir(self.rc_apbs) 1070 self.rc_apbs += os.sep + "rc_apbs" 1071 if not os.path.exists(self.rc_apbs): 1072 open(self.rc_apbs,'w') 1073 else: 1074 file = open(self.rc_apbs) 1075 text = file.read() 1076 text = text.split() 1077 for line in text: 1078 tmp_line = line.split('User:') 1079 if len(tmp_line) > 1: 1080 descr.entryByName['UserName_Entry']['wcfg']\ 1081 ['textvariable'].set(tmp_line[1]) 1082 tmp_line = line.split('Password:') 1083 if len(tmp_line) > 1: 1084 descr.entryByName['Password_Entry']['wcfg']\ 1085 ['textvariable'].set(tmp_line[1]) 1086 file.close() 1087 descr.entryByName['ParallelGroup']['widget'].toggle() 1088 if not descr.entryByName['web service address']['widget'].get(): 1089 descr.entryByName['web service address']['widget']\ 1090 .selectitem(1) 1091 url = descr.entryByName['web service address']['widget'].get() 1092 url = url.strip() 1093 if url.find('https://') != 0: 1094 descr.entryByName['UserName_Label']['widget'].grid_forget() 1095 descr.entryByName['UserName_Entry']['widget'].grid_forget() 1096 descr.entryByName['Password_Label']['widget'].grid_forget() 1097 descr.entryByName['Password_Entry']['widget'].grid_forget() 1098 descr.entryByName['Remember_Label']['widget'].grid_forget() 1099 descr.entryByName['Remember_Checkbutton']['widget']\ 1100 .grid_forget() 1101 self.progressBar = ProgressBar( 1102 descr.entryByName['WS_ProgressBar']['widget'] 1103 , labelside=None, 1104 width=200, height=20, mode='percent') 1105 1106 self.progressBar.setLabelText('Progress...') 1107 self.progressBar.set(0) 1108 descr.entryByName['WS_ProgressBar']['widget'].grid_forget() 1109 else: 1110 descr.entryByName['WS_http']['widget'].bind( 1111 sequence = "<Button-1>", func = self.WS_http) 1112 descr.entryByName['calculationType']['widget']._entryWidget.\ 1113 config(state = 'readonly') 1114 descr.entryByName['pbeType']['widget']._entryWidget.\ 1115 config(state = 'readonly') 1116 descr.entryByName['boundaryConditions']['widget']._entryWidget.\ 1117 config(state = 'readonly') 1118 descr.entryByName['chargeDiscretization']['widget'].\ 1119 _entryWidget.config(state = 'readonly') 1120 descr.entryByName['surfaceCalculation']['widget']._entryWidget.\ 1121 config(state = 'readonly') 1122 descr.entryByName['energyOutput']['widget']._entryWidget.\ 1123 config(state = 'readonly') 1124 descr.entryByName['forceOutput']['widget']._entryWidget.\ 1125 config(state = 'readonly') 1126 self.refreshCalculationPage() 1127 self.refreshGridPage() 1128 self.refreshPhysicsPage()
1129
1130 - def paramUpdateAll(self):
1131 """Updates all parameters. Returns "ERROR" if failed """ 1132 if self.calculationParamUpdate() == "ERROR": 1133 return "ERROR" 1134 if self.gridParamUpdate() == "ERROR": 1135 return "ERROR" 1136 if self.physicsParamUpdate() == "ERROR": 1137 return "ERROR"
1138
1139 - def setOutputFiles(self):
1140 """Sets output files using outputFilesForm GUI""" 1141 outputFilesForm = self.showForm('outputFilesForm', \ 1142 modal = 1, blocking = 1,force=1,master=self.cmdForms['default'].f) 1143 descr = self.cmdForms['outputFilesForm'].descr 1144 self.params.chargeDistributionFile = descr.entryByName\ 1145 ['chargeDistributionFile']['widget'].get() 1146 self.params.potentialFile = descr.entryByName['potentialFile']\ 1147 ['widget'].get() 1148 self.params.solventAccessibilityFile = descr.entryByName\ 1149 ['solventAccessibilityFile']['widget'].get() 1150 self.params.splineBasedAccessibilityFile = descr.entryByName\ 1151 ['splineBasedAccessibilityFile']['widget'].get() 1152 self.params.VDWAccessibilityFile = descr.entryByName\ 1153 ['VDWAccessibilityFile']['widget'].get() 1154 self.params.ionAccessibilityFile = descr.entryByName\ 1155 ['ionAccessibilityFile']['widget'].get() 1156 self.params.laplacianOfPotentialFile = descr.entryByName\ 1157 ['laplacianOfPotentialFile']['widget'].get() 1158 self.params.energyDensityFile = descr.entryByName\ 1159 ['energyDensityFile']['widget'].get() 1160 self.params.ionNumberFile = descr.entryByName\ 1161 ['ionNumberFile']['widget'].get() 1162 self.params.ionChargeDensityFile = descr.entryByName\ 1163 ['ionChargeDensityFile']['widget'].get() 1164 self.params.xShiftedDielectricFile = descr.entryByName\ 1165 ['xShiftedDielectricFile']['widget'].get() 1166 self.params.yShiftedDielectricFile = descr.entryByName\ 1167 ['yShiftedDielectricFile']['widget'].get() 1168 self.params.zShiftedDielectricFile = descr.entryByName\ 1169 ['zShiftedDielectricFile']['widget'].get() 1170 self.params.kappaFunctionFile = descr.entryByName\ 1171 ['kappaFunctionFile']['widget'].get()
1172
1173 - def addIon(self):
1174 """Adds an Ion""" 1175 ionForm = self.showForm('ionForm', modal = 0, blocking = 1, 1176 master=self.cmdForms['default'].f) 1177 descr = self.cmdForms['ionForm'].descr 1178 ion = Ion() 1179 ion.charge = float(descr.entryByName['ionCharge']['widget'].get()) 1180 ion.concentration = float(descr.entryByName['ionConcentration'] 1181 ['widget'].get()) 1182 ion.radius = float(descr.entryByName['ionRadius']['widget'].get()) 1183 self.params.ions.append(ion) 1184 self.vf.message("self.APBSSetup.params.ions.append(Pmv.APBSCommands.Ion\ 1185 ("+ion.toString()+"))") 1186 self.vf.log("self.APBSSetup.params.ions.append(Pmv.APBSCommands.Ion(" \ 1187 +ion.toString()+"))") 1188 f = self.cmdForms['default'] 1189 f.descr.entryByName['ionsList']['widget'].insert('end', ion.toString())
1190
1191 - def removeIon(self):
1192 """Removes an Ion""" 1193 descr = self.cmdForms['default'].descr 1194 s = repr(descr.entryByName['ionsList']['widget'].getcurselection()) 1195 for i in range(descr.entryByName['ionsList']['widget'].size()): 1196 if(string.find(s,descr.entryByName['ionsList']['widget'] 1197 .get(i))>-1): 1198 break 1199 descr.entryByName['ionsList']['widget'].delete(i) 1200 self.params.ions.pop(i) 1201 self.vf.message("self.APBSSetup.params.ions.pop("+`i`+")") 1202 self.vf.log("self.APBSSetup.params.ions.pop("+`i`+")")
1203
1204 - def moleculeListSelect(self, molName):
1205 """None <--- moleculeListSelect(molName)\n 1206 Selects molecule with molName.\n 1207 If the molecule was not read as pqr file moleculeListSelect\n 1208 """ 1209 if self.cmdForms.has_key('default'): 1210 self.cmdForms['default'].root.config(cursor='watch') 1211 self.vf.GUI.ROOT.config(cursor='watch') 1212 self.vf.GUI.VIEWER.master.config(cursor='watch') 1213 #self.vf.GUI.MESSAGE_BOX.tx.component('text').config(cursor='watch') 1214 molName = molName.replace('-','_') 1215 mol = self.vf.getMolFromName(molName) 1216 file, ext = os.path.splitext(mol.parser.filename) 1217 if ext: 1218 ext = ext.lower() 1219 if ext == '.pqr': 1220 filename = mol.parser.filename 1221 mol.flag_copy_pqr = True 1222 else: #create pqr file using pdb2pqr.py 1223 filename = mol.name+".pqr" 1224 #full_filename = os.path.join(self.params.projectFolder,filename) 1225 #filename = full_filename 1226 flag_overwrite = True 1227 if not os.path.exists(filename) or \ 1228 self.vf.APBSPreferences.overwrite_pqr: 1229 if not self.vf.commands.has_key('writePDB'): 1230 self.vf.browseCommands("fileCommands", 1231 commands=['writePDB',]) 1232 try: 1233 import tempfile 1234 tmp, tmp_pdb = tempfile.mkstemp() 1235 tmp_pdb += '.pdb' 1236 except: 1237 from user import home 1238 tmp_pdb = home + os.path.sep + 'tmp.pdb' 1239 filename = home + os.path.sep + filename 1240 self.vf.writePDB(mol,tmp_pdb, pdbRec=('ATOM','HETATM'), log=0) 1241 # Exe_String = sys.executable + \ 1242 # " -Wignore::DeprecationWarning " + self.params.pdb2pqr_Path\ 1243 # + " --ff="+self.params.pdb2pqr_ForceField + " tmp.pdb " + \ 1244 # "\""+full_filename+"\"" 1245 from MolKit.pdb2pqr import pdb2pqr 1246 sys.argv = [pdb2pqr.__file__] 1247 from MolKit.pdb2pqr import pdb2pqr 1248 if self.vf.APBSPreferences.nodebump.get(): 1249 sys.argv.append('--nodebump') 1250 if self.vf.APBSPreferences.nohopt.get(): 1251 sys.argv.append('--noopt') 1252 sys.argv.append('--ff='+self.params.pdb2pqr_ForceField) 1253 sys.argv.append(tmp_pdb) 1254 sys.argv.append(filename) 1255 sys.path.append(os.path.split(self.params.pdb2pqr_Path)[0]) 1256 try: 1257 pdb2pqr.mainCommand() 1258 try: 1259 os.remove(mol.name + '-typemap.html') 1260 except: 1261 pass 1262 except Exception, inst: 1263 print inst 1264 msg = """Could not convet pdb to pqr! Try 1265 using http://pdb2pqr.sourceforge.net instead""" 1266 if self.cmdForms.has_key('default') and \ 1267 self.cmdForms['default'].f.winfo_toplevel().wm_state()==\ 1268 'normal': 1269 tkMessageBox.showerror("ERROR: ", msg, 1270 parent = self.cmdForms['default'].root) 1271 else: 1272 tkMessageBox.showerror("ERROR: ", msg) 1273 1274 self.vf.GUI.ROOT.config(cursor='') 1275 self.vf.GUI.VIEWER.master.config(cursor='') 1276 if self.cmdForms.has_key('default'): 1277 self.cmdForms['default'].root.config(cursor='') 1278 return '' 1279 1280 if self.cmdForms.has_key('default'): 1281 self.cmdForms['default'].root.config(cursor='') 1282 self.vf.GUI.ROOT.config(cursor='') 1283 self.vf.GUI.VIEWER.master.config(cursor='') 1284 #self.vf.GUI.MESSAGE_BOX.tx.component('text').config(cursor='xterm') 1285 os.remove(tmp_pdb) 1286 mol_tmp = self.vf.readPQR(filename, topCommand=0) 1287 if not mol_tmp: 1288 msg = """Could not convet pdb to pqr! Try 1289 using http://pdb2pqr.sourceforge.net instead""" 1290 if self.cmdForms.has_key('default') and \ 1291 self.cmdForms['default'].f.winfo_toplevel().wm_state()==\ 1292 'normal': 1293 tkMessageBox.showerror("ERROR: ", msg, 1294 parent = self.cmdForms['default'].root) 1295 else: 1296 tkMessageBox.showerror("ERROR: ", msg) 1297 self.vf.GUI.ROOT.config(cursor='') 1298 self.vf.GUI.VIEWER.master.config(cursor='') 1299 if self.cmdForms.has_key('default'): 1300 self.cmdForms['default'].root.config(cursor='') 1301 return '' 1302 mol_tmp.name = str(mol.name) 1303 self.vf.deleteMol(mol,topCommand=0) 1304 mol = mol_tmp 1305 mol.flag_copy_pqr = False 1306 self.vf.assignAtomsRadii(mol, overwrite=True,log=False) 1307 change_Menu_state(self.vf.APBSSaveProfile, 'normal') 1308 1309 if self.cmdForms.has_key('default'): 1310 self.cmdForms['default'].root.config(cursor='') 1311 self.vf.GUI.ROOT.config(cursor='') 1312 self.vf.GUI.VIEWER.master.config(cursor='') 1313 # self.vf.GUI.MESSAGE_BOX.tx.component('text').config(cursor='xterm') 1314 if self.cmdForms.has_key('default'): 1315 form_descr = self.cmdForms['default'].descr 1316 #form_descr.entryByName['Profiles']['widget'].setentry('Default') 1317 form_descr.entryByName['Profiles_Add']['widget'].config(state = 1318 "normal") 1319 form_descr.entryByName['Profiles_Remove']['widget'].config(state = 1320 "normal") 1321 form_descr.entryByName['Profiles_Run']['widget'].config(state = 1322 "normal") 1323 form_descr.entryByName['Profiles_Save']['widget'].config(state = 1324 "normal") 1325 form_descr.entryByName['Profiles_Load']['widget'].config(state = 1326 "normal") 1327 if APBSservicesFound: 1328 form_descr.entryByName['WS_Run']['widget'].config(state = 1329 "normal") 1330 else: 1331 global state_GUI 1332 state_GUI = 'normal' 1333 mol = self.vf.getMolFromName(molName.replace('-','_')) 1334 if self.cmdForms.has_key('default'): 1335 APBSParamName = self.cmdForms['default'].descr.\ 1336 entryByName['Profiles']['widget'].get() 1337 mol.APBSParams[APBSParamName] = self.params 1338 else: 1339 mol.APBSParams['Default'] = self.params 1340 return filename
1341
1342 - def molecule1Select(self):
1343 """Seclects molecule1 and setups molecule1Path""" 1344 val = self.showForm('moleculeSelect', modal = 0, \ 1345 blocking = 1,master=self.cmdForms['default'].f) 1346 if val: 1347 if len(val['moleculeListSelect'])==0: return 1348 molName = val['moleculeListSelect'][0] 1349 self.params.molecule1Path = self.moleculeListSelect(molName) 1350 if not self.params.molecule1Path: 1351 return 1352 self.refreshCalculationPage() 1353 1354 if not self.vf.APBSSetup.flag_grid_changed: 1355 self.autocenterCoarseGrid() 1356 self.autosizeCoarseGrid() 1357 self.autocenterFineGrid() 1358 self.autosizeFineGrid() 1359 self.refreshGridPage()
1360
1361 - def molecule2Select(self):
1362 """Seclects molecule2 and setups molecule2Path""" 1363 val = self.showForm('moleculeSelect', modal = 0, \ 1364 blocking = 1,master=self.cmdForms['default'].f) 1365 if val: 1366 if len(val['moleculeListSelect'])==0: return 1367 molName = val['moleculeListSelect'][0] 1368 self.params.molecule2Path = self.moleculeListSelect(molName) 1369 self.refreshCalculationPage()
1370
1371 - def complexSelect(self):
1372 """Seclects complex and setups complexPath""" 1373 val = self.showForm('moleculeSelect', modal=0, blocking=1,\ 1374 master=self.cmdForms['default'].f) 1375 if val: 1376 if len(val['moleculeListSelect'])==0: return 1377 molName = val['moleculeListSelect'][0] 1378 self.params.complexPath = self.moleculeListSelect(molName) 1379 self.refreshCalculationPage() 1380 if not self.params.complexPath: 1381 return 1382 if not self.vf.APBSSetup.flag_grid_changed: 1383 self.autocenterCoarseGrid() 1384 self.autosizeCoarseGrid() 1385 self.autocenterFineGrid() 1386 self.autosizeFineGrid() 1387 self.refreshGridPage()
1388 1389
1390 - def apbsOutput(self, molecule1 = None, molecule2 = None, _complex = None ):
1391 """Runs APBS using mglutil.popen2Threads.SysCmdInThread""" 1392 self.add_profile() 1393 if self.paramUpdateAll() == "ERROR": 1394 return 1395 if molecule1: 1396 self.params.SaveAPBSInput(self.params.projectFolder+os.path.sep\ 1397 +"apbs-input-file.apbs") 1398 from mglutil.popen2Threads import SysCmdInThread 1399 self.changeMenuState('disabled') 1400 cmdstring = "\""+self.params.APBS_Path+"\" "+'apbs-input-file.apbs' 1401 self.cwd = os.getcwd() 1402 os.chdir(self.params.projectFolder) 1403 self.cmd = SysCmdInThread(cmdstring, shell=True) 1404 self.cmd.start() 1405 time.sleep(1) 1406 self.SaveResults(self.params.name) 1407 os.chdir(self.cwd) 1408 else: 1409 file_name, ext = os.path.splitext(self.params.molecule1Path) 1410 molecule1 = os.path.split(file_name)[-1] 1411 if self.cmdForms.has_key('default'): 1412 APBSParamName = self.cmdForms['default'].descr.\ 1413 entryByName['Profiles']['widget'].get() 1414 else: 1415 APBSParamName = 'Default' 1416 if self.params.calculationType == 'Binding energy': 1417 file_name, ext = os.path.splitext(self.params.molecule2Path) 1418 molecule2 = os.path.split(file_name)[-1] 1419 file_name, ext = os.path.splitext(self.params.complexPath) 1420 _complex = os.path.split(file_name)[-1] 1421 self.vf.APBSRun(molecule1, molecule2, _complex, APBSParamName = 1422 APBSParamName)
1423
1424 - def SaveResults(self,params_name):
1425 """Checks the queue for results until we get one""" 1426 if self.cmd.ok.configure()['state'][-1] == 'normal': 1427 self.saveProfile(Profilename=params_name) 1428 self.changeMenuState('normal') 1429 self.cmd.com.wait() 1430 potential_dx = self.params.projectFolder 1431 file_name, ext = os.path.splitext(self.params.molecule1Path) 1432 mol_name = os.path.split(file_name)[-1] 1433 potential = os.path.join(potential_dx, mol_name+'.potential.dx') 1434 self.vf.Grid3DReadAny(potential, show=False, normalize=False) 1435 self.vf.grids3D[mol_name+'.potential.dx'].geomContainer['Box'].Set(visible=0) 1436 self.potential = mol_name+'.potential.dx' 1437 change_Menu_state(self.vf.APBSDisplayIsocontours, 'normal') 1438 change_Menu_state(self.vf.APBSDisplayOrthoSlice, 'normal') 1439 if hasattr(self.vf,'APBSVolumeRender'): 1440 change_Menu_state(self.vf.APBSVolumeRender, 'normal') 1441 return 1442 self.vf.GUI.ROOT.after(10, self.SaveResults, params_name)
1443
1444 - def select_profile(self,profile_name):
1445 """Selects profile""" 1446 if self.paramUpdateAll() == "ERROR": 1447 self.remove_profile() 1448 return 1449 file_name, ext = os.path.splitext(self.params.molecule1Path) 1450 tmp_mol_name = os.path.split(file_name)[-1] 1451 molecule1 = self.vf.getMolFromName(tmp_mol_name.replace('-','_')) 1452 if molecule1.APBSParams.has_key(profile_name): 1453 self.params = molecule1.APBSParams[profile_name] 1454 self.refreshAll() 1455 else: 1456 self.params.name = profile_name 1457 molecule1.APBSParams[profile_name] = self.params
1458
1459 - def add_profile(self):
1460 """Adds profile""" 1461 if self.cmdForms.has_key('default'): 1462 ComboBox = self.cmdForms['default'].descr.entryByName['Profiles']\ 1463 ['widget'] 1464 profile_name = ComboBox._entryfield.get() 1465 list_items = ComboBox._list.get() 1466 if not profile_name in list_items: 1467 list_items += (profile_name,) 1468 file_name, ext = os.path.splitext(self.params.molecule1Path) 1469 tmp_mol_name = os.path.split(file_name)[-1] 1470 molecule1 = self.vf.getMolFromName(tmp_mol_name.replace('-','_')) 1471 self.params.name = profile_name 1472 molecule1.APBSParams[profile_name] = self.params 1473 ComboBox.setlist(list_items) 1474 ComboBox.setentry(profile_name)
1475
1476 - def remove_profile(self):
1477 """Removes current profile""" 1478 ComboBox = self.cmdForms['default'].descr.entryByName['Profiles']\ 1479 ['widget'] 1480 profile_name = ComboBox._entryfield.get() 1481 list_items = ComboBox._list.get() 1482 if profile_name in list_items: 1483 list_items = list(list_items) 1484 list_items.remove(profile_name) 1485 list_items = tuple(list_items) 1486 ComboBox.clear() 1487 ComboBox.setlist(list_items) 1488 try: 1489 ComboBox.setentry(list_items[0]) 1490 except IndexError: 1491 pass 1492 file_name, ext = os.path.splitext(self.params.molecule1Path) 1493 tmp_mol_name = os.path.split(file_name)[-1] 1494 molecule1 = self.vf.getMolFromName(tmp_mol_name.replace('-','_')) 1495 if molecule1 and molecule1.APBSParams.has_key(profile_name): 1496 del molecule1.APBSParams[profile_name]
1497
1498 - def saveProfile(self, Profilename = "Default"):
1499 """Saves current profile""" 1500 if Profilename: 1501 if self.cmdForms.has_key('default'): 1502 Profilename = self.cmdForms['default'].descr.\ 1503 entryByName['Profiles']['widget'].get() 1504 1505 file_name,ext = os.path.splitext(self.params.molecule1Path) 1506 mol_name = os.path.split(file_name)[-1] 1507 potential_dx = os.path.join(self.params.projectFolder, mol_name+ 1508 '.potential.dx') 1509 if os.path.exists(potential_dx): 1510 tmp_string = os.path.basename(Profilename).\ 1511 replace(".apbs.pf","") 1512 dest_path = os.path.join(self.params.projectFolder, tmp_string + 1513 '_' + mol_name + '_potential.dx') 1514 shutil.copy(potential_dx,dest_path) 1515 1516 if self.params.calculationType == 'Solvation energy': 1517 potential_dx = os.path.join(self.params.projectFolder, mol_name+ 1518 '_Vacuum.potential.dx') 1519 if os.path.exists(potential_dx): 1520 tmp_string = os.path.basename(Profilename).\ 1521 replace(".apbs.pf","") 1522 dest_path = os.path.join(self.params.projectFolder, 1523 tmp_string + '_' + mol_name + '_Vacuum_potential.dx') 1524 shutil.copy(potential_dx,dest_path) 1525 1526 if self.params.calculationType == 'Binding energy': 1527 file_name,ext = os.path.splitext(self.params.molecule2Path) 1528 mol_name = os.path.split(file_name)[-1] 1529 potential_dx = os.path.join(self.params.projectFolder, mol_name+ 1530 '.potential.dx') 1531 if os.path.exists(potential_dx): 1532 tmp_string = os.path.basename(Profilename).\ 1533 replace(".apbs.pf","") 1534 dest_path = os.path.join(self.params.projectFolder, 1535 tmp_string + '_' + mol_name + '_potential.dx') 1536 shutil.copy(potential_dx,dest_path) 1537 file_name,ext = os.path.splitext(self.params.complexPath) 1538 mol_name = os.path.split(file_name)[-1] 1539 potential_dx = os.path.join(self.params.projectFolder, mol_name+ 1540 '.potential.dx') 1541 if os.path.exists(potential_dx): 1542 tmp_string = os.path.basename(Profilename).\ 1543 replace(".apbs.pf","") 1544 dest_path = os.path.join(self.params.projectFolder, 1545 tmp_string + '_' + mol_name + '_potential.dx') 1546 shutil.copy(potential_dx,dest_path) 1547 Profilename = os.path.join(self.params.projectFolder, Profilename) 1548 if(string.find(Profilename,'.apbs.pf')<0): 1549 Profilename = Profilename + '.apbs.pf' 1550 fp = open(Profilename, 'w') 1551 pickle.dump(self.params, fp) 1552 pickle.dump(self.params.ions, fp) 1553 fp.close() 1554 else: 1555 self.vf.APBSSaveProfile()
1556
1557 - def loadProfile(self, filename = None):
1558 """Loads profile""" 1559 if filename: 1560 fp = open(filename, 'r') 1561 self.params = pickle.load(fp) 1562 self.doit(**self.params.__dict__) 1563 fp.close() 1564 profile_name = os.path.basename(filename).replace(".apbs.pf","") 1565 if self.params.calculationType=='Solvation energy' or self.params.\ 1566 calculationType=='Electrostatic potential': 1567 if not self.vf.getMolFromName(os.path.basename(os.path.\ 1568 splitext(self.params.molecule1Path)[0])): 1569 molecule1Path = os.path.join(self.params.projectFolder, 1570 self.params.molecule1Path) 1571 self.vf.readPQR(molecule1Path, topCommand=0) 1572 if(self.params.calculationType=='Binding energy'): 1573 if not self.vf.getMolFromName(os.path.basename(os.path.\ 1574 splitext(self.params.molecule1Path)[0])): 1575 molecule1Path = os.path.join(self.params.projectFolder, 1576 self.params.molecule1Path) 1577 self.vf.readPQR(molecule1Path, topCommand=0) 1578 if not self.vf.getMolFromName(os.path.basename(os.path.\ 1579 splitext(self.params.molecule2Path)[0])): 1580 molecule2Path = os.path.join(self.params.projectFolder, 1581 self.params.molecule2Path) 1582 self.vf.readPQR(molecule2Path, topCommand=0) 1583 if not self.vf.getMolFromName(os.path.basename(os.path.\ 1584 splitext(self.params.complexPath)[0])): 1585 complexPath = os.path.join(self.params.projectFolder, 1586 self.params.complexPath) 1587 self.vf.readPQR(complexPath, topCommand=0) 1588 # the following part updates Profiles ComboBox 1589 if self.cmdForms.has_key('default'): 1590 ComboBox = self.cmdForms['default'].descr.entryByName\ 1591 ['Profiles']['widget'] 1592 list_items = ComboBox._list.get() 1593 if not profile_name in list_items: 1594 list_items += (profile_name,) 1595 ComboBox.setlist(list_items) 1596 ComboBox.setentry(profile_name) 1597 else: 1598 global PROFILES 1599 PROFILES += (profile_name,) 1600 if self.cmdForms.has_key('default'): 1601 form_descr = self.cmdForms['default'].descr 1602 form_descr.entryByName['Profiles_Add']['widget'].config(state = 1603 "normal") 1604 form_descr.entryByName['Profiles_Remove']['widget'].config(state 1605 = "normal") 1606 form_descr.entryByName['Profiles_Run']['widget'].config(state = 1607 "normal") 1608 form_descr.entryByName['Profiles_Save']['widget'].config(state = 1609 "normal") 1610 form_descr.entryByName['Profiles_Load']['widget'].config(state = 1611 "normal") 1612 if APBSservicesFound: 1613 form_descr.entryByName['WS_Run']['widget'].config(state = 1614 "normal") 1615 else: 1616 global state_GUI 1617 state_GUI = 'normal' 1618 change_Menu_state(self.vf.APBSSaveProfile, 'normal') 1619 self.refreshAll() 1620 file_name,ext = os.path.splitext(self.params.molecule1Path) 1621 mol_name = os.path.split(file_name)[-1] 1622 file_potential = os.path.join(self.params.projectFolder,profile_name 1623 + '_' + mol_name + '_potential.dx') 1624 if os.path.exists(file_potential): 1625 shutil.copy(file_potential,os.path.join(self.params.\ 1626 projectFolder,mol_name + '.potential.dx')) 1627 self.changeMenuState('normal') 1628 self.potential = mol_name+'.potential.dx' 1629 change_Menu_state(self.vf.APBSDisplayIsocontours, 'normal') 1630 change_Menu_state(self.vf.APBSDisplayOrthoSlice, 'normal') 1631 change_Menu_state(self.vf.APBSVolumeRender, 'normal') 1632 self.vf.Grid3DReadAny(os.path.join(self.params.projectFolder,mol_name + '.potential.dx'), 1633 show=False, normalize=False) 1634 self.vf.grids3D[mol_name+'.potential.dx'].geomContainer['Box'].Set(visible=0) 1635 1636 else: 1637 self.vf.APBSLoadProfile()
1638
1639 - def apbsRunRemote(self):
1640 """Runs APBS Web Services in a thread and checks for the results""" 1641 if self.paramUpdateAll() == "ERROR": 1642 return 1643 file_name, ext = os.path.splitext(self.params.molecule1Path) 1644 tmp_mol_name = os.path.split(file_name)[-1] 1645 mol = self.vf.getMolFromName(tmp_mol_name.replace('-','_')) 1646 f = self.cmdForms['default'] 1647 address = f.descr.entryByName['web service address']['widget'].get() 1648 address = address.strip() 1649 global APBS_ssl 1650 if address.find('https://') != 0: 1651 #first check to see if APBS Web Services is up and running 1652 import urllib 1653 opener = urllib.FancyURLopener({}) 1654 try: 1655 servlet = opener.open(address+"/axis/servlet/AxisServlet") 1656 except IOError: 1657 self.errorMsg=address+"/axis/servlet/AxisServlet could not be found" 1658 self.errorMsg += "\nPlease make sure that server is up and running" 1659 self.errorMsg += "\nFor more info on APBS Web Services visit http://www.nbcr.net/services" 1660 self.showForm('error') 1661 return 1662 html_txt = servlet.read() 1663 if html_txt.find('APBSBlockingPort') == -1: 1664 self.errorMsg = "Cound not find APBSBlockingPort at " +address+\ 1665 "/axis/servlet/AxisServlet"+\ 1666 "\nPlease make sure that APBS Web Services is running on "+address+\ 1667 "\nFor more info on APBS Web Services visit http://www.nbcr.net/services" 1668 return 1669 APBS_ssl = False 1670 else: 1671 from SecuritymyproxyloginImplService_services import \ 1672 loginUserMyProxyRequestWrapper, \ 1673 SecuritymyproxyloginImplServiceLocator 1674 gamaLoginLocator = SecuritymyproxyloginImplServiceLocator() 1675 gamaLoginService = gamaLoginLocator.getSecuritymyproxyloginImpl( 1676 ssl=1,transport=httplib.HTTPSConnection) 1677 req = loginUserMyProxyRequestWrapper() 1678 username = self.cmdForms['default'].descr.\ 1679 entryByName['UserName_Entry']['widget'].get() 1680 passwd = self.cmdForms['default'].descr.\ 1681 entryByName['Password_Entry']['widget'].get() 1682 req._username = username 1683 req._passwd = passwd 1684 resp = gamaLoginService.loginUserMyProxy(req) 1685 f = open(APBS_proxy, "w") 1686 f.write(resp._loginUserMyProxyReturn) 1687 f.close() 1688 APBS_ssl = True 1689 if self.RememberLogin_var.get(): 1690 file = open(self.rc_apbs,'w') 1691 user = self.cmdForms['default'].descr.entryByName\ 1692 ['UserName_Entry']['widget'].get() 1693 passwd = self.cmdForms['default'].descr.entryByName\ 1694 ['Password_Entry']['widget'].get() 1695 file.write("User:%s\nPassword:%s\n"%(user,passwd)) 1696 self.params.projectFolder=os.path.join(os.getcwd(),"apbs-"+mol.name) 1697 from thread import start_new_thread 1698 if self.params.calculationType == 'Binding energy': 1699 file_name, ext = os.path.splitext(self.params.molecule2Path) 1700 tmp_mol_name = os.path.split(file_name)[-1] 1701 mol2 = self.vf.getMolFromName(tmp_mol_name.replace('-','_')) 1702 file_name, ext = os.path.splitext(self.params.complexPath) 1703 tmp_mol_name = os.path.split(file_name)[-1] 1704 _complex = self.vf.getMolFromName(tmp_mol_name.replace('-','_')) 1705 self.params.projectFolder += "_" + mol2.name + "_"+ _complex.name 1706 if not os.path.exists(self.params.projectFolder): 1707 os.mkdir(self.params.projectFolder) 1708 self.runWS(address, self.params, mol, mol2, _complex) 1709 else: 1710 if not os.path.exists(self.params.projectFolder): 1711 os.mkdir(self.params.projectFolder) 1712 self.runWS(address, self.params, mol)
1713 #start_new_thread( self.checkForRemoteResults, (self.webServiceResultsQueue,)) 1714
1715 - def runWS(self, address, params, mol1, mol2 = None, _complex = None):
1716 """Runs APBS Web Services""" 1717 if self.cmdForms.has_key('default'): 1718 if self.Parallel_var.get(): 1719 self.npx = int(self.cmdForms['default'].descr.entryByName['npx']\ 1720 ['widget'].getvalue()) 1721 self.npy = int(self.cmdForms['default'].descr.entryByName['npy']\ 1722 ['widget'].getvalue()) 1723 self.npz = int(self.cmdForms['default'].descr.entryByName['npz']\ 1724 ['widget'].getvalue()) 1725 ofrac = self.cmdForms['default'].descr.entryByName['ofrac']\ 1726 ['widget'].getvalue() 1727 1728 self.apbsWS = APBSCmdToWebService(params, mol1, mol2, _complex,\ 1729 Parallel_flag = True, npx = self.npx, npy = self.npy, 1730 npz = self.npz, ofrac = float(ofrac)) 1731 self.Parallel_flag = True 1732 else: 1733 self.apbsWS = APBSCmdToWebService(params, mol1,mol2, _complex) 1734 self.Parallel_flag = False 1735 else: 1736 self.apbsWS = APBSCmdToWebService(params, mol1, mol2, _complex) 1737 self.Parallel_flag = False 1738 try: 1739 f = self.cmdForms['default'] 1740 f.descr.entryByName['APBSservicesLabel1']['widget'].\ 1741 configure(text = 'Connecting to '+ address) 1742 f.descr.entryByName['APBSservicesLabel2']['widget'].\ 1743 configure(text = "") 1744 f.descr.entryByName['APBSservicesLabel4']['widget'].\ 1745 configure(text = "") 1746 f.descr.entryByName['APBSservicesLabel3']['widget'].\ 1747 configure(text = "Please wait ...") 1748 f.descr.entryByName['APBSservicesLabel4']['widget'].\ 1749 configure(text = "") 1750 self.vf.GUI.ROOT.update() 1751 resp = self.apbsWS.run(address) 1752 1753 f.descr.entryByName['APBSservicesLabel1']['widget'].\ 1754 configure(text = "Received Job ID: " + resp._jobID._value) 1755 if APBS_ssl: 1756 self.apbsStatusPort = self.apbsWS.apbsLocator.getAPBSStatusPortType( 1757 address + "/axis/services/APBSStatusPort", 1758 ssl = 1, 1759 cert_file = APBS_proxy, 1760 key_file = APBS_proxy, 1761 transport=httplib.HTTPSConnection) 1762 else: 1763 self.apbsStatusPort = self.apbsWS.apbsLocator.getAPBSStatusPortType( 1764 address + "/axis/services/APBSStatusPort") 1765 self.req = queryStatusRequestWrapper() 1766 self.req._value = resp._jobID._value 1767 self.vf.GUI.ROOT.after(5, self.checkForRemoteResults) 1768 f.descr.entryByName['WS_Run']['widget'].configure(state = 'disabled') 1769 # f.descr.entryByName['APBSservicesLabel1']['widget'].\ 1770 # configure(text = 'Remote APBS calculation is done') 1771 self.rml = mol1.name 1772 except Exception, inst: 1773 f.descr.entryByName['APBSservicesLabel3']['widget'].\ 1774 configure(text = "") 1775 from ZSI import FaultException 1776 if isinstance(inst, FaultException): 1777 tmp_str = inst.fault.AsSOAP() 1778 tmp_str = tmp_str.split('<message>') 1779 tmp_str = tmp_str[1].split('</message>') 1780 if self.cmdForms.has_key('default') and \ 1781 self.cmdForms['default'].f.winfo_toplevel().wm_state() == \ 1782 'normal': 1783 tkMessageBox.showerror("ERROR: ",tmp_str[0],parent = 1784 self.cmdForms['default'].root) 1785 else: 1786 tkMessageBox.showerror("ERROR: ",tmp_str[0]) 1787 else: 1788 import traceback 1789 traceback.print_stack() 1790 traceback.print_exc() 1791 f.descr.entryByName['APBSservicesLabel1']['widget'].\ 1792 configure(text = "") 1793 f.descr.entryByName['APBSservicesLabel2']['widget'].\ 1794 configure(text = "ERROR!!! Unable to complete the Run") 1795 f.descr.entryByName['APBSservicesLabel3']['widget'].\ 1796 configure(text = "Please see Python Shell for Traceback")
1797
1798 - def checkForRemoteResults(self):
1799 """Checks the queue for remote results until we get one""" 1800 resp = self.apbsStatusPort.queryStatus(self.req) 1801 1802 if resp._code == 8: # 8 = GramJob.STATUS_DONE 1803 f = self.cmdForms['default'] 1804 f.descr.entryByName['APBSservicesLabel2']['widget'].\ 1805 configure(text = resp._message) 1806 webbrowser.open(resp._baseURL) 1807 f.descr.entryByName['APBSservicesLabel3']['widget'].\ 1808 configure(text = resp._baseURL,fg='Blue',cursor='hand1') 1809 def openurl(event): 1810 webbrowser.open(resp._baseURL)
1811 f.descr.entryByName['APBSservicesLabel3']['widget'].\ 1812 bind(sequence="<Button-1>",func = openurl) 1813 # read the potential back 1814 opener = urllib.FancyURLopener(cert_file = APBS_proxy, key_file = APBS_proxy) 1815 if self.Parallel_flag: 1816 if self.npx*self.npy*self.npz == 1: 1817 f.descr.entryByName['APBSservicesLabel4']['widget'].\ 1818 configure(text = "Downloading %s.potential-PE0.dx"%self.rml) 1819 f.descr.entryByName['WS_ProgressBar']['widget'].\ 1820 grid(sticky='ew', row = 9, column = 0, columnspan = 2) 1821 f.descr.entryByName['APBS_WS_DX_Label']['widget'].\ 1822 configure(text = "URI: "+resp._baseURL+"/%s.potential-PE0.dx"%self.rml) 1823 self.progressBar.configure(progressformat='precent', 1824 labeltext='Progress ... ', max =100) 1825 self.progressBar.set(0) 1826 self._dx = opener.open(resp._baseURL+"/%s.potential-PE0.dx"%self.rml) 1827 self._dx_out = open(os.path.join(self.params.projectFolder, 1828 "%s.potential.dx"%self.rml),"w") 1829 bytes = int(self._dx.headers.dict['content-length']) 1830 self._progress_counter = 0 1831 self._download_bytes = bytes/100 1832 if self._download_bytes == 0: self._download_bytes = 1 1833 self.Download() 1834 else: 1835 f.descr.entryByName['APBSservicesLabel4']['widget'].\ 1836 configure(text = "Downloading %s.potential.dx. Please wait ..."%self.rml) 1837 1838 f.descr.entryByName['WS_ProgressBar']['widget'].\ 1839 grid(sticky='ew', row = 9, column = 0, columnspan = 2) 1840 f.descr.entryByName['APBS_WS_DX_Label']['widget'].\ 1841 configure(text = "URI: "+resp._baseURL+"/%s.potential-PE*.dx"%self.rml) 1842 self.progressBar.configure(progressformat='ratio', 1843 labeltext='Progress ... ', max =self.npx*self.npy*self.npz) 1844 self._progress_counter = 0 1845 self.progressBar.set(0) 1846 self._dx_files = [] 1847 for i in range(self.npx*self.npy*self.npz): 1848 self._dx_files.append(opener.open(resp._baseURL+ 1849 "/%s.potential-PE%d.dx"%(self.rml,i))) 1850 self._dx_out = open(os.path.join(self.params.projectFolder, 1851 "%s.potential.dx"%self.rml),"w") 1852 self._dx_out.write("# Data from %s\n"%resp._baseURL) 1853 self._dx_out.write("#\n# POTENTIAL (kT/e)\n#\n") 1854 self.Download_and_Merge() 1855 else: 1856 f.descr.entryByName['APBSservicesLabel4']['widget'].\ 1857 configure(text = "Downloading %s.potential.dx"%self.rml) 1858 f.descr.entryByName['WS_ProgressBar']['widget'].\ 1859 grid(sticky='ew', row = 9, column = 0, columnspan = 2) 1860 f.descr.entryByName['APBS_WS_DX_Label']['widget'].\ 1861 configure(text = "URI: "+resp._baseURL + "/%s.potential.dx"%self.rml) 1862 self.progressBar.configure(progressformat='percent', 1863 labeltext='Progress ... ', max =100) 1864 self.progressBar.set(0) 1865 1866 self._dx = opener.open(resp._baseURL + "/%s.potential.dx"%self.rml) 1867 self._dx_out = open(os.path.join(self.params.projectFolder, 1868 "%s.potential.dx"%self.rml),"w") 1869 bytes = int(self._dx.headers.dict['content-length']) 1870 self._progress_counter = 0 1871 self._download_bytes = bytes/100 1872 if self._download_bytes == 0: self._download_bytes = 1 1873 self.Download() 1874 return 1875 else: 1876 f = self.cmdForms['default'] 1877 f.descr.entryByName['APBSservicesLabel2']['widget'].\ 1878 configure(text = "Status: " + resp._message) 1879 1880 self.vf.GUI.ROOT.after(500, self.checkForRemoteResults)
1881
1882 - def Download(self):
1883 self._progress_counter += 1 1884 if self._progress_counter > 100: 1885 self._progress_counter = 100 1886 self.progressBar.set(self._progress_counter) 1887 tmp = self._dx.read(self._download_bytes) 1888 if tmp: 1889 self._dx_out.write(tmp) 1890 else: 1891 self._dx.close() 1892 self._dx_out.close() 1893 f = self.cmdForms['default'] 1894 f.descr.entryByName['WS_ProgressBar']['widget'].grid_forget() 1895 f.descr.entryByName['APBS_WS_DX_Label']['widget'].\ 1896 configure(text = '') 1897 f.descr.entryByName['APBSservicesLabel4']['widget'].\ 1898 configure(text="%s.potential.dx has been saved"%self.rml) 1899 self.saveProfile(self.params.name) 1900 self.changeMenuState('normal') 1901 f.descr.entryByName['WS_Run']['widget'].configure(state = 'normal') 1902 f.descr.entryByName['APBSservicesLabel5']['widget'].\ 1903 configure(text = '') 1904 return 1905 self.vf.GUI.ROOT.after(10, self.Download)
1906
1907 - def Download_and_Merge(self):
1908 self._dx_files[0].readline() 1909 self._dx_files[0].readline() 1910 self._dx_files[0].readline() 1911 self._dx_files[0].readline() 1912 tmp_str = self._dx_files[0].readline() 1913 from string import split 1914 w = split(tmp_str) 1915 nx, ny, nz = int(w[5]), int(w[6]), int(w[7]) 1916 self._dx_out.write("object 1 class gridpositions counts %d %d %d\n" 1917 %(nx*self.npx,ny*self.npy,nz*self.npz)) 1918 self._dx_out.write(self._dx_files[0].readline()) 1919 self._dx_out.write(self._dx_files[0].readline()) 1920 self._dx_out.write(self._dx_files[0].readline()) 1921 self._dx_out.write(self._dx_files[0].readline()) 1922 self._dx_out.write("object 2 class gridconnections counts %d %d %d\n" 1923 %(nx*self.npx,ny*self.npy,nz*self.npz)) 1924 self._dx_out.write("object 3 class array type double rank 0 items %d" 1925 %(nx*self.npx*ny*self.npy*nz*self.npz)+" data follows\n") 1926 for file in self._dx_files[1:]: 1927 for i in range(11): 1928 file.readline() 1929 self._dx_files[0].readline() 1930 self._dx_files[0].readline() 1931 arrays = [] 1932 for file in self._dx_files: 1933 self._progress_counter += 1 1934 self.progressBar.set(self._progress_counter) 1935 data = file.readlines() 1936 file.close() 1937 array = Numeric.zeros( (nx,ny,nz), Numeric.Float32) 1938 values = map(split, data[0:-5]) 1939 ind=0 1940 size = nx*ny*nz 1941 for line in values: 1942 if ind>=size: 1943 break 1944 l = len(line) 1945 array.flat[ind:ind+l] = map(float, line) 1946 ind = ind + l 1947 arrays.append(array) 1948 self.progressBar.configure(labeltext='Merging ... ') 1949 for k in range(self.npz): 1950 for j in range(self.npy): 1951 for i in range(self.npx): 1952 if i == 0: 1953 array_x = arrays[self.npx*j+ 1954 self.npx*self.npy*k] 1955 else: 1956 array_x = Numeric.concatenate( 1957 (array_x,arrays[i+self.npx*j+ 1958 self.npx*self.npy*k]),axis=0) 1959 if j == 0: 1960 array_y = array_x 1961 else: 1962 array_y = Numeric.concatenate( 1963 (array_y,array_x),axis=1) 1964 if k == 0: 1965 array_out = array_y 1966 else: 1967 array_out = Numeric.concatenate( 1968 (array_out,array_y),axis=2) 1969 for z in array_out: 1970 for y in z: 1971 for x in y: 1972 self._dx_out.write(str(x)+" ") 1973 self._dx_out.write('\n') 1974 self._dx_out.write("attribute \"dep\" string \"positions\"\n") 1975 self._dx_out.write("object \"regular positions regular connections\" class field\n") 1976 self._dx_out.write("component \"positions\" value 1\n") 1977 self._dx_out.write("component \"connections\" value 2\n") 1978 self._dx_out.write("component \"data\" value 3\n") 1979 self._dx_out.close() 1980 f = self.cmdForms['default'] 1981 f.descr.entryByName['WS_ProgressBar']['widget'].grid_forget() 1982 f.descr.entryByName['APBS_WS_DX_Label']['widget'].\ 1983 configure(text = '') 1984 f.descr.entryByName['APBSservicesLabel4']['widget'].\ 1985 configure(text="%s.potential.dx has been saved"%self.rml) 1986 self.saveProfile(self.params.name) 1987 self.changeMenuState('normal') 1988 f.descr.entryByName['WS_Run']['widget'].configure(state = 'normal') 1989 f.descr.entryByName['APBSservicesLabel5']['widget'].\ 1990 configure(text = '')
1991 # Forms defined here 1992
1993 - def buildFormDescr(self, formName):
1994 """Builds 'error','ionForm','outputFilesForm','moleculeSelect' and 1995 'default' forms'""" 1996 if formName == 'error': 1997 if self.cmdForms.has_key('default') and \ 1998 self.cmdForms['default'].f.winfo_toplevel().wm_state() == \ 1999 'normal': 2000 tkMessageBox.showerror("ERROR: ", self.errorMsg,parent = 2001 self.cmdForms['default'].root) 2002 else: 2003 tkMessageBox.showerror("ERROR: ", self.errorMsg) 2004 return 2005 if formName == 'ionForm': 2006 ifd = InputFormDescr(title = "Add Ion") 2007 ifd.append({'name':'ionChargeLabel', 2008 'widgetType':Tkinter.Label, 2009 'wcfg':{'text':'Charge (e):'}, 2010 'gridcfg':{'row':0, 'column':0, 'sticky':'wens'} 2011 }) 2012 2013 ifd.append({'widgetType':Pmw.EntryField, 2014 'name':'ionCharge', 2015 'wcfg':{'validate':{'validator':'real'}, 'value':1}, 2016 'gridcfg':{'row':0, 'column':1, 'sticky':'wens'} 2017 }) 2018 2019 ifd.append({'name':'ionConcentrationLabel', 2020 'widgetType':Tkinter.Label, 2021 'wcfg':{'text':'Concentration (M):'}, 2022 'gridcfg':{'row':1, 'column':0, 'sticky':'wens'} 2023 }) 2024 ifd.append({'widgetType':ThumbWheel, 2025 'name':'ionConcentration', 2026 'wcfg':{'text':None, 'showLabel':1, 2027 'min':0, 2028 'value':0.01, 'oneTurn':0.1, 2029 'type':'float', 2030 'increment':0.01, 2031 'wheelLabcfg1':{'font': 2032 ('Times', 15, 'bold'), 'fill':'grey'}, 2033 'wheelLabcfg2':{'font': 2034 ('Times', 15, 'bold'), 'fill':'black'}, 2035 'continuous':1, 2036 'wheelPad':1, 'width':150,'height':14}, 2037 'gridcfg':{'row':1, 'column':1, 'sticky':'wens'} 2038 }) 2039 ifd.append({'name':'ionRadiusLabel', 2040 'widgetType':Tkinter.Label, 2041 'wcfg':{'text':'Radius (Angstroms):'}, 2042 'gridcfg':{'row':2, 'column':0, 'sticky':'wens'} 2043 }) 2044 ifd.append({'widgetType':Pmw.EntryField, 2045 'name':'ionRadius', 2046 'wcfg':{'validate':{'validator':'real','min':0}, 'value':1}, 2047 'gridcfg':{'row':2, 'column':1, 'sticky':'wens'} 2048 }) 2049 return ifd 2050 elif formName =='outputFilesForm': 2051 ifd = InputFormDescr(title = "Select output files") 2052 2053 ifd.append({'name':'fileTypeLabel', 2054 'widgetType':Tkinter.Label, 2055 'wcfg':{'text':'File Type'}, 2056 'gridcfg':{'sticky':'e', 'row':1, 'column':0} 2057 }) 2058 ifd.append({'name':'fileFormatLabel', 2059 'widgetType':Tkinter.Label, 2060 'wcfg':{'text':'File format'}, 2061 'gridcfg':{'sticky':'e', 'row':1, 'column':1} 2062 }) 2063 ifd.append({'name':'chargeDistributionFileLabel', 2064 'widgetType':Tkinter.Label, 2065 'wcfg':{'text':'Charge distribution file: '}, 2066 'gridcfg':{'sticky':'e', 'row':2, 'column':0} 2067 }) 2068 ifd.append({'name':'chargeDistributionFile', 2069 'widgetType':Pmw.ComboBox, 2070 'wcfg':{'scrolledlist_items':self.params.FILETYPES, 2071 'listheight':100, 'dropdown':1, 'history':0,}, 2072 'defaultValue':self.params.chargeDistributionFile, 2073 'gridcfg':{'sticky':'wens', 'row':2, 'column':1} 2074 }) 2075 ifd.append({'name':'potentialFileLabel', 2076 'widgetType':Tkinter.Label, 2077 'wcfg':{'text':'Potential file: '}, 2078 'gridcfg':{'sticky':'e', 'row':3, 'column':0} 2079 }) 2080 ifd.append({'name':'potentialFile', 2081 'widgetType':Pmw.ComboBox, 2082 'wcfg':{'scrolledlist_items':self.params.FILETYPES, 2083 'listheight':100, 'history':0, 'dropdown':1}, 2084 'defaultValue':self.params.potentialFile, 2085 'gridcfg':{'sticky':'wens', 'row':3, 'column':1} 2086 }) 2087 ifd.append({'name':'solventAccessibilityFileLabel', 2088 'widgetType':Tkinter.Label, 2089 'wcfg':{'text':'Solvent accessibility file: '}, 2090 'gridcfg':{'sticky':'e', 'row':4, 'column':0} 2091 }) 2092 ifd.append({'name':'solventAccessibilityFile', 2093 'widgetType':Pmw.ComboBox, 2094 'wcfg':{'scrolledlist_items':self.params.FILETYPES, 2095 'listheight':100, 'history':0, 'dropdown':1}, 2096 'defaultValue':self.params.solventAccessibilityFile, 2097 'gridcfg':{'sticky':'wens', 'row':4, 'column':1} 2098 }) 2099 ifd.append({'name':'splineBasedAccessibilityFileLabel', 2100 'widgetType':Tkinter.Label, 2101 'wcfg':{'text':'Spline-based accessibility file: '}, 2102 'gridcfg':{'sticky':'e', 'row':5, 'column':0} 2103 }) 2104 ifd.append({'name':'splineBasedAccessibilityFile', 2105 'widgetType':Pmw.ComboBox, 2106 'wcfg':{'scrolledlist_items':self.params.FILETYPES, 2107 'listheight':100, 'history':0, 'dropdown':1}, 2108 'defaultValue':self.params.splineBasedAccessibilityFile, 2109 'gridcfg':{'sticky':'wens', 'row':5, 'column':1} 2110 }) 2111 ifd.append({'name':'VDWAccessibilityFileLabel', 2112 'widgetType':Tkinter.Label, 2113 'wcfg':{'text':'VDW accessibility file: '}, 2114 'gridcfg':{'sticky':'e', 'row':6, 'column':0} 2115 }) 2116 ifd.append({'name':'VDWAccessibilityFile', 2117 'widgetType':Pmw.ComboBox, 2118 'wcfg':{'scrolledlist_items':self.params.FILETYPES, 2119 'listheight':100, 'history':0, 'dropdown':1}, 2120 'defaultValue':self.params.VDWAccessibilityFile, 2121 'gridcfg':{'sticky':'wens', 'row':6, 'column':1} 2122 }) 2123 ifd.</