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
c9d7d1e9
Commit
c9d7d1e9
authored
Apr 23, 2012
by
Peter Eastman
Browse files
Fixed bugs setting up nonbonded and GB forces
parent
ee1ec687
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
wrappers/python/simtk/openmm/app/amberprmtopfile.py
wrappers/python/simtk/openmm/app/amberprmtopfile.py
+0
-2
wrappers/python/simtk/openmm/app/internal/amber_file_parser.py
...ers/python/simtk/openmm/app/internal/amber_file_parser.py
+5
-4
wrappers/python/simtk/openmm/app/internal/customgbforces.py
wrappers/python/simtk/openmm/app/internal/customgbforces.py
+8
-0
No files found.
wrappers/python/simtk/openmm/app/amberprmtopfile.py
View file @
c9d7d1e9
...
@@ -135,8 +135,6 @@ class AmberPrmtopFile(object):
...
@@ -135,8 +135,6 @@ class AmberPrmtopFile(object):
raise
ValueError
(
'Illegal value for nonbonded method'
)
raise
ValueError
(
'Illegal value for nonbonded method'
)
if
not
self
.
_prmtop
.
getIfBox
()
and
nonbondedMethod
in
(
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
):
if
not
self
.
_prmtop
.
getIfBox
()
and
nonbondedMethod
in
(
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
):
raise
ValueError
(
'Illegal nonbonded method for a non-periodic system'
)
raise
ValueError
(
'Illegal nonbonded method for a non-periodic system'
)
if
nonbondedMethod
==
ff
.
NoCutoff
:
nonbondedCutoff
=
None
constraintMap
=
{
None
:
None
,
constraintMap
=
{
None
:
None
,
ff
.
HBonds
:
'h-bonds'
,
ff
.
HBonds
:
'h-bonds'
,
ff
.
AllBonds
:
'all-bonds'
,
ff
.
AllBonds
:
'all-bonds'
,
...
...
wrappers/python/simtk/openmm/app/internal/amber_file_parser.py
View file @
c9d7d1e9
...
@@ -676,6 +676,7 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode
...
@@ -676,6 +676,7 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode
min_box_width
=
min
([
boxX
/
units
.
nanometers
,
boxY
/
units
.
nanometers
,
boxZ
/
units
.
nanometers
])
min_box_width
=
min
([
boxX
/
units
.
nanometers
,
boxY
/
units
.
nanometers
,
boxZ
/
units
.
nanometers
])
CLEARANCE_FACTOR
=
0.97
# reduce the cutoff to be a bit smaller than 1/2 smallest box length
CLEARANCE_FACTOR
=
0.97
# reduce the cutoff to be a bit smaller than 1/2 smallest box length
nonbondedCutoff
=
units
.
Quantity
((
min_box_width
*
CLEARANCE_FACTOR
)
/
2.0
,
units
.
nanometers
)
nonbondedCutoff
=
units
.
Quantity
((
min_box_width
*
CLEARANCE_FACTOR
)
/
2.0
,
units
.
nanometers
)
if
nonbondedMethod
!=
'NoCutoff'
:
force
.
setCutoffDistance
(
nonbondedCutoff
)
force
.
setCutoffDistance
(
nonbondedCutoff
)
# Set nonbonded method.
# Set nonbonded method.
...
@@ -789,15 +790,15 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode
...
@@ -789,15 +790,15 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode
symbls
=
prmtop
.
getAtomTypes
()
symbls
=
prmtop
.
getAtomTypes
()
gb_parms
=
prmtop
.
getGBParms
(
symbls
)
gb_parms
=
prmtop
.
getGBParms
(
symbls
)
if
gbmodel
==
'HCT'
:
if
gbmodel
==
'HCT'
:
gb
=
customgb
.
GBSAHCTForce
(
solventDielectric
,
soluteDielectric
,
True
)
gb
=
customgb
.
GBSAHCTForce
(
solventDielectric
,
soluteDielectric
,
'ACE'
)
elif
gbmodel
==
'OBC1'
:
elif
gbmodel
==
'OBC1'
:
gb
=
customgb
.
GBSAOBC1Force
(
solventDielectric
,
soluteDielectric
,
True
)
gb
=
customgb
.
GBSAOBC1Force
(
solventDielectric
,
soluteDielectric
,
'ACE'
)
elif
gbmodel
==
'OBC2'
:
elif
gbmodel
==
'OBC2'
:
gb
=
mm
.
GBSAOBCForce
()
gb
=
mm
.
GBSAOBCForce
()
gb
.
setSoluteDielectric
(
soluteDielectric
)
gb
.
setSoluteDielectric
(
soluteDielectric
)
gb
.
setSolventDielectric
(
solventDielectric
)
gb
.
setSolventDielectric
(
solventDielectric
)
elif
gbmodel
==
'GBn'
:
elif
gbmodel
==
'GBn'
:
gb
=
customgb
.
GBSAGBnForce
(
solventDielectric
,
soluteDielectric
,
True
)
gb
=
customgb
.
GBSAGBnForce
(
solventDielectric
,
soluteDielectric
,
'ACE'
)
else
:
else
:
raise
Exception
(
"Illegal value specified for implicit solvent model"
)
raise
Exception
(
"Illegal value specified for implicit solvent model"
)
for
iAtom
in
range
(
prmtop
.
getNumAtoms
()):
for
iAtom
in
range
(
prmtop
.
getNumAtoms
()):
...
...
wrappers/python/simtk/openmm/app/internal/customgbforces.py
View file @
c9d7d1e9
...
@@ -217,6 +217,8 @@ def GBSAHCTForce(solventDielectric=78.5, soluteDielectric=1, SA=None):
...
@@ -217,6 +217,8 @@ def GBSAHCTForce(solventDielectric=78.5, soluteDielectric=1, SA=None):
custom
.
addEnergyTerm
(
"-0.5*138.935485*(1/soluteDielectric-1/solventDielectric)*q^2/B"
,
CustomGBForce
.
SingleParticle
)
custom
.
addEnergyTerm
(
"-0.5*138.935485*(1/soluteDielectric-1/solventDielectric)*q^2/B"
,
CustomGBForce
.
SingleParticle
)
if
SA
==
'ACE'
:
if
SA
==
'ACE'
:
custom
.
addEnergyTerm
(
"28.3919551*(radius+0.14)^2*(radius/B)^6"
,
CustomGBForce
.
SingleParticle
)
custom
.
addEnergyTerm
(
"28.3919551*(radius+0.14)^2*(radius/B)^6"
,
CustomGBForce
.
SingleParticle
)
elif
SA
is
not
None
:
raise
ValueError
(
'Unknown surface area method: '
+
SA
)
custom
.
addEnergyTerm
(
"-138.935485*(1/soluteDielectric-1/solventDielectric)*q1*q2/f;"
custom
.
addEnergyTerm
(
"-138.935485*(1/soluteDielectric-1/solventDielectric)*q1*q2/f;"
"f=sqrt(r^2+B1*B2*exp(-r^2/(4*B1*B2)))"
,
CustomGBForce
.
ParticlePairNoExclusions
)
"f=sqrt(r^2+B1*B2*exp(-r^2/(4*B1*B2)))"
,
CustomGBForce
.
ParticlePairNoExclusions
)
...
@@ -248,6 +250,8 @@ def GBSAOBC1Force(solventDielectric=78.5, soluteDielectric=1, SA=None):
...
@@ -248,6 +250,8 @@ def GBSAOBC1Force(solventDielectric=78.5, soluteDielectric=1, SA=None):
custom
.
addEnergyTerm
(
"-0.5*138.935485*(1/soluteDielectric-1/solventDielectric)*q^2/B"
,
CustomGBForce
.
SingleParticle
)
custom
.
addEnergyTerm
(
"-0.5*138.935485*(1/soluteDielectric-1/solventDielectric)*q^2/B"
,
CustomGBForce
.
SingleParticle
)
if
SA
==
'ACE'
:
if
SA
==
'ACE'
:
custom
.
addEnergyTerm
(
"28.3919551*(radius+0.14)^2*(radius/B)^6"
,
CustomGBForce
.
SingleParticle
)
custom
.
addEnergyTerm
(
"28.3919551*(radius+0.14)^2*(radius/B)^6"
,
CustomGBForce
.
SingleParticle
)
elif
SA
is
not
None
:
raise
ValueError
(
'Unknown surface area method: '
+
SA
)
custom
.
addEnergyTerm
(
"-138.935485*(1/soluteDielectric-1/solventDielectric)*q1*q2/f;"
custom
.
addEnergyTerm
(
"-138.935485*(1/soluteDielectric-1/solventDielectric)*q1*q2/f;"
"f=sqrt(r^2+B1*B2*exp(-r^2/(4*B1*B2)))"
,
CustomGBForce
.
ParticlePairNoExclusions
)
"f=sqrt(r^2+B1*B2*exp(-r^2/(4*B1*B2)))"
,
CustomGBForce
.
ParticlePairNoExclusions
)
...
@@ -279,6 +283,8 @@ def GBSAOBC2Force(solventDielectric=78.5, soluteDielectric=1, SA=None):
...
@@ -279,6 +283,8 @@ def GBSAOBC2Force(solventDielectric=78.5, soluteDielectric=1, SA=None):
custom
.
addEnergyTerm
(
"-0.5*138.935485*(1/soluteDielectric-1/solventDielectric)*q^2/B"
,
CustomGBForce
.
SingleParticle
)
custom
.
addEnergyTerm
(
"-0.5*138.935485*(1/soluteDielectric-1/solventDielectric)*q^2/B"
,
CustomGBForce
.
SingleParticle
)
if
SA
==
'ACE'
:
if
SA
==
'ACE'
:
custom
.
addEnergyTerm
(
"28.3919551*(radius+0.14)^2*(radius/B)^6"
,
CustomGBForce
.
SingleParticle
)
custom
.
addEnergyTerm
(
"28.3919551*(radius+0.14)^2*(radius/B)^6"
,
CustomGBForce
.
SingleParticle
)
elif
SA
is
not
None
:
raise
ValueError
(
'Unknown surface area method: '
+
SA
)
custom
.
addEnergyTerm
(
"-138.935485*(1/soluteDielectric-1/solventDielectric)*q1*q2/f;"
custom
.
addEnergyTerm
(
"-138.935485*(1/soluteDielectric-1/solventDielectric)*q1*q2/f;"
"f=sqrt(r^2+B1*B2*exp(-r^2/(4*B1*B2)))"
,
CustomGBForce
.
ParticlePairNoExclusions
)
"f=sqrt(r^2+B1*B2*exp(-r^2/(4*B1*B2)))"
,
CustomGBForce
.
ParticlePairNoExclusions
)
...
@@ -329,6 +335,8 @@ def GBSAGBnForce(solventDielectric=78.5, soluteDielectric=1, SA=None):
...
@@ -329,6 +335,8 @@ def GBSAGBnForce(solventDielectric=78.5, soluteDielectric=1, SA=None):
custom
.
addEnergyTerm
(
"-0.5*138.935485*(1/soluteDielectric-1/solventDielectric)*q^2/B"
,
CustomGBForce
.
SingleParticle
)
custom
.
addEnergyTerm
(
"-0.5*138.935485*(1/soluteDielectric-1/solventDielectric)*q^2/B"
,
CustomGBForce
.
SingleParticle
)
if
SA
==
'ACE'
:
if
SA
==
'ACE'
:
custom
.
addEnergyTerm
(
"28.3919551*(radius+0.14)^2*(radius/B)^6"
,
CustomGBForce
.
SingleParticle
)
custom
.
addEnergyTerm
(
"28.3919551*(radius+0.14)^2*(radius/B)^6"
,
CustomGBForce
.
SingleParticle
)
elif
SA
is
not
None
:
raise
ValueError
(
'Unknown surface area method: '
+
SA
)
custom
.
addEnergyTerm
(
"-138.935485*(1/soluteDielectric-1/solventDielectric)*q1*q2/f;"
custom
.
addEnergyTerm
(
"-138.935485*(1/soluteDielectric-1/solventDielectric)*q1*q2/f;"
"f=sqrt(r^2+B1*B2*exp(-r^2/(4*B1*B2)))"
,
CustomGBForce
.
ParticlePairNoExclusions
)
"f=sqrt(r^2+B1*B2*exp(-r^2/(4*B1*B2)))"
,
CustomGBForce
.
ParticlePairNoExclusions
)
...
...
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