1 #!/bin/env python 2 # 3 # File: OpenMMPerformMDSimulation.py 4 # Author: Manish Sud <msud@san.rr.com> 5 # 6 # Copyright (C) 2025 Manish Sud. All rights reserved. 7 # 8 # The functionality available in this script is implemented using OpenMM, an 9 # open source molecuar simulation package. 10 # 11 # This file is part of MayaChemTools. 12 # 13 # MayaChemTools is free software; you can redistribute it and/or modify it under 14 # the terms of the GNU Lesser General Public License as published by the Free 15 # Software Foundation; either version 3 of the License, or (at your option) any 16 # later version. 17 # 18 # MayaChemTools is distributed in the hope that it will be useful, but without 19 # any warranty; without even the implied warranty of merchantability of fitness 20 # for a particular purpose. See the GNU Lesser General Public License for more 21 # details. 22 # 23 # You should have received a copy of the GNU Lesser General Public License 24 # along with MayaChemTools; if not, see <http://www.gnu.org/licenses/> or 25 # write to the Free Software Foundation Inc., 59 Temple Place, Suite 330, 26 # Boston, MA, 02111-1307, USA. 27 # 28 29 from __future__ import print_function 30 31 # Add local python path to the global path and import standard library modules... 32 import os 33 import sys; sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), "..", "lib", "Python")) 34 import time 35 import re 36 37 # OpenMM imports... 38 try: 39 import openmm as mm 40 import openmm.app 41 except ImportError as ErrMsg: 42 sys.stderr.write("\nFailed to import OpenMM related module/package: %s\n" % ErrMsg) 43 sys.stderr.write("Check/update your OpenMM environment and try again.\n\n") 44 sys.exit(1) 45 46 # MDTraj import... 47 try: 48 import mdtraj 49 except ImportError as ErrMsg: 50 sys.stderr.write("\nFailed to import MDTraj: %s\n" % ErrMsg) 51 sys.stderr.write("Check/update your MDTraj environment and try again.\n\n") 52 sys.exit(1) 53 54 # MayaChemTools imports... 55 try: 56 from docopt import docopt 57 import MiscUtil 58 import OpenMMUtil 59 except ImportError as ErrMsg: 60 sys.stderr.write("\nFailed to import MayaChemTools module/package: %s\n" % ErrMsg) 61 sys.stderr.write("Check/update your MayaChemTools environment and try again.\n\n") 62 sys.exit(1) 63 64 ScriptName = os.path.basename(sys.argv[0]) 65 Options = {} 66 OptionsInfo = {} 67 68 def main(): 69 """Start execution of the script.""" 70 71 MiscUtil.PrintInfo("\n%s (OpenMM v%s; MayaChemTools v%s; %s): Starting...\n" % (ScriptName, mm.Platform.getOpenMMVersion(), MiscUtil.GetMayaChemToolsVersion(), time.asctime())) 72 73 (WallClockTime, ProcessorTime) = MiscUtil.GetWallClockAndProcessorTime() 74 75 # Retrieve command line arguments and options... 76 RetrieveOptions() 77 78 # Process and validate command line arguments and options... 79 ProcessOptions() 80 81 # Perform actions required by the script... 82 PerformMDSimulation() 83 84 MiscUtil.PrintInfo("\n%s: Done...\n" % ScriptName) 85 MiscUtil.PrintInfo("Total time: %s" % MiscUtil.GetFormattedElapsedTime(WallClockTime, ProcessorTime)) 86 87 def PerformMDSimulation(): 88 """Perform MD simulation.""" 89 90 # Prepare system for simulation... 91 System, Topology, Positions = PrepareSystem() 92 93 # Freeze and restraint atoms... 94 FreezeRestraintAtoms(System, Topology, Positions) 95 96 # Setup integrator... 97 Integrator = SetupIntegrator() 98 99 # Setup simulation... 100 Simulation = SetupSimulation(System, Integrator, Topology, Positions) 101 102 # Write setup files... 103 WriteSimulationSetupFiles(System, Integrator) 104 105 # Perform minimization... 106 PerformMinimization(Simulation) 107 108 # Set up intial velocities... 109 SetupInitialVelocities(Simulation) 110 111 # Perform equilibration... 112 PerformEquilibration(Simulation) 113 114 # Setup reporters for production run... 115 SetupReporters(Simulation) 116 117 # Perform or restart production run... 118 PerformOrRestartProductionRun(Simulation) 119 120 # Save final state files... 121 WriteFinalStateFiles(Simulation) 122 123 # Reimage and realign trajectory for periodic systems... 124 ProcessTrajectory(System, Topology) 125 126 def PrepareSystem(): 127 """Prepare system for simulation.""" 128 129 System, Topology, Positions = OpenMMUtil.InitializeSystem(OptionsInfo["Infile"], OptionsInfo["ForcefieldParams"], OptionsInfo["SystemParams"], OptionsInfo["WaterBox"], OptionsInfo["WaterBoxParams"], OptionsInfo["SmallMolFile"], OptionsInfo["SmallMolID"]) 130 131 if OptionsInfo["NPTMode"]: 132 if not OpenMMUtil.DoesSystemUsesPeriodicBoundaryConditions(System): 133 MiscUtil.PrintInfo("") 134 MiscUtil.PrintWarning("A barostat needs to be added for NPT simulation. It appears that your system is a non-periodic system and OpenMM might fail during the initialization of the system. You might want to specify a periodic system or add water box to automatically set up a periodic system. ") 135 136 BarostatHandle = OpenMMUtil.InitializeBarostat(OptionsInfo["IntegratorParams"]) 137 MiscUtil.PrintInfo("Adding barostat for NPT simulation...") 138 try: 139 System.addForce(BarostatHandle) 140 except Exception as ErrMsg: 141 MiscUtil.PrintInfo("") 142 MiscUtil.PrintError("Failed to add barostat:\n%s\n" % (ErrMsg)) 143 144 # Write out a PDB file for the system... 145 PDBFile = OptionsInfo["PDBOutfile"] 146 if OptionsInfo["RestartMode"]: 147 MiscUtil.PrintInfo("\nSkipping wrriting of PDB file %s during restart..." % PDBFile) 148 else: 149 MiscUtil.PrintInfo("\nWriting PDB file %s..." % PDBFile) 150 OpenMMUtil.WritePDBFile(PDBFile, Topology, Positions, OptionsInfo["OutputParams"]["PDBOutKeepIDs"]) 151 152 return (System, Topology, Positions) 153 154 def SetupIntegrator(): 155 """Setup integrator. """ 156 157 Integrator = OpenMMUtil.InitializeIntegrator(OptionsInfo["IntegratorParams"], OptionsInfo["SystemParams"]["ConstraintErrorTolerance"]) 158 159 return Integrator 160 161 def SetupSimulation(System, Integrator, Topology, Positions): 162 """Setup simulation. """ 163 164 Simulation = OpenMMUtil.InitializeSimulation(System, Integrator, Topology, Positions, OptionsInfo["PlatformParams"]) 165 166 return Simulation 167 168 def SetupInitialVelocities(Simulation): 169 """Setup initial velocities.""" 170 171 # Set velocities to random values choosen from a Boltzman distribution at a given 172 # temperature... 173 if OptionsInfo["RestartMode"]: 174 MiscUtil.PrintInfo("\nSkipping setting of intial velocities to temperature during restart...") 175 else: 176 MiscUtil.PrintInfo("\nSetting intial velocities to temperature...") 177 IntegratorParamsInfo = OpenMMUtil.SetupIntegratorParameters(OptionsInfo["IntegratorParams"]) 178 Simulation.context.setVelocitiesToTemperature(IntegratorParamsInfo["Temperature"]) 179 180 def PerformMinimization(Simulation): 181 """Perform minimization.""" 182 183 SimulationParams = OpenMMUtil.SetupSimulationParameters(OptionsInfo["SimulationParams"]) 184 185 if OptionsInfo["RestartMode"]: 186 MiscUtil.PrintInfo("\nSkipping energy minimization during restart...") 187 return 188 else: 189 if not SimulationParams["Minimization"]: 190 MiscUtil.PrintInfo("\nSkipping energy minimization...") 191 return 192 193 OutputParams = OptionsInfo["OutputParams"] 194 195 # Setup a local minimization reporter... 196 MinimizeReporter = None 197 if OutputParams["MinimizationDataStdout"] or OutputParams["MinimizationDataLog"]: 198 MinimizeReporter = LocalMinimizationReporter() 199 200 if MinimizeReporter is not None: 201 MiscUtil.PrintInfo("\nAdding minimization reporters...") 202 if OutputParams["MinimizationDataLog"]: 203 MiscUtil.PrintInfo("Adding data log minimization reporter (Steps: %s; File: %s)..." % (OutputParams["MinimizationDataSteps"], OutputParams["MinimizationDataLogFile"])) 204 if OutputParams["MinimizationDataStdout"]: 205 MiscUtil.PrintInfo("Adding data stdout minimization reporter (Steps: %s)..." % (OutputParams["MinimizationDataSteps"])) 206 else: 207 MiscUtil.PrintInfo("\nSkipping addition of minimization reporters...") 208 209 MaxSteps = SimulationParams["MinimizationMaxSteps"] 210 211 MaxStepsMsg = "MaxSteps: %s" % ("UntilConverged" if MaxSteps == 0 else MaxSteps) 212 ToleranceMsg = "Tolerance: %.2f kcal/mol/A (%.2f kjoules/mol/nm)" % (SimulationParams["MinimizationToleranceInKcal"], SimulationParams["MinimizationToleranceInJoules"]) 213 214 MiscUtil.PrintInfo("\nPerforming energy minimization (%s; %s)..." % (MaxStepsMsg, ToleranceMsg)) 215 216 if OutputParams["MinimizationDataStdout"]: 217 HeaderLine = SetupMinimizationDataOutHeaderLine() 218 print("\n%s" % HeaderLine) 219 220 Simulation.minimizeEnergy(tolerance = SimulationParams["MinimizationTolerance"], maxIterations = MaxSteps, reporter = MinimizeReporter) 221 222 if OutputParams["MinimizationDataLog"]: 223 WriteMinimizationDataLogFile(MinimizeReporter.DataOutValues) 224 225 if OutputParams["PDBOutMinimized"]: 226 MiscUtil.PrintInfo("\nWriting PDB file %s..." % OptionsInfo["MinimizedPDBOutfile"]) 227 OpenMMUtil.WriteSimulationStatePDBFile(Simulation, OptionsInfo["MinimizedPDBOutfile"], OutputParams["PDBOutKeepIDs"]) 228 229 def PerformEquilibration(Simulation): 230 """Perform equilibration.""" 231 232 Mode = OptionsInfo["Mode"] 233 SimulationParams = OptionsInfo["SimulationParams"] 234 OutputParams = OptionsInfo["OutputParams"] 235 236 if OptionsInfo["RestartMode"]: 237 MiscUtil.PrintInfo("\nSkipping equilibration during restart...") 238 return 239 else: 240 if not SimulationParams["Equilibration"]: 241 MiscUtil.PrintInfo("\nSkipping equilibration...") 242 return 243 244 EquilibrationSteps = SimulationParams["EquilibrationSteps"] 245 246 IntegratorParamsInfo = OpenMMUtil.SetupIntegratorParameters(OptionsInfo["IntegratorParams"]) 247 StepSize = IntegratorParamsInfo["StepSize"] 248 249 TotalTime = OpenMMUtil.GetFormattedTotalSimulationTime(StepSize, EquilibrationSteps) 250 MiscUtil.PrintInfo("\nPerforming equilibration (Mode: %s; Steps: %s; StepSize: %s; TotalTime: %s)..." % (Mode, EquilibrationSteps, StepSize, TotalTime)) 251 252 # Equilibrate... 253 Simulation.step(EquilibrationSteps) 254 255 if OutputParams["PDBOutEquilibrated"]: 256 MiscUtil.PrintInfo("\nWriting PDB file %s..." % OptionsInfo["EquilibratedPDBOutfile"]) 257 OpenMMUtil.WriteSimulationStatePDBFile(Simulation, OptionsInfo["EquilibratedPDBOutfile"], OutputParams["PDBOutKeepIDs"]) 258 259 def PerformOrRestartProductionRun(Simulation): 260 """Perform or restart production run. """ 261 262 if OptionsInfo["RestartMode"]: 263 RestartProductionRun(Simulation) 264 else: 265 PerformProductionRun(Simulation) 266 267 def PerformProductionRun(Simulation): 268 """Perform production run.""" 269 270 Mode = OptionsInfo["Mode"] 271 SimulationParams = OptionsInfo["SimulationParams"] 272 Steps = SimulationParams["Steps"] 273 274 IntegratorParamsInfo = OpenMMUtil.SetupIntegratorParameters(OptionsInfo["IntegratorParams"]) 275 StepSize = IntegratorParamsInfo["StepSize"] 276 277 if SimulationParams["Equilibration"]: 278 Simulation.currentStep = 0 279 Simulation.context.setTime(0.0 * mm.unit.picoseconds) 280 MiscUtil.PrintInfo("\nSetting current step and current time to 0 for starting production run after equilibration...") 281 282 TotalTime = OpenMMUtil.GetFormattedTotalSimulationTime(StepSize, Steps) 283 MiscUtil.PrintInfo("\nPerforming production run (Mode: %s; Steps: %s; StepSize: %s; TotalTime: %s)..." % (Mode, Steps, StepSize, TotalTime)) 284 285 Simulation.step(Steps) 286 287 def RestartProductionRun(Simulation): 288 """Restart production run.""" 289 290 SimulationParams = OptionsInfo["SimulationParams"] 291 RestartParams = OptionsInfo["RestartParams"] 292 293 RestartFile = RestartParams["FinalStateFile"] 294 295 Steps = SimulationParams["Steps"] 296 297 IntegratorParamsInfo = OpenMMUtil.SetupIntegratorParameters(OptionsInfo["IntegratorParams"]) 298 StepSize = IntegratorParamsInfo["StepSize"] 299 300 TotalTime = OpenMMUtil.GetFormattedTotalSimulationTime(StepSize, Steps) 301 MiscUtil.PrintInfo("\nRestarting production run (Steps: %s; StepSize: %s; TotalTime: %s)..." % (Steps, StepSize, TotalTime)) 302 303 if RestartParams["FinalStateFileCheckpointMode"]: 304 MiscUtil.PrintInfo("Loading final state checkpoint file %s...\n" % RestartFile) 305 Simulation.loadCheckpoint(RestartFile) 306 elif RestartParams["FinalStateFileXMLMode"]: 307 MiscUtil.PrintInfo("Loading final state XML f ile %s...\n" % RestartFile) 308 Simulation.loadState(RestartFile) 309 else: 310 MiscUtil.PrintError("The specified final state restart file, %s, is not a valid. Supported file formats: chk or xml" % (RestartFile)) 311 312 Simulation.step(Steps) 313 314 def SetupReporters(Simulation): 315 """Setup reporters. """ 316 317 (TrajReporter, DataLogReporter, DataStdoutReporter, CheckpointReporter) = OpenMMUtil.InitializeReporters(OptionsInfo["OutputParams"], OptionsInfo["SimulationParams"]["Steps"], OptionsInfo["DataOutAppendMode"]) 318 319 if TrajReporter is None and DataLogReporter is None and DataStdoutReporter is None and CheckpointReporter is None: 320 MiscUtil.PrintInfo("\nSkip adding reporters...") 321 return 322 323 MiscUtil.PrintInfo("\nAdding reporters...") 324 325 OutputParams = OptionsInfo["OutputParams"] 326 AppendMsg = "" 327 if OptionsInfo["RestartMode"]: 328 AppendMsg = "; Append: Yes" if OptionsInfo["DataOutAppendMode"] else "; Append: No" 329 if TrajReporter is not None: 330 MiscUtil.PrintInfo("Adding trajectory reporter (Steps: %s; File: %s%s)..." % (OutputParams["TrajSteps"], OutputParams["TrajFile"], AppendMsg)) 331 Simulation.reporters.append(TrajReporter) 332 333 if CheckpointReporter is not None: 334 MiscUtil.PrintInfo("Adding checkpoint reporter (Steps: %s; File: %s)..." % (OutputParams["CheckpointSteps"], OutputParams["CheckpointFile"])) 335 Simulation.reporters.append(CheckpointReporter) 336 337 if DataLogReporter is not None: 338 MiscUtil.PrintInfo("Adding data log reporter (Steps: %s; File: %s%s)..." % (OutputParams["DataLogSteps"], OutputParams["DataLogFile"], AppendMsg)) 339 Simulation.reporters.append(DataLogReporter) 340 341 if DataStdoutReporter is not None: 342 MiscUtil.PrintInfo("Adding data stdout reporter (Steps: %s)..." % (OutputParams["DataStdoutSteps"])) 343 Simulation.reporters.append(DataStdoutReporter) 344 345 class LocalMinimizationReporter(mm.MinimizationReporter): 346 """Setup a local minimization reporter. """ 347 348 (DataSteps, DataOutTypeList, DataOutDelimiter, StdoutStatus) = [None] * 4 349 350 DataOutValues = [] 351 First = True 352 353 def report(self, Iteration, PositonsList, GradientsList, DataStatisticsMap): 354 """Report and track minimization.""" 355 356 if self.First: 357 # Initialize... 358 self.DataSteps = OptionsInfo["OutputParams"]["MinimizationDataSteps"] 359 self.DataOutTypeList = OptionsInfo["OutputParams"]["MinimizationDataOutTypeOpenMMNameList"] 360 self.DataOutDelimiter = OptionsInfo["OutputParams"]["DataOutDelimiter"] 361 self.StdoutStatus = True if OptionsInfo["OutputParams"]["MinimizationDataStdout"] else False 362 363 self.First = False 364 365 if Iteration % self.DataSteps == 0: 366 # Setup data values... 367 DataValues = [] 368 DataValues.append("%s" % Iteration) 369 for DataType in self.DataOutTypeList: 370 DataValue = "%.4f" % DataStatisticsMap[DataType] 371 DataValues.append(DataValue) 372 373 # Track data... 374 self.DataOutValues.append(DataValues) 375 376 # Print data values... 377 if self.StdoutStatus: 378 print("%s" % self.DataOutDelimiter.join(DataValues)) 379 380 # This method must return a bool. You may return true for early termination. 381 return False 382 383 def WriteMinimizationDataLogFile(DataOutValues): 384 """Write minimization data log file. """ 385 386 OutputParams = OptionsInfo["OutputParams"] 387 388 Outfile = OutputParams["MinimizationDataLogFile"] 389 OutDelimiter = OutputParams["DataOutDelimiter"] 390 391 MiscUtil.PrintInfo("\nWriting minimization log file %s..." % Outfile) 392 OutFH = open(Outfile, "w") 393 394 HeaderLine = SetupMinimizationDataOutHeaderLine() 395 OutFH.write("%s\n" % HeaderLine) 396 397 for LineWords in DataOutValues: 398 Line = OutDelimiter.join(LineWords) 399 OutFH.write("%s\n" % Line) 400 401 OutFH.close() 402 403 def SetupMinimizationDataOutHeaderLine(): 404 """Setup minimization data output header line. """ 405 406 LineWords = ["Iteration"] 407 for Label in OptionsInfo["OutputParams"]["MinimizationDataOutTypeList"]: 408 if re.match("^(SystemEnergy|RestraintEnergy)$", Label, re.I): 409 LineWords.append("%s(kjoules/mol)" % Label) 410 elif re.match("^RestraintStrength$", Label, re.I): 411 LineWords.append("%s(kjoules/mol/nm^2)" % Label) 412 else: 413 LineWords.append(Label) 414 415 Line = OptionsInfo["OutputParams"]["DataOutDelimiter"].join(LineWords) 416 417 return Line 418 419 def FreezeRestraintAtoms(System, Topology, Positions): 420 """Handle freezing and restraining of atoms.""" 421 422 # Get atoms for freezing... 423 FreezeAtomList = None 424 if OptionsInfo["FreezeAtoms"]: 425 FreezeAtomList = OpenMMUtil.GetAtoms(Topology, OptionsInfo["FreezeAtomsParams"]["CAlphaProteinStatus"], OptionsInfo["FreezeAtomsParams"]["ResidueNames"], OptionsInfo["FreezeAtomsParams"]["Negate"]) 426 if FreezeAtomList is None: 427 MiscUtil.PrintError("The freeze atoms parameters specified, \"selection, %s, selectionSpec, %s, negate, %s\", - using \"--freezeAtomsParams\" option didn't match any atoms in the system. You must specify a valid set of parameters for freezing atoms or disable freezing using \"No\" value for \"--freezeAtoms\" option.." % (OptionsInfo["FreezeAtomsParams"]["Selection"], OptionsInfo["FreezeAtomsParams"]["SelectionSpec"], OptionsInfo["FreezeAtomsParams"]["Negate"])) 428 429 # Get atoms for restraining... 430 RestraintAtomList = None 431 if OptionsInfo["RestraintAtoms"]: 432 RestraintAtomList = OpenMMUtil.GetAtoms(Topology, OptionsInfo["RestraintAtomsParams"]["CAlphaProteinStatus"], OptionsInfo["RestraintAtomsParams"]["ResidueNames"], OptionsInfo["RestraintAtomsParams"]["Negate"]) 433 if RestraintAtomList is None: 434 MiscUtil.PrintError("The restraint atoms parameters specified, \"selection, %s, selectionSpec, %s, negate, %s\", - using \"--restraintAtomsParams\" option didn't match any atoms in the system. You must specify a valid set of parameters for restraining atoms or disable restraining using \"No\" value for \"--restraintAtoms\" option." % (OptionsInfo["RestraintAtomsParams"]["Selection"], OptionsInfo["RestraintAtomsParams"]["SelectionSpec"], OptionsInfo["RestraintAtomsParams"]["Negate"])) 435 436 # Check for atoms to freeze or restraint... 437 if FreezeAtomList is None and RestraintAtomList is None: 438 return 439 440 # Check for overlap between freeze and restraint atoms... 441 if OpenMMUtil.DoAtomListsOverlap(FreezeAtomList, RestraintAtomList): 442 MiscUtil.PrintError("The atoms specified using \"--freezeAtomsParams\" and \"--restraintAtomsParams\" options appear to overlap. You must specify unique sets of atoms to freeze and restraint.") 443 444 # Check overlap of freeze atoms with system constraints... 445 if OpenMMUtil.DoesAtomListOverlapWithSystemConstraints(System, FreezeAtomList): 446 MiscUtil.PrintError("The atoms specified using \"--freezeAtomsParams\" appear to overlap with atoms being constrained corresponding to the value specified, %s, for paramater name \"constraints\" using \"--systemParams\" option.\n\nYou must specify a unique set of atoms to freeze or turn off system constaints by specifying value, None, for \"constraints\" parameter using option \"--systemsParams\".\n\nIn addtion, you may want specify, no, value for \"rigidWater\" option.\n\nThe atoms are frozen by setting their particle mass to zero. OpenMM doesn't allow to both constraint atoms and set their mass to zero." % (OptionsInfo["SystemParams"]["Constraints"])) 447 448 # Check overlap of restraint atoms with system constraints... 449 if OpenMMUtil.DoesAtomListOverlapWithSystemConstraints(System, RestraintAtomList): 450 MiscUtil.PrintInfo("") 451 MiscUtil.PrintWarning("The atoms specified using \"--restraintAtomsParams\" appear to overlap with atoms being constrained corresponding to the value specified, %s, for paramater name \"constraints\" using \"--systemParams\" option. You may want to specify a unique set of atoms to restraints or turn off system constaints by specifying value, None, for \"constraints\" parameter using option \"--systemsParams\"." % (OptionsInfo["SystemParams"]["Constraints"])) 452 453 # Check and adjust step size... 454 if FreezeAtomList is not None or RestraintAtomList is not None: 455 CheckAndAdjustStepSizeDuringFreezeRestraintAtoms() 456 457 # Freeze atoms... 458 if FreezeAtomList is None: 459 MiscUtil.PrintInfo("\nSkipping freezing of atoms...") 460 else: 461 MiscUtil.PrintInfo("\nFreezing atoms (Selection: %s)..." % OptionsInfo["FreezeAtomsParams"]["Selection"]) 462 OpenMMUtil.FreezeAtoms(System, FreezeAtomList) 463 464 # Restraint atoms... 465 if RestraintAtomList is None: 466 MiscUtil.PrintInfo("\nSkipping restraining of atoms...") 467 else: 468 MiscUtil.PrintInfo("\nRestraining atoms (Selection: %s)..." % OptionsInfo["RestraintAtomsParams"]["Selection"]) 469 470 SprintConstantInKcal = OptionsInfo["RestraintSpringConstant"] 471 OpenMMUtil.RestraintAtoms(System, Positions, RestraintAtomList, SprintConstantInKcal) 472 473 def CheckAndAdjustStepSizeDuringFreezeRestraintAtoms(): 474 """Check and set step size during freezing or restraining of atoms """ 475 476 if re.match("^auto$", OptionsInfo["IntegratorParams"]["StepSizeSpecified"], re.I): 477 # Automatically set stepSize to 2.0 fs.. 478 OptionsInfo["IntegratorParams"]["StepSize"] = 2.0 479 MiscUtil.PrintInfo("") 480 MiscUtil.PrintWarning("The time step has been automatically set to %s fs during freezing or restraining of atoms. You may specify an explicit value for parameter name, stepSize, using \"--integratorParams\" option." % (OptionsInfo["IntegratorParams"]["StepSize"])) 481 elif OptionsInfo["IntegratorParams"]["StepSize"] > 2: 482 MiscUtil.PrintInfo("") 483 MiscUtil.PrintWarning("A word to the wise: The parameter value specified, %s, for parameter name, stepSize, using \"--integratorParams\" option may be too large. You may want to consider using a smaller time step. Othwerwise, your simulation may blow up." % (OptionsInfo["IntegratorParams"]["StepSize"] )) 484 MiscUtil.PrintInfo("") 485 486 def WriteSimulationSetupFiles(System, Integrator): 487 """Write simulation setup files for system and integrator.""" 488 489 OutputParams = OptionsInfo["OutputParams"] 490 491 if OutputParams["XmlSystemOut"] or OutputParams["XmlIntegratorOut"]: 492 MiscUtil.PrintInfo("") 493 494 if OutputParams["XmlSystemOut"]: 495 Outfile = OutputParams["XmlSystemFile"] 496 MiscUtil.PrintInfo("Writing system setup XML file %s..." % Outfile) 497 with open(Outfile, mode = "w") as OutFH: 498 OutFH.write(mm.XmlSerializer.serialize(System)) 499 500 if OutputParams["XmlIntegratorOut"]: 501 Outfile = OutputParams["XmlIntegratorFile"] 502 MiscUtil.PrintInfo("Writing integrator setup XML file %s..." % Outfile) 503 with open(Outfile, mode = "w") as OutFH: 504 OutFH.write(mm.XmlSerializer.serialize(Integrator)) 505 506 def WriteFinalStateFiles(Simulation): 507 """Write final state files. """ 508 509 OutputParams = OptionsInfo["OutputParams"] 510 511 if OutputParams["SaveFinalStateCheckpoint"] or OutputParams["SaveFinalStateXML"] or OutputParams["PDBOutFinal"]: 512 MiscUtil.PrintInfo("") 513 514 if OutputParams["SaveFinalStateCheckpoint"]: 515 Outfile = OutputParams["SaveFinalStateCheckpointFile"] 516 MiscUtil.PrintInfo("Writing final state checkpoint file %s..." % Outfile) 517 Simulation.saveCheckpoint(Outfile) 518 519 if OutputParams["SaveFinalStateXML"]: 520 Outfile = OutputParams["SaveFinalStateXMLFile"] 521 MiscUtil.PrintInfo("Writing final state XML file %s..." % Outfile) 522 Simulation.saveState(Outfile) 523 524 if OutputParams["PDBOutFinal"]: 525 MiscUtil.PrintInfo("\nWriting PDB file %s..." % OptionsInfo["FinalPDBOutfile"]) 526 OpenMMUtil.WriteSimulationStatePDBFile(Simulation, OptionsInfo["FinalPDBOutfile"], OutputParams["PDBOutKeepIDs"]) 527 528 def ProcessTrajectory(System, Topology): 529 """Reimage and realign trajectory for periodic systems. """ 530 531 ReimageFrames = True if OpenMMUtil.DoesSystemUsesPeriodicBoundaryConditions(System) else False 532 if not ReimageFrames: 533 MiscUtil.PrintInfo("\nSkipping reimaging and realigning of trajectory for a system not using periodic boundary conditions...") 534 return 535 536 MiscUtil.PrintInfo("\nReimaging and realigning trajectory for a system using periodic boundary conditions...") 537 538 # Reimage and realign trajectory file... 539 RealignFrames = True 540 TrajTopologyFile = OptionsInfo["PDBOutfile"] 541 TrajFile = OptionsInfo["OutputParams"]["TrajFile"] 542 Traj, ReimagedStatus, RealignedStatus = OpenMMUtil.ReimageRealignTrajectory(Topology, TrajFile, ReimageFrames, RealignFrames) 543 544 if (Traj is None) or (not ReimagedStatus and not RealignedStatus): 545 MiscUtil.PrintInfo("Skipping writing first frame to PDB file %s..." % PDBOutfile) 546 MiscUtil.PrintInfo("Skippig writing trajectory file %s..." % TrajOutfile) 547 return 548 549 PDBOutFormat = OptionsInfo["OutputParams"]["PDBOutFormat"] 550 PDBOutfile = OptionsInfo["ReimagedPDBOutfile"] 551 TrajOutfile = OptionsInfo["ReimagedTrajOutfile"] 552 553 # Write out first frame... 554 MiscUtil.PrintInfo("Writing first frame to PDB file %s..." % PDBOutfile) 555 if re.match("^CIF$", PDBOutFormat, re.I): 556 # MDTraj doesn't appear to support CIF format. Write it out as a temporary 557 # PDB file and convert it using OpenMM... 558 FileDir, FileRoot, FileExt = MiscUtil.ParseFileName(PDBOutfile) 559 TmpPDBOutfile = "%s_PID%s.pdb" % (FileRoot, os.getpid()) 560 Traj[0].save(TmpPDBOutfile) 561 562 PDBHandle = OpenMMUtil.ReadPDBFile(TmpPDBOutfile) 563 OpenMMUtil.WritePDBFile(PDBOutfile, PDBHandle.topology, PDBHandle.positions, OptionsInfo["OutputParams"]["PDBOutKeepIDs"]) 564 565 os.remove(TmpPDBOutfile) 566 else: 567 Traj[0].save(PDBOutfile) 568 569 # Write out reimaged and realinged trajectory... 570 MiscUtil.PrintInfo("Writing trajectory file %s..." % TrajOutfile) 571 Traj.save(TrajOutfile) 572 573 def ProcessOutfilePrefixParameter(): 574 """Process outfile prefix paramater.""" 575 576 OutfilePrefix = Options["--outfilePrefix"] 577 578 if not re.match("^auto$", OutfilePrefix, re.I): 579 OptionsInfo["OutfilePrefix"] = OutfilePrefix 580 return 581 582 if OptionsInfo["SmallMolFileMode"]: 583 OutfilePrefix = "%s_%s_Complex" % (OptionsInfo["InfileRoot"], OptionsInfo["SmallMolFileRoot"]) 584 else: 585 OutfilePrefix = "%s" % (OptionsInfo["InfileRoot"]) 586 587 if re.match("^yes$", Options["--waterBox"], re.I): 588 OutfilePrefix = "%s_Solvated" % (OutfilePrefix) 589 590 OutfilePrefix = "%s_%s" % (OutfilePrefix, OptionsInfo["Mode"]) 591 592 OptionsInfo["OutfilePrefix"] = OutfilePrefix 593 594 def ProcessOutfileNames(): 595 """Process outfile names.""" 596 597 OutputParams = OptionsInfo["OutputParams"] 598 OutfileParamNames = ["CheckpointFile", "DataLogFile", "MinimizationDataLogFile", "SaveFinalStateCheckpointFile", "SaveFinalStateXMLFile", "TrajFile", "XmlSystemFile", "XmlIntegratorFile"] 599 for OutfileParamName in OutfileParamNames: 600 OutfileParamValue = OutputParams[OutfileParamName] 601 if not Options["--overwrite"]: 602 if os.path.exists(OutfileParamValue): 603 MiscUtil.PrintError("The file specified, %s, for parameter name, %s, using option \"--outfileParams\" already exist. Use option \"--ov\" or \"--overwrite\" and try again. " % (OutfileParamValue, OutfileParamName)) 604 605 PDBOutfile = "%s.%s" % (OptionsInfo["OutfilePrefix"], OutputParams["PDBOutfileExt"]) 606 ReimagedPDBOutfile = "%s_Reimaged.%s" % (OptionsInfo["OutfilePrefix"], OutputParams["PDBOutfileExt"]) 607 ReimagedTrajOutfile = "%s_Reimaged.%s" % (OptionsInfo["OutfilePrefix"], OutputParams["TrajFileExt"]) 608 609 MinimizedPDBOutfile = "%s_Minimized.%s" % (OptionsInfo["OutfilePrefix"], OutputParams["PDBOutfileExt"]) 610 EquilibratedPDBOutfile = "%s_Equilibrated.%s" % (OptionsInfo["OutfilePrefix"], OutputParams["PDBOutfileExt"]) 611 FinalPDBOutfile = "%s_Final.%s" % (OptionsInfo["OutfilePrefix"], OutputParams["PDBOutfileExt"]) 612 613 for Outfile in [PDBOutfile, ReimagedPDBOutfile, ReimagedTrajOutfile, MinimizedPDBOutfile, EquilibratedPDBOutfile, FinalPDBOutfile]: 614 if not Options["--overwrite"]: 615 if os.path.exists(Outfile): 616 MiscUtil.PrintError("The file name, %s, generated using option \"--outfilePrefix\" already exist. Use option \"--ov\" or \"--overwrite\" and try again. " % (Outfile)) 617 OptionsInfo["PDBOutfile"] = PDBOutfile 618 OptionsInfo["ReimagedPDBOutfile"] = ReimagedPDBOutfile 619 OptionsInfo["ReimagedTrajOutfile"] = ReimagedTrajOutfile 620 621 OptionsInfo["MinimizedPDBOutfile"] = MinimizedPDBOutfile 622 OptionsInfo["EquilibratedPDBOutfile"] = EquilibratedPDBOutfile 623 OptionsInfo["FinalPDBOutfile"] = FinalPDBOutfile 624 625 def ProcessRestartParameters(): 626 """Process restart parameters. """ 627 628 OptionsInfo["RestartMode"] = True if re.match("^yes$", Options["--restart"], re.I) else False 629 OptionsInfo["RestartParams"] = OpenMMUtil.ProcessOptionOpenMMRestartParameters("--restartParams", Options["--restartParams"], OptionsInfo["OutfilePrefix"]) 630 if OptionsInfo["RestartMode"]: 631 RestartFile = OptionsInfo["RestartParams"]["FinalStateFile"] 632 if not os.path.exists(RestartFile): 633 MiscUtil.PrintError("The file specified, %s, for parameter name, finalStateFile, using option \"--restartParams\" doesn't exist." % (RestartFile)) 634 635 DataOutAppendMode = False 636 if OptionsInfo["RestartMode"]: 637 DataOutAppendMode = True if OptionsInfo["RestartParams"]["DataAppend"] else False 638 OptionsInfo["DataOutAppendMode"] = DataOutAppendMode 639 640 def ProcessWaterBoxParameters(): 641 """Process water box parameters. """ 642 643 OptionsInfo["WaterBox"] = True if re.match("^yes$", Options["--waterBox"], re.I) else False 644 OptionsInfo["WaterBoxParams"] = OpenMMUtil.ProcessOptionOpenMMWaterBoxParameters("--waterBoxParams", Options["--waterBoxParams"]) 645 646 if OptionsInfo["WaterBox"]: 647 if OptionsInfo["ForcefieldParams"]["ImplicitWater"]: 648 MiscUtil.PrintInfo("") 649 MiscUtil.PrintWarning("The value, %s, specified using option \"--waterBox\" may not be valid for the combination of biopolymer and water forcefields, %s and %s, specified using \"--forcefieldParams\". You may consider using a valid combination of biopolymer and water forcefields for explicit water during the addition of a water box." % (Options["--waterBox"], OptionsInfo["ForcefieldParams"]["Biopolymer"], OptionsInfo["ForcefieldParams"]["Water"])) 650 651 def ProcessOptions(): 652 """Process and validate command line arguments and options.""" 653 654 MiscUtil.PrintInfo("Processing options...") 655 656 ValidateOptions() 657 658 OptionsInfo["Infile"] = Options["--infile"] 659 FileDir, FileName, FileExt = MiscUtil.ParseFileName(OptionsInfo["Infile"]) 660 OptionsInfo["InfileRoot"] = FileName 661 662 SmallMolFile = Options["--smallMolFile"] 663 SmallMolID = Options["--smallMolID"] 664 SmallMolFileMode = False 665 SmallMolFileRoot = None 666 if SmallMolFile is not None: 667 FileDir, FileName, FileExt = MiscUtil.ParseFileName(SmallMolFile) 668 SmallMolFileRoot = FileName 669 SmallMolFileMode = True 670 671 OptionsInfo["SmallMolFile"] = SmallMolFile 672 OptionsInfo["SmallMolFileRoot"] = SmallMolFileRoot 673 OptionsInfo["SmallMolFileMode"] = SmallMolFileMode 674 OptionsInfo["SmallMolID"] = SmallMolID.upper() 675 676 OptionsInfo["Mode"] = Options["--mode"].upper() 677 OptionsInfo["NPTMode"] = True if re.match("^NPT$", OptionsInfo["Mode"]) else False 678 OptionsInfo["NVTMode"] = True if re.match("^NVT$", OptionsInfo["Mode"]) else False 679 680 ProcessOutfilePrefixParameter() 681 682 if OptionsInfo["NVTMode"]: 683 ParamsDefaultInfoOverride = {"DataOutType": "Step Speed Progress PotentialEnergy Temperature Time Volume"} 684 else: 685 ParamsDefaultInfoOverride = {"DataOutType": "Step Speed Progress PotentialEnergy Temperature Time Density"} 686 OptionsInfo["OutputParams"] = OpenMMUtil.ProcessOptionOpenMMOutputParameters("--outputParams", Options["--outputParams"], OptionsInfo["OutfilePrefix"], ParamsDefaultInfoOverride) 687 ProcessOutfileNames() 688 689 OptionsInfo["ForcefieldParams"] = OpenMMUtil.ProcessOptionOpenMMForcefieldParameters("--forcefieldParams", Options["--forcefieldParams"]) 690 691 OptionsInfo["FreezeAtoms"] = True if re.match("^yes$", Options["--freezeAtoms"], re.I) else False 692 if OptionsInfo["FreezeAtoms"]: 693 OptionsInfo["FreezeAtomsParams"] = OpenMMUtil.ProcessOptionOpenMMAtomsSelectionParameters("--freezeAtomsParams", Options["--freezeAtomsParams"]) 694 else: 695 OptionsInfo["FreezeAtomsParams"] = None 696 697 ParamsDefaultInfoOverride = {"Name": Options["--platform"], "Threads": 1} 698 OptionsInfo["PlatformParams"] = OpenMMUtil.ProcessOptionOpenMMPlatformParameters("--platformParams", Options["--platformParams"], ParamsDefaultInfoOverride) 699 700 OptionsInfo["RestraintAtoms"] = True if re.match("^yes$", Options["--restraintAtoms"], re.I) else False 701 if OptionsInfo["RestraintAtoms"]: 702 OptionsInfo["RestraintAtomsParams"] = OpenMMUtil.ProcessOptionOpenMMAtomsSelectionParameters("--restraintAtomsParams", Options["--restraintAtomsParams"]) 703 else: 704 OptionsInfo["RestraintAtomsParams"] = None 705 OptionsInfo["RestraintSpringConstant"] = float(Options["--restraintSpringConstant"]) 706 707 ProcessRestartParameters() 708 709 OptionsInfo["SystemParams"] = OpenMMUtil.ProcessOptionOpenMMSystemParameters("--systemParams", Options["--systemParams"]) 710 711 OptionsInfo["IntegratorParams"] = OpenMMUtil.ProcessOptionOpenMMIntegratorParameters("--integratorParams", Options["--integratorParams"], HydrogenMassRepartioningStatus = OptionsInfo["SystemParams"]["HydrogenMassRepartioning"]) 712 713 OptionsInfo["SimulationParams"] = OpenMMUtil.ProcessOptionOpenMMSimulationParameters("--simulationParams", Options["--simulationParams"]) 714 715 ProcessWaterBoxParameters() 716 717 OptionsInfo["Overwrite"] = Options["--overwrite"] 718 719 def RetrieveOptions(): 720 """Retrieve command line arguments and options.""" 721 722 # Get options... 723 global Options 724 Options = docopt(_docoptUsage_) 725 726 # Set current working directory to the specified directory... 727 WorkingDir = Options["--workingdir"] 728 if WorkingDir: 729 os.chdir(WorkingDir) 730 731 # Handle examples option... 732 if "--examples" in Options and Options["--examples"]: 733 MiscUtil.PrintInfo(MiscUtil.GetExamplesTextFromDocOptText(_docoptUsage_)) 734 sys.exit(0) 735 736 def ValidateOptions(): 737 """Validate option values.""" 738 739 MiscUtil.ValidateOptionFilePath("-i, --infile", Options["--infile"]) 740 MiscUtil.ValidateOptionFileExt("-i, --infile", Options["--infile"], "pdb cif") 741 742 FileDir, FileName, FileExt = MiscUtil.ParseFileName(Options["--infile"]) 743 OutfilePrefix = Options["--outfilePrefix"] 744 if not re.match("^auto$", OutfilePrefix, re.I): 745 if re.match("^(%s)$" % OutfilePrefix, FileName, re.I): 746 MiscUtil.PrintError("The value specified, %s, for option \"--outfilePrefix\" is not valid. You must specify a value different from, %s, the root of infile name." % (OutfilePrefix, FileName)) 747 748 if Options["--smallMolFile"] is not None: 749 MiscUtil.ValidateOptionFilePath("-l, --smallMolFile", Options["--smallMolFile"]) 750 MiscUtil.ValidateOptionFileExt("-l, --smallMolFile", Options["--smallMolFile"], "sd sdf") 751 752 SmallMolID = Options["--smallMolID"] 753 if len(SmallMolID) != 3: 754 MiscUtil.PrintError("The value specified, %s, for option \"--smallMolID\" is not valid. You must specify a three letter small molecule ID." % (SmallMolID)) 755 756 MiscUtil.ValidateOptionTextValue("--freezeAtoms", Options["--freezeAtoms"], "yes no") 757 if re.match("^yes$", Options["--freezeAtoms"], re.I): 758 if Options["--freezeAtomsParams"] is None: 759 MiscUtil.PrintError("No value specified for option \"--freezeAtomsParams\". You must specify valid values during, yes, value for \"--freezeAtoms\" option.") 760 761 MiscUtil.ValidateOptionTextValue("-m, --mode", Options["--mode"], "NPT NVT") 762 763 MiscUtil.ValidateOptionTextValue("-p, --platform", Options["--platform"], "CPU CUDA OpenCL Reference") 764 765 MiscUtil.ValidateOptionTextValue("-r, --restart ", Options["--restart"], "yes no") 766 767 MiscUtil.ValidateOptionTextValue("--restraintAtoms", Options["--restraintAtoms"], "yes no") 768 if re.match("^yes$", Options["--restraintAtoms"], re.I): 769 if Options["--restraintAtomsParams"] is None: 770 MiscUtil.PrintError("No value specified for option \"--restraintAtomsParams\". You must specify valid values during, yes, value for \"--restraintAtoms\" option.") 771 772 MiscUtil.ValidateOptionFloatValue("--restraintSpringConstant", Options["--restraintSpringConstant"], {">": 0}) 773 774 MiscUtil.ValidateOptionTextValue("--waterBox", Options["--waterBox"], "yes no") 775 776 # Setup a usage string for docopt... 777 _docoptUsage_ = """ 778 OpenMMPerformMDSimulation.py - Perform a MD simulation. 779 780 Usage: 781 OpenMMPerformMDSimulation.py [--forcefieldParams <Name,Value,..>] [--freezeAtoms <yes or no>] 782 [--freezeAtomsParams <Name,Value,..>] [--integratorParams <Name,Value,..>] 783 [--mode <NVT or NPT>] [--outputParams <Name,Value,..>] [--outfilePrefix <text>] 784 [--overwrite] [--platform <text>] [--platformParams <Name,Value,..>] [--restart <yes or no>] 785 [--restartParams <Name,Value,..>] [--restraintAtoms <yes or no>] 786 [--restraintAtomsParams <Name,Value,..>] [--restraintSpringConstant <number>] 787 [--simulationParams <Name,Value,..>] [--smallMolFile <SmallMolFile>] [--smallMolID <text>] 788 [--systemParams <Name,Value,..>] [--waterBox <yes or no>] 789 [--waterBoxParams <Name,Value,..>] [-w <dir>] -i <infile> 790 OpenMMPerformMDSimulation.py -h | --help | -e | --examples 791 792 Description: 793 Perform a MD simulation using an NPT or NVT statistical ensemble. You may 794 run a simulation using a macromolecule or a macromolecule in a complex with 795 small molecule. By default, the system is minimized and equilibrated before the 796 production run. 797 798 The input file must contain a macromolecule already prepared for simulation. 799 The preparation of the macromolecule for a simulation generally involves the 800 following: tasks: Identification and replacement non-standard residues; 801 Addition of missing residues; Addition of missing heavy atoms; Addition of 802 missing hydrogens; Addition of a water box which is optional. 803 804 In addition, the small molecule input file must contain a molecule already 805 prepared for simulation. It must contain appropriate 3D coordinates relative 806 to the macromolecule along with no missing hydrogens. 807 808 You may optionally add a water box and freeze/restraint atoms for the 809 simulation. 810 811 The supported macromolecule input file formats are: PDB (.pdb) and 812 CIF (.cif) 813 814 The supported small molecule input file format are : SD (.sdf, .sd) 815 816 Possible outfile prefixes: 817 818 <InfieRoot>_<Mode> 819 <InfieRoot>_Solvated_<Mode> 820 <InfieRoot>_<SmallMolFileRoot>_Complex_<Mode>, 821 <InfieRoot>_<SmallMolFileRoot>_Complex_Solvated_<Mode> 822 823 Possible output files: 824 825 <OutfilePrefix>.<pdb or cif> [ Initial sytem ] 826 <OutfilePrefix>.<dcd or xtc> 827 828 <OutfilePrefix>_Reimaged.<pdb or cif> [ First frame ] 829 <OutfilePrefix>_Reimaged.<dcd or xtc> 830 831 <OutfilePrefix>_Minimized.<pdb or cif> 832 <OutfilePrefix>_Equilibrated.<pdb or cif> 833 <OutfilePrefix>_Final.<pdb or cif> [ Final system ] 834 835 <OutfilePrefix>.chk 836 <OutfilePrefix>.csv 837 <OutfilePrefix>_Minimization.csv 838 <OutfilePrefix>_FinalState.chk 839 <OutfilePrefix>_FinalState.xml 840 841 <OutfilePrefix>_System.xml 842 <OutfilePrefix>_Integrator.xml 843 844 The reimaged PDB file, <OutfilePrefix>_Reimaged.pdb, corresponds to the first 845 frame in the trajectory. The reimaged trajectory file contains all the frames 846 aligned to the first frame after reimaging of the frames for periodic systems. 847 848 Options: 849 -e, --examples 850 Print examples. 851 -f, --forcefieldParams <Name,Value,..> [default: auto] 852 A comma delimited list of parameter name and value pairs for biopolymer, 853 water, and small molecule forcefields. 854 855 The supported parameter names along with their default values are 856 are shown below: 857 858 biopolymer, amber14-all.xml [ Possible values: Any Valid value ] 859 smallMolecule, openff-2.2.1 [ Possible values: Any Valid value ] 860 water, auto [ Possible values: Any Valid value ] 861 additional, none [ Possible values: Space delimited list of any 862 valid value ] 863 864 Possible biopolymer forcefield values: 865 866 amber14-all.xml, amber99sb.xml, amber99sbildn.xml, amber03.xml, 867 amber10.xml 868 charmm36.xml, charmm_polar_2019.xml 869 amoeba2018.xml 870 871 Possible small molecule forcefield values: 872 873 openff-2.2.1, openff-2.0.0, openff-1.3.1, openff-1.2.1, 874 openff-1.1.1, openff-1.1.0,... 875 smirnoff99Frosst-1.1.0, smirnoff99Frosst-1.0.9,... 876 gaff-2.11, gaff-2.1, gaff-1.81, gaff-1.8, gaff-1.4,... 877 878 The default water forcefield valus is dependent on the type of the 879 biopolymer forcefield as shown below: 880 881 Amber: amber14/tip3pfb.xml 882 CHARMM: charmm36/water.xml or None for charmm_polar_2019.xml 883 Amoeba: None (Explicit) 884 885 Possible water forcefield values: 886 887 amber14/tip3p.xml, amber14/tip3pfb.xml, amber14/spce.xml, 888 amber14/tip4pew.xml, amber14/tip4pfb.xml, 889 charmm36/water.xml, charmm36/tip3p-pme-b.xml, 890 charmm36/tip3p-pme-f.xml, charmm36/spce.xml, 891 charmm36/tip4pew.xml, charmm36/tip4p2005.xml, 892 charmm36/tip5p.xml, charmm36/tip5pew.xml, 893 implicit/obc2.xml, implicit/GBn.xml, implicit/GBn2.xml, 894 amoeba2018_gk.xml (Implict water) 895 None (Explicit water for amoeba) 896 897 The additional forcefield value is a space delimited list of any valid 898 forcefield values and is passed on to the OpenMMForcefields 899 SystemGenerator along with the specified forcefield values for 900 biopolymer, water, and mall molecule. Possible additional forcefield 901 values are: 902 903 amber14/DNA.OL15.xml amber14/RNA.OL3.xml 904 amber14/lipid17.xml amber14/GLYCAM_06j-1.xml 905 ... ... ... 906 907 You may specify any valid forcefield names supported by OpenMM. No 908 explicit validation is performed. 909 --freezeAtoms <yes or no> [default: no] 910 Freeze atoms during a simulation. The specified atoms are kept completely 911 fixed by setting their masses to zero. Their positions do not change during 912 local energy minimization and MD simulation, and they do not contribute 913 to the kinetic energy of the system. 914 --freezeAtomsParams <Name,Value,..> 915 A comma delimited list of parameter name and value pairs for freezing 916 atoms during a simulation. You must specify these parameters for 'yes' 917 value of '--freezeAtoms' option. 918 919 The supported parameter names along with their default values are 920 are shown below: 921 922 selection, none [ Possible values: CAlphaProtein, Ions, Ligand, 923 Protein, Residues, or Water ] 924 selectionSpec, auto [ Possible values: A space delimited list of 925 residue names ] 926 negate, no [ Possible values: yes or no ] 927 928 A brief description of parameters is provided below: 929 930 selection: Atom selection to freeze. 931 selectionSpec: A space delimited list of residue names for 932 selecting atoms to freeze. You must specify its value during 933 'Ligand' and 'Protein' value for 'selection'. The default values 934 are automatically set for 'CAlphaProtein', 'Ions', 'Protein', 935 and 'Water' values of 'selection' as shown below: 936 937 CAlphaProtein: List of stadard protein residues from pdbfixer 938 for selecting CAlpha atoms. 939 Ions: Li Na K Rb Cs Cl Br F I 940 Water: HOH 941 Protein: List of standard protein residues from pdbfixer. 942 943 negate: Negate atom selection match to select atoms for freezing. 944 945 In addition, you may specify an explicit space delimited list of residue 946 names using 'selectionSpec' for any 'selection". The specified residue 947 names are appended to the appropriate default values during the 948 selection of atoms for freezing. 949 -h, --help 950 Print this help message. 951 -i, --infile <infile> 952 Input file name containing a macromolecule. 953 --integratorParams <Name,Value,..> [default: auto] 954 A comma delimited list of parameter name and value pairs for integrator 955 during a simulation. 956 957 The supported parameter names along with their default values are 958 are shown below: 959 960 integrator, LangevinMiddle [ Possible values: LangevinMiddle, 961 Langevin, NoseHoover, Brownian ] 962 963 randomSeed, auto [ Possible values: > 0 ] 964 965 frictionCoefficient, 1.0 [ Units: 1/ps ] 966 stepSize, auto [ Units: fs; Default value: 4 fs during yes value of 967 hydrogen mass repartioning with no freezing/restraining of atoms; 968 otherwsie, 2 fs ] 969 temperature, 300.0 [ Units: kelvin ] 970 971 barostat, MonteCarlo [ Possible values: MonteCarlo or 972 MonteCarloMembrane ] 973 barostatInterval, 25 974 pressure, 1.0 [ Units: atm ] 975 976 Parameters used only for MonteCarloMembraneBarostat with default 977 values corresponding to Amber forcefields: 978 979 surfaceTension, 0.0 [ Units: atm*A. It is automatically converted 980 into OpenMM default units of atm*nm before its usage. ] 981 xymode, Isotropic [ Possible values: Anisotropic or Isotropic ] 982 zmode, Free [ Possible values: Free or Fixed ] 983 984 A brief description of parameters is provided below: 985 986 integrator: Type of integrator 987 988 randomSeed: Random number seed for barostat and integrator. Not 989 supported for NoseHoover integrator. 990 991 frictionCoefficient: Friction coefficient for coupling the system to 992 the heat bath.. 993 stepSize: Simulation time step size. 994 temperature: Simulation temperature. 995 996 barostat: Barostat type. 997 barostatInterval: Barostat interval step size during NPT 998 simulation for applying Monte Carlo pressure changes. 999 pressure: Pressure during NPT simulation. 1000 1001 Parameters used only for MonteCarloMembraneBarostat: 1002 1003 surfaceTension: Surface tension acting on the system. 1004 xymode: Behavior along X and Y axes. You may allow the X and Y axes 1005 to vary independently of each other or always scale them by the same 1006 amount to keep the ratio of their lengths constant. 1007 zmode: Beahvior along Z axis. You may allow the Z axis to vary 1008 independently of the other axes or keep it fixed. 1009 1010 -m, --mode <NPT or NVT> [default: NPT] 1011 Type of statistical ensemble to use for simulation. Possible values: 1012 NPT (constant Number of particles, Pressure, and Temperature) or 1013 NVT ((constant Number of particles, Volume and Temperature) 1014 --outfilePrefix <text> [default: auto] 1015 File prefix for generating the names of output files. The default value 1016 depends on the names of input files for macromolecule and small molecule 1017 along with the type of statistical ensemble and the nature of the solvation. 1018 1019 The possible values for outfile prefix are shown below: 1020 1021 <InfieRoot>_<Mode> 1022 <InfieRoot>_Solvated_<Mode> 1023 <InfieRoot>_<SmallMolFileRoot>_Complex_<Mode>, 1024 <InfieRoot>_<SmallMolFileRoot>_Complex_Solvated_<Mode> 1025 1026 --outputParams <Name,Value,..> [default: auto] 1027 A comma delimited list of parameter name and value pairs for generating 1028 output during a simulation. 1029 1030 The supported parameter names along with their default values are 1031 are shown below: 1032 1033 checkpoint, no [ Possible values: yes or no ] 1034 checkpointFile, auto [ Default: <OutfilePrefix>.chk ] 1035 checkpointSteps, 10000 1036 1037 dataOutType, auto [ Possible values: A space delimited list of valid 1038 parameter names. 1039 NPT simulation default: Density Step Speed Progress 1040 PotentialEnergy Temperature Time. 1041 NVT simulation default: Step Speed Progress PotentialEnergy 1042 Temperature Time Volumne 1043 Other valid names: ElapsedTime RemainingTime KineticEnergy 1044 TotalEnergy ] 1045 1046 dataLog, yes [ Possible values: yes or no ] 1047 dataLogFile, auto [ Default: <OutfilePrefix>.csv ] 1048 dataLogSteps, 1000 1049 1050 dataStdout, no [ Possible values: yes or no ] 1051 dataStdoutSteps, 1000 1052 1053 minimizationDataSteps, 100 1054 minimizationDataStdout, no [ Possible values: yes or no ] 1055 minimizationDataLog, no [ Possible values: yes or no ] 1056 minimizationDataLogFile, auto [ Default: 1057 <OutfilePrefix>_MinimizationOut.csv ] 1058 minimizationDataOutType, auto [ Possible values: A space delimited 1059 list of valid parameter names. Default: SystemEnergy 1060 RestraintEnergy MaxConstraintError. 1061 Other valid names: RestraintStrength ] 1062 1063 pdbOutFormat, PDB [ Possible values: PDB or CIF ] 1064 pdbOutKeepIDs, yes [ Possible values: yes or no ] 1065 1066 pdbOutMinimized, no [ Possible values: yes or no ] 1067 pdbOutEquilibrated, no [ Possible values: yes or no ] 1068 pdbOutFinal, no [ Possible values: yes or no ] 1069 1070 saveFinalStateCheckpoint, yes [ Possible values: yes or no ] 1071 saveFinalStateCheckpointFile, auto [ Default: 1072 <OutfilePrefix>_FinalState.chk ] 1073 saveFinalStateXML, no [ Possible values: yes or no ] 1074 saveFinalStateXMLFile, auto [ Default: 1075 <OutfilePrefix>_FinalState.xml] 1076 1077 traj, yes [ Possible values: yes or no ] 1078 trajFile, auto [ Default: <OutfilePrefix>.<TrajFormat> ] 1079 trajFormat, DCD [ Possible values: DCD or XTC ] 1080 trajSteps, 10000 [ The default value corresponds to 40 ps for step 1081 size of 4 fs. ] 1082 1083 xmlSystemOut, no [ Possible values: yes or no ] 1084 xmlSystemFile, auto [ Default: <OutfilePrefix>_System.xml ] 1085 xmlIntegratorOut, no [ Possible values: yes or no ] 1086 xmlIntegratorFile, auto [ Default: <OutfilePrefix>_Integrator.xml ] 1087 1088 A brief description of parameters is provided below: 1089 1090 checkpoint: Write intermediate checkpoint file. 1091 checkpointFile: Intermediate checkpoint file name. 1092 checkpointSteps: Frequency of writing intermediate checkpoint file. 1093 1094 dataOutType: Type of data to write to stdout and log file. 1095 1096 dataLog: Write data to log file. 1097 dataLogFile: Data log file name. 1098 dataLogSteps: Frequency of writing data to log file. 1099 1100 dataStdout: Write data to stdout. 1101 dataStdoutSteps: Frequency of writing data to stdout. 1102 1103 minimizationDataSteps: Frequency of writing data to stdout 1104 and log file. 1105 minimizationDataStdout: Write data to stdout. 1106 minimizationDataLog: Write data to log file. 1107 minimizationDataLogFile: Data log fie name. 1108 minimizationDataOutType: Type of data to write to stdout 1109 and log file. 1110 1111 saveFinalStateCheckpoint: Save final state checkpoint file. 1112 saveFinalStateCheckpointFile: Name of final state checkpoint file. 1113 saveFinalStateXML: Save final state XML file. 1114 saveFinalStateXMLFile: Name of final state XML file. 1115 1116 pdbOutFormat: Format of output PDB files. 1117 pdbOutKeepIDs: Keep existing chain and residue IDs. 1118 1119 pdbOutMinimized: Write PDB file after minimization. 1120 pdbOutEquilibrated: Write PDB file after equilibration. 1121 pdbOutFinal: Write final PDB file after production run. 1122 1123 traj: Write out trajectory file. 1124 trajFile: Trajectory file name. 1125 trajFormat: Trajectory file format. 1126 trajSteps: Frequency of writing trajectory file. 1127 1128 xmlSystemOut: Write system XML file. 1129 xmlSystemFile: System XML file name. 1130 xmlIntegratorOut: Write integrator XML file. 1131 xmlIntegratorFile: Integrator XML file name. 1132 1133 --overwrite 1134 Overwrite existing files. 1135 -p, --platform <text> [default: CPU] 1136 Platform to use for running MD simulation. Possible values: CPU, CUDA, 1137 OpenCL, or Reference. 1138 --platformParams <Name,Value,..> [default: auto] 1139 A comma delimited list of parameter name and value pairs to configure 1140 platform for running MD simulation. 1141 1142 The supported parameter names along with their default values for 1143 different platforms are shown below: 1144 1145 CPU: 1146 1147 threads, 1 [ Possible value: >= 0 or auto. The value of 'auto' 1148 or zero implies the use of all available CPUs for threading. ] 1149 1150 CUDA: 1151 1152 deviceIndex, auto [ Possible values: 0, '0 1' etc. ] 1153 deterministicForces, auto [ Possible values: yes or no ] 1154 precision, single [ Possible values: single, double, or mix ] 1155 tempDirectory, auto [ Possible value: DirName ] 1156 useBlockingSync, auto [ Possible values: yes or no ] 1157 useCpuPme, auto [ Possible values: yes or no ] 1158 1159 OpenCL: 1160 1161 deviceIndex, auto [ Possible values: 0, '0 1' etc. ] 1162 openCLPlatformIndex, auto [ Possible value: Number] 1163 precision, single [ Possible values: single, double, or mix ] 1164 useCpuPme, auto [ Possible values: yes or no ] 1165 1166 A brief description of parameters is provided below: 1167 1168 CPU: 1169 1170 threads: Number of threads to use for simulation. 1171 1172 CUDA: 1173 1174 deviceIndex: Space delimited list of device indices to use for 1175 calculations. 1176 deterministicForces: Generate reproducible results at the cost of a 1177 small decrease in performance. 1178 precision: Number precision to use for calculations. 1179 tempDirectory: Directory name for storing temporary files. 1180 useBlockingSync: Control run-time synchronization between CPU and 1181 GPU. 1182 useCpuPme: Use CPU-based PME implementation. 1183 1184 OpenCL: 1185 1186 deviceIndex: Space delimited list of device indices to use for 1187 simulation. 1188 openCLPlatformIndex: Platform index to use for calculations. 1189 precision: Number precision to use for calculations. 1190 useCpuPme: Use CPU-based PME implementation. 1191 1192 -r, --restart <yes or no> [default: no] 1193 Restart simulation using a previously saved final state checkpoint or 1194 XML file. 1195 --restartParams <Name,Value,..> [default: auto] 1196 A comma delimited list of parameter name and value pairs for restarting 1197 a simulation. 1198 1199 The supported parameter names along with their default values are 1200 are shown below: 1201 1202 finalStateFile, <OutfilePrefix>_FinalState.<chk> [ Possible values: 1203 Valid final state checkpoint or XML filename ] 1204 dataAppend, yes [ Possible values: yes or no] 1205 1206 A brief description of parameters is provided below: 1207 1208 finalStateFile: Final state checkpoint or XML file 1209 dataAppend: Append data to existing trajectory and data log files 1210 during the restart of a simulation using a previously saved final 1211 state checkpoint or XML file. 1212 1213 --restraintAtoms <yes or no> [default: no] 1214 Restraint atoms during a simulation. The motion of specified atoms is 1215 restricted by adding a harmonic force that binds them to their starting 1216 positions. The atoms are not completely fixed unlike freezing of atoms. 1217 Their motion, however, is restricted and they are not able to move far away 1218 from their starting positions during local energy minimization and MD 1219 simulation. 1220 --restraintAtomsParams <Name,Value,..> 1221 A comma delimited list of parameter name and value pairs for restraining 1222 atoms during a simulation. You must specify these parameters for 'yes' 1223 value of '--restraintAtoms' option. 1224 1225 The supported parameter names along with their default values are 1226 are shown below: 1227 1228 selection, none [ Possible values: CAlphaProtein, Ions, Ligand, 1229 Protein, Residues, or Water ] 1230 selectionSpec, auto [ Possible values: A space delimited list of 1231 residue names ] 1232 negate, no [ Possible values: yes or no ] 1233 1234 A brief description of parameters is provided below: 1235 1236 selection: Atom selection to restraint. 1237 selectionSpec: A space delimited list of residue names for 1238 selecting atoms to restraint. You must specify its value during 1239 'Ligand' and 'Protein' value for 'selection'. The default values 1240 are automatically set for 'CAlphaProtein', 'Ions', 'Protein', 1241 and 'Water' values of 'selection' as shown below: 1242 1243 CAlphaProtein: List of stadard protein residues from pdbfixer 1244 for selecting CAlpha atoms. 1245 Ions: Li Na K Rb Cs Cl Br F I 1246 Water: HOH 1247 Protein: List of standard protein residues from pdbfixer. 1248 1249 negate: Negate atom selection match to select atoms for freezing. 1250 1251 In addition, you may specify an explicit space delimited list of residue 1252 names using 'selectionSpec' for any 'selection". The specified residue 1253 names are appended to the appropriate default values during the 1254 selection of atoms for restraining. 1255 --restraintSpringConstant <number> [default: 2.5] 1256 Restraint spring constant for applying external restraint force to restraint 1257 atoms relative to their initial positions during 'yes' value of '--restraintAtoms' 1258 option. Default units: kcal/mol/A**2. The default value, 2.5, corresponds to 1259 1046.0 kjoules/mol/nm**2. The default value is automatically converted into 1260 units of kjoules/mol/nm**2 before its usage. 1261 --simulationParams <Name,Value,..> [default: auto] 1262 A comma delimited list of parameter name and value pairs for simulation. 1263 1264 The supported parameter names along with their default values are 1265 are shown below: 1266 1267 steps, 1000000 [ Possible values: > 0. The default value 1268 corresponds to 4 ns for step size of 4 fs. ] 1269 1270 minimization, yes [ Possible values: yes or no ] 1271 minimizationMaxSteps, auto [ Possible values: >= 0. The value of 1272 zero implies until the minimization is converged. ] 1273 minimizationTolerance, 0.24 [ Units: kcal/mol/A. The default value 1274 0.25, corresponds to OpenMM default of value of 10.04 1275 kjoules/mol/nm. It is automatically converted into OpenMM 1276 default units before its usage. ] 1277 1278 equilibration, yes [ Possible values: yes or no ] 1279 equilibrationSteps, 1000 [ Possible values: > 0 ] 1280 1281 A brief description of parameters is provided below: 1282 1283 steps: Number of steps for production run. 1284 1285 minimization: Perform minimization before equilibration and 1286 production run. 1287 minimizationMaxSteps: Maximum number of minimization steps. The 1288 value of zero implies until the minimization is converged. 1289 minimizationTolerance: Energy convergence tolerance during 1290 minimization. 1291 1292 equilibration: Perform equilibration before the production run. 1293 equilibrationSteps: Number of steps for equilibration. 1294 1295 -s, --smallMolFile <SmallMolFile> 1296 Small molecule input file name. The macromolecue and small molecule are 1297 merged for simulation and the complex is written out to a PDB file. 1298 --smallMolID <text> [default: LIG] 1299 Three letter small molecule residue ID. The small molecule ID corresponds 1300 to the residue name of the small molecule and is written out to a PDB file 1301 containing the complex. 1302 --systemParams <Name,Value,..> [default: auto] 1303 A comma delimited list of parameter name and value pairs to configure 1304 a system for simulation. 1305 1306 The supported parameter names along with their default values are 1307 are shown below: 1308 1309 constraints, BondsInvolvingHydrogens [ Possible values: None, 1310 WaterOnly, BondsInvolvingHydrogens, AllBonds, or 1311 AnglesInvolvingHydrogens ] 1312 constraintErrorTolerance, 0.000001 1313 ewaldErrorTolerance, 0.0005 1314 1315 nonbondedMethodPeriodic, PME [ Possible values: NoCutoff, 1316 CutoffNonPeriodic, or PME ] 1317 nonbondedMethodNonPeriodic, NoCutoff [ Possible values: 1318 NoCutoff or CutoffNonPeriodic] 1319 nonbondedCutoff, 1.0 [ Units: nm ] 1320 1321 hydrogenMassRepartioning, yes [ Possible values: yes or no ] 1322 hydrogenMass, 1.5 [ Units: amu] 1323 1324 removeCMMotion, yes [ Possible values: yes or no ] 1325 rigidWater, auto [ Possible values: yes or no. Default: 'No' for 1326 'None' value of constraints; Otherwise, yes ] 1327 1328 A brief description of parameters is provided below: 1329 1330 constraints: Type of system constraints to use for simulation. These 1331 constraints are different from freezing and restraining of any 1332 atoms in the system. 1333 constraintErrorTolerance: Distance tolerance for constraints as a 1334 fraction of the constrained distance. 1335 ewaldErrorTolerance: Ewald error tolerance for a periodic system. 1336 1337 nonbondedMethodPeriodic: Nonbonded method to use during the 1338 calculation of long range interactions for a periodic system. 1339 nonbondedMethodNonPeriodic: Nonbonded method to use during the 1340 calculation of long range interactions for a non-periodic system. 1341 nonbondedCutoff: Cutoff distance to use for long range interactions 1342 in both perioidic non-periodic systems. 1343 1344 hydrogenMassRepartioning: Use hydrogen mass repartioning. It 1345 increases the mass of the hydrogen atoms attached to the heavy 1346 atoms and decreasing the mass of the bonded heavy atom to 1347 maintain constant system mass. This allows the use of larger 1348 integration step size (4 fs) during a simulation. 1349 hydrogenMass: Hydrogen mass to use during repartioning. 1350 1351 removeCMMotion: Remove all center of mass motion at every time step. 1352 rigidWater: Keep water rigid during a simulation. This is determined 1353 automatically based on the value of 'constraints' parameter. 1354 1355 --waterBox <yes or no> [default: no] 1356 Add water box. 1357 --waterBoxParams <Name,Value,..> [default: auto] 1358 A comma delimited list of parameter name and value pairs for adding 1359 a water box. 1360 1361 The supported parameter names along with their default values are 1362 are shown below: 1363 1364 model, tip3p [ Possible values: tip3p, spce, tip4pew, tip5p or 1365 swm4ndp ] 1366 mode, Padding [ Possible values: Size or Padding ] 1367 padding, 1.0 1368 size, None [ Possible value: xsize ysize zsize ] 1369 shape, cube [ Possible values: cube, dodecahedron, or octahedron ] 1370 ionPositive, Na+ [ Possible values: Li+, Na+, K+, Rb+, or Cs+ ] 1371 ionNegative, Cl- [ Possible values: Cl-, Br-, F-, or I- ] 1372 ionicStrength, 0.0 1373 1374 A brief description of parameters is provided below: 1375 1376 model: Water model to use for adding water box. The van der 1377 Waals radii and atomic charges are determined using the 1378 specified water forcefield. You must specify an appropriate 1379 water forcefield. No validation is performed. 1380 mode: Specify the size of the waterbox explicitly or calculate it 1381 automatically for a macromolecule along with adding padding 1382 around ther macromolecule. 1383 padding: Padding around a macromolecule in nanometers for filling 1384 box with water. It must be specified during 'Padding' value of 1385 'mode' parameter. 1386 size: A space delimited triplet of values corresponding to water 1387 size in nanometers. It must be specified during 'Size' value of 1388 'mode' parameter. 1389 ionPositive: Type of positive ion to add during the addition of a 1390 water box. 1391 ionNegative: Type of negative ion to add during the addition of a 1392 water box. 1393 ionicStrength: Total concentration of both positive and negative 1394 ions to add excluding the ions added to neutralize the system 1395 during the addition of a water box. 1396 1397 -w, --workingdir <dir> 1398 Location of working directory which defaults to the current directory. 1399 1400 Examples: 1401 To perform a MD simulation for a macromolecule in a PDB file by using an NPT 1402 ensemble, applying system constraints for bonds involving hydrogens along 1403 with hydrogen mass repartioning, using a step size of 4 fs, performing minimization 1404 until it's converged along with equilibration for 1,000 steps ( 4 ps), performing 1405 production run for 1,000,000 steps (4 ns), writing trajectory file every 10,000 1406 steps (40 ps), writing data log file every 1,000 steps (4 ps), generating a checkpoint 1407 file after the completion of the, and generating a PDB for the final system, type: 1408 1409 % OpenMMPerformMDSimulation.py -i Sample13.pdb --waterBox yes 1410 1411 To run the first example for performing OpenMM simulation using multi- 1412 threading employing all available CPUs on your machine and generate various 1413 output files, type: 1414 1415 % OpenMMPerformMDSimulation.py -i Sample13.pdb --waterBox yes 1416 --platformParams "threads,0" 1417 1418 To run the first example for performing OpenMM simulation using CUDA platform 1419 on your machine and generate various output files, type: 1420 1421 % OpenMMPerformMDSimulation.py -i Sample13.pdb --waterBox yes -p CUDA 1422 1423 To run the second example for performing NVT simulation minimizing for a 1424 maximum of 2,000 steps, performing production run of 10,00 steps (40 ps), 1425 writing trajectory file every 1,000 steps (4 ps), and generate various output 1426 files, type: 1427 1428 % OpenMMPerformMDSimulation.py -i Sample13.pdb --waterBox yes 1429 --platformParams "threads,0" --simulationParams "steps,10000, 1430 minimizationMaxSteps, 1000" --outputParams "trajSteps,1000" 1431 1432 To run the second example for a marcomolecule in a complex with a small 1433 molecule and generate various output files, type: 1434 1435 % OpenMMPerformMDSimulation.py -i Sample13.pdb -s Sample13Ligand.sdf 1436 --waterBox yes --platformParams "threads,0" 1437 1438 To run the second example for performing NVT simulation and generate various 1439 output files, type: 1440 1441 % OpenMMPerformMDSimulation.py -i Sample13.pdb -s Sample13Ligand.sdf 1442 --mode NVT --platformParams "threads,0" 1443 1444 % OpenMMPerformMDSimulation.py -i Sample13.pdb -s Sample13Ligand.sdf 1445 --mode NVT --waterBox yes --platformParams "threads,0" 1446 1447 To run the second example for a macromolecule in a lipid bilayer, write out 1448 reimaged and realigned trajectory file for the periodic system, along with a 1449 PDB file corresponding to the first frame, and generate various output files, 1450 type: 1451 1452 % OpenMMPerformMDSimulation.py -i Sample12LipidBilayer.pdb 1453 --platformParams "threads,0" --integratorParams 1454 "barostat,MonteCarloMembrane" 1455 1456 To run the second example by freezing CAlpha atoms in a macromolecule without 1457 using any system constraints to avoid any issues with the freezing of the same atoms, 1458 using a step size of 2 fs, and generate various output files, type: 1459 1460 % OpenMMPerformMDSimulation.py -i Sample13.pdb --waterBox yes 1461 --freezeAtoms yes --freezeAtomsParams "selection,CAlphaProtein" 1462 --systemParams "constraints, None" 1463 --platformParams "threads,0" --integratorParams "stepSize,2" 1464 1465 To run the second example by restrainting CAlpha atoms in a macromolecule and 1466 and generate various output files, type: 1467 1468 % OpenMMPerformMDSimulation.py -i Sample13.pdb --waterBox yes 1469 --restraintAtomsParams "selection,CAlphaProtein" 1470 --platformParams "threads,0" --integratorParams "stepSize,2" 1471 1472 To run the second example for a marcomolecule in a complex with a small 1473 molecule by using implicit water and generate various output files, type: 1474 1475 % OpenMMPerformMDSimulation.py -i Sample13.pdb -s Sample13Ligand.sdf 1476 --mode NVT --platformParams "threads,0" 1477 --forcefieldParams "biopolymer, amber14-all.xml, water, 1478 implicit/obc2.xml" 1479 1480 To run the second example by specifying explict values for various parametres 1481 and generate various output files, type: 1482 1483 % OpenMMPerformMDSimulation.py -m NPT -i Sample13.pdb 1484 -f " biopolymer,amber14-all.xml,smallMolecule, openff-2.2.1, 1485 water,amber14/tip3pfb.xml" --waterBox yes 1486 --integratorParams "integrator,LangevinMiddle,randomSeed,42, 1487 stepSize,2, temperature, 300.0,pressure, 1.0" 1488 --outputParams "checkpoint,yes,dataLog,yes,dataStdout,yes, 1489 minimizationDataStdout,yes,minimizationDataLog,yes, 1490 pdbOutFormat,CIF,pdbOutKeepIDs,yes,saveFinalStateCheckpoint, yes, 1491 traj,yes,xmlSystemOut,yes,xmlIntegratorOut,yes" 1492 -p CPU --platformParams "threads,0" 1493 --simulationParams "steps,10000,minimization,yes, 1494 minimizationMaxSteps,500,equilibration,yes,equilibrationSteps,1000" 1495 --systemParams "constraints,BondsInvolvingHydrogens, 1496 nonbondedMethodPeriodic,PME,nonbondedMethodNonPeriodic,NoCutoff, 1497 hydrogenMassRepartioning, yes" 1498 1499 Author: 1500 Manish Sud(msud@san.rr.com) 1501 1502 See also: 1503 OpenMMPrepareMacromolecule.py, OpenMMPerformMinimization.py, 1504 OpenMMPerformSimulatedAnnealing.py 1505 1506 Copyright: 1507 Copyright (C) 2025 Manish Sud. All rights reserved. 1508 1509 The functionality available in this script is implemented using OpenMM, an 1510 open source molecuar simulation package. 1511 1512 This file is part of MayaChemTools. 1513 1514 MayaChemTools is free software; you can redistribute it and/or modify it under 1515 the terms of the GNU Lesser General Public License as published by the Free 1516 Software Foundation; either version 3 of the License, or (at your option) any 1517 later version. 1518 1519 """ 1520 1521 if __name__ == "__main__": 1522 main()