"platforms/reference/vscode:/vscode.git/clone" did not exist on "38db8fb1280042a9dae2ae166987e4651ebc6af9"
Commit e1a4e015 authored by Justin MacCallum's avatar Justin MacCallum
Browse files

Revert "Changed gb settings to use strings rather than named constants."

This reverts commit 4572d2e3.
parent 40929077
...@@ -40,11 +40,11 @@ import simtk.unit as unit ...@@ -40,11 +40,11 @@ import simtk.unit as unit
import simtk.openmm as mm import simtk.openmm as mm
# Enumerated values for implicit solvent model # Enumerated values for implicit solvent model
# Prefer to use strings now, but these are here for backwards compatibility
HCT = 'HCT' HCT = object()
OBC1 = 'OBC1' OBC1 = object()
OBC2 = 'OBC2' OBC2 = object()
GBn = 'GBn' GBn = object()
class AmberPrmtopFile(object): class AmberPrmtopFile(object):
"""AmberPrmtopFile parses an AMBER prmtop file and constructs a Topology and (optionally) an OpenMM System from it.""" """AmberPrmtopFile parses an AMBER prmtop file and constructs a Topology and (optionally) an OpenMM System from it."""
...@@ -122,8 +122,7 @@ class AmberPrmtopFile(object): ...@@ -122,8 +122,7 @@ class AmberPrmtopFile(object):
- constraints (object=None) Specifies which bonds angles should be implemented with constraints. - constraints (object=None) Specifies which bonds angles should be implemented with constraints.
Allowed values are None, HBonds, AllBonds, or HAngles. Allowed values are None, HBonds, AllBonds, or HAngles.
- rigidWater (boolean=True) If true, water molecules will be fully rigid regardless of the value passed for the constraints argument - rigidWater (boolean=True) If true, water molecules will be fully rigid regardless of the value passed for the constraints argument
- implicitSolvent (object=None) If not None, the implicit solvent - implicitSolvent (object=None) If not None, the implicit solvent model to use. Allowed values are HCT, OBC1, OBC2, or GBn.
model to use. Allowed values are 'HCT', 'OBC1', 'OBC2', or 'GBn'.
- soluteDielectric (float=1.0) The solute dielectric constant to use in the implicit solvent model. - soluteDielectric (float=1.0) The solute dielectric constant to use in the implicit solvent model.
- solventDielectric (float=78.5) The solvent dielectric constant to use in the implicit solvent model. - solventDielectric (float=78.5) The solvent dielectric constant to use in the implicit solvent model.
- removeCMMotion (boolean=True) If true, a CMMotionRemover will be added to the System - removeCMMotion (boolean=True) If true, a CMMotionRemover will be added to the System
...@@ -149,12 +148,21 @@ class AmberPrmtopFile(object): ...@@ -149,12 +148,21 @@ class AmberPrmtopFile(object):
constraintString = constraintMap[constraints] constraintString = constraintMap[constraints]
else: else:
raise ValueError('Illegal value for constraints') raise ValueError('Illegal value for constraints')
if implicitSolvent is None:
sys = amber_file_parser.readAmberSystem(prmtop_loader=self._prmtop, shake=constraintString, implicitString = None
nonbondedCutoff=nonbondedCutoff, nonbondedMethod=methodMap[nonbondedMethod], elif implicitSolvent == HCT:
flexibleConstraints=False, gbmodel=implicitSolvent, implicitString = 'HCT'
soluteDielectric=soluteDielectric, solventDielectric=solventDielectric, elif implicitSolvent == OBC1:
rigidWater=rigidWater) implicitString = 'OBC1'
elif implicitSolvent == OBC2:
implicitString = 'OBC2'
elif implicitSolvent == GBn:
implicitString = 'GBn'
else:
raise ValueError('Illegal value for implicit solvent model')
sys = amber_file_parser.readAmberSystem(prmtop_loader=self._prmtop, shake=constraintString, nonbondedCutoff=nonbondedCutoff,
nonbondedMethod=methodMap[nonbondedMethod], flexibleConstraints=False, gbmodel=implicitString,
soluteDielectric=soluteDielectric, solventDielectric=solventDielectric, rigidWater=rigidWater)
for force in sys.getForces(): for force in sys.getForces():
if isinstance(force, mm.NonbondedForce): if isinstance(force, mm.NonbondedForce):
force.setEwaldErrorTolerance(ewaldErrorTolerance) force.setEwaldErrorTolerance(ewaldErrorTolerance)
......
...@@ -45,7 +45,7 @@ HBonds = ff.HBonds ...@@ -45,7 +45,7 @@ HBonds = ff.HBonds
AllBonds = ff.AllBonds AllBonds = ff.AllBonds
HAngles = ff.HAngles HAngles = ff.HAngles
OBC2 = 'OBC2' OBC2 = prmtop.OBC2
class GromacsTopFile(object): class GromacsTopFile(object):
"""GromacsTopFile parses a Gromacs top file and constructs a Topology and (optionally) an OpenMM System from it.""" """GromacsTopFile parses a Gromacs top file and constructs a Topology and (optionally) an OpenMM System from it."""
...@@ -426,7 +426,7 @@ class GromacsTopFile(object): ...@@ -426,7 +426,7 @@ class GromacsTopFile(object):
- constraints (object=None) Specifies which bonds and angles should be implemented with constraints. - constraints (object=None) Specifies which bonds and angles should be implemented with constraints.
Allowed values are None, HBonds, AllBonds, or HAngles. Allowed values are None, HBonds, AllBonds, or HAngles.
- rigidWater (boolean=True) If true, water molecules will be fully rigid regardless of the value passed for the constraints argument - rigidWater (boolean=True) If true, water molecules will be fully rigid regardless of the value passed for the constraints argument
- implicitSolvent (string=None) If not None, the implicit solvent model to use. The only allowed value is 'OBC2'. - implicitSolvent (object=None) If not None, the implicit solvent model to use. The only allowed value is OBC2.
- soluteDielectric (float=1.0) The solute dielectric constant to use in the implicit solvent model. - soluteDielectric (float=1.0) The solute dielectric constant to use in the implicit solvent model.
- solventDielectric (float=78.5) The solvent dielectric constant to use in the implicit solvent model. - solventDielectric (float=78.5) The solvent dielectric constant to use in the implicit solvent model.
- ewaldErrorTolerance (float=0.0005) The error tolerance to use if nonbondedMethod is Ewald or PME. - ewaldErrorTolerance (float=0.0005) The error tolerance to use if nonbondedMethod is Ewald or PME.
...@@ -443,7 +443,7 @@ class GromacsTopFile(object): ...@@ -443,7 +443,7 @@ class GromacsTopFile(object):
raise ValueError('Illegal nonbonded method for a non-periodic system') raise ValueError('Illegal nonbonded method for a non-periodic system')
nb = mm.NonbondedForce() nb = mm.NonbondedForce()
sys.addForce(nb) sys.addForce(nb)
if implicitSolvent == 'OBC2': if implicitSolvent is OBC2:
gb = mm.GBSAOBCForce() gb = mm.GBSAOBCForce()
gb.setSoluteDielectric(soluteDielectric) gb.setSoluteDielectric(soluteDielectric)
gb.setSolventDielectric(solventDielectric) gb.setSolventDielectric(solventDielectric)
...@@ -656,7 +656,7 @@ class GromacsTopFile(object): ...@@ -656,7 +656,7 @@ class GromacsTopFile(object):
else: else:
q = float(params[3]) q = float(params[3])
nb.addParticle(q, float(params[5]), float(params[6])) nb.addParticle(q, float(params[5]), float(params[6]))
if implicitSolvent == 'OBC2': if implicitSolvent is OBC2:
if fields[1] not in self._implicitTypes: if fields[1] not in self._implicitTypes:
raise ValueError('No implicit solvent parameters specified for atom type: '+fields[1]) raise ValueError('No implicit solvent parameters specified for atom type: '+fields[1])
gbparams = self._implicitTypes[fields[1]] gbparams = self._implicitTypes[fields[1]]
......
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