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
4c6cf680
Unverified
Commit
4c6cf680
authored
Mar 10, 2021
by
Peter Eastman
Committed by
GitHub
Mar 10, 2021
Browse files
Added name property to Forces (#3049)
parent
7c2e5991
Changes
67
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
0 deletions
+20
-0
serialization/tests/TestSerializeMonteCarloBarostat.cpp
serialization/tests/TestSerializeMonteCarloBarostat.cpp
+2
-0
serialization/tests/TestSerializeMonteCarloMembraneBarostat.cpp
...ization/tests/TestSerializeMonteCarloMembraneBarostat.cpp
+2
-0
serialization/tests/TestSerializeNonbondedForce.cpp
serialization/tests/TestSerializeNonbondedForce.cpp
+2
-0
serialization/tests/TestSerializePeriodicTorsionForce.cpp
serialization/tests/TestSerializePeriodicTorsionForce.cpp
+2
-0
serialization/tests/TestSerializeRBTorsionForce.cpp
serialization/tests/TestSerializeRBTorsionForce.cpp
+2
-0
serialization/tests/TestSerializeRMSDForce.cpp
serialization/tests/TestSerializeRMSDForce.cpp
+2
-0
wrappers/python/openmm/app/forcefield.py
wrappers/python/openmm/app/forcefield.py
+8
-0
No files found.
serialization/tests/TestSerializeMonteCarloBarostat.cpp
View file @
4c6cf680
...
...
@@ -43,6 +43,7 @@ void testSerialization() {
MonteCarloBarostat
force
(
25.5
,
250.0
,
14
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setRandomNumberSeed
(
3
);
// Serialize and then deserialize it.
...
...
@@ -55,6 +56,7 @@ void testSerialization() {
MonteCarloBarostat
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getDefaultPressure
(),
force2
.
getDefaultPressure
());
ASSERT_EQUAL
(
force
.
getDefaultTemperature
(),
force2
.
getDefaultTemperature
());
ASSERT_EQUAL
(
force
.
getFrequency
(),
force2
.
getFrequency
());
...
...
serialization/tests/TestSerializeMonteCarloMembraneBarostat.cpp
View file @
4c6cf680
...
...
@@ -43,6 +43,7 @@ void testSerialization() {
MonteCarloMembraneBarostat
force
(
25.5
,
11.2
,
250.0
,
MonteCarloMembraneBarostat
::
XYAnisotropic
,
MonteCarloMembraneBarostat
::
ZFixed
,
14
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setRandomNumberSeed
(
3
);
// Serialize and then deserialize it.
...
...
@@ -55,6 +56,7 @@ void testSerialization() {
MonteCarloMembraneBarostat
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getDefaultPressure
(),
force2
.
getDefaultPressure
());
ASSERT_EQUAL
(
force
.
getDefaultSurfaceTension
(),
force2
.
getDefaultSurfaceTension
());
ASSERT_EQUAL
(
force
.
getDefaultTemperature
(),
force2
.
getDefaultTemperature
());
...
...
serialization/tests/TestSerializeNonbondedForce.cpp
View file @
4c6cf680
...
...
@@ -43,6 +43,7 @@ void testSerialization() {
NonbondedForce
force
;
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
setNonbondedMethod
(
NonbondedForce
::
CutoffPeriodic
);
force
.
setSwitchingDistance
(
1.5
);
force
.
setUseSwitchingFunction
(
true
);
...
...
@@ -77,6 +78,7 @@ void testSerialization() {
NonbondedForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getNonbondedMethod
(),
force2
.
getNonbondedMethod
());
ASSERT_EQUAL
(
force
.
getSwitchingDistance
(),
force2
.
getSwitchingDistance
());
ASSERT_EQUAL
(
force
.
getUseSwitchingFunction
(),
force2
.
getUseSwitchingFunction
());
...
...
serialization/tests/TestSerializePeriodicTorsionForce.cpp
View file @
4c6cf680
...
...
@@ -43,6 +43,7 @@ void testSerialization() {
PeriodicTorsionForce
force
;
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addTorsion
(
0
,
1
,
2
,
3
,
2
,
1.0
,
2.0
);
force
.
addTorsion
(
0
,
2
,
3
,
4
,
2
,
2.0
,
2.1
);
force
.
addTorsion
(
2
,
3
,
4
,
7
,
1
,
3.0
,
2.2
);
...
...
@@ -59,6 +60,7 @@ void testSerialization() {
PeriodicTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumTorsions
(),
force2
.
getNumTorsions
());
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
...
...
serialization/tests/TestSerializeRBTorsionForce.cpp
View file @
4c6cf680
...
...
@@ -43,6 +43,7 @@ void testSerialization() {
RBTorsionForce
force
;
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
force
.
addTorsion
(
0
,
1
,
2
,
3
,
0.1
,
0.2
,
0.3
,
0.4
,
0.5
,
0.6
);
force
.
addTorsion
(
0
,
2
,
3
,
4
,
0.2
,
0.3
,
0.4
,
0.5
,
0.6
,
0.7
);
force
.
addTorsion
(
2
,
3
,
4
,
7
,
-
1
,
-
2
,
-
3
,
1.1
,
2.2
,
3.3
);
...
...
@@ -58,6 +59,7 @@ void testSerialization() {
RBTorsionForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force
.
getNumTorsions
(),
force2
.
getNumTorsions
());
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
...
...
serialization/tests/TestSerializeRMSDForce.cpp
View file @
4c6cf680
...
...
@@ -49,6 +49,7 @@ void testSerialization() {
particles
.
push_back
(
i
*
i
);
RMSDForce
force
(
refPos
,
particles
);
force
.
setForceGroup
(
3
);
force
.
setName
(
"custom name"
);
// Serialize and then deserialize it.
...
...
@@ -60,6 +61,7 @@ void testSerialization() {
RMSDForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force
.
getName
(),
force2
.
getName
());
ASSERT_EQUAL
(
force
.
getReferencePositions
().
size
(),
force2
.
getReferencePositions
().
size
());
for
(
int
i
=
0
;
i
<
force
.
getReferencePositions
().
size
();
i
++
)
ASSERT_EQUAL_VEC
(
force
.
getReferencePositions
()[
i
],
force2
.
getReferencePositions
()[
i
],
0.0
);
...
...
wrappers/python/openmm/app/forcefield.py
View file @
4c6cf680
...
...
@@ -2569,6 +2569,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'
)
self
.
force
.
setName
(
'LennardJones'
)
if
nonbondedMethod
in
[
CutoffPeriodic
,
Ewald
,
PME
,
LJPME
]:
self
.
force
.
setNonbondedMethod
(
mm
.
CustomNonbondedForce
.
CutoffPeriodic
)
elif
nonbondedMethod
is
NoCutoff
:
...
...
@@ -2614,6 +2615,7 @@ class LennardJonesGenerator(object):
bonded
=
mm
.
CustomBondForce
(
'%g*epsilon*((sigma/r)^12-(sigma/r)^6)'
%
(
4
*
self
.
lj14scale
))
bonded
.
addPerBondParameter
(
'sigma'
)
bonded
.
addPerBondParameter
(
'epsilon'
)
bonded
.
setName
(
'LennardJones14'
)
sys
.
addForce
(
bonded
)
skip
=
set
(
tuple
(
forceCopy
.
getExclusionParticles
(
i
))
for
i
in
range
(
forceCopy
.
getNumExclusions
()))
for
i
in
range
(
self
.
force
.
getNumExclusions
()):
...
...
@@ -3340,6 +3342,7 @@ class AmoebaBondGenerator(object):
force
=
mm
.
CustomBondForce
(
energy
)
force
.
addPerBondParameter
(
'r0'
)
force
.
addPerBondParameter
(
'k'
)
force
.
setName
(
'AmoebaBond'
)
sys
.
addForce
(
force
)
else
:
force
=
existing
[
0
]
...
...
@@ -3474,6 +3477,7 @@ class AmoebaAngleGenerator(object):
force
=
mm
.
CustomAngleForce
(
energy
)
force
.
addPerAngleParameter
(
'theta0'
)
force
.
addPerAngleParameter
(
'k'
)
force
.
setName
(
'AmoebaAngle'
)
sys
.
addForce
(
force
)
else
:
force
=
existing
[
0
]
...
...
@@ -3543,6 +3547,7 @@ class AmoebaAngleGenerator(object):
force
=
mm
.
CustomCompoundBondForce
(
4
,
energy
)
force
.
addPerBondParameter
(
"theta0"
)
force
.
addPerBondParameter
(
"k"
)
force
.
setName
(
'AmoebaInPlaneAngle'
)
sys
.
addForce
(
force
)
else
:
force
=
existing
[
0
]
...
...
@@ -3706,6 +3711,7 @@ class AmoebaOutOfPlaneBendGenerator(object):
if
len
(
existing
)
==
0
:
force
=
mm
.
CustomCompoundBondForce
(
4
,
energy
)
force
.
addPerBondParameter
(
"k"
)
force
.
setName
(
'AmoebaOutOfPlaneBend'
)
sys
.
addForce
(
force
)
else
:
force
=
existing
[
0
]
...
...
@@ -4014,6 +4020,7 @@ class AmoebaPiTorsionGenerator(object):
if
len
(
existing
)
==
0
:
force
=
mm
.
CustomCompoundBondForce
(
6
,
energy
)
force
.
addPerBondParameter
(
'k'
)
force
.
setName
(
'AmoebaPiTorsion'
)
sys
.
addForce
(
force
)
else
:
force
=
existing
[
0
]
...
...
@@ -4398,6 +4405,7 @@ class AmoebaStretchBendGenerator(object):
force
.
addPerBondParameter
(
"theta0"
)
force
.
addPerBondParameter
(
"k1"
)
force
.
addPerBondParameter
(
"k2"
)
force
.
setName
(
'AmoebaStretchBend'
)
sys
.
addForce
(
force
)
else
:
force
=
existing
[
0
]
...
...
Prev
1
2
3
4
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