def __init__ ( self, **kwargs ): """Constructor.""" for ( attribute, value ) in kwargs.iteritems ( ): setattr ( self, attribute, value ) self.mmModel = MMModelOPLS ( ) self.nbModel = NBModelABFS ( ) self.p1Factor = 1.0
def runTest(self): """The test.""" # . Paths. dataPath = os.path.join(os.getenv("PDYNAMO_PMOLECULE"), "data", "mol") log = self.GetLog() # . Get the system. molecule = MOLFile_ToSystem( os.path.join(dataPath, "tyrosineDipeptide.mol")) molecule.DefineMMModel(MMModelOPLS("protein")) molecule.DefineNBModel(NBModelFull()) molecule.Summary(log=log) molecule.Energy(log=log, doGradients=True) # . Save initial coordinates. reference3 = Clone(molecule.coordinates3) # . Do some dynamics. normalDeviateGenerator = NormalDeviateGenerator.WithRandomNumberGenerator( RandomNumberGenerator.WithSeed(247171)) LangevinDynamics_SystemGeometry( molecule, collisionFrequency=25.0, log=log, logFrequency=1000, normalDeviateGenerator=normalDeviateGenerator, steps=_NSteps, temperature=300.0, timeStep=0.001) # . Check RMSs which should be the same as rotation and translation are removed. masses = molecule.atoms.GetItemAttributes("mass") rms0 = molecule.coordinates3.RMSDeviation(reference3, weights=masses) molecule.coordinates3.Superimpose(reference3, weights=masses) rms1 = molecule.coordinates3.RMSDeviation(reference3, weights=masses) # . Get the observed and reference data. observed = {"RMS Deviation": rms1} referenceData = TestDataSet("Rotation/Translation Removal") referenceData.AddDatum( TestReal("RMS Deviation", rms0, referenceData, absoluteErrorTolerance=_RMSAbsoluteErrorTolerance, toleranceFormat="{:.3f}", valueFormat="{:.3f}")) # . Check for success/failure. if len(observed) > 0: results = referenceData.VerifyAgainst(observed) results.Summary(log=log, fullSummary=self.fullVerificationSummary) isOK = results.WasSuccessful() else: isOK = True self.assertTrue(isOK)
def runTest ( self ): """The test.""" # . Paths. dataPath = os.path.join ( os.getenv ( "PDYNAMO_ROOT" ), "molecularStructures", "aminoAcids", "mol" ) log = self.GetLog ( ) # . Models. mmModel = MMModelOPLS ( "protein" ) nbModel = NBModelFull ( ) # . Get all files. molFiles = glob.glob ( os.path.join ( dataPath, "*.mol" ) ) molFiles.sort ( ) # . Read all mol files. numberFailed = 0 for molFile in molFiles: if log is not None: log.Text ( "\nProcessing " + molFile + ":\n" ) molecule = MOLFile_ToSystem ( molFile ) try: molecule.DefineMMModel ( mmModel, log = log ) molecule.DefineNBModel ( nbModel ) molecule.Summary ( log = log ) molecule.Energy ( log = log, doGradients = True ) except Exception as e: numberFailed += 1 if log is not None: log.Text ( "\nError occurred> " + e.args[0] + "\n" ) # . Summary of results. if log is not None: summary = log.GetSummary ( ) summary.Start ( "OPLS Protein Parameter Tests" ) summary.Entry ( "Successes", "{:d}".format ( len ( molFiles ) - numberFailed ) ) summary.Entry ( "Failures" , "{:d}".format ( numberFailed ) ) summary.Stop ( ) # . Success/failure. self.assertTrue ( ( numberFailed == 0 ) )
def runTest ( self ): """The test.""" # . Paths. dataPath = os.path.join ( os.getenv ( "PDYNAMO_PMOLECULE" ), "data", "mol" ) if self.resultPath is None: outPath = os.path.join ( os.getenv ( "PDYNAMO_SCRATCH" ), _Destination ) else: outPath = os.path.join ( self.resultPath , _Destination ) if not os.path.exists ( outPath ): os.mkdir ( outPath ) log = self.GetLog ( ) # . Energy models. mmModel = MMModelOPLS ( "protein" ) nbModel = NBModelFull ( ) qcModel = QCModelMNDO ( converger = DIISSCFConverger ( densityTolerance = 1.0e-10 ) ) # . Initialization. numberFailures = 0 # . Loop over molecules. for moleculeLabel in _MoleculeLabels: # . Get the system. system = MOLFile_ToSystem ( os.path.join ( dataPath, moleculeLabel + ".mol" ) ) if moleculeLabel in _QCModels: system.DefineQCModel ( qcModel ) else: system.DefineMMModel ( mmModel, log = log ) system.DefineNBModel ( nbModel ) system.Summary ( log = log ) system.Energy ( log = log ) # . Minimize well. LBFGSMinimize_SystemGeometry ( system, log = log , logFrequency = _LogFrequency , maximumIterations = _Iterations , rmsGradientTolerance = _Tolerance ) # . Normal mode analysis. nmState = NormalModes_SystemGeometry ( system, log = log ) # . Do a dynamics simulation: equilibration and then data collection. normalDeviateGenerator = NormalDeviateGenerator.WithRandomNumberGenerator ( RandomNumberGenerator.WithSeed ( _Seed ) ) LangevinDynamics_SystemGeometry ( system , collisionFrequency = _CollisionFrequency , log = log , logFrequency = _LogFrequency , normalDeviateGenerator = normalDeviateGenerator , steps = _NSteps0 , temperature = _Temperature , timeStep = 0.001 ) reference3 = Clone ( system.coordinates3 ) trajectory = AmberTrajectoryFileWriter ( os.path.join ( outPath, moleculeLabel + ".crd" ), system ) LangevinDynamics_SystemGeometry ( system , collisionFrequency = _CollisionFrequency , log = log , logFrequency = _LogFrequency , normalDeviateGenerator = normalDeviateGenerator , steps = _NSteps1 , temperature = _Temperature , timeStep = 0.001 , trajectories = [ ( trajectory, _SaveFrequency ) ] ) # . Check RMSs. masses = system.atoms.GetItemAttributes ( "mass" ) rms0 = system.coordinates3.RMSDeviation ( reference3, weights = masses ) system.coordinates3.Superimpose ( reference3, weights = masses ) rms1 = system.coordinates3.RMSDeviation ( reference3, weights = masses ) if ( math.fabs ( rms1 - rms0 ) >= _RMSAbsoluteErrorTolerance ): numberFailures += 1 # . Do a quasi-harmonic analysis. trajectory = AmberTrajectoryFileReader ( os.path.join ( outPath, moleculeLabel + ".crd" ), system ) qhState = QuasiHarmonic_SystemGeometry ( system, log = log, temperature = _Temperature, trajectories = [ trajectory ] ) # . Success/failure. self.assertTrue ( ( numberFailures == 0 ) )
def runTest(self): """The test.""" # . Paths. dataPath = os.path.join(os.getenv("PDYNAMO_PMOLECULE"), "data", "mol") log = self.GetLog() # . Energy models. mmModel = MMModelOPLS("protein") nbModel = NBModelFull() # . Get the files. molFiles = glob.glob(os.path.join(dataPath, "*.mol")) # . Initialization. numberErrors = 0 numberFailures = 0 # . Loop over the files. for molFile in molFiles: try: # . Get the system. try: system = MOLFile_ToSystem(molFile) system.DefineMMModel(mmModel, log=log) system.DefineNBModel(nbModel) system.Summary(log=log) except: continue # . Calculate an energy. eBefore = system.Energy(log=log, doGradients=True) # . Define all hydrogen positions as undefined. for (i, atom) in enumerate(system.atoms): if atom.atomicNumber == 1: system.coordinates3.FlagCoordinateAsUndefined(i) # . Build as many undefined coordinates as possible. randomNumberGenerator = RandomNumberGenerator.WithSeed(957197) BuildHydrogenCoordinates3FromConnectivity( system, log=log, randomNumberGenerator=randomNumberGenerator) # . Calculate an energy if all coordinates have been defined. if system.coordinates3.numberUndefined > 0: numberFailures += 1 if log is not None: log.Paragraph("Not all hydrogens have been rebuilt.") else: eAfter = system.Energy(log=log, doGradients=True) if log is not None: log.Paragraph( "Energy difference after rebuilding = {:.1f}.". format(eAfter - eBefore)) except Exception as e: numberErrors += 1 if log is not None: log.Text("\nError occurred> " + e.args[0] + "\n") # . Success/failure. self.assertTrue(((numberErrors == 0) and (numberFailures == 0)))
def runTest(self): """The test.""" # . Initialization. isOK = True numberErrors = 0 # . Energy models. mmModel = MMModelOPLS("protein") nbModel = NBModelABFS() # . Paths. dataPath = os.path.join(os.getenv("PDYNAMO_PBABEL"), "data") modelPath = os.path.join(dataPath, "pdbModel") pdbPath = os.path.join(dataPath, "pdb") outPath = None if self.resultPath is not None: outPath = os.path.join(self.resultPath, "xyz") log = self.GetLog() # . Set up the output directory. if outPath is not None: if not os.path.exists(outPath): os.mkdir(outPath) outFiles = glob.glob(os.path.join(outPath, "*.xyz")) for outFile in outFiles: os.remove(outFile) # . Get the files to process. modelFiles = glob.glob(os.path.join(modelPath, "*.model")) # . Get the model file names. pdbNames = set() for modelFile in modelFiles: (head, tail) = os.path.split(modelFile) pdbNames.add(tail[0:-6]) pdbNames = list(pdbNames) pdbNames.sort() # . Loop over the files. for pdbName in pdbNames: # . Check file names. modelFile = os.path.join(modelPath, pdbName + ".model") pdbFile = os.path.join(pdbPath, pdbName + ".pdb") if os.path.exists(modelFile) and os.path.exists(pdbFile): # . Get the model and its raw counterpart. model1 = PDBModel_FromModelFile(modelFile, log=log) rawModel = PDBFile_ToPDBModel(pdbFile, log=log) # . Route 1 - make an atomic model. model1.Summary(log=log) try: # . Make the atomic model. model1.MakeAtomicModelFromComponentLibrary(log=log) model1.ExtractAtomData(rawModel, log=log) model1.Summary(log=log) # . Make a system. system1 = model1.MakeSystem() system1.Summary(log=log) # . Add energy models. system1.DefineMMModel(mmModel, log=log) system1.DefineNBModel(nbModel) # . Build as many undefined coordinates as possible. if system1.coordinates3.numberUndefined > 0: rng = RandomNumberGenerator.WithSeed(117513) BuildHydrogenCoordinates3FromConnectivity( system1, log=log, randomNumberGenerator=rng) # . Calculate an energy if all coordinates have been defined. if system1.coordinates3.numberUndefined <= 0: system1.Energy(log=log, doGradients=True) # . Error. except Exception as e: numberErrors += 1 if log is not None: log.Text("\nError occurred> " + e.args[0] + "\n") # . Route 2 - extract atoms. model2 = PDBModel_FromModelFile(modelFile, log=log) model2.ExtractAtoms(rawModel, log=log) model2.Summary(log=log) system2 = model2.MakeSystem() system2.Summary(log=log) # . Output the xyz file if there are no undefined coordinates. n = system2.coordinates3.numberUndefined if n > 0: if log is not None: log.Paragraph( "System has {:d} undefined coordinates.".format(n)) elif outPath is not None: XYZFile_FromSystem(os.path.join(outPath, pdbName + ".xyz"), system2) # . Separator. if log is not None: log.Separator() # . Success/failure. self.assertTrue(isOK and (numberErrors == 0))
def runTest(self): """The test.""" # . Paths. dataPath = os.path.join(os.getenv("PDYNAMO_PMOLECULE"), "data", "pdb") log = self.GetLog() # . Models. mmModel = MMModelOPLS("protein") nbModel = NBModelABFS() # . Get all files. pdbFiles = glob.glob(os.path.join(dataPath, "*.pdb")) pdbFiles.sort() # . Read all PDB files. numberFailed = 0 for pdbFile in pdbFiles: if log is not None: log.Text("\nProcessing " + pdbFile + ":\n") system = PDBFile_ToSystem(pdbFile, log=log, useComponentLibrary=True) BuildHydrogenCoordinates3FromConnectivity(system) try: # . Setup. if system.coordinates3.numberUndefined > 0: raise system.DefineMMModel(mmModel, log=log) system.DefineNBModel(nbModel) system.Summary(log=log) system.Energy(log=log, doGradients=True) # . Selection. selector = SQLAtomSelector(system) # . Standard selections. aromatics = selector.aromatics backbone = selector.backbone boundaryAtoms = selector.boundaryAtoms counterions = selector.counterions heavyAtoms = selector.heavyAtoms hydrogens = selector.hydrogens mmAtoms = selector.mmAtoms polymerAtoms1 = selector.linearPolymerAtoms protein = selector.protein qcAtoms = selector.qcAtoms ringAtoms = selector.ringAtoms water = selector.water # . Where selections. nearOrigin1 = selector.Where("X*X + Y*Y + Z*Z < 25.0") positive = selector.Where("Charge > 0.0") threonines1 = selector.Where("Path LIKE '%:THR.%:%'") threonines2 = selector.Where("ResNam='THR'") # . Atom selection methods. nearOrigin2 = nearOrigin1.Within(5.0).ByComponent() polymerAtoms2 = threonines1.ByLinearPolymer() neighbors = threonines1.ByBondedNeighbor(iterations=3) # . Atom selection operators. complementNearOrigin2 = ~nearOrigin2 null = (nearOrigin2 & complementNearOrigin2) total1 = (nearOrigin2 | complementNearOrigin2) total2 = (nearOrigin2 ^ complementNearOrigin2) # . Basic checks. n = len(system.atoms) isOK = ( len ( boundaryAtoms ) == 0 ) and \ ( len ( qcAtoms ) == 0 ) and \ ( len ( mmAtoms ) == n ) and \ ( len ( heavyAtoms ) + len ( hydrogens ) == n ) and \ ( len ( polymerAtoms1 ) == len ( polymerAtoms2 ) ) and \ ( len ( counterions ) + len ( protein ) + len ( water ) == n ) and \ ( len ( threonines1 ) == len ( threonines2 ) ) and \ ( len ( null ) == 0 ) and \ ( len ( total1 ) == len ( total2 ) ) and \ ( len ( total1 ) == n ) if not isOK: raise except Exception as e: numberFailed += 1 if log is not None: log.Text("\nError occurred> " + e.args[0] + "\n") # . Summary of results. if log is not None: summary = log.GetSummary() summary.Start("SQL Atom Selection Tests") summary.Entry("Successes", "{:d}".format(len(pdbFiles) - numberFailed)) summary.Entry("Failures", "{:d}".format(numberFailed)) summary.Stop() # . Success/failure. self.assertTrue((numberFailed == 0))
# . Box sizes. _XBox = 75.0 _YBox = 60.0 _ZBox = 60.0 # . Number and type of ions to add. _NNegative = 27 _NPositive = 24 _NegativeIon = "chloride" _PositiveIon = "potassium" # . Reorient option. _Reorient = False # . Define the solvent MM and NB models. mmModel = MMModelOPLS ( "bookSmallExamples" ) # . Get the system. system = Unpickle ( os.path.join ( outPath, "step7.pkl" ) ) system.Summary ( ) # . Reorient the system if necessary (see the results of GetSolvationInformation.py). masses = system.atoms.GetItemAttributes ( "mass" ) if _Reorient: system.coordinates3.ToPrincipalAxes ( weights = masses ) # . Get the positive and negative ions. if _NNegative > 0: anion = MOLFile_ToSystem ( os.path.join ( dataPath, _NegativeIon + ".mol" ) ) anion.DefineMMModel ( mmModel ) anion.Summary ( ) if _NPositive > 0:
"""Generate a MM model for a system.""" import os, os.path, sys sys.path.append( os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "data")) from Definitions import outPath from pCore import Pickle, Unpickle from pMolecule import MMModelOPLS # . Set up a MM model. mmModel = MMModelOPLS("protein") # . Get the system. system = Unpickle(os.path.join(outPath, "step3.pkl")) system.Summary() # . Add the energy model. system.DefineMMModel(mmModel) system.Summary() # . Save the system. mmModel.ClearModelBuildingData() Pickle(os.path.join(outPath, "step4.pkl"), system)
def runTest(self): """The test.""" # . Output setup. dataPath = os.path.join(os.getenv("PDYNAMO_PMOLECULE"), "data", "mol") log = self.GetLog() # . Define the MM, NB and QC models. mmModel = MMModelOPLS("bookSmallExamples") nbModel = NBModelFull() qcModel = QCModelMNDO() # . Define the dimer with an MM model. dimer = MOLFile_ToSystem(os.path.join(dataPath, "waterDimer_cs.mol")) dimer.DefineMMModel(mmModel) dimer.Summary(log=log) # . Define the monomer selections. selection1 = Selection.FromIterable(range(0, 3)) selection2 = Selection.FromIterable(range(3, 6)) # . Get the monomer energies. e1 = self.MonomerEnergies(dimer, selection1, nbModel, qcModel, log=log) e2 = self.MonomerEnergies(dimer, selection2, nbModel, qcModel, log=log) # . Get the binding energies. e12 = {} for model1 in _Models: for model2 in _Models: key = model1 + " " + model2 if log is not None: log.Heading(model1 + "/" + model2 + " Dimer Calculation", QBLANKLINE=True) # . Define the energy model. if key == "QC QC": dimer.DefineQCModel(qcModel) elif key == "QC MM": dimer.DefineQCModel(qcModel, qcSelection=selection1) elif key == "MM QC": dimer.DefineQCModel(qcModel, qcSelection=selection2) else: dimer.energyModel.ClearQCModel(dimer.configuration) if "MM" in key: dimer.DefineNBModel(nbModel) dimer.Summary(log=log) # . Store the results. e12[key] = dimer.Energy(log=log) - e1[model1] - e2[model2] # . Output the results. if log is not None: keys = e12.keys() keys.sort() table = log.GetTable(columns=[20, 20, 20]) table.Start() table.Title("Water Dimer Binding Energies") table.Heading("Monomer 1") table.Heading("Monomer 2") table.Heading("Binding Energy") for key in keys: (model1, model2) = key.split() table.Entry(model1) table.Entry(model2) table.Entry("{:.1f}".format(e12[key])) table.Stop() # . Success/failure. isOK = True for e in e12.values(): if (e < _LowerBound) or (e > _UpperBound): isOK = False break self.assertTrue(isOK)
def __init__(self, **kwargs): """Constructor.""" for (attribute, value) in kwargs.iteritems(): setattr(self, attribute, value) self.mmModel = MMModelOPLS("protein") self.nbModel = NBModelFull()
elif self.setUpType == "MOL2" : system = MOL2File_ToSystem ( self.setUpFile ) if self.xyzFile is not None: system.coordinates3 = XYZFile_ToCoordinates3 ( self.xyzFile ) if self.mmModel is not None: system.DefineMMModel ( self.mmModel ) if self.hasSymmetry: system.DefineSymmetry ( crystalClass = CrystalClassCubic ( ), a = self.a ) system.label = self.label system.Summary ( log = log ) return system #=================================================================================================================================== # . Test systems. #=================================================================================================================================== # . Test system definitions. dataPath = os.path.join ( os.getenv ( "PDYNAMO_PMOLECULE" ), "data", "gridUpdating" ) testSystemDefinitions = ( { "hasSymmetry" : False , "label" : "Crambin" , "mmModel" : MMModelOPLS ( "protein" ) , "setUpFile" : os.path.join ( dataPath, "crambin.mol" ) , "setUpType" : "MOL" , "xyzFile" : None }, { "a" : 40.0 , "hasSymmetry" : True , "label" : "Water Box 40x40x40" , "mmModel" : MMModelOPLS ( "protein" ) , "setUpFile" : os.path.join ( dataPath, "waterBox40x40x40.mol2" ) , "setUpType" : "MOL2" , "xyzFile" : None }, { "a" : 62.23 , "hasSymmetry" : True , "label" : "DHFR Benchmark" , "mmModel" : None , "parameterFiles" : [ os.path.join ( dataPath, "par_all22_prot.inp" ) ] ,
def runTest ( self ): """The test.""" # . Paths. dataPath = os.path.join ( os.getenv ( "PDYNAMO_PMOLECULE" ), "data", "mol2" ) if self.resultPath is None: outPath = os.path.join ( os.getenv ( "PDYNAMO_SCRATCH" ), _Destination ) else: outPath = os.path.join ( self.resultPath, _Destination ) if not os.path.exists ( outPath ): os.mkdir ( outPath ) log = self.GetLog ( ) # . NB models. nbModelNoC = NBModelABFS ( useCentering = False ) nbModelC = NBModelABFS ( useCentering = True ) # . Set up the system. system = ImportSystem ( os.path.join ( dataPath, "waterBox.mol2" ), log = log ) system.DefineMMModel ( MMModelOPLS ( "bookSmallExamples" ) ) system.DefineNBModel ( nbModelC ) system.Summary ( log = log ) system.Energy ( log = log ) # . Do a short dynamics. # . Define a normal deviate generator in a given state. normalDeviateGenerator = NormalDeviateGenerator.WithRandomNumberGenerator ( RandomNumberGenerator.WithSeed ( 614108 ) ) # . Dynamics. trajectoryPath = os.path.join ( outPath, "waterBox_C_1ps.dcd" ) trajectory = DCDTrajectoryFileWriter ( trajectoryPath, system ) LangevinDynamics_SystemGeometry ( system , collisionFrequency = 25.0 , log = log , logFrequency = _NLog , normalDeviateGenerator = normalDeviateGenerator , steps = _NSteps , temperature = 300.0 , timeStep = 0.001 , trajectories = [ ( trajectory, _NSave ) ] ) # . Calculate trajectory energies with different NB models. energies = [] for ( i, nbModel ) in enumerate ( ( nbModelC, nbModelNoC ) ): system.DefineNBModel ( nbModel ) trajectory = DCDTrajectoryFileReader ( trajectoryPath, system ) trajectory.ReadHeader ( ) e = [] while trajectory.RestoreOwnerData ( ): e.append ( system.Energy ( log = None ) ) trajectory.Close ( ) energies.append ( e ) # . Check deviations. ( e0, e1 ) = energies maximumDeviation = 0.0 for i in range ( len ( e0 ) ): maximumDeviation = max ( maximumDeviation, math.fabs ( e0[i] - e1[i] ) ) # . Summary of results. if log is not None: log.Paragraph ( "Maximum deviation = {:.5f}".format ( maximumDeviation ) ) # . Success/failure. self.assertTrue ( ( maximumDeviation <= _Tolerance ) )
from pCore import CPUTime, logFile, LogFileActive from pMolecule import MMModelOPLS, NBModelFull, QCModelMNDO, QCModelORCA from pMoleculeScripts import GrowingStringInitialPath # . Should check barriers somehow? #=================================================================================================================================== # . Parameters. #=================================================================================================================================== # . Test systems. # . Reactant and product energies are OK to 0.1 kJ mol^-1, barrier energies to 1.0 kJ mol^-1. _PathTestSystemData = ( # . Alanine dipeptide. { "energyBarrier" : -131.0 , "energyProduct" : -165.0 , "energyReactant" : -133.1 , "mmModel" : MMModelOPLS ( "bookSmallExamples" ) , "nbModel" : NBModelFull ( ) , "productsFile" : "bAla_c5.xyz" , "reactantsFile" : "bAla_alpha.xyz" , "setUpCoordinatesFile" : "bAla_c7eq.mol" , "setUpMode" : "mol" }, { "energyBarrier" : -129.0 , "energyProduct" : -154.7 , "energyReactant" : -133.1 , "mmModel" : MMModelOPLS ( "bookSmallExamples" ) , "nbModel" : NBModelFull ( ) , "productsFile" : "bAla_c7ax.xyz" , "reactantsFile" : "bAla_alpha.xyz" , "setUpCoordinatesFile" : "bAla_c7eq.mol" , "setUpMode" : "mol" }, { "energyBarrier" : -132.0 ,
"""Generate a MM model for a system.""" import os, os.path, sys sys.path.append( os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "data")) from Definitions import dataPath, outPath from pCore import Pickle, Unpickle from pMolecule import MMModelOPLS # . Set up a MM model. mmModel = MMModelOPLS("pkaProtein", path=dataPath) # . Get the system. system = Unpickle(os.path.join(outPath, "step3.pkl")) system.Summary() # . Add the energy model. system.DefineMMModel(mmModel) system.Summary() # . Save the system. mmModel.ClearModelBuildingData() Pickle(os.path.join(outPath, "step4.pkl"), system)
from pMolecule import CrystalClassCubic, MMModelOPLS, NBModelMonteCarlo from pMoleculeScripts import MergeByAtom methane = MOLFile_ToSystem("../mol/methane.mol") water = MOLFile_ToSystem("../mol/water.mol") # . Systems to create. _ToCreate = (([methane] + 215 * [water], "Methane in Water.", "ch4_water215_cubicBox_mc.xyz", "ch4_water215_cubicBox_mc.pkl"), (216 * [water], "Water Box.", "water216_cubicBox_mc.xyz", "water216_cubicBox_mc.pkl")) for (molecules, label, xyzPath, pklPath) in _ToCreate: system = MergeByAtom(molecules) system.label = label xyzSystem = XYZFile_ToSystem("../xyz/" + xyzPath) sideLength = float(xyzSystem.label.split()[-1]) system.coordinates3 = xyzSystem.coordinates3 system.DefineMMModel(MMModelOPLS("bookSmallExamples")) system.DefineNBModel(NBModelMonteCarlo()) system.DefineSymmetry(crystalClass=CrystalClassCubic(), a=sideLength) system.Summary() Pickle("../pkl/" + pklPath, system)