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
a87df3ad
Commit
a87df3ad
authored
Jul 02, 2014
by
peastman
Browse files
Merged upstream changes
parents
1c604fe4
9db70803
Changes
27
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
732 additions
and
9 deletions
+732
-9
plugins/amoeba/platforms/cuda/src/kernels/multipoleFixedField.cu
.../amoeba/platforms/cuda/src/kernels/multipoleFixedField.cu
+2
-2
plugins/amoeba/platforms/cuda/src/kernels/multipoleInducedField.cu
...moeba/platforms/cuda/src/kernels/multipoleInducedField.cu
+2
-2
plugins/amoeba/platforms/cuda/src/kernels/pmeMultipoleElectrostatics.cu
.../platforms/cuda/src/kernels/pmeMultipoleElectrostatics.cu
+2
-2
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+3
-1
wrappers/python/simtk/openmm/app/gromacstopfile.py
wrappers/python/simtk/openmm/app/gromacstopfile.py
+1
-1
wrappers/python/tests/TestForceField.py
wrappers/python/tests/TestForceField.py
+70
-1
wrappers/python/tests/systems/amoeba-ion-in-water.pdb
wrappers/python/tests/systems/amoeba-ion-in-water.pdb
+652
-0
No files found.
plugins/amoeba/platforms/cuda/src/kernels/multipoleFixedField.cu
View file @
a87df3ad
...
@@ -599,14 +599,14 @@ extern "C" __global__ void computeFixedField(
...
@@ -599,14 +599,14 @@ extern "C" __global__ void computeFixedField(
// Extract the coordinates of this tile.
// Extract the coordinates of this tile.
unsigned
int
x
,
y
;
int
x
,
y
;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
if
(
numTiles
<=
maxTiles
)
if
(
numTiles
<=
maxTiles
)
x
=
tiles
[
pos
];
x
=
tiles
[
pos
];
else
else
#endif
#endif
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS
+
0.5
f
-
SQRT
((
NUM_BLOCKS
+
0.5
f
)
*
(
NUM_BLOCKS
+
0.5
f
)
-
2
*
pos
));
y
=
(
int
)
floor
(
NUM_BLOCKS
+
0.5
f
-
SQRT
((
NUM_BLOCKS
+
0.5
f
)
*
(
NUM_BLOCKS
+
0.5
f
)
-
2
*
pos
));
x
=
(
pos
-
y
*
NUM_BLOCKS
+
y
*
(
y
+
1
)
/
2
);
x
=
(
pos
-
y
*
NUM_BLOCKS
+
y
*
(
y
+
1
)
/
2
);
if
(
x
<
y
||
x
>=
NUM_BLOCKS
)
{
// Occasionally happens due to roundoff error.
if
(
x
<
y
||
x
>=
NUM_BLOCKS
)
{
// Occasionally happens due to roundoff error.
y
+=
(
x
<
y
?
-
1
:
1
);
y
+=
(
x
<
y
?
-
1
:
1
);
...
...
plugins/amoeba/platforms/cuda/src/kernels/multipoleInducedField.cu
View file @
a87df3ad
...
@@ -337,14 +337,14 @@ extern "C" __global__ void computeInducedField(
...
@@ -337,14 +337,14 @@ extern "C" __global__ void computeInducedField(
// Extract the coordinates of this tile.
// Extract the coordinates of this tile.
unsigned
int
x
,
y
;
int
x
,
y
;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
if
(
numTiles
<=
maxTiles
)
if
(
numTiles
<=
maxTiles
)
x
=
tiles
[
pos
];
x
=
tiles
[
pos
];
else
else
#endif
#endif
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS
+
0.5
f
-
SQRT
((
NUM_BLOCKS
+
0.5
f
)
*
(
NUM_BLOCKS
+
0.5
f
)
-
2
*
pos
));
y
=
(
int
)
floor
(
NUM_BLOCKS
+
0.5
f
-
SQRT
((
NUM_BLOCKS
+
0.5
f
)
*
(
NUM_BLOCKS
+
0.5
f
)
-
2
*
pos
));
x
=
(
pos
-
y
*
NUM_BLOCKS
+
y
*
(
y
+
1
)
/
2
);
x
=
(
pos
-
y
*
NUM_BLOCKS
+
y
*
(
y
+
1
)
/
2
);
if
(
x
<
y
||
x
>=
NUM_BLOCKS
)
{
// Occasionally happens due to roundoff error.
if
(
x
<
y
||
x
>=
NUM_BLOCKS
)
{
// Occasionally happens due to roundoff error.
y
+=
(
x
<
y
?
-
1
:
1
);
y
+=
(
x
<
y
?
-
1
:
1
);
...
...
plugins/amoeba/platforms/cuda/src/kernels/pmeMultipoleElectrostatics.cu
View file @
a87df3ad
...
@@ -321,14 +321,14 @@ extern "C" __global__ void computeElectrostatics(
...
@@ -321,14 +321,14 @@ extern "C" __global__ void computeElectrostatics(
// Extract the coordinates of this tile.
// Extract the coordinates of this tile.
unsigned
int
x
,
y
;
int
x
,
y
;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
if
(
numTiles
<=
maxTiles
)
if
(
numTiles
<=
maxTiles
)
x
=
tiles
[
pos
];
x
=
tiles
[
pos
];
else
else
#endif
#endif
{
{
y
=
(
unsigned
int
)
floor
(
NUM_BLOCKS
+
0.5
f
-
SQRT
((
NUM_BLOCKS
+
0.5
f
)
*
(
NUM_BLOCKS
+
0.5
f
)
-
2
*
pos
));
y
=
(
int
)
floor
(
NUM_BLOCKS
+
0.5
f
-
SQRT
((
NUM_BLOCKS
+
0.5
f
)
*
(
NUM_BLOCKS
+
0.5
f
)
-
2
*
pos
));
x
=
(
pos
-
y
*
NUM_BLOCKS
+
y
*
(
y
+
1
)
/
2
);
x
=
(
pos
-
y
*
NUM_BLOCKS
+
y
*
(
y
+
1
)
/
2
);
if
(
x
<
y
||
x
>=
NUM_BLOCKS
)
{
// Occasionally happens due to roundoff error.
if
(
x
<
y
||
x
>=
NUM_BLOCKS
)
{
// Occasionally happens due to roundoff error.
y
+=
(
x
<
y
?
-
1
:
1
);
y
+=
(
x
<
y
?
-
1
:
1
);
...
...
wrappers/python/simtk/openmm/app/forcefield.py
View file @
a87df3ad
...
@@ -1107,6 +1107,8 @@ class NonbondedGenerator:
...
@@ -1107,6 +1107,8 @@ class NonbondedGenerator:
force
.
setCutoffDistance
(
nonbondedCutoff
)
force
.
setCutoffDistance
(
nonbondedCutoff
)
if
'ewaldErrorTolerance'
in
args
:
if
'ewaldErrorTolerance'
in
args
:
force
.
setEwaldErrorTolerance
(
args
[
'ewaldErrorTolerance'
])
force
.
setEwaldErrorTolerance
(
args
[
'ewaldErrorTolerance'
])
if
'useDispersionCorrection'
in
args
:
force
.
setUseDispersionCorrection
(
bool
(
args
[
'useDispersionCorrection'
]))
sys
.
addForce
(
force
)
sys
.
addForce
(
force
)
def
postprocessSystem
(
self
,
sys
,
data
,
args
):
def
postprocessSystem
(
self
,
sys
,
data
,
args
):
...
@@ -3037,7 +3039,7 @@ class AmoebaVdwGenerator:
...
@@ -3037,7 +3039,7 @@ class AmoebaVdwGenerator:
# dispersion correction
# dispersion correction
if
(
'useDispersionCorrection'
in
args
):
if
(
'useDispersionCorrection'
in
args
):
force
.
setUseDispersionCorrection
(
int
(
args
[
'useDispersionCorrection'
]))
force
.
setUseDispersionCorrection
(
bool
(
args
[
'useDispersionCorrection'
]))
if
(
nonbondedMethod
==
PME
):
if
(
nonbondedMethod
==
PME
):
force
.
setNonbondedMethod
(
mm
.
AmoebaVdwForce
.
CutoffPeriodic
)
force
.
setNonbondedMethod
(
mm
.
AmoebaVdwForce
.
CutoffPeriodic
)
...
...
wrappers/python/simtk/openmm/app/gromacstopfile.py
View file @
a87df3ad
...
@@ -111,7 +111,7 @@ class GromacsTopFile(object):
...
@@ -111,7 +111,7 @@ class GromacsTopFile(object):
if
len
(
fields
)
<
2
:
if
len
(
fields
)
<
2
:
raise
ValueError
(
'Illegal line in .top file: '
+
line
)
raise
ValueError
(
'Illegal line in .top file: '
+
line
)
name
=
fields
[
1
]
name
=
fields
[
1
]
valueStart
=
stripped
.
find
(
name
,
len
(
command
))
+
len
(
name
)
valueStart
=
stripped
.
find
(
name
,
len
(
command
))
+
len
(
name
)
+
1
value
=
line
[
valueStart
:].
strip
()
value
=
line
[
valueStart
:].
strip
()
self
.
_defines
[
name
]
=
value
self
.
_defines
[
name
]
=
value
elif
command
==
'#ifdef'
:
elif
command
==
'#ifdef'
:
...
...
wrappers/python/tests/TestForceField.py
View file @
a87df3ad
...
@@ -19,6 +19,7 @@ class TestForceField(unittest.TestCase):
...
@@ -19,6 +19,7 @@ class TestForceField(unittest.TestCase):
self
.
topology1
=
self
.
pdb1
.
topology
self
.
topology1
=
self
.
pdb1
.
topology
self
.
topology1
.
setUnitCellDimensions
(
Vec3
(
2
,
2
,
2
))
self
.
topology1
.
setUnitCellDimensions
(
Vec3
(
2
,
2
,
2
))
# alalnine dipeptide with implicit water
self
.
pdb2
=
PDBFile
(
'systems/alanine-dipeptide-implicit.pdb'
)
self
.
pdb2
=
PDBFile
(
'systems/alanine-dipeptide-implicit.pdb'
)
self
.
forcefield2
=
ForceField
(
'amber99sb.xml'
,
'amber99_obc.xml'
)
self
.
forcefield2
=
ForceField
(
'amber99sb.xml'
,
'amber99_obc.xml'
)
...
@@ -38,6 +39,18 @@ class TestForceField(unittest.TestCase):
...
@@ -38,6 +39,18 @@ class TestForceField(unittest.TestCase):
f
.
getNonbondedMethod
()
==
methodMap
[
method
]
f
.
getNonbondedMethod
()
==
methodMap
[
method
]
for
f
in
forces
))
for
f
in
forces
))
def
test_DispersionCorrection
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
for
useDispersionCorrection
in
[
True
,
False
]:
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
nonbondedCutoff
=
2
*
nanometer
,
useDispersionCorrection
=
useDispersionCorrection
)
for
force
in
system
.
getForces
():
if
isinstance
(
force
,
NonbondedForce
):
self
.
assertEqual
(
useDispersionCorrection
,
force
.
getUseDispersionCorrection
())
def
test_Cutoff
(
self
):
def
test_Cutoff
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
...
@@ -133,6 +146,62 @@ class TestForceField(unittest.TestCase):
...
@@ -133,6 +146,62 @@ class TestForceField(unittest.TestCase):
for
f1
,
f2
,
in
zip
(
state1
.
getForces
().
value_in_unit
(
kilojoules_per_mole
/
nanometer
),
state2
.
getForces
().
value_in_unit
(
kilojoules_per_mole
/
nanometer
)):
for
f1
,
f2
,
in
zip
(
state1
.
getForces
().
value_in_unit
(
kilojoules_per_mole
/
nanometer
),
state2
.
getForces
().
value_in_unit
(
kilojoules_per_mole
/
nanometer
)):
self
.
assertTrue
(
norm
(
f1
-
f2
)
<
0.1
)
self
.
assertTrue
(
norm
(
f1
-
f2
)
<
0.1
)
class
AmoebaTestForceField
(
unittest
.
TestCase
):
"""Test the ForceField.createSystem() method with the AMOEBA forcefield."""
def
setUp
(
self
):
"""Set up the tests by loading the input pdb files and force field
xml files.
"""
self
.
pdb1
=
PDBFile
(
'systems/amoeba-ion-in-water.pdb'
)
self
.
forcefield1
=
ForceField
(
'amoeba2009.xml'
)
self
.
topology1
=
self
.
pdb1
.
topology
def
test_NonbondedMethod
(
self
):
"""Test all five options for the nonbondedMethod parameter."""
methodMap
=
{
NoCutoff
:
AmoebaMultipoleForce
.
NoCutoff
,
PME
:
AmoebaMultipoleForce
.
PME
}
for
method
in
methodMap
:
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
nonbondedMethod
=
method
)
forces
=
system
.
getForces
()
self
.
assertTrue
(
any
(
isinstance
(
f
,
AmoebaMultipoleForce
)
and
f
.
getNonbondedMethod
()
==
methodMap
[
method
]
for
f
in
forces
))
def
test_Cutoff
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
cutoff_distance
=
0.7
*
nanometer
for
method
in
[
NoCutoff
,
PME
]:
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
nonbondedMethod
=
method
,
nonbondedCutoff
=
cutoff_distance
,
constraints
=
None
)
for
force
in
system
.
getForces
():
if
isinstance
(
force
,
AmoebaVdwForce
):
self
.
assertEqual
(
force
.
getCutoff
(),
cutoff_distance
)
if
isinstance
(
force
,
AmoebaMultipoleForce
):
self
.
assertEqual
(
force
.
getCutoffDistance
(),
cutoff_distance
)
def
test_DispersionCorrection
(
self
):
"""Test to make sure the nonbondedCutoff parameter is passed correctly."""
for
useDispersionCorrection
in
[
True
,
False
]:
system
=
self
.
forcefield1
.
createSystem
(
self
.
pdb1
.
topology
,
nonbondedMethod
=
PME
,
useDispersionCorrection
=
useDispersionCorrection
)
for
force
in
system
.
getForces
():
if
isinstance
(
force
,
AmoebaVdwForce
):
self
.
assertEqual
(
useDispersionCorrection
,
force
.
getUseDispersionCorrection
())
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
wrappers/python/tests/systems/amoeba-ion-in-water.pdb
0 → 100644
View file @
a87df3ad
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
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