Unverified Commit e62bdf6a authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

API improvements (#4437)

* Can use getPlatform() instead of getPlatformByName()

* More concise arguments for getState()
parent 71f4b3fc
...@@ -9,27 +9,30 @@ ...@@ -9,27 +9,30 @@
def getIntegrator(self): def getIntegrator(self):
return self._integrator return self._integrator
def getState(self, getPositions=False, getVelocities=False, def getState(self, positions=False, velocities=False,
forces=False, energy=False, parameters=False,
parameterDerivatives=False, integratorParameters=False,
enforcePeriodicBox=False, groups=-1,
getPositions=False, getVelocities=False,
getForces=False, getEnergy=False, getParameters=False, getForces=False, getEnergy=False, getParameters=False,
getParameterDerivatives=False, getIntegratorParameters=False, getParameterDerivatives=False, getIntegratorParameters=False):
enforcePeriodicBox=False, groups=-1):
"""Get a State object recording the current state information stored in this context. """Get a State object recording the current state information stored in this context.
Parameters Parameters
---------- ----------
getPositions : bool=False positions : bool=False
whether to store particle positions in the State whether to store particle positions in the State
getVelocities : bool=False velocities : bool=False
whether to store particle velocities in the State whether to store particle velocities in the State
getForces : bool=False forces : bool=False
whether to store the forces acting on particles in the State whether to store the forces acting on particles in the State
getEnergy : bool=False energy : bool=False
whether to store potential and kinetic energy in the State whether to store potential and kinetic energy in the State
getParameters : bool=False parameters : bool=False
whether to store context parameters in the State whether to store context parameters in the State
getParameterDerivatives : bool=False parameterDerivatives : bool=False
whether to store parameter derivatives in the State whether to store parameter derivatives in the State
getIntegratorParameters : bool=False integratorParameters : bool=False
whether to store integrator parameters in the State whether to store integrator parameters in the State
enforcePeriodicBox : bool=False enforcePeriodicBox : bool=False
if false, the position of each particle will be whatever position if false, the position of each particle will be whatever position
...@@ -41,6 +44,20 @@ ...@@ -41,6 +44,20 @@
forces and energies. The default value includes all groups. groups forces and energies. The default value includes all groups. groups
can also be passed as an unsigned integer interpreted as a bitmask, can also be passed as an unsigned integer interpreted as a bitmask,
in which case group i will be included if (groups&(1<<i)) != 0. in which case group i will be included if (groups&(1<<i)) != 0.
getPositions : bool=False
Deprecated. Use `positions` instead.
getVelocities : bool=False
Deprecated. Use `velocities` instead.
getForces : bool=False
Deprecated. Use `forces` instead.
getEnergy : bool=False
Deprecated. Use `energy` instead.
getParameters : bool=False
Deprecated. Use `parameters` instead.
getParameterDerivatives : bool=False
Deprecated. Use `parameterDerivatives` instead.
getIntegratorParameters : bool=False
Deprecated. Use `integratorParameters` instead.
""" """
try: try:
# is the input integer-like? # is the input integer-like?
...@@ -55,19 +72,19 @@ ...@@ -55,19 +72,19 @@
if groups_mask >= 0x80000000: if groups_mask >= 0x80000000:
groups_mask -= 0x100000000 groups_mask -= 0x100000000
types = 0 types = 0
if getPositions: if positions or getPositions:
types += State.Positions types += State.Positions
if getVelocities: if velocities or getVelocities:
types += State.Velocities types += State.Velocities
if getForces: if forces or getForces:
types += State.Forces types += State.Forces
if getEnergy: if energy or getEnergy:
types += State.Energy types += State.Energy
if getParameters: if parameters or getParameters:
types += State.Parameters types += State.Parameters
if getParameterDerivatives: if parameterDerivatives or getParameterDerivatives:
types += State.ParameterDerivatives types += State.ParameterDerivatives
if getIntegratorParameters: if integratorParameters or getIntegratorParameters:
types += State.IntegratorParameters types += State.IntegratorParameters
state = _openmm.Context_getState(self, types, enforcePeriodicBox, groups_mask) state = _openmm.Context_getState(self, types, enforcePeriodicBox, groups_mask)
return state return state
......
...@@ -27,7 +27,7 @@ class TestATMForce(unittest.TestCase): ...@@ -27,7 +27,7 @@ class TestATMForce(unittest.TestCase):
system.addForce(atmforce) system.addForce(atmforce)
integrator = VerletIntegrator(1.0) integrator = VerletIntegrator(1.0)
platform = Platform.getPlatformByName('Reference') platform = Platform.getPlatform('Reference')
context = Context(system, integrator, platform) context = Context(system, integrator, platform)
positions = [] positions = []
......
...@@ -177,7 +177,7 @@ class TestAmberPrmtopFile(unittest.TestCase): ...@@ -177,7 +177,7 @@ class TestAmberPrmtopFile(unittest.TestCase):
integrator = VerletIntegrator(1.0*femtoseconds) integrator = VerletIntegrator(1.0*femtoseconds)
# Use reference platform, since it should always be present and # Use reference platform, since it should always be present and
# 'working', and the system is plenty small so this won't be too slow # 'working', and the system is plenty small so this won't be too slow
sim = Simulation(prmtop3.topology, system, integrator, Platform.getPlatformByName('Reference')) sim = Simulation(prmtop3.topology, system, integrator, Platform.getPlatform('Reference'))
# Check that the energy is about what we expect it to be # Check that the energy is about what we expect it to be
sim.context.setPositions(inpcrd3.positions) sim.context.setPositions(inpcrd3.positions)
ene = sim.context.getState(getEnergy=True, enforcePeriodicBox=True).getPotentialEnergy() ene = sim.context.getState(getEnergy=True, enforcePeriodicBox=True).getPotentialEnergy()
...@@ -207,7 +207,7 @@ class TestAmberPrmtopFile(unittest.TestCase): ...@@ -207,7 +207,7 @@ class TestAmberPrmtopFile(unittest.TestCase):
integrator = VerletIntegrator(1.0*femtoseconds) integrator = VerletIntegrator(1.0*femtoseconds)
# Use reference platform, since it should always be present and # Use reference platform, since it should always be present and
# 'working', and the system is plenty small so this won't be too slow # 'working', and the system is plenty small so this won't be too slow
sim = Simulation(prmtop3.topology, system, integrator, Platform.getPlatformByName('Reference')) sim = Simulation(prmtop3.topology, system, integrator, Platform.getPlatform('Reference'))
# Check that the energy is about what we expect it to be # Check that the energy is about what we expect it to be
sim.context.setPositions(inpcrd3.getPositions()) sim.context.setPositions(inpcrd3.getPositions())
ene = sim.context.getState(getEnergy=True, enforcePeriodicBox=True).getPotentialEnergy() ene = sim.context.getState(getEnergy=True, enforcePeriodicBox=True).getPotentialEnergy()
...@@ -265,7 +265,7 @@ class TestAmberPrmtopFile(unittest.TestCase): ...@@ -265,7 +265,7 @@ class TestAmberPrmtopFile(unittest.TestCase):
integrator = VerletIntegrator(1.0*femtoseconds) integrator = VerletIntegrator(1.0*femtoseconds)
# Use reference platform, since it should always be present and # Use reference platform, since it should always be present and
# 'working', and the system is plenty small so this won't be too slow # 'working', and the system is plenty small so this won't be too slow
sim = Simulation(prmtop4.topology, system, integrator, Platform.getPlatformByName('Reference')) sim = Simulation(prmtop4.topology, system, integrator, Platform.getPlatform('Reference'))
# Check that the energy is about what we expect it to be # Check that the energy is about what we expect it to be
sim.context.setPositions(inpcrd4.positions) sim.context.setPositions(inpcrd4.positions)
ene = sim.context.getState(getEnergy=True, enforcePeriodicBox=True).getPotentialEnergy() ene = sim.context.getState(getEnergy=True, enforcePeriodicBox=True).getPotentialEnergy()
...@@ -310,7 +310,7 @@ class TestAmberPrmtopFile(unittest.TestCase): ...@@ -310,7 +310,7 @@ class TestAmberPrmtopFile(unittest.TestCase):
for i in range(5): for i in range(5):
system = prmtop2.createSystem(implicitSolvent=solventType[i], nonbondedMethod=nonbondedMethod[i], implicitSolventSaltConc=salt[i]) system = prmtop2.createSystem(implicitSolvent=solventType[i], nonbondedMethod=nonbondedMethod[i], implicitSolventSaltConc=salt[i])
integrator = VerletIntegrator(0.001) integrator = VerletIntegrator(0.001)
context = Context(system, integrator, Platform.getPlatformByName("Reference")) context = Context(system, integrator, Platform.getPlatform("Reference"))
context.setPositions(pdb.positions) context.setPositions(pdb.positions)
state1 = context.getState(getForces=True) state1 = context.getState(getForces=True)
with open('systems/alanine-dipeptide-implicit-forces/'+file[i]+'.xml') as infile: with open('systems/alanine-dipeptide-implicit-forces/'+file[i]+'.xml') as infile:
...@@ -380,7 +380,7 @@ class TestAmberPrmtopFile(unittest.TestCase): ...@@ -380,7 +380,7 @@ class TestAmberPrmtopFile(unittest.TestCase):
for i,f in enumerate(system.getForces()): for i,f in enumerate(system.getForces()):
f.setForceGroup(i) f.setForceGroup(i)
integrator = VerletIntegrator(0.001) integrator = VerletIntegrator(0.001)
context = Context(system, integrator, Platform.getPlatformByName('Reference')) context = Context(system, integrator, Platform.getPlatform('Reference'))
context.setPositions(crd.positions) context.setPositions(crd.positions)
# Compare to energies computed with pytraj.energy_decomposition() # Compare to energies computed with pytraj.energy_decomposition()
...@@ -422,7 +422,7 @@ class TestAmberPrmtopFile(unittest.TestCase): ...@@ -422,7 +422,7 @@ class TestAmberPrmtopFile(unittest.TestCase):
if isinstance(f, CustomGBForce) or isinstance(f, GBSAOBCForce): if isinstance(f, CustomGBForce) or isinstance(f, GBSAOBCForce):
f.setForceGroup(1) f.setForceGroup(1)
integrator = VerletIntegrator(0.001) integrator = VerletIntegrator(0.001)
context = Context(system, integrator, Platform.getPlatformByName('Reference')) context = Context(system, integrator, Platform.getPlatform('Reference'))
context.setPositions(inpcrd.positions) context.setPositions(inpcrd.positions)
energy = context.getState(getEnergy=True, groups={1}).getPotentialEnergy().value_in_unit(kilojoules_per_mole) energy = context.getState(getEnergy=True, groups={1}).getPotentialEnergy().value_in_unit(kilojoules_per_mole)
self.assertAlmostEqual(energy, expectedEnergy, delta=5e-4*abs(energy)) self.assertAlmostEqual(energy, expectedEnergy, delta=5e-4*abs(energy))
...@@ -460,7 +460,7 @@ class TestAmberPrmtopFile(unittest.TestCase): ...@@ -460,7 +460,7 @@ class TestAmberPrmtopFile(unittest.TestCase):
system = prmtop.createSystem(constraints=constraints) system = prmtop.createSystem(constraints=constraints)
integrator = VerletIntegrator(0.001*picoseconds) integrator = VerletIntegrator(0.001*picoseconds)
# If a constraint was added to a massless particle, this will throw an exception. # If a constraint was added to a massless particle, this will throw an exception.
context = Context(system, integrator, Platform.getPlatformByName('Reference')) context = Context(system, integrator, Platform.getPlatform('Reference'))
def testWaterBonds(self): def testWaterBonds(self):
"""Test that water molecules have the right set of bonds""" """Test that water molecules have the right set of bonds"""
......
...@@ -8,7 +8,7 @@ class TestBytes(unittest.TestCase): ...@@ -8,7 +8,7 @@ class TestBytes(unittest.TestCase):
system.addParticle(1.0) system.addParticle(1.0)
refPositions = [(0,0,0)] refPositions = [(0,0,0)]
platform = mm.Platform.getPlatformByName('Reference') platform = mm.Platform.getPlatform('Reference')
context = mm.Context(system, mm.VerletIntegrator(0), platform) context = mm.Context(system, mm.VerletIntegrator(0), platform)
context.setPositions(refPositions) context.setPositions(refPositions)
chk = context.createCheckpoint() chk = context.createCheckpoint()
......
...@@ -139,7 +139,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -139,7 +139,7 @@ class TestCharmmFiles(unittest.TestCase):
a.charge = 0.0 a.charge = 0.0
# Now compute the full energy # Now compute the full energy
plat = Platform.getPlatformByName('Reference') plat = Platform.getPlatform('Reference')
system = psf.createSystem(params, nonbondedMethod=PME, system = psf.createSystem(params, nonbondedMethod=PME,
nonbondedCutoff=8*angstroms) nonbondedCutoff=8*angstroms)
...@@ -168,7 +168,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -168,7 +168,7 @@ class TestCharmmFiles(unittest.TestCase):
f.setForceGroup(1) f.setForceGroup(1)
else: else:
f.setForceGroup(0) f.setForceGroup(0)
context = Context(system, VerletIntegrator(2*femtoseconds), Platform.getPlatformByName('Reference')) context = Context(system, VerletIntegrator(2*femtoseconds), Platform.getPlatform('Reference'))
context.setPositions(crd.positions) context.setPositions(crd.positions)
state = context.getState(getEnergy=True, groups={1}) state = context.getState(getEnergy=True, groups={1})
energy = state.getPotentialEnergy().value_in_unit(kilocalories_per_mole) energy = state.getPotentialEnergy().value_in_unit(kilocalories_per_mole)
...@@ -184,7 +184,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -184,7 +184,7 @@ class TestCharmmFiles(unittest.TestCase):
psf.setBox(30.0*angstroms, 30.0*angstroms, 30.0*angstroms) psf.setBox(30.0*angstroms, 30.0*angstroms, 30.0*angstroms)
# Now compute the full energy # Now compute the full energy
plat = Platform.getPlatformByName('Reference') plat = Platform.getPlatform('Reference')
system = psf.createSystem(params, nonbondedMethod=PME, ewaldErrorTolerance=0.00005) system = psf.createSystem(params, nonbondedMethod=PME, ewaldErrorTolerance=0.00005)
integrator = DrudeLangevinIntegrator(300*kelvin, 1.0/picosecond, 1*kelvin, 10/picosecond, 0.001*picoseconds) integrator = DrudeLangevinIntegrator(300*kelvin, 1.0/picosecond, 1*kelvin, 10/picosecond, 0.001*picoseconds)
con = Context(system, integrator, plat) con = Context(system, integrator, plat)
...@@ -234,7 +234,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -234,7 +234,7 @@ class TestCharmmFiles(unittest.TestCase):
psf.setBox(33.2*angstroms, 33.2*angstroms, 33.2*angstroms) psf.setBox(33.2*angstroms, 33.2*angstroms, 33.2*angstroms)
# Now compute the full energy # Now compute the full energy
plat = Platform.getPlatformByName('Reference') plat = Platform.getPlatform('Reference')
system = psf.createSystem(params, nonbondedMethod=PME, ewaldErrorTolerance=0.00005) system = psf.createSystem(params, nonbondedMethod=PME, ewaldErrorTolerance=0.00005)
integrator = DrudeLangevinIntegrator(300*kelvin, 1.0/picosecond, 1*kelvin, 10/picosecond, 0.001*picoseconds) integrator = DrudeLangevinIntegrator(300*kelvin, 1.0/picosecond, 1*kelvin, 10/picosecond, 0.001*picoseconds)
con = Context(system, integrator, plat) con = Context(system, integrator, plat)
...@@ -251,7 +251,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -251,7 +251,7 @@ class TestCharmmFiles(unittest.TestCase):
crd = CharmmCrdFile('systems/chlb_cgenff.crd') crd = CharmmCrdFile('systems/chlb_cgenff.crd')
params = CharmmParameterSet('systems/top_all36_cgenff.rtf', params = CharmmParameterSet('systems/top_all36_cgenff.rtf',
'systems/par_all36_cgenff.prm') 'systems/par_all36_cgenff.prm')
plat = Platform.getPlatformByName('Reference') plat = Platform.getPlatform('Reference')
system = psf.createSystem(params) system = psf.createSystem(params)
con = Context(system, VerletIntegrator(2*femtoseconds), plat) con = Context(system, VerletIntegrator(2*femtoseconds), plat)
con.setPositions(crd.positions) con.setPositions(crd.positions)
...@@ -310,7 +310,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -310,7 +310,7 @@ class TestCharmmFiles(unittest.TestCase):
for i in range(5): for i in range(5):
system = self.psf_c.createSystem(self.params, implicitSolvent=solventType[i], nonbondedMethod=nonbondedMethod[i], implicitSolventSaltConc=salt[i]) system = self.psf_c.createSystem(self.params, implicitSolvent=solventType[i], nonbondedMethod=nonbondedMethod[i], implicitSolventSaltConc=salt[i])
integrator = VerletIntegrator(0.001) integrator = VerletIntegrator(0.001)
context = Context(system, integrator, Platform.getPlatformByName("Reference")) context = Context(system, integrator, Platform.getPlatform("Reference"))
context.setPositions(self.pdb.positions) context.setPositions(self.pdb.positions)
state1 = context.getState(getForces=True) state1 = context.getState(getForces=True)
#out = open('systems/ala-ala-ala-implicit-forces/'+file[i]+'.xml', 'w') #out = open('systems/ala-ala-ala-implicit-forces/'+file[i]+'.xml', 'w')
...@@ -338,7 +338,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -338,7 +338,7 @@ class TestCharmmFiles(unittest.TestCase):
a.charge = 0.0 a.charge = 0.0
# Now compute the full energy # Now compute the full energy
plat = Platform.getPlatformByName('Reference') plat = Platform.getPlatform('Reference')
system_strict = psf.createSystem(params_strict , nonbondedMethod=PME, system_strict = psf.createSystem(params_strict , nonbondedMethod=PME,
nonbondedCutoff=8*angstroms) nonbondedCutoff=8*angstroms)
...@@ -365,7 +365,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -365,7 +365,7 @@ class TestCharmmFiles(unittest.TestCase):
force = [f for f in system.getForces() if isinstance(f, CustomTorsionForce)][0] force = [f for f in system.getForces() if isinstance(f, CustomTorsionForce)][0]
group = force.getForceGroup() group = force.getForceGroup()
integrator = VerletIntegrator(0.001) integrator = VerletIntegrator(0.001)
context = Context(system, integrator, Platform.getPlatformByName("Reference")) context = Context(system, integrator, Platform.getPlatform("Reference"))
angle = 0.1 angle = 0.1
pos1 = [Vec3(0,0,0), Vec3(1,0,0), Vec3(1,1,0), Vec3(0,1,math.tan(angle))] # theta = angle pos1 = [Vec3(0,0,0), Vec3(1,0,0), Vec3(1,1,0), Vec3(0,1,math.tan(angle))] # theta = angle
pos2 = [Vec3(0,0,0), Vec3(1,0,0), Vec3(1,1,0), Vec3(2,1,math.tan(angle))] # theta = pi-angle pos2 = [Vec3(0,0,0), Vec3(1,0,0), Vec3(1,1,0), Vec3(2,1,math.tan(angle))] # theta = pi-angle
...@@ -448,7 +448,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -448,7 +448,7 @@ class TestCharmmFiles(unittest.TestCase):
params = CharmmParameterSet('systems/charmm22.rtf', parfile.name) params = CharmmParameterSet('systems/charmm22.rtf', parfile.name)
os.remove(parfile.name) os.remove(parfile.name)
system = self.psf_c.createSystem(params, nonbondedMethod=NoCutoff) system = self.psf_c.createSystem(params, nonbondedMethod=NoCutoff)
context = Context(system, VerletIntegrator(1*femtoseconds), Platform.getPlatformByName('Reference')) context = Context(system, VerletIntegrator(1*femtoseconds), Platform.getPlatform('Reference'))
context.setPositions(crd.positions) context.setPositions(crd.positions)
energy = context.getState(getEnergy=True).getPotentialEnergy().value_in_unit(kilocalories_per_mole) energy = context.getState(getEnergy=True).getPotentialEnergy().value_in_unit(kilocalories_per_mole)
self.assertAlmostEqual(energy, modeEnergy[abs(nbxmod)], delta=1e-3*abs(energy)) self.assertAlmostEqual(energy, modeEnergy[abs(nbxmod)], delta=1e-3*abs(energy))
...@@ -459,7 +459,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -459,7 +459,7 @@ class TestCharmmFiles(unittest.TestCase):
pdb = PDBFile('systems/MoS2.pdb') pdb = PDBFile('systems/MoS2.pdb')
params = CharmmParameterSet('systems/MoS2.prm') params = CharmmParameterSet('systems/MoS2.prm')
system = psf.createSystem(params, nonbondedMethod=NoCutoff) system = psf.createSystem(params, nonbondedMethod=NoCutoff)
context = Context(system, VerletIntegrator(1*femtoseconds), Platform.getPlatformByName('Reference')) context = Context(system, VerletIntegrator(1*femtoseconds), Platform.getPlatform('Reference'))
context.setPositions(pdb.positions) context.setPositions(pdb.positions)
energy = context.getState(getEnergy=True).getPotentialEnergy().value_in_unit(kilocalories_per_mole) energy = context.getState(getEnergy=True).getPotentialEnergy().value_in_unit(kilocalories_per_mole)
# Compare with value computed with NAMD. # Compare with value computed with NAMD.
...@@ -507,7 +507,7 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -507,7 +507,7 @@ class TestCharmmFiles(unittest.TestCase):
crd = CharmmCrdFile('systems/ala3_solv.crd') crd = CharmmCrdFile('systems/ala3_solv.crd')
params = CharmmParameterSet('systems/par_all36_prot.prm', params = CharmmParameterSet('systems/par_all36_prot.prm',
'systems/toppar_water_ions.str') 'systems/toppar_water_ions.str')
plat = Platform.getPlatformByName('Reference') plat = Platform.getPlatform('Reference')
system_charmm = psf.createSystem(params, nonbondedMethod=PME, system_charmm = psf.createSystem(params, nonbondedMethod=PME,
nonbondedCutoff=8 * angstroms) nonbondedCutoff=8 * angstroms)
topology = psf.topology topology = psf.topology
......
...@@ -39,7 +39,7 @@ class TestDCDFile(unittest.TestCase): ...@@ -39,7 +39,7 @@ class TestDCDFile(unittest.TestCase):
# Create a simulation and write some frames to a DCD file. # Create a simulation and write some frames to a DCD file.
integrator = mm.VerletIntegrator(0.001*unit.picoseconds) integrator = mm.VerletIntegrator(0.001*unit.picoseconds)
simulation = app.Simulation(pdb.topology, system, integrator, mm.Platform.getPlatformByName('Reference')) simulation = app.Simulation(pdb.topology, system, integrator, mm.Platform.getPlatform('Reference'))
dcd = app.DCDReporter(fname, 2) dcd = app.DCDReporter(fname, 2)
simulation.reporters.append(dcd) simulation.reporters.append(dcd)
simulation.context.setPositions(pdb.positions) simulation.context.setPositions(pdb.positions)
...@@ -53,7 +53,7 @@ class TestDCDFile(unittest.TestCase): ...@@ -53,7 +53,7 @@ class TestDCDFile(unittest.TestCase):
# Create a new simulation and have it append some more frames. # Create a new simulation and have it append some more frames.
integrator = mm.VerletIntegrator(0.001*unit.picoseconds) integrator = mm.VerletIntegrator(0.001*unit.picoseconds)
simulation = app.Simulation(pdb.topology, system, integrator, mm.Platform.getPlatformByName('Reference')) simulation = app.Simulation(pdb.topology, system, integrator, mm.Platform.getPlatform('Reference'))
dcd = app.DCDReporter(fname, 2, append=True) dcd = app.DCDReporter(fname, 2, append=True)
simulation.reporters.append(dcd) simulation.reporters.append(dcd)
simulation.context.setPositions(pdb.positions) simulation.context.setPositions(pdb.positions)
......
...@@ -90,7 +90,7 @@ class TestDesmondDMSFile(unittest.TestCase): ...@@ -90,7 +90,7 @@ class TestDesmondDMSFile(unittest.TestCase):
"""Test OPLS potential energy of nabumetone """ """Test OPLS potential energy of nabumetone """
system = self.dms_opls1.createSystem(nonbondedMethod=NoCutoff, OPLS = True) system = self.dms_opls1.createSystem(nonbondedMethod=NoCutoff, OPLS = True)
integrator = LangevinIntegrator(300*kelvin, 1.0/picosecond, 0.0005*picoseconds) integrator = LangevinIntegrator(300*kelvin, 1.0/picosecond, 0.0005*picoseconds)
context = Context(system, integrator,Platform.getPlatformByName('Reference')) context = Context(system, integrator,Platform.getPlatform('Reference'))
context.setPositions(self.dms_opls1.positions) context.setPositions(self.dms_opls1.positions)
ene = context.getState(getEnergy=True).getPotentialEnergy() ene = context.getState(getEnergy=True).getPotentialEnergy()
self.assertAlmostEqual(ene.value_in_unit(kilojoules_per_mole), 94.21, places=2) self.assertAlmostEqual(ene.value_in_unit(kilojoules_per_mole), 94.21, places=2)
...@@ -99,7 +99,7 @@ class TestDesmondDMSFile(unittest.TestCase): ...@@ -99,7 +99,7 @@ class TestDesmondDMSFile(unittest.TestCase):
"""Test OPLS potential energy of beta-cyclodextrin/nabumetone complex """ """Test OPLS potential energy of beta-cyclodextrin/nabumetone complex """
system = self.dms_opls2.createSystem(nonbondedMethod=NoCutoff, OPLS = True) system = self.dms_opls2.createSystem(nonbondedMethod=NoCutoff, OPLS = True)
integrator = LangevinIntegrator(300*kelvin, 1.0/picosecond, 0.0005*picoseconds) integrator = LangevinIntegrator(300*kelvin, 1.0/picosecond, 0.0005*picoseconds)
context = Context(system, integrator,Platform.getPlatformByName('Reference')) context = Context(system, integrator,Platform.getPlatform('Reference'))
context.setPositions(self.dms_opls2.positions) context.setPositions(self.dms_opls2.positions)
ene = context.getState(getEnergy=True).getPotentialEnergy() ene = context.getState(getEnergy=True).getPotentialEnergy()
self.assertAlmostEqual(ene.value_in_unit(kilojoules_per_mole), 903.04, places=2) self.assertAlmostEqual(ene.value_in_unit(kilojoules_per_mole), 903.04, places=2)
......
...@@ -323,7 +323,7 @@ class TestForceField(unittest.TestCase): ...@@ -323,7 +323,7 @@ class TestForceField(unittest.TestCase):
forcefield = ForceField('amber96.xml', f'implicit/{solventType[i]}.xml') forcefield = ForceField('amber96.xml', f'implicit/{solventType[i]}.xml')
system = forcefield.createSystem(self.pdb2.topology, nonbondedMethod=nonbondedMethod[i], implicitSolventKappa=kappa[i]) system = forcefield.createSystem(self.pdb2.topology, nonbondedMethod=nonbondedMethod[i], implicitSolventKappa=kappa[i])
integrator = VerletIntegrator(0.001) integrator = VerletIntegrator(0.001)
context = Context(system, integrator, Platform.getPlatformByName("Reference")) context = Context(system, integrator, Platform.getPlatform("Reference"))
context.setPositions(self.pdb2.positions) context.setPositions(self.pdb2.positions)
state1 = context.getState(getForces=True) state1 = context.getState(getForces=True)
if file[i] is not None: if file[i] is not None:
...@@ -872,7 +872,7 @@ class TestForceField(unittest.TestCase): ...@@ -872,7 +872,7 @@ class TestForceField(unittest.TestCase):
a.charge = 0.0 a.charge = 0.0
# Now compute the full energy # Now compute the full energy
plat = Platform.getPlatformByName('Reference') plat = Platform.getPlatform('Reference')
system = psf.createSystem(params, nonbondedMethod=PME, system = psf.createSystem(params, nonbondedMethod=PME,
nonbondedCutoff=5*angstroms) nonbondedCutoff=5*angstroms)
...@@ -1122,7 +1122,7 @@ END""")) ...@@ -1122,7 +1122,7 @@ END"""))
if isinstance(f, NonbondedForce): if isinstance(f, NonbondedForce):
f.setPMEParameters(3.4, 64, 64, 64) f.setPMEParameters(3.4, 64, 64, 64)
integrator = DrudeLangevinIntegrator(300, 1.0, 1.0, 10.0, 0.001) integrator = DrudeLangevinIntegrator(300, 1.0, 1.0, 10.0, 0.001)
context = Context(system, integrator, Platform.getPlatformByName('Reference')) context = Context(system, integrator, Platform.getPlatform('Reference'))
context.setPositions(pdb.positions) context.setPositions(pdb.positions)
# Compare the energy to values computed by CHARMM. Here is what it outputs: # Compare the energy to values computed by CHARMM. Here is what it outputs:
...@@ -1200,7 +1200,7 @@ self.scriptExecuted = True ...@@ -1200,7 +1200,7 @@ self.scriptExecuted = True
for i, f in enumerate(system.getForces()): for i, f in enumerate(system.getForces()):
f.setForceGroup(i) f.setForceGroup(i)
integrator = VerletIntegrator(0.001) integrator = VerletIntegrator(0.001)
context = Context(system, integrator, Platform.getPlatformByName('Reference')) context = Context(system, integrator, Platform.getPlatform('Reference'))
context.setPositions(pdb.positions) context.setPositions(pdb.positions)
energies = {} energies = {}
for i, f in enumerate(system.getForces()): for i, f in enumerate(system.getForces()):
...@@ -1244,7 +1244,7 @@ self.scriptExecuted = True ...@@ -1244,7 +1244,7 @@ self.scriptExecuted = True
</ForceField> """ </ForceField> """
ff = ForceField(StringIO(xml)) ff = ForceField(StringIO(xml))
system = ff.createSystem(pdb.topology) system = ff.createSystem(pdb.topology)
context = Context(system, VerletIntegrator(2*femtoseconds), Platform.getPlatformByName('Reference')) context = Context(system, VerletIntegrator(2*femtoseconds), Platform.getPlatform('Reference'))
context.setPositions(pdb.positions) context.setPositions(pdb.positions)
energy1 = context.getState(getEnergy=True).getPotentialEnergy().value_in_unit(kilojoules_per_mole) energy1 = context.getState(getEnergy=True).getPotentialEnergy().value_in_unit(kilojoules_per_mole)
...@@ -1257,7 +1257,7 @@ self.scriptExecuted = True ...@@ -1257,7 +1257,7 @@ self.scriptExecuted = True
f.addParticle(0, 0.404468018036, 0.6276) f.addParticle(0, 0.404468018036, 0.6276)
f.addParticle(0, 0.251367073323, 0.1962296) f.addParticle(0, 0.251367073323, 0.1962296)
system.addForce(f) system.addForce(f)
context = Context(system, VerletIntegrator(2*femtoseconds), Platform.getPlatformByName('Reference')) context = Context(system, VerletIntegrator(2*femtoseconds), Platform.getPlatform('Reference'))
context.setPositions(pdb.positions) context.setPositions(pdb.positions)
energy2 = context.getState(getEnergy=True).getPotentialEnergy().value_in_unit(kilojoules_per_mole) energy2 = context.getState(getEnergy=True).getPotentialEnergy().value_in_unit(kilojoules_per_mole)
self.assertAlmostEqual(energy1, energy2) self.assertAlmostEqual(energy1, energy2)
...@@ -1417,7 +1417,7 @@ class AmoebaTestForceField(unittest.TestCase): ...@@ -1417,7 +1417,7 @@ class AmoebaTestForceField(unittest.TestCase):
forcefield = ForceField('amoeba2013.xml', 'amoeba2013_gk.xml') forcefield = ForceField('amoeba2013.xml', 'amoeba2013_gk.xml')
system = forcefield.createSystem(pdb.topology, polarization='direct') system = forcefield.createSystem(pdb.topology, polarization='direct')
integrator = VerletIntegrator(0.001) integrator = VerletIntegrator(0.001)
context = Context(system, integrator, Platform.getPlatformByName('Reference')) context = Context(system, integrator, Platform.getPlatform('Reference'))
context.setPositions(pdb.positions) context.setPositions(pdb.positions)
state1 = context.getState(getForces=True) state1 = context.getState(getForces=True)
with open('systems/alanine-dipeptide-amoeba-forces.xml') as input: with open('systems/alanine-dipeptide-amoeba-forces.xml') as input:
...@@ -1433,7 +1433,7 @@ class AmoebaTestForceField(unittest.TestCase): ...@@ -1433,7 +1433,7 @@ class AmoebaTestForceField(unittest.TestCase):
for i, f in enumerate(system.getForces()): for i, f in enumerate(system.getForces()):
f.setForceGroup(i) f.setForceGroup(i)
integrator = VerletIntegrator(0.001) integrator = VerletIntegrator(0.001)
context = Context(system, integrator, Platform.getPlatformByName('Reference')) context = Context(system, integrator, Platform.getPlatform('Reference'))
context.setPositions(pdb.positions) context.setPositions(pdb.positions)
energies = {} energies = {}
for i, f in enumerate(system.getForces()): for i, f in enumerate(system.getForces()):
......
...@@ -14,7 +14,7 @@ class TestForceGroups(unittest.TestCase): ...@@ -14,7 +14,7 @@ class TestForceGroups(unittest.TestCase):
force.setForceGroup(i) force.setForceGroup(i)
system.addForce(force) system.addForce(force)
platform = mm.Platform.getPlatformByName('Reference') platform = mm.Platform.getPlatform('Reference')
context = mm.Context(system, mm.VerletIntegrator(0), platform) context = mm.Context(system, mm.VerletIntegrator(0), platform)
context.setPositions([(0,0,0)]) context.setPositions([(0,0,0)])
self.context = context self.context = context
......
...@@ -45,7 +45,7 @@ class TestGromacsTopFile(unittest.TestCase): ...@@ -45,7 +45,7 @@ class TestGromacsTopFile(unittest.TestCase):
if isinstance(force, PeriodicTorsionForce): if isinstance(force, PeriodicTorsionForce):
force.setForceGroup(1) force.setForceGroup(1)
context = Context(system, VerletIntegrator(1*femtosecond), context = Context(system, VerletIntegrator(1*femtosecond),
Platform.getPlatformByName('Reference')) Platform.getPlatform('Reference'))
context.setPositions(gro.positions) context.setPositions(gro.positions)
ene = context.getState(getEnergy=True, groups=2**1).getPotentialEnergy() ene = context.getState(getEnergy=True, groups=2**1).getPotentialEnergy()
self.assertAlmostEqual(ene.value_in_unit(kilojoules_per_mole), 341.6905133582857) self.assertAlmostEqual(ene.value_in_unit(kilojoules_per_mole), 341.6905133582857)
...@@ -57,7 +57,7 @@ class TestGromacsTopFile(unittest.TestCase): ...@@ -57,7 +57,7 @@ class TestGromacsTopFile(unittest.TestCase):
system = top.createSystem() system = top.createSystem()
context = Context(system, VerletIntegrator(1*femtosecond), context = Context(system, VerletIntegrator(1*femtosecond),
Platform.getPlatformByName('Reference')) Platform.getPlatform('Reference'))
context.setPositions(gro.positions) context.setPositions(gro.positions)
ene = context.getState(getEnergy=True).getPotentialEnergy() ene = context.getState(getEnergy=True).getPotentialEnergy()
self.assertAlmostEqual(ene.value_in_unit(kilojoules_per_mole), -346.940915296) self.assertAlmostEqual(ene.value_in_unit(kilojoules_per_mole), -346.940915296)
...@@ -72,7 +72,7 @@ class TestGromacsTopFile(unittest.TestCase): ...@@ -72,7 +72,7 @@ class TestGromacsTopFile(unittest.TestCase):
f.setUseLongRangeCorrection(True) f.setUseLongRangeCorrection(True)
context = Context(system, VerletIntegrator(1*femtosecond), context = Context(system, VerletIntegrator(1*femtosecond),
Platform.getPlatformByName('Reference')) Platform.getPlatform('Reference'))
context.setPositions(gro.positions) context.setPositions(gro.positions)
energy = context.getState(getEnergy=True).getPotentialEnergy().value_in_unit(kilojoules_per_mole) energy = context.getState(getEnergy=True).getPotentialEnergy().value_in_unit(kilojoules_per_mole)
self.assertAlmostEqual(energy, 3135.33, delta=energy*0.005) self.assertAlmostEqual(energy, 3135.33, delta=energy*0.005)
...@@ -173,7 +173,7 @@ class TestGromacsTopFile(unittest.TestCase): ...@@ -173,7 +173,7 @@ class TestGromacsTopFile(unittest.TestCase):
self.assertEqual(1, len(top._moleculeTypes['BENX'].vsites2)) self.assertEqual(1, len(top._moleculeTypes['BENX'].vsites2))
context = Context(system, VerletIntegrator(1*femtosecond), context = Context(system, VerletIntegrator(1*femtosecond),
Platform.getPlatformByName('Reference')) Platform.getPlatform('Reference'))
context.setPositions(gro.positions) context.setPositions(gro.positions)
context.computeVirtualSites() context.computeVirtualSites()
ene = context.getState(getEnergy=True).getPotentialEnergy() ene = context.getState(getEnergy=True).getPotentialEnergy()
...@@ -203,7 +203,7 @@ class TestGromacsTopFile(unittest.TestCase): ...@@ -203,7 +203,7 @@ class TestGromacsTopFile(unittest.TestCase):
system = top.createSystem() system = top.createSystem()
for i, f in enumerate(system.getForces()): for i, f in enumerate(system.getForces()):
f.setForceGroup(i) f.setForceGroup(i)
context = Context(system, VerletIntegrator(1*femtosecond), Platform.getPlatformByName('Reference')) context = Context(system, VerletIntegrator(1*femtosecond), Platform.getPlatform('Reference'))
context.setPositions(gro.positions) context.setPositions(gro.positions)
energy = {} energy = {}
for i, f in enumerate(system.getForces()): for i, f in enumerate(system.getForces()):
......
...@@ -64,7 +64,7 @@ class TestIntegrators(unittest.TestCase): ...@@ -64,7 +64,7 @@ class TestIntegrators(unittest.TestCase):
velocities = [ (random.random()-0.5, random.random()-0.5, random.random()-0.5) for i in range(numParticles) ] velocities = [ (random.random()-0.5, random.random()-0.5, random.random()-0.5) for i in range(numParticles) ]
# Create Context # Create Context
platform = Platform.getPlatformByName('Reference') platform = Platform.getPlatform('Reference')
context = Context(system, integrator, platform) context = Context(system, integrator, platform)
context.setPositions(positions) context.setPositions(positions)
context.setVelocities(velocities) context.setVelocities(velocities)
...@@ -161,7 +161,7 @@ class TestIntegrators(unittest.TestCase): ...@@ -161,7 +161,7 @@ class TestIntegrators(unittest.TestCase):
# Create a System with a single particle and no forces # Create a System with a single particle and no forces
system = System() system = System()
system.addParticle(12.0*amu) system.addParticle(12.0*amu)
platform = Platform.getPlatformByName('Reference') platform = Platform.getPlatform('Reference')
initial_positions = [Vec3(0,0,0)] initial_positions = [Vec3(0,0,0)]
initial_velocities = [Vec3(1,0,0)] initial_velocities = [Vec3(1,0,0)]
nsteps = 125 # number of steps to take nsteps = 125 # number of steps to take
......
...@@ -25,7 +25,7 @@ class TestMetadynamics(unittest.TestCase): ...@@ -25,7 +25,7 @@ class TestMetadynamics(unittest.TestCase):
residue = topology.addResidue('H2', chain) residue = topology.addResidue('H2', chain)
topology.addAtom('H1', element.hydrogen, residue) topology.addAtom('H1', element.hydrogen, residue)
topology.addAtom('H2', element.hydrogen, residue) topology.addAtom('H2', element.hydrogen, residue)
simulation = Simulation(topology, system, integrator, Platform.getPlatformByName('Reference')) simulation = Simulation(topology, system, integrator, Platform.getPlatform('Reference'))
simulation.context.setPositions([Vec3(0, 0, 0), Vec3(1, 0, 0)]) simulation.context.setPositions([Vec3(0, 0, 0), Vec3(1, 0, 0)])
meta.step(simulation, 200000) meta.step(simulation, 200000)
fe = meta.getFreeEnergy() fe = meta.getFreeEnergy()
......
...@@ -22,7 +22,7 @@ class TestNumpyCompatibility(unittest.TestCase): ...@@ -22,7 +22,7 @@ class TestNumpyCompatibility(unittest.TestCase):
integrator = mm.LangevinIntegrator(300*unit.kelvin, 1.0/unit.picoseconds, integrator = mm.LangevinIntegrator(300*unit.kelvin, 1.0/unit.picoseconds,
2.0*unit.femtoseconds) 2.0*unit.femtoseconds)
self.simulation = app.Simulation(prmtop.topology, system, integrator, self.simulation = app.Simulation(prmtop.topology, system, integrator,
mm.Platform.getPlatformByName('Reference')) mm.Platform.getPlatform('Reference'))
def test_setPositions(self): def test_setPositions(self):
......
...@@ -69,7 +69,7 @@ class TestPdbxFile(unittest.TestCase): ...@@ -69,7 +69,7 @@ class TestPdbxFile(unittest.TestCase):
parm = AmberPrmtopFile('systems/alanine-dipeptide-implicit.prmtop') parm = AmberPrmtopFile('systems/alanine-dipeptide-implicit.prmtop')
system = parm.createSystem() system = parm.createSystem()
sim = Simulation(parm.topology, system, VerletIntegrator(1*femtoseconds), sim = Simulation(parm.topology, system, VerletIntegrator(1*femtoseconds),
Platform.getPlatformByName('Reference')) Platform.getPlatform('Reference'))
sim.context.setPositions(PDBFile('systems/alanine-dipeptide-implicit.pdb').getPositions()) sim.context.setPositions(PDBFile('systems/alanine-dipeptide-implicit.pdb').getPositions())
sim.reporters.append(PDBxReporter('test.cif', 1)) sim.reporters.append(PDBxReporter('test.cif', 1))
sim.step(10) sim.step(10)
...@@ -101,7 +101,7 @@ class TestPdbxFile(unittest.TestCase): ...@@ -101,7 +101,7 @@ class TestPdbxFile(unittest.TestCase):
parm = AmberPrmtopFile('systems/alanine-dipeptide-explicit.prmtop') parm = AmberPrmtopFile('systems/alanine-dipeptide-explicit.prmtop')
system = parm.createSystem(nonbondedCutoff=1.0, nonbondedMethod=PME) system = parm.createSystem(nonbondedCutoff=1.0, nonbondedMethod=PME)
sim = Simulation(parm.topology, system, VerletIntegrator(1*femtoseconds), sim = Simulation(parm.topology, system, VerletIntegrator(1*femtoseconds),
Platform.getPlatformByName('Reference')) Platform.getPlatform('Reference'))
orig_pdb = PDBFile('systems/alanine-dipeptide-explicit.pdb') orig_pdb = PDBFile('systems/alanine-dipeptide-explicit.pdb')
sim.context.setPositions(orig_pdb.getPositions()) sim.context.setPositions(orig_pdb.getPositions())
sim.context.setPeriodicBoxVectors(*parm.topology.getPeriodicBoxVectors()) sim.context.setPeriodicBoxVectors(*parm.topology.getPeriodicBoxVectors())
......
...@@ -20,7 +20,7 @@ class TestSimulatedTempering(unittest.TestCase): ...@@ -20,7 +20,7 @@ class TestSimulatedTempering(unittest.TestCase):
residue = topology.addResidue('H2', chain) residue = topology.addResidue('H2', chain)
topology.addAtom('H1', element.hydrogen, residue) topology.addAtom('H1', element.hydrogen, residue)
topology.addAtom('H2', element.hydrogen, residue) topology.addAtom('H2', element.hydrogen, residue)
simulation = Simulation(topology, system, integrator, Platform.getPlatformByName('Reference')) simulation = Simulation(topology, system, integrator, Platform.getPlatform('Reference'))
st = SimulatedTempering(simulation, numTemperatures=10, minTemperature=200*kelvin, maxTemperature=400*kelvin, tempChangeInterval=5, reportInterval=10000) st = SimulatedTempering(simulation, numTemperatures=10, minTemperature=200*kelvin, maxTemperature=400*kelvin, tempChangeInterval=5, reportInterval=10000)
self.assertEqual(10, len(st.temperatures)) self.assertEqual(10, len(st.temperatures))
self.assertEqual(200*kelvin, st.temperatures[0]) self.assertEqual(200*kelvin, st.temperatures[0])
...@@ -72,7 +72,7 @@ class TestSimulatedTempering(unittest.TestCase): ...@@ -72,7 +72,7 @@ class TestSimulatedTempering(unittest.TestCase):
residue = topology.addResidue('H2', chain) residue = topology.addResidue('H2', chain)
topology.addAtom('H1', element.hydrogen, residue) topology.addAtom('H1', element.hydrogen, residue)
topology.addAtom('H2', element.hydrogen, residue) topology.addAtom('H2', element.hydrogen, residue)
simulation = Simulation(topology, system, integrator, Platform.getPlatformByName('Reference')) simulation = Simulation(topology, system, integrator, Platform.getPlatform('Reference'))
simulation.context.setPositions([Vec3(0, 0, 0), Vec3(1, 0, 0)]) simulation.context.setPositions([Vec3(0, 0, 0), Vec3(1, 0, 0)])
# Check the temperature is correct before creating the simulated tempering simulation # Check the temperature is correct before creating the simulated tempering simulation
......
...@@ -17,7 +17,7 @@ class TestSimulation(unittest.TestCase): ...@@ -17,7 +17,7 @@ class TestSimulation(unittest.TestCase):
# Create a Simulation. # Create a Simulation.
simulation = Simulation(pdb.topology, system, integrator, Platform.getPlatformByName('Reference')) simulation = Simulation(pdb.topology, system, integrator, Platform.getPlatform('Reference'))
simulation.context.setPositions(pdb.positions) simulation.context.setPositions(pdb.positions)
simulation.context.setVelocitiesToTemperature(300*kelvin) simulation.context.setVelocitiesToTemperature(300*kelvin)
initialState = simulation.context.getState(getPositions=True, getVelocities=True) initialState = simulation.context.getState(getPositions=True, getVelocities=True)
...@@ -74,7 +74,7 @@ class TestSimulation(unittest.TestCase): ...@@ -74,7 +74,7 @@ class TestSimulation(unittest.TestCase):
# Create a Simulation. # Create a Simulation.
simulation = Simulation(pdb.topology, system, integrator, Platform.getPlatformByName('Reference')) simulation = Simulation(pdb.topology, system, integrator, Platform.getPlatform('Reference'))
simulation.context.setPositions(pdb.positions) simulation.context.setPositions(pdb.positions)
simulation.context.setVelocitiesToTemperature(300*kelvin) simulation.context.setVelocitiesToTemperature(300*kelvin)
initialState = simulation.context.getState(getPositions=True, getVelocities=True) initialState = simulation.context.getState(getPositions=True, getVelocities=True)
...@@ -107,7 +107,7 @@ class TestSimulation(unittest.TestCase): ...@@ -107,7 +107,7 @@ class TestSimulation(unittest.TestCase):
# Create a Simulation. # Create a Simulation.
simulation = Simulation(pdb.topology, system, integrator, Platform.getPlatformByName('Reference')) simulation = Simulation(pdb.topology, system, integrator, Platform.getPlatform('Reference'))
simulation.context.setPositions(pdb.positions) simulation.context.setPositions(pdb.positions)
simulation.context.setVelocitiesToTemperature(300*kelvin) simulation.context.setVelocitiesToTemperature(300*kelvin)
self.assertEqual(0, simulation.currentStep) self.assertEqual(0, simulation.currentStep)
...@@ -130,7 +130,7 @@ class TestSimulation(unittest.TestCase): ...@@ -130,7 +130,7 @@ class TestSimulation(unittest.TestCase):
# Create a Simulation. # Create a Simulation.
simulation = Simulation(pdb.topology, system, integrator, Platform.getPlatformByName('Reference')) simulation = Simulation(pdb.topology, system, integrator, Platform.getPlatform('Reference'))
simulation.context.setPositions(pdb.positions) simulation.context.setPositions(pdb.positions)
simulation.context.setVelocitiesToTemperature(300*kelvin) simulation.context.setVelocitiesToTemperature(300*kelvin)
self.assertEqual(0, simulation.currentStep) self.assertEqual(0, simulation.currentStep)
......
...@@ -163,7 +163,7 @@ class TestXtcFile(unittest.TestCase): ...@@ -163,7 +163,7 @@ class TestXtcFile(unittest.TestCase):
pdb.topology, pdb.topology,
system, system,
integrator, integrator,
mm.Platform.getPlatformByName("Reference"), mm.Platform.getPlatform("Reference"),
) )
xtc = app.XTCReporter(fname, 2) xtc = app.XTCReporter(fname, 2)
simulation.reporters.append(xtc) simulation.reporters.append(xtc)
...@@ -182,7 +182,7 @@ class TestXtcFile(unittest.TestCase): ...@@ -182,7 +182,7 @@ class TestXtcFile(unittest.TestCase):
pdb.topology, pdb.topology,
system, system,
integrator, integrator,
mm.Platform.getPlatformByName("Reference"), mm.Platform.getPlatform("Reference"),
) )
xtc = app.XTCReporter(fname, 2, append=True) xtc = app.XTCReporter(fname, 2, append=True)
simulation.reporters.append(xtc) simulation.reporters.append(xtc)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment