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
c9fcabb5
"vscode:/vscode.git/clone" did not exist on "6c119bc2336a64acc6e333f5019ebdefadb03694"
Commit
c9fcabb5
authored
Jan 26, 2017
by
Peter Eastman
Browse files
More updates to dispersion PME
parent
c274f08d
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
89 additions
and
42 deletions
+89
-42
openmmapi/include/openmm/NonbondedForce.h
openmmapi/include/openmm/NonbondedForce.h
+2
-1
openmmapi/src/NonbondedForceImpl.cpp
openmmapi/src/NonbondedForceImpl.cpp
+1
-1
serialization/src/NonbondedForceProxy.cpp
serialization/src/NonbondedForceProxy.cpp
+15
-2
serialization/tests/TestSerializeNonbondedForce.cpp
serialization/tests/TestSerializeNonbondedForce.cpp
+10
-0
wrappers/python/simtk/openmm/app/__init__.py
wrappers/python/simtk/openmm/app/__init__.py
+1
-0
wrappers/python/simtk/openmm/app/amberprmtopfile.py
wrappers/python/simtk/openmm/app/amberprmtopfile.py
+5
-4
wrappers/python/simtk/openmm/app/charmmpsffile.py
wrappers/python/simtk/openmm/app/charmmpsffile.py
+7
-6
wrappers/python/simtk/openmm/app/desmonddmsfile.py
wrappers/python/simtk/openmm/app/desmonddmsfile.py
+5
-4
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+9
-3
wrappers/python/simtk/openmm/app/gromacstopfile.py
wrappers/python/simtk/openmm/app/gromacstopfile.py
+5
-4
wrappers/python/simtk/openmm/app/internal/amber_file_parser.py
...ers/python/simtk/openmm/app/internal/amber_file_parser.py
+3
-1
wrappers/python/tests/TestAPIUnits.py
wrappers/python/tests/TestAPIUnits.py
+2
-0
wrappers/python/tests/TestAmberPrmtopFile.py
wrappers/python/tests/TestAmberPrmtopFile.py
+6
-4
wrappers/python/tests/TestDesmondDMSFile.py
wrappers/python/tests/TestDesmondDMSFile.py
+6
-4
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+6
-4
wrappers/python/tests/TestGromacsTopFile.py
wrappers/python/tests/TestGromacsTopFile.py
+6
-4
No files found.
openmmapi/include/openmm/NonbondedForce.h
View file @
c9fcabb5
...
...
@@ -412,7 +412,8 @@ public:
bool
usesPeriodicBoundaryConditions
()
const
{
return
nonbondedMethod
==
NonbondedForce
::
CutoffPeriodic
||
nonbondedMethod
==
NonbondedForce
::
Ewald
||
nonbondedMethod
==
NonbondedForce
::
PME
;
nonbondedMethod
==
NonbondedForce
::
PME
||
nonbondedMethod
==
NonbondedForce
::
LJPME
;
}
protected:
ForceImpl
*
createImpl
()
const
;
...
...
openmmapi/src/NonbondedForceImpl.cpp
View file @
c9fcabb5
...
...
@@ -90,7 +90,7 @@ void NonbondedForceImpl::initialize(ContextImpl& context) {
exceptions
[
particle1
].
insert
(
particle2
);
exceptions
[
particle2
].
insert
(
particle1
);
}
if
(
owner
.
getNonbondedMethod
()
!=
NonbondedForce
::
NoCutoff
)
{
if
(
owner
.
getNonbondedMethod
()
!=
NonbondedForce
::
NoCutoff
&&
owner
.
getNonbondedMethod
()
!=
NonbondedForce
::
CutoffNonPeriodic
)
{
Vec3
boxVectors
[
3
];
system
.
getDefaultPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
double
cutoff
=
owner
.
getCutoffDistance
();
...
...
serialization/src/NonbondedForceProxy.cpp
View file @
c9fcabb5
...
...
@@ -42,7 +42,7 @@ NonbondedForceProxy::NonbondedForceProxy() : SerializationProxy("NonbondedForce"
}
void
NonbondedForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
NonbondedForce
&
force
=
*
reinterpret_cast
<
const
NonbondedForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
...
...
@@ -59,6 +59,11 @@ void NonbondedForceProxy::serialize(const void* object, SerializationNode& node)
node
.
setIntProperty
(
"nx"
,
nx
);
node
.
setIntProperty
(
"ny"
,
ny
);
node
.
setIntProperty
(
"nz"
,
nz
);
force
.
getLJPMEParameters
(
alpha
,
nx
,
ny
,
nz
);
node
.
setDoubleProperty
(
"ljAlpha"
,
alpha
);
node
.
setIntProperty
(
"ljnx"
,
nx
);
node
.
setIntProperty
(
"ljny"
,
ny
);
node
.
setIntProperty
(
"ljnz"
,
nz
);
node
.
setIntProperty
(
"recipForceGroup"
,
force
.
getReciprocalSpaceForceGroup
());
SerializationNode
&
particles
=
node
.
createChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
...
...
@@ -76,7 +81,8 @@ void NonbondedForceProxy::serialize(const void* object, SerializationNode& node)
}
void
*
NonbondedForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
2
)
throw
OpenMMException
(
"Unsupported version number"
);
NonbondedForce
*
force
=
new
NonbondedForce
();
try
{
...
...
@@ -93,6 +99,13 @@ void* NonbondedForceProxy::deserialize(const SerializationNode& node) const {
int
ny
=
node
.
getIntProperty
(
"ny"
,
0
);
int
nz
=
node
.
getIntProperty
(
"nz"
,
0
);
force
->
setPMEParameters
(
alpha
,
nx
,
ny
,
nz
);
if
(
version
>=
2
)
{
alpha
=
node
.
getDoubleProperty
(
"ljAlpha"
,
0.0
);
nx
=
node
.
getIntProperty
(
"ljnx"
,
0
);
ny
=
node
.
getIntProperty
(
"ljny"
,
0
);
nz
=
node
.
getIntProperty
(
"ljnz"
,
0
);
force
->
setLJPMEParameters
(
alpha
,
nx
,
ny
,
nz
);
}
force
->
setReciprocalSpaceForceGroup
(
node
.
getIntProperty
(
"recipForceGroup"
,
-
1
));
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
...
...
serialization/tests/TestSerializeNonbondedForce.cpp
View file @
c9fcabb5
...
...
@@ -53,6 +53,9 @@ void testSerialization() {
double
alpha
=
0.5
;
int
nx
=
3
,
ny
=
5
,
nz
=
7
;
force
.
setPMEParameters
(
alpha
,
nx
,
ny
,
nz
);
double
dalpha
=
0.8
;
int
dnx
=
4
,
dny
=
6
,
dnz
=
7
;
force
.
setLJPMEParameters
(
dalpha
,
dnx
,
dny
,
dnz
);
force
.
addParticle
(
1
,
0.1
,
0.01
);
force
.
addParticle
(
0.5
,
0.2
,
0.02
);
force
.
addParticle
(
-
0.5
,
0.3
,
0.03
);
...
...
@@ -84,6 +87,13 @@ void testSerialization() {
ASSERT_EQUAL
(
nx
,
nx2
);
ASSERT_EQUAL
(
ny
,
ny2
);
ASSERT_EQUAL
(
nz
,
nz2
);
double
dalpha2
;
int
dnx2
,
dny2
,
dnz2
;
force2
.
getLJPMEParameters
(
dalpha2
,
dnx2
,
dny2
,
dnz2
);
ASSERT_EQUAL
(
dalpha
,
dalpha2
);
ASSERT_EQUAL
(
dnx
,
dnx2
);
ASSERT_EQUAL
(
dny
,
dny2
);
ASSERT_EQUAL
(
dnz
,
dnz2
);
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
double
charge1
,
sigma1
,
epsilon1
;
double
charge2
,
sigma2
,
epsilon2
;
...
...
wrappers/python/simtk/openmm/app/__init__.py
View file @
c9fcabb5
...
...
@@ -40,6 +40,7 @@ CutoffNonPeriodic = forcefield.CutoffNonPeriodic
CutoffPeriodic
=
forcefield
.
CutoffPeriodic
Ewald
=
forcefield
.
Ewald
PME
=
forcefield
.
PME
LJPME
=
forcefield
.
LJPME
HBonds
=
forcefield
.
HBonds
AllBonds
=
forcefield
.
AllBonds
...
...
wrappers/python/simtk/openmm/app/amberprmtopfile.py
View file @
c9fcabb5
...
...
@@ -169,7 +169,7 @@ class AmberPrmtopFile(object):
----------
nonbondedMethod : object=NoCutoff
The method to use for nonbonded interactions. Allowed values are
NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald, or PME.
NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald,
PME,
or
LJ
PME.
nonbondedCutoff : distance=1*nanometer
The cutoff distance to use for nonbonded interactions
constraints : object=None
...
...
@@ -202,7 +202,7 @@ class AmberPrmtopFile(object):
added to a hydrogen is subtracted from the heavy atom to keep their
total mass the same.
ewaldErrorTolerance : float=0.0005
The error tolerance to use if nonbondedMethod is Ewald or PME.
The error tolerance to use if nonbondedMethod is Ewald
, PME,
or
LJ
PME.
switchDistance : float=0*nanometers
The distance at which the potential energy switching function is
turned on for Lennard-Jones interactions. If the switchDistance is 0
...
...
@@ -222,10 +222,11 @@ class AmberPrmtopFile(object):
ff
.
CutoffNonPeriodic
:
'CutoffNonPeriodic'
,
ff
.
CutoffPeriodic
:
'CutoffPeriodic'
,
ff
.
Ewald
:
'Ewald'
,
ff
.
PME
:
'PME'
}
ff
.
PME
:
'PME'
,
ff
.
LJPME
:
'LJPME'
}
if
nonbondedMethod
not
in
methodMap
:
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
,
ff
.
LJPME
):
raise
ValueError
(
'Illegal nonbonded method for a non-periodic system'
)
constraintMap
=
{
None
:
None
,
ff
.
HBonds
:
'h-bonds'
,
...
...
wrappers/python/simtk/openmm/app/charmmpsffile.py
View file @
c9fcabb5
...
...
@@ -690,7 +690,7 @@ class CharmmPsfFile(object):
The parameter set to use to parametrize this molecule
nonbondedMethod : object=NoCutoff
The method to use for nonbonded interactions. Allowed values are
NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald, or PME.
NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald,
PME,
or
LJ
PME.
nonbondedCutoff : distance=1*nanometer
The cutoff distance to use for nonbonded interactions.
switchDistance : distance=0*nanometer
...
...
@@ -728,7 +728,7 @@ class CharmmPsfFile(object):
added to a hydrogen is subtracted from the heavy atom to keep their
total mass the same.
ewaldErrorTolerance : float=0.0005
The error tolerance to use if the nonbonded method is Ewald or PME.
The error tolerance to use if the nonbonded method is Ewald
, PME,
or
LJ
PME.
flexibleConstraints : bool=True
Are our constraints flexible or not?
verbose : bool=False
...
...
@@ -746,10 +746,10 @@ class CharmmPsfFile(object):
cutoff
=
cutoff
.
value_in_unit
(
u
.
nanometers
)
if
nonbondedMethod
not
in
(
ff
.
NoCutoff
,
ff
.
CutoffNonPeriodic
,
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
):
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
,
ff
.
LJPME
):
raise
ValueError
(
'Illegal value for nonbonded method'
)
if
not
hasbox
and
nonbondedMethod
in
(
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
):
ff
.
Ewald
,
ff
.
PME
,
ff
.
LJPME
):
raise
ValueError
(
'Illegal nonbonded method for a '
'non-periodic system'
)
if
implicitSolvent
not
in
(
HCT
,
OBC1
,
OBC2
,
GBn
,
GBn2
,
None
):
...
...
@@ -1009,6 +1009,8 @@ class CharmmPsfFile(object):
force
.
setNonbondedMethod
(
mm
.
NonbondedForce
.
Ewald
)
elif
nonbondedMethod
is
ff
.
PME
:
force
.
setNonbondedMethod
(
mm
.
NonbondedForce
.
PME
)
elif
nonbondedMethod
is
ff
.
LJPME
:
force
.
setNonbondedMethod
(
mm
.
NonbondedForce
.
LJPME
)
else
:
raise
ValueError
(
'Cutoff method is not understood'
)
...
...
@@ -1088,8 +1090,7 @@ class CharmmPsfFile(object):
mm
.
Discrete2DFunction
(
num_lj_types
,
num_lj_types
,
bcoef
))
cforce
.
addPerParticleParameter
(
'type'
)
cforce
.
setForceGroup
(
self
.
NONBONDED_FORCE_GROUP
)
if
(
nonbondedMethod
is
ff
.
PME
or
nonbondedMethod
is
ff
.
Ewald
or
nonbondedMethod
is
ff
.
CutoffPeriodic
):
if
(
nonbondedMethod
in
(
ff
.
PME
,
ff
.
LJPME
,
ff
.
Ewald
,
ff
.
CutoffPeriodic
)):
cforce
.
setNonbondedMethod
(
cforce
.
CutoffPeriodic
)
cforce
.
setCutoffDistance
(
nonbondedCutoff
)
cforce
.
setUseLongRangeCorrection
(
True
)
...
...
wrappers/python/simtk/openmm/app/desmonddmsfile.py
View file @
c9fcabb5
...
...
@@ -165,11 +165,11 @@ class DesmondDMSFile(object):
----------
nonbondedMethod : object=NoCutoff
The method to use for nonbonded interactions. Allowed values are
NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald, or PME.
NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald,
PME,
or
LJ
PME.
nonbondedCutoff : distance=1*nanometer
The cutoff distance to use for nonbonded interactions
ewaldErrorTolerance : float=0.0005
The error tolerance to use if nonbondedMethod is Ewald or PME.
The error tolerance to use if nonbondedMethod is Ewald
, PME,
or
LJ
PME.
removeCMMotion : boolean=True
If true, a CMMotionRemover will be added to the System
hydrogenMass : mass=None
...
...
@@ -185,7 +185,7 @@ class DesmondDMSFile(object):
boxSize
=
self
.
topology
.
getUnitCellDimensions
()
if
boxSize
is
not
None
:
sys
.
setDefaultPeriodicBoxVectors
((
boxSize
[
0
],
0
,
0
),
(
0
,
boxSize
[
1
],
0
),
(
0
,
0
,
boxSize
[
2
]))
elif
nonbondedMethod
in
(
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
):
elif
nonbondedMethod
in
(
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
,
ff
.
LJPME
):
raise
ValueError
(
'Illegal nonbonded method for a non-periodic system'
)
# Create all of the particles
...
...
@@ -207,7 +207,8 @@ class DesmondDMSFile(object):
ff
.
CutoffNonPeriodic
:
mm
.
NonbondedForce
.
CutoffNonPeriodic
,
ff
.
CutoffPeriodic
:
mm
.
NonbondedForce
.
CutoffPeriodic
,
ff
.
Ewald
:
mm
.
NonbondedForce
.
Ewald
,
ff
.
PME
:
mm
.
NonbondedForce
.
PME
}
ff
.
PME
:
mm
.
NonbondedForce
.
PME
,
ff
.
LJPME
:
mm
.
NonbondedForce
.
LJPME
}
nb
.
setNonbondedMethod
(
methodMap
[
nonbondedMethod
])
nb
.
setCutoffDistance
(
nonbondedCutoff
)
nb
.
setEwaldErrorTolerance
(
ewaldErrorTolerance
)
...
...
wrappers/python/simtk/openmm/app/forcefield.py
View file @
c9fcabb5
...
...
@@ -115,6 +115,11 @@ class PME(Singleton):
return
'PME'
PME
=
PME
()
class
LJPME
(
Singleton
):
def
__repr__
(
self
):
return
'LJPME'
LJPME
=
LJPME
()
# Enumerated values for constraint type
class
HBonds
(
Singleton
):
...
...
@@ -971,7 +976,7 @@ class ForceField(object):
The Topology for which to create a System
nonbondedMethod : object=NoCutoff
The method to use for nonbonded interactions. Allowed values are
NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald, or PME.
NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald,
PME,
or
LJ
PME.
nonbondedCutoff : distance=1*nanometer
The cutoff distance to use for nonbonded interactions
constraints : object=None
...
...
@@ -2195,7 +2200,8 @@ class NonbondedGenerator(object):
CutoffNonPeriodic
:
mm
.
NonbondedForce
.
CutoffNonPeriodic
,
CutoffPeriodic
:
mm
.
NonbondedForce
.
CutoffPeriodic
,
Ewald
:
mm
.
NonbondedForce
.
Ewald
,
PME
:
mm
.
NonbondedForce
.
PME
}
PME
:
mm
.
NonbondedForce
.
PME
,
LJPME
:
mm
.
NonbondedForce
.
LJPME
}
if
nonbondedMethod
not
in
methodMap
:
raise
ValueError
(
'Illegal nonbonded method for NonbondedForce'
)
force
=
mm
.
NonbondedForce
()
...
...
@@ -2307,7 +2313,7 @@ class LennardJonesGenerator(object):
self
.
force
.
addTabulatedFunction
(
'acoef'
,
mm
.
Discrete2DFunction
(
numLjTypes
,
numLjTypes
,
acoef
))
self
.
force
.
addTabulatedFunction
(
'bcoef'
,
mm
.
Discrete2DFunction
(
numLjTypes
,
numLjTypes
,
bcoef
))
self
.
force
.
addPerParticleParameter
(
'type'
)
if
nonbondedMethod
in
[
CutoffPeriodic
,
Ewald
,
PME
]:
if
nonbondedMethod
in
[
CutoffPeriodic
,
Ewald
,
PME
,
LJPME
]:
self
.
force
.
setNonbondedMethod
(
mm
.
CustomNonbondedForce
.
CutoffPeriodic
)
elif
nonbondedMethod
is
NoCutoff
:
self
.
force
.
setNonbondedMethod
(
mm
.
CustomNonbondedForce
.
NoCutoff
)
...
...
wrappers/python/simtk/openmm/app/gromacstopfile.py
View file @
c9fcabb5
...
...
@@ -552,7 +552,7 @@ class GromacsTopFile(object):
----------
nonbondedMethod : object=NoCutoff
The method to use for nonbonded interactions. Allowed values are
NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald, or PME.
NoCutoff, CutoffNonPeriodic, CutoffPeriodic, Ewald,
PME,
or
LJ
PME.
nonbondedCutoff : distance=1*nanometer
The cutoff distance to use for nonbonded interactions
constraints : object=None
...
...
@@ -570,7 +570,7 @@ class GromacsTopFile(object):
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.
The error tolerance to use if nonbondedMethod is Ewald
, PME,
or
LJ
PME.
removeCMMotion : boolean=True
If true, a CMMotionRemover will be added to the System
hydrogenMass : mass=None
...
...
@@ -589,7 +589,7 @@ class GromacsTopFile(object):
boxVectors
=
self
.
topology
.
getPeriodicBoxVectors
()
if
boxVectors
is
not
None
:
sys
.
setDefaultPeriodicBoxVectors
(
*
boxVectors
)
elif
nonbondedMethod
in
(
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
):
elif
nonbondedMethod
in
(
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
,
ff
.
LJPME
):
raise
ValueError
(
'Illegal nonbonded method for a non-periodic system'
)
nb
=
mm
.
NonbondedForce
()
sys
.
addForce
(
nb
)
...
...
@@ -877,7 +877,8 @@ class GromacsTopFile(object):
ff
.
CutoffNonPeriodic
:
mm
.
NonbondedForce
.
CutoffNonPeriodic
,
ff
.
CutoffPeriodic
:
mm
.
NonbondedForce
.
CutoffPeriodic
,
ff
.
Ewald
:
mm
.
NonbondedForce
.
Ewald
,
ff
.
PME
:
mm
.
NonbondedForce
.
PME
}
ff
.
PME
:
mm
.
NonbondedForce
.
PME
,
ff
.
LJPME
:
mm
.
NonbondedForce
.
LJPME
}
nb
.
setNonbondedMethod
(
methodMap
[
nonbondedMethod
])
nb
.
setCutoffDistance
(
nonbondedCutoff
)
nb
.
setEwaldErrorTolerance
(
ewaldErrorTolerance
)
...
...
wrappers/python/simtk/openmm/app/internal/amber_file_parser.py
View file @
c9fcabb5
...
...
@@ -776,6 +776,8 @@ def readAmberSystem(topology, prmtop_filename=None, prmtop_loader=None, shake=No
force
.
setNonbondedMethod
(
mm
.
NonbondedForce
.
Ewald
)
elif
nonbondedMethod
==
'PME'
:
force
.
setNonbondedMethod
(
mm
.
NonbondedForce
.
PME
)
elif
nonbondedMethod
==
'LJPME'
:
force
.
setNonbondedMethod
(
mm
.
NonbondedForce
.
LJPME
)
else
:
raise
Exception
(
"Cutoff method not understood."
)
...
...
@@ -885,7 +887,7 @@ def readAmberSystem(topology, prmtop_filename=None, prmtop_loader=None, shake=No
ii
,
jj
,
chg
,
sig
,
eps
=
force
.
getExceptionParameters
(
i
)
cforce
.
addExclusion
(
ii
,
jj
)
# Now set the various properties based on the NonbondedForce object
if
nonbondedMethod
in
(
'PME'
,
'Ewald'
,
'CutoffPeriodic'
):
if
nonbondedMethod
in
(
'PME'
,
'LJPME'
,
'Ewald'
,
'CutoffPeriodic'
):
cforce
.
setNonbondedMethod
(
cforce
.
CutoffPeriodic
)
cforce
.
setCutoffDistance
(
nonbondedCutoff
)
cforce
.
setUseLongRangeCorrection
(
True
)
...
...
wrappers/python/tests/TestAPIUnits.py
View file @
c9fcabb5
...
...
@@ -186,6 +186,8 @@ class TestAPIUnits(unittest.TestCase):
self
.
assertTrue
(
force
.
usesPeriodicBoundaryConditions
())
force
.
setNonbondedMethod
(
NonbondedForce
.
PME
)
self
.
assertTrue
(
force
.
usesPeriodicBoundaryConditions
())
force
.
setNonbondedMethod
(
NonbondedForce
.
LJPME
)
self
.
assertTrue
(
force
.
usesPeriodicBoundaryConditions
())
def
testCmapForce
(
self
):
""" Tests the CMAPTorsionForce API features """
...
...
wrappers/python/tests/TestAmberPrmtopFile.py
View file @
c9fcabb5
...
...
@@ -21,12 +21,14 @@ class TestAmberPrmtopFile(unittest.TestCase):
"""Test the AmberPrmtopFile.createSystem() method."""
def
test_NonbondedMethod
(
self
):
"""Test all
five
options for the nonbondedMethod parameter."""
"""Test all
six
options for the nonbondedMethod parameter."""
methodMap
=
{
NoCutoff
:
NonbondedForce
.
NoCutoff
,
CutoffNonPeriodic
:
NonbondedForce
.
CutoffNonPeriodic
,
CutoffPeriodic
:
NonbondedForce
.
CutoffPeriodic
,
Ewald
:
NonbondedForce
.
Ewald
,
PME
:
NonbondedForce
.
PME
}
Ewald
:
NonbondedForce
.
Ewald
,
PME
:
NonbondedForce
.
PME
,
LJPME
:
NonbondedForce
.
LJPME
}
for
method
in
methodMap
:
system
=
prmtop1
.
createSystem
(
nonbondedMethod
=
method
)
forces
=
system
.
getForces
()
...
...
@@ -37,7 +39,7 @@ class TestAmberPrmtopFile(unittest.TestCase):
def
test_Cutoff
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
for
method
in
[
CutoffNonPeriodic
,
CutoffPeriodic
,
Ewald
,
PME
]:
for
method
in
[
CutoffNonPeriodic
,
CutoffPeriodic
,
Ewald
,
PME
,
LJPME
]:
system
=
prmtop1
.
createSystem
(
nonbondedMethod
=
method
,
nonbondedCutoff
=
2
*
nanometer
,
constraints
=
HBonds
)
...
...
@@ -51,7 +53,7 @@ class TestAmberPrmtopFile(unittest.TestCase):
def
test_EwaldErrorTolerance
(
self
):
"""Test to make sure the ewaldErrorTolerance parameter is passed correctly."""
for
method
in
[
Ewald
,
PME
]:
for
method
in
[
Ewald
,
PME
,
LJPME
]:
system
=
prmtop1
.
createSystem
(
nonbondedMethod
=
method
,
ewaldErrorTolerance
=
1e-6
,
constraints
=
HBonds
)
...
...
wrappers/python/tests/TestDesmondDMSFile.py
View file @
c9fcabb5
...
...
@@ -14,12 +14,14 @@ class TestDesmondDMSFile(unittest.TestCase):
self
.
dms
=
DesmondDMSFile
(
path
)
def
test_NonbondedMethod
(
self
):
"""Test all
five
options for the nonbondedMethod parameter."""
"""Test all
six
options for the nonbondedMethod parameter."""
methodMap
=
{
NoCutoff
:
NonbondedForce
.
NoCutoff
,
CutoffNonPeriodic
:
NonbondedForce
.
CutoffNonPeriodic
,
CutoffPeriodic
:
NonbondedForce
.
CutoffPeriodic
,
Ewald
:
NonbondedForce
.
Ewald
,
PME
:
NonbondedForce
.
PME
}
Ewald
:
NonbondedForce
.
Ewald
,
PME
:
NonbondedForce
.
PME
,
LJPME
:
NonbondedForce
.
LJPME
}
for
method
in
methodMap
:
system
=
self
.
dms
.
createSystem
(
nonbondedMethod
=
method
)
forces
=
system
.
getForces
()
...
...
@@ -30,7 +32,7 @@ class TestDesmondDMSFile(unittest.TestCase):
def
test_Cutoff
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
for
method
in
[
CutoffNonPeriodic
,
CutoffPeriodic
,
Ewald
,
PME
]:
for
method
in
[
CutoffNonPeriodic
,
CutoffPeriodic
,
Ewald
,
PME
,
LJPME
]:
system
=
self
.
dms
.
createSystem
(
nonbondedMethod
=
method
,
nonbondedCutoff
=
2
*
nanometer
)
cutoff_distance
=
0.0
*
nanometer
...
...
@@ -43,7 +45,7 @@ class TestDesmondDMSFile(unittest.TestCase):
def
test_EwaldErrorTolerance
(
self
):
"""Test to make sure the ewaldErrorTolerance parameter is passed correctly."""
for
method
in
[
Ewald
,
PME
]:
for
method
in
[
Ewald
,
PME
,
LJPME
]:
system
=
self
.
dms
.
createSystem
(
nonbondedMethod
=
method
,
ewaldErrorTolerance
=
1e-6
)
tolerance
=
0
...
...
wrappers/python/tests/TestForceField.py
View file @
c9fcabb5
...
...
@@ -33,12 +33,14 @@ class TestForceField(unittest.TestCase):
def
test_NonbondedMethod
(
self
):
"""Test all
five
options for the nonbondedMethod parameter."""
"""Test all
six
options for the nonbondedMethod parameter."""
methodMap
=
{
NoCutoff
:
NonbondedForce
.
NoCutoff
,
CutoffNonPeriodic
:
NonbondedForce
.
CutoffNonPeriodic
,
CutoffPeriodic
:
NonbondedForce
.
CutoffPeriodic
,
Ewald
:
NonbondedForce
.
Ewald
,
PME
:
NonbondedForce
.
PME
}
Ewald
:
NonbondedForce
.
Ewald
,
PME
:
NonbondedForce
.
PME
,
LJPME
:
NonbondedForce
.
LJPME
}
for
method
in
methodMap
:
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
nonbondedMethod
=
method
)
...
...
@@ -62,7 +64,7 @@ class TestForceField(unittest.TestCase):
def
test_Cutoff
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
for
method
in
[
CutoffNonPeriodic
,
CutoffPeriodic
,
Ewald
,
PME
]:
for
method
in
[
CutoffNonPeriodic
,
CutoffPeriodic
,
Ewald
,
PME
,
LJPME
]:
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
nonbondedMethod
=
method
,
nonbondedCutoff
=
2
*
nanometer
,
...
...
@@ -776,7 +778,7 @@ class AmoebaTestForceField(unittest.TestCase):
def
test_NonbondedMethod
(
self
):
"""Test
all five
options for the nonbondedMethod parameter."""
"""Test
both
options for the nonbondedMethod parameter."""
methodMap
=
{
NoCutoff
:
AmoebaMultipoleForce
.
NoCutoff
,
PME
:
AmoebaMultipoleForce
.
PME
}
...
...
wrappers/python/tests/TestGromacsTopFile.py
View file @
c9fcabb5
...
...
@@ -22,12 +22,14 @@ class TestGromacsTopFile(unittest.TestCase):
self
.
top2
=
GromacsTopFile
(
'systems/implicit.top'
)
def
test_NonbondedMethod
(
self
):
"""Test all
five
options for the nonbondedMethod parameter."""
"""Test all
six
options for the nonbondedMethod parameter."""
methodMap
=
{
NoCutoff
:
NonbondedForce
.
NoCutoff
,
CutoffNonPeriodic
:
NonbondedForce
.
CutoffNonPeriodic
,
CutoffPeriodic
:
NonbondedForce
.
CutoffPeriodic
,
Ewald
:
NonbondedForce
.
Ewald
,
PME
:
NonbondedForce
.
PME
}
Ewald
:
NonbondedForce
.
Ewald
,
PME
:
NonbondedForce
.
PME
,
LJPME
:
NonbondedForce
.
LJPME
}
for
method
in
methodMap
:
system
=
self
.
top1
.
createSystem
(
nonbondedMethod
=
method
)
forces
=
system
.
getForces
()
...
...
@@ -52,7 +54,7 @@ class TestGromacsTopFile(unittest.TestCase):
def
test_Cutoff
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
for
method
in
[
CutoffNonPeriodic
,
CutoffPeriodic
,
Ewald
,
PME
]:
for
method
in
[
CutoffNonPeriodic
,
CutoffPeriodic
,
Ewald
,
PME
,
LJPME
]:
system
=
self
.
top1
.
createSystem
(
nonbondedMethod
=
method
,
nonbondedCutoff
=
2
*
nanometer
,
constraints
=
HBonds
)
...
...
@@ -66,7 +68,7 @@ class TestGromacsTopFile(unittest.TestCase):
def
test_EwaldErrorTolerance
(
self
):
"""Test to make sure the ewaldErrorTolerance parameter is passed correctly."""
for
method
in
[
Ewald
,
PME
]:
for
method
in
[
Ewald
,
PME
,
LJPME
]:
system
=
self
.
top1
.
createSystem
(
nonbondedMethod
=
method
,
ewaldErrorTolerance
=
1e-6
,
constraints
=
HBonds
)
...
...
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