Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
4572d2e3
Commit
4572d2e3
authored
Jun 20, 2013
by
Justin MacCallum
Browse files
Changed gb settings to use strings rather than named constants.
parent
960d2010
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
92 deletions
+84
-92
wrappers/python/simtk/openmm/app/amberprmtopfile.py
wrappers/python/simtk/openmm/app/amberprmtopfile.py
+24
-32
wrappers/python/simtk/openmm/app/gromacstopfile.py
wrappers/python/simtk/openmm/app/gromacstopfile.py
+60
-60
No files found.
wrappers/python/simtk/openmm/app/amberprmtopfile.py
View file @
4572d2e3
...
...
@@ -40,11 +40,11 @@ import simtk.unit as unit
import
simtk.openmm
as
mm
# Enumerated values for implicit solvent model
HCT
=
object
()
OBC1
=
object
()
OBC2
=
object
()
GBn
=
object
()
# Prefer to use strings now, but these are here for backwards compatibility
HCT
=
'HCT'
OBC1
=
'OBC1'
OBC2
=
'OBC2'
GBn
=
'GBn'
class
AmberPrmtopFile
(
object
):
"""AmberPrmtopFile parses an AMBER prmtop file and constructs a Topology and (optionally) an OpenMM System from it."""
...
...
@@ -122,7 +122,8 @@ class AmberPrmtopFile(object):
- constraints (object=None) Specifies which bonds angles should be implemented with constraints.
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
- implicitSolvent (object=None) If not None, the implicit solvent model to use. Allowed values are HCT, OBC1, OBC2, or GBn.
- implicitSolvent (object=None) If not None, the implicit solvent
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.
- 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
...
...
@@ -148,21 +149,12 @@ class AmberPrmtopFile(object):
constraintString
=
constraintMap
[
constraints
]
else
:
raise
ValueError
(
'Illegal value for constraints'
)
if
implicitSolvent
is
None
:
implicitString
=
None
elif
implicitSolvent
==
HCT
:
implicitString
=
'HCT'
elif
implicitSolvent
==
OBC1
:
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
)
sys
=
amber_file_parser
.
readAmberSystem
(
prmtop_loader
=
self
.
_prmtop
,
shake
=
constraintString
,
nonbondedCutoff
=
nonbondedCutoff
,
nonbondedMethod
=
methodMap
[
nonbondedMethod
],
flexibleConstraints
=
False
,
gbmodel
=
implicitSolvent
,
soluteDielectric
=
soluteDielectric
,
solventDielectric
=
solventDielectric
,
rigidWater
=
rigidWater
)
for
force
in
sys
.
getForces
():
if
isinstance
(
force
,
mm
.
NonbondedForce
):
force
.
setEwaldErrorTolerance
(
ewaldErrorTolerance
)
...
...
wrappers/python/simtk/openmm/app/gromacstopfile.py
View file @
4572d2e3
...
...
@@ -45,7 +45,7 @@ HBonds = ff.HBonds
AllBonds
=
ff
.
AllBonds
HAngles
=
ff
.
HAngles
OBC2
=
prmtop
.
OBC2
OBC2
=
'
OBC2
'
class
GromacsTopFile
(
object
):
"""GromacsTopFile parses a Gromacs top file and constructs a Topology and (optionally) an OpenMM System from it."""
...
...
@@ -426,7 +426,7 @@ class GromacsTopFile(object):
- constraints (object=None) Specifies which bonds and angles should be implemented with constraints.
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
- implicitSolvent (
object
=None) If not None, the implicit solvent model to use. The only allowed value is OBC2.
- implicitSolvent (
string
=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.
- 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.
...
...
@@ -443,7 +443,7 @@ class GromacsTopFile(object):
raise
ValueError
(
'Illegal nonbonded method for a non-periodic system'
)
nb
=
mm
.
NonbondedForce
()
sys
.
addForce
(
nb
)
if
implicitSolvent
is
OBC2
:
if
implicitSolvent
==
'
OBC2
'
:
gb
=
mm
.
GBSAOBCForce
()
gb
.
setSoluteDielectric
(
soluteDielectric
)
gb
.
setSolventDielectric
(
solventDielectric
)
...
...
@@ -656,7 +656,7 @@ class GromacsTopFile(object):
else
:
q
=
float
(
params
[
3
])
nb
.
addParticle
(
q
,
float
(
params
[
5
]),
float
(
params
[
6
]))
if
implicitSolvent
is
OBC2
:
if
implicitSolvent
==
'
OBC2
'
:
if
fields
[
1
]
not
in
self
.
_implicitTypes
:
raise
ValueError
(
'No implicit solvent parameters specified for atom type: '
+
fields
[
1
])
gbparams
=
self
.
_implicitTypes
[
fields
[
1
]]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment