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
dca54ec7
Commit
dca54ec7
authored
Jun 30, 2016
by
Saurabh Belsare
Browse files
Merged fork with latest original master
parents
cace5edf
01f9e415
Changes
384
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
343 additions
and
70 deletions
+343
-70
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaInPlaneAngleForce.cpp
.../reference/tests/TestReferenceAmoebaInPlaneAngleForce.cpp
+46
-1
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaOutOfPlaneBendForce.cpp
...eference/tests/TestReferenceAmoebaOutOfPlaneBendForce.cpp
+39
-1
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaPiTorsionForce.cpp
...rms/reference/tests/TestReferenceAmoebaPiTorsionForce.cpp
+37
-1
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaStretchBendForce.cpp
...s/reference/tests/TestReferenceAmoebaStretchBendForce.cpp
+37
-1
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaTorsionTorsionForce.cpp
...eference/tests/TestReferenceAmoebaTorsionTorsionForce.cpp
+40
-1
plugins/amoeba/serialization/src/AmoebaAngleForceProxy.cpp
plugins/amoeba/serialization/src/AmoebaAngleForceProxy.cpp
+10
-4
plugins/amoeba/serialization/src/AmoebaBondForceProxy.cpp
plugins/amoeba/serialization/src/AmoebaBondForceProxy.cpp
+10
-3
plugins/amoeba/serialization/src/AmoebaGeneralizedKirkwoodForceProxy.cpp
...serialization/src/AmoebaGeneralizedKirkwoodForceProxy.cpp
+7
-4
plugins/amoeba/serialization/src/AmoebaInPlaneAngleForceProxy.cpp
...amoeba/serialization/src/AmoebaInPlaneAngleForceProxy.cpp
+10
-4
plugins/amoeba/serialization/src/AmoebaMultipoleForceProxy.cpp
...ns/amoeba/serialization/src/AmoebaMultipoleForceProxy.cpp
+34
-22
plugins/amoeba/serialization/src/AmoebaOutOfPlaneBendForceProxy.cpp
...oeba/serialization/src/AmoebaOutOfPlaneBendForceProxy.cpp
+10
-4
plugins/amoeba/serialization/src/AmoebaPiTorsionForceProxy.cpp
...ns/amoeba/serialization/src/AmoebaPiTorsionForceProxy.cpp
+10
-3
plugins/amoeba/serialization/src/AmoebaStretchBendForceProxy.cpp
.../amoeba/serialization/src/AmoebaStretchBendForceProxy.cpp
+9
-3
plugins/amoeba/serialization/src/AmoebaTorsionTorsionForceProxy.cpp
...oeba/serialization/src/AmoebaTorsionTorsionForceProxy.cpp
+10
-4
plugins/amoeba/serialization/src/AmoebaVdwForceProxy.cpp
plugins/amoeba/serialization/src/AmoebaVdwForceProxy.cpp
+9
-6
plugins/amoeba/serialization/src/AmoebaWcaDispersionForceProxy.cpp
...moeba/serialization/src/AmoebaWcaDispersionForceProxy.cpp
+7
-4
plugins/amoeba/serialization/tests/TestSerializeAmoebaAngleForce.cpp
...eba/serialization/tests/TestSerializeAmoebaAngleForce.cpp
+5
-1
plugins/amoeba/serialization/tests/TestSerializeAmoebaBondForce.cpp
...oeba/serialization/tests/TestSerializeAmoebaBondForce.cpp
+5
-1
plugins/amoeba/serialization/tests/TestSerializeAmoebaGeneralizedKirkwoodForce.cpp
...ion/tests/TestSerializeAmoebaGeneralizedKirkwoodForce.cpp
+3
-1
plugins/amoeba/serialization/tests/TestSerializeAmoebaInPlaneAngleForce.cpp
...ialization/tests/TestSerializeAmoebaInPlaneAngleForce.cpp
+5
-1
No files found.
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaInPlaneAngleForce.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008 Stanford University and the Authors.
*
* Portions copyright (c) 2008
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -354,12 +354,57 @@ void testOneAngle() {
...
@@ -354,12 +354,57 @@ void testOneAngle() {
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaInPlaneAngleForce
,
TOL
,
"testOneInPlaneAngle"
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaInPlaneAngleForce
,
TOL
,
"testOneInPlaneAngle"
);
}
}
void
testPeriodic
()
{
// Create a force that uses periodic boundary conditions.
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
3
,
0
,
0
),
Vec3
(
0
,
3
,
0
),
Vec3
(
0
,
0
,
3
));
int
numberOfParticles
=
4
;
for
(
int
ii
=
0
;
ii
<
numberOfParticles
;
ii
++
)
system
.
addParticle
(
1.0
);
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
AmoebaInPlaneAngleForce
*
amoebaInPlaneAngleForce
=
new
AmoebaInPlaneAngleForce
();
double
angle
=
65.0
;
double
quadraticK
=
1.0
;
double
cubicK
=
0.0e-01
;
double
quarticK
=
0.0e-02
;
double
penticK
=
0.0e-03
;
double
sexticK
=
0.0e-04
;
amoebaInPlaneAngleForce
->
addAngle
(
0
,
1
,
2
,
3
,
angle
,
quadraticK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAngleCubic
(
cubicK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAngleQuartic
(
quarticK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAnglePentic
(
penticK
);
amoebaInPlaneAngleForce
->
setAmoebaGlobalInPlaneAngleSextic
(
sexticK
);
amoebaInPlaneAngleForce
->
setUsesPeriodicBoundaryConditions
(
true
);
system
.
addForce
(
amoebaInPlaneAngleForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"Reference"
));
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
positions
[
0
]
=
Vec3
(
0
,
1
,
0
);
positions
[
1
]
=
Vec3
(
0
,
0
,
0
);
positions
[
2
]
=
Vec3
(
0
,
0
,
1
);
positions
[
3
]
=
Vec3
(
1
,
1
,
1
);
context
.
setPositions
(
positions
);
State
s1
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
// Move one atom to a position that should give identical results.
positions
[
2
]
=
Vec3
(
0
,
0
,
-
2
);
context
.
setPositions
(
positions
);
State
s2
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
ASSERT_EQUAL_TOL
(
s1
.
getPotentialEnergy
(),
s2
.
getPotentialEnergy
(),
1e-5
);
for
(
int
i
=
0
;
i
<
numberOfParticles
;
i
++
)
ASSERT_EQUAL_VEC
(
s1
.
getForces
()[
i
],
s2
.
getForces
()[
i
],
1e-5
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[])
{
int
main
(
int
numberOfArguments
,
char
*
argv
[])
{
try
{
try
{
std
::
cout
<<
"TestReferenceAmoebaInPlaneAngleForce running test..."
<<
std
::
endl
;
std
::
cout
<<
"TestReferenceAmoebaInPlaneAngleForce running test..."
<<
std
::
endl
;
registerAmoebaReferenceKernelFactories
();
registerAmoebaReferenceKernelFactories
();
testOneAngle
();
testOneAngle
();
testPeriodic
();
}
}
catch
(
const
std
::
exception
&
e
)
{
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaOutOfPlaneBendForce.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008 Stanford University and the Authors.
*
* Portions copyright (c) 2008
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -461,12 +461,50 @@ void testOneOutOfPlaneBend2(int setId) {
...
@@ -461,12 +461,50 @@ void testOneOutOfPlaneBend2(int setId) {
}
}
}
}
void
testPeriodic
()
{
// Create a force that uses periodic boundary conditions.
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
3
,
0
,
0
),
Vec3
(
0
,
3
,
0
),
Vec3
(
0
,
0
,
3
));
int
numberOfParticles
=
4
;
for
(
int
ii
=
0
;
ii
<
numberOfParticles
;
ii
++
)
system
.
addParticle
(
1.0
);
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
AmoebaOutOfPlaneBendForce
*
amoebaOutOfPlaneBendForce
=
new
AmoebaOutOfPlaneBendForce
();
amoebaOutOfPlaneBendForce
->
setAmoebaGlobalOutOfPlaneBendCubic
(
-
0.1400000E-01
);
amoebaOutOfPlaneBendForce
->
setAmoebaGlobalOutOfPlaneBendQuartic
(
0.5600000E-04
);
amoebaOutOfPlaneBendForce
->
setAmoebaGlobalOutOfPlaneBendPentic
(
-
0.7000000E-06
);
amoebaOutOfPlaneBendForce
->
setAmoebaGlobalOutOfPlaneBendSextic
(
0.2200000E-07
);
double
kOutOfPlaneBend
=
0.328682196E-01
;
amoebaOutOfPlaneBendForce
->
addOutOfPlaneBend
(
0
,
1
,
2
,
3
,
kOutOfPlaneBend
);
amoebaOutOfPlaneBendForce
->
setUsesPeriodicBoundaryConditions
(
true
);
system
.
addForce
(
amoebaOutOfPlaneBendForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"Reference"
));
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
positions
[
0
]
=
Vec3
(
0
,
0
,
0
);
positions
[
1
]
=
Vec3
(
1
,
0
,
0
);
positions
[
2
]
=
Vec3
(
0
,
1
,
0
);
positions
[
3
]
=
Vec3
(
0
,
0
,
1
);
context
.
setPositions
(
positions
);
State
s1
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
// Move one atom to a position that should give identical results.
positions
[
3
]
=
Vec3
(
0
,
0
,
-
2
);
context
.
setPositions
(
positions
);
State
s2
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
ASSERT_EQUAL_TOL
(
s1
.
getPotentialEnergy
(),
s2
.
getPotentialEnergy
(),
1e-5
);
for
(
int
i
=
0
;
i
<
numberOfParticles
;
i
++
)
ASSERT_EQUAL_VEC
(
s1
.
getForces
()[
i
],
s2
.
getForces
()[
i
],
1e-5
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[])
{
int
main
(
int
numberOfArguments
,
char
*
argv
[])
{
try
{
try
{
std
::
cout
<<
"TestReferenceAmoebaOutOfPlaneBendForce running test..."
<<
std
::
endl
;
std
::
cout
<<
"TestReferenceAmoebaOutOfPlaneBendForce running test..."
<<
std
::
endl
;
registerAmoebaReferenceKernelFactories
();
registerAmoebaReferenceKernelFactories
();
testOneOutOfPlaneBend
();
testOneOutOfPlaneBend
();
testPeriodic
();
//testOneOutOfPlaneBend2(atoi(argv[1]));
//testOneOutOfPlaneBend2(atoi(argv[1]));
//for (int ii = 1; ii <= 6; ii++) {
//for (int ii = 1; ii <= 6; ii++) {
// testOneOutOfPlaneBend2(ii);
// testOneOutOfPlaneBend2(ii);
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaPiTorsionForce.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008 Stanford University and the Authors.
*
* Portions copyright (c) 2008
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -290,12 +290,48 @@ void testOnePiTorsion() {
...
@@ -290,12 +290,48 @@ void testOnePiTorsion() {
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaPiTorsionForce
,
TOL
,
"testOnePiTorsion"
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaPiTorsionForce
,
TOL
,
"testOnePiTorsion"
);
}
}
void
testPeriodic
()
{
// Create a force that uses periodic boundary conditions.
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
3
,
0
,
0
),
Vec3
(
0
,
3
,
0
),
Vec3
(
0
,
0
,
3
));
int
numberOfParticles
=
6
;
for
(
int
ii
=
0
;
ii
<
numberOfParticles
;
ii
++
)
system
.
addParticle
(
1.0
);
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
AmoebaPiTorsionForce
*
amoebaPiTorsionForce
=
new
AmoebaPiTorsionForce
();
double
kTorsion
=
6.85
;
amoebaPiTorsionForce
->
addPiTorsion
(
0
,
1
,
2
,
3
,
4
,
5
,
kTorsion
);
amoebaPiTorsionForce
->
setUsesPeriodicBoundaryConditions
(
true
);
system
.
addForce
(
amoebaPiTorsionForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"Reference"
));
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
positions
[
0
]
=
Vec3
(
0
,
1
,
0
);
positions
[
1
]
=
Vec3
(
0
,
0
,
0
);
positions
[
2
]
=
Vec3
(
0
,
0
,
0.5
);
positions
[
3
]
=
Vec3
(
0.4
,
0.4
,
0.4
);
positions
[
4
]
=
Vec3
(
1
,
0
,
1
);
positions
[
5
]
=
Vec3
(
1
,
1
,
0
);
context
.
setPositions
(
positions
);
State
s1
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
// Move one atom to a position that should give identical results.
positions
[
0
]
=
Vec3
(
0
,
-
2
,
0
);
context
.
setPositions
(
positions
);
State
s2
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
ASSERT_EQUAL_TOL
(
s1
.
getPotentialEnergy
(),
s2
.
getPotentialEnergy
(),
1e-5
);
for
(
int
i
=
0
;
i
<
numberOfParticles
;
i
++
)
ASSERT_EQUAL_VEC
(
s1
.
getForces
()[
i
],
s2
.
getForces
()[
i
],
1e-5
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[])
{
int
main
(
int
numberOfArguments
,
char
*
argv
[])
{
try
{
try
{
std
::
cout
<<
"TestReferenceAmoebaPiTorsionForce running test..."
<<
std
::
endl
;
std
::
cout
<<
"TestReferenceAmoebaPiTorsionForce running test..."
<<
std
::
endl
;
registerAmoebaReferenceKernelFactories
();
registerAmoebaReferenceKernelFactories
();
testOnePiTorsion
();
testOnePiTorsion
();
testPeriodic
();
}
}
catch
(
const
std
::
exception
&
e
)
{
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaStretchBendForce.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008 Stanford University and the Authors.
*
* Portions copyright (c) 2008
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -270,12 +270,48 @@ void testOneStretchBend() {
...
@@ -270,12 +270,48 @@ void testOneStretchBend() {
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaStretchBendForce
,
TOL
,
"testOneStretchBend"
);
compareWithExpectedForceAndEnergy
(
context
,
*
amoebaStretchBendForce
,
TOL
,
"testOneStretchBend"
);
}
}
void
testPeriodic
()
{
// Create a force that uses periodic boundary conditions.
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
3
,
0
,
0
),
Vec3
(
0
,
3
,
0
),
Vec3
(
0
,
0
,
3
));
int
numberOfParticles
=
3
;
for
(
int
ii
=
0
;
ii
<
numberOfParticles
;
ii
++
)
system
.
addParticle
(
1.0
);
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
AmoebaStretchBendForce
*
amoebaStretchBendForce
=
new
AmoebaStretchBendForce
();
double
abLength
=
0.144800000E+01
;
double
cbLength
=
0.101500000E+01
;
double
angleStretchBend
=
0.108500000E+03
*
DegreesToRadians
;
double
kStretchBend
=
1.0
;
amoebaStretchBendForce
->
addStretchBend
(
0
,
1
,
2
,
abLength
,
cbLength
,
angleStretchBend
,
kStretchBend
,
kStretchBend
);
amoebaStretchBendForce
->
setUsesPeriodicBoundaryConditions
(
true
);
system
.
addForce
(
amoebaStretchBendForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"Reference"
));
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
positions
[
0
]
=
Vec3
(
0
,
1
,
0
);
positions
[
1
]
=
Vec3
(
0
,
0
,
0
);
positions
[
2
]
=
Vec3
(
0
,
0
,
1
);
context
.
setPositions
(
positions
);
State
s1
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
// Move one atom to a position that should give identical results.
positions
[
2
]
=
Vec3
(
0
,
0
,
-
2
);
context
.
setPositions
(
positions
);
State
s2
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
ASSERT_EQUAL_TOL
(
s1
.
getPotentialEnergy
(),
s2
.
getPotentialEnergy
(),
1e-5
);
for
(
int
i
=
0
;
i
<
numberOfParticles
;
i
++
)
ASSERT_EQUAL_VEC
(
s1
.
getForces
()[
i
],
s2
.
getForces
()[
i
],
1e-5
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[])
{
int
main
(
int
numberOfArguments
,
char
*
argv
[])
{
try
{
try
{
std
::
cout
<<
"TestReferenceAmoebaStretchBendForce running test..."
<<
std
::
endl
;
std
::
cout
<<
"TestReferenceAmoebaStretchBendForce running test..."
<<
std
::
endl
;
registerAmoebaReferenceKernelFactories
();
registerAmoebaReferenceKernelFactories
();
testOneStretchBend
();
testOneStretchBend
();
testPeriodic
();
}
}
catch
(
const
std
::
exception
&
e
)
{
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaTorsionTorsionForce.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008 Stanford University and the Authors.
*
* Portions copyright (c) 2008
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -2669,6 +2669,44 @@ void testTorsionTorsion(int systemId, bool includeDerivs) {
...
@@ -2669,6 +2669,44 @@ void testTorsionTorsion(int systemId, bool includeDerivs) {
ASSERT_EQUAL_TOL
(
expectedEnergy
,
state
.
getPotentialEnergy
(),
tolerance
);
ASSERT_EQUAL_TOL
(
expectedEnergy
,
state
.
getPotentialEnergy
(),
tolerance
);
}
}
void
testPeriodic
()
{
// Create a force that uses periodic boundary conditions.
System
system
;
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
3
,
0
,
0
),
Vec3
(
0
,
3
,
0
),
Vec3
(
0
,
0
,
3
));
int
numberOfParticles
=
6
;
for
(
int
ii
=
0
;
ii
<
numberOfParticles
;
ii
++
)
system
.
addParticle
(
1.0
);
LangevinIntegrator
integrator
(
0.0
,
0.1
,
0.01
);
AmoebaTorsionTorsionForce
*
amoebaTorsionTorsionForce
=
new
AmoebaTorsionTorsionForce
();
int
chiralCheckAtomIndex
;
int
gridIndex
;
chiralCheckAtomIndex
=
5
;
gridIndex
=
2
;
amoebaTorsionTorsionForce
->
addTorsionTorsion
(
0
,
1
,
2
,
3
,
4
,
chiralCheckAtomIndex
,
0
);
amoebaTorsionTorsionForce
->
setTorsionTorsionGrid
(
0
,
getTorsionGrid
(
gridIndex
,
false
));
amoebaTorsionTorsionForce
->
setUsesPeriodicBoundaryConditions
(
true
);
system
.
addForce
(
amoebaTorsionTorsionForce
);
Context
context
(
system
,
integrator
,
Platform
::
getPlatformByName
(
"Reference"
));
std
::
vector
<
Vec3
>
positions
(
numberOfParticles
);
positions
[
0
]
=
Vec3
(
0
,
1
,
0
);
positions
[
1
]
=
Vec3
(
0
,
0
,
0
);
positions
[
2
]
=
Vec3
(
0
,
0
,
0.5
);
positions
[
3
]
=
Vec3
(
0.4
,
0.4
,
0.4
);
positions
[
4
]
=
Vec3
(
1
,
0
,
1
);
positions
[
5
]
=
Vec3
(
1
,
1
,
0
);
context
.
setPositions
(
positions
);
State
s1
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
// Move one atom to a position that should give identical results.
positions
[
0
]
=
Vec3
(
0
,
-
2
,
0
);
context
.
setPositions
(
positions
);
State
s2
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
ASSERT_EQUAL_TOL
(
s1
.
getPotentialEnergy
(),
s2
.
getPotentialEnergy
(),
1e-5
);
for
(
int
i
=
0
;
i
<
numberOfParticles
;
i
++
)
ASSERT_EQUAL_VEC
(
s1
.
getForces
()[
i
],
s2
.
getForces
()[
i
],
1e-5
);
}
int
main
(
int
numberOfArguments
,
char
*
argv
[])
{
int
main
(
int
numberOfArguments
,
char
*
argv
[])
{
...
@@ -2677,6 +2715,7 @@ int main(int numberOfArguments, char* argv[]) {
...
@@ -2677,6 +2715,7 @@ int main(int numberOfArguments, char* argv[]) {
registerAmoebaReferenceKernelFactories
();
registerAmoebaReferenceKernelFactories
();
testTorsionTorsion
(
1
,
true
);
testTorsionTorsion
(
1
,
true
);
testTorsionTorsion
(
1
,
false
);
testTorsionTorsion
(
1
,
false
);
testPeriodic
();
}
}
catch
(
const
std
::
exception
&
e
)
{
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
...
...
plugins/amoeba/serialization/src/AmoebaAngleForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,10 +42,12 @@ AmoebaAngleForceProxy::AmoebaAngleForceProxy() : SerializationProxy("AmoebaAngle
...
@@ -42,10 +42,12 @@ AmoebaAngleForceProxy::AmoebaAngleForceProxy() : SerializationProxy("AmoebaAngle
}
}
void
AmoebaAngleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaAngleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
3
);
const
AmoebaAngleForce
&
force
=
*
reinterpret_cast
<
const
AmoebaAngleForce
*>
(
object
);
const
AmoebaAngleForce
&
force
=
*
reinterpret_cast
<
const
AmoebaAngleForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
node
.
setDoubleProperty
(
"cubic"
,
force
.
getAmoebaGlobalAngleCubic
());
node
.
setDoubleProperty
(
"cubic"
,
force
.
getAmoebaGlobalAngleCubic
());
node
.
setDoubleProperty
(
"quartic"
,
force
.
getAmoebaGlobalAngleQuartic
());
node
.
setDoubleProperty
(
"quartic"
,
force
.
getAmoebaGlobalAngleQuartic
());
node
.
setDoubleProperty
(
"pentic"
,
force
.
getAmoebaGlobalAnglePentic
());
node
.
setDoubleProperty
(
"pentic"
,
force
.
getAmoebaGlobalAnglePentic
());
...
@@ -61,11 +63,15 @@ void AmoebaAngleForceProxy::serialize(const void* object, SerializationNode& nod
...
@@ -61,11 +63,15 @@ void AmoebaAngleForceProxy::serialize(const void* object, SerializationNode& nod
}
}
void
*
AmoebaAngleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaAngleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
3
)
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaAngleForce
*
force
=
new
AmoebaAngleForce
();
AmoebaAngleForce
*
force
=
new
AmoebaAngleForce
();
try
{
try
{
if
(
version
>
1
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
2
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setAmoebaGlobalAngleCubic
(
node
.
getDoubleProperty
(
"cubic"
));
force
->
setAmoebaGlobalAngleCubic
(
node
.
getDoubleProperty
(
"cubic"
));
force
->
setAmoebaGlobalAngleQuartic
(
node
.
getDoubleProperty
(
"quartic"
));
force
->
setAmoebaGlobalAngleQuartic
(
node
.
getDoubleProperty
(
"quartic"
));
force
->
setAmoebaGlobalAnglePentic
(
node
.
getDoubleProperty
(
"pentic"
));
force
->
setAmoebaGlobalAnglePentic
(
node
.
getDoubleProperty
(
"pentic"
));
...
...
plugins/amoeba/serialization/src/AmoebaBondForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,9 +42,11 @@ AmoebaBondForceProxy::AmoebaBondForceProxy() : SerializationProxy("AmoebaBondFor
...
@@ -42,9 +42,11 @@ AmoebaBondForceProxy::AmoebaBondForceProxy() : SerializationProxy("AmoebaBondFor
}
}
void
AmoebaBondForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaBondForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
3
);
const
AmoebaBondForce
&
force
=
*
reinterpret_cast
<
const
AmoebaBondForce
*>
(
object
);
const
AmoebaBondForce
&
force
=
*
reinterpret_cast
<
const
AmoebaBondForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
node
.
setDoubleProperty
(
"cubic"
,
force
.
getAmoebaGlobalBondCubic
());
node
.
setDoubleProperty
(
"cubic"
,
force
.
getAmoebaGlobalBondCubic
());
node
.
setDoubleProperty
(
"quartic"
,
force
.
getAmoebaGlobalBondQuartic
());
node
.
setDoubleProperty
(
"quartic"
,
force
.
getAmoebaGlobalBondQuartic
());
...
@@ -58,10 +60,15 @@ void AmoebaBondForceProxy::serialize(const void* object, SerializationNode& node
...
@@ -58,10 +60,15 @@ void AmoebaBondForceProxy::serialize(const void* object, SerializationNode& node
}
}
void
*
AmoebaBondForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaBondForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
3
)
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaBondForce
*
force
=
new
AmoebaBondForce
();
AmoebaBondForce
*
force
=
new
AmoebaBondForce
();
try
{
try
{
if
(
version
>
1
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
2
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setAmoebaGlobalBondCubic
(
node
.
getDoubleProperty
(
"cubic"
));
force
->
setAmoebaGlobalBondCubic
(
node
.
getDoubleProperty
(
"cubic"
));
force
->
setAmoebaGlobalBondQuartic
(
node
.
getDoubleProperty
(
"quartic"
));
force
->
setAmoebaGlobalBondQuartic
(
node
.
getDoubleProperty
(
"quartic"
));
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
...
...
plugins/amoeba/serialization/src/AmoebaGeneralizedKirkwoodForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,9 +42,10 @@ AmoebaGeneralizedKirkwoodForceProxy::AmoebaGeneralizedKirkwoodForceProxy() : Ser
...
@@ -42,9 +42,10 @@ AmoebaGeneralizedKirkwoodForceProxy::AmoebaGeneralizedKirkwoodForceProxy() : Ser
}
}
void
AmoebaGeneralizedKirkwoodForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaGeneralizedKirkwoodForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
AmoebaGeneralizedKirkwoodForce
&
force
=
*
reinterpret_cast
<
const
AmoebaGeneralizedKirkwoodForce
*>
(
object
);
const
AmoebaGeneralizedKirkwoodForce
&
force
=
*
reinterpret_cast
<
const
AmoebaGeneralizedKirkwoodForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setDoubleProperty
(
"GeneralizedKirkwoodSolventDielectric"
,
force
.
getSolventDielectric
());
node
.
setDoubleProperty
(
"GeneralizedKirkwoodSolventDielectric"
,
force
.
getSolventDielectric
());
node
.
setDoubleProperty
(
"GeneralizedKirkwoodSoluteDielectric"
,
force
.
getSoluteDielectric
());
node
.
setDoubleProperty
(
"GeneralizedKirkwoodSoluteDielectric"
,
force
.
getSoluteDielectric
());
//node.setDoubleProperty("GeneralizedKirkwoodDielectricOffset", force.getDielectricOffset());
//node.setDoubleProperty("GeneralizedKirkwoodDielectricOffset", force.getDielectricOffset());
...
@@ -62,11 +63,13 @@ void AmoebaGeneralizedKirkwoodForceProxy::serialize(const void* object, Serializ
...
@@ -62,11 +63,13 @@ void AmoebaGeneralizedKirkwoodForceProxy::serialize(const void* object, Serializ
}
}
void
*
AmoebaGeneralizedKirkwoodForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaGeneralizedKirkwoodForceProxy
::
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"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaGeneralizedKirkwoodForce
*
force
=
new
AmoebaGeneralizedKirkwoodForce
();
AmoebaGeneralizedKirkwoodForce
*
force
=
new
AmoebaGeneralizedKirkwoodForce
();
try
{
try
{
if
(
version
>
1
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
force
->
setSolventDielectric
(
node
.
getDoubleProperty
(
"GeneralizedKirkwoodSolventDielectric"
));
force
->
setSolventDielectric
(
node
.
getDoubleProperty
(
"GeneralizedKirkwoodSolventDielectric"
));
force
->
setSoluteDielectric
(
node
.
getDoubleProperty
(
"GeneralizedKirkwoodSoluteDielectric"
));
force
->
setSoluteDielectric
(
node
.
getDoubleProperty
(
"GeneralizedKirkwoodSoluteDielectric"
));
//force->setDielectricOffset( node.getDoubleProperty("GeneralizedKirkwoodDielectricOffset"));
//force->setDielectricOffset( node.getDoubleProperty("GeneralizedKirkwoodDielectricOffset"));
...
...
plugins/amoeba/serialization/src/AmoebaInPlaneAngleForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -43,9 +43,11 @@ AmoebaInPlaneAngleForceProxy::AmoebaInPlaneAngleForceProxy() : SerializationProx
...
@@ -43,9 +43,11 @@ AmoebaInPlaneAngleForceProxy::AmoebaInPlaneAngleForceProxy() : SerializationProx
void
AmoebaInPlaneAngleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaInPlaneAngleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
3
);
const
AmoebaInPlaneAngleForce
&
force
=
*
reinterpret_cast
<
const
AmoebaInPlaneAngleForce
*>
(
object
);
const
AmoebaInPlaneAngleForce
&
force
=
*
reinterpret_cast
<
const
AmoebaInPlaneAngleForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
node
.
setDoubleProperty
(
"cubic"
,
force
.
getAmoebaGlobalInPlaneAngleCubic
());
node
.
setDoubleProperty
(
"cubic"
,
force
.
getAmoebaGlobalInPlaneAngleCubic
());
node
.
setDoubleProperty
(
"quartic"
,
force
.
getAmoebaGlobalInPlaneAngleQuartic
());
node
.
setDoubleProperty
(
"quartic"
,
force
.
getAmoebaGlobalInPlaneAngleQuartic
());
node
.
setDoubleProperty
(
"pentic"
,
force
.
getAmoebaGlobalInPlaneAnglePentic
());
node
.
setDoubleProperty
(
"pentic"
,
force
.
getAmoebaGlobalInPlaneAnglePentic
());
...
@@ -61,11 +63,15 @@ void AmoebaInPlaneAngleForceProxy::serialize(const void* object, SerializationNo
...
@@ -61,11 +63,15 @@ void AmoebaInPlaneAngleForceProxy::serialize(const void* object, SerializationNo
}
}
void
*
AmoebaInPlaneAngleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaInPlaneAngleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
3
)
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaInPlaneAngleForce
*
force
=
new
AmoebaInPlaneAngleForce
();
AmoebaInPlaneAngleForce
*
force
=
new
AmoebaInPlaneAngleForce
();
try
{
try
{
if
(
version
>
1
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
2
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setAmoebaGlobalInPlaneAngleCubic
(
node
.
getDoubleProperty
(
"cubic"
));
force
->
setAmoebaGlobalInPlaneAngleCubic
(
node
.
getDoubleProperty
(
"cubic"
));
force
->
setAmoebaGlobalInPlaneAngleQuartic
(
node
.
getDoubleProperty
(
"quartic"
));
force
->
setAmoebaGlobalInPlaneAngleQuartic
(
node
.
getDoubleProperty
(
"quartic"
));
force
->
setAmoebaGlobalInPlaneAnglePentic
(
node
.
getDoubleProperty
(
"pentic"
));
force
->
setAmoebaGlobalInPlaneAnglePentic
(
node
.
getDoubleProperty
(
"pentic"
));
...
...
plugins/amoeba/serialization/src/AmoebaMultipoleForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -68,25 +68,32 @@ void loadCovalentMap(const SerializationNode& map, std::vector< int >& covalentM
...
@@ -68,25 +68,32 @@ void loadCovalentMap(const SerializationNode& map, std::vector< int >& covalentM
}
}
void
AmoebaMultipoleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaMultipoleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
2
);
node
.
setIntProperty
(
"version"
,
4
);
const
AmoebaMultipoleForce
&
force
=
*
reinterpret_cast
<
const
AmoebaMultipoleForce
*>
(
object
);
const
AmoebaMultipoleForce
&
force
=
*
reinterpret_cast
<
const
AmoebaMultipoleForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setIntProperty
(
"nonbondedMethod"
,
force
.
getNonbondedMethod
());
node
.
setIntProperty
(
"nonbondedMethod"
,
force
.
getNonbondedMethod
());
node
.
setIntProperty
(
"polarizationType"
,
force
.
getPolarizationType
());
node
.
setIntProperty
(
"polarizationType"
,
force
.
getPolarizationType
());
//node.setIntProperty("pmeBSplineOrder", force.getPmeBSplineOrder());
//node.setIntProperty("mutualInducedIterationMethod", force.getMutualInducedIterationMethod());
node
.
setIntProperty
(
"mutualInducedMaxIterations"
,
force
.
getMutualInducedMaxIterations
());
node
.
setIntProperty
(
"mutualInducedMaxIterations"
,
force
.
getMutualInducedMaxIterations
());
node
.
setDoubleProperty
(
"cutoffDistance"
,
force
.
getCutoffDistance
());
node
.
setDoubleProperty
(
"cutoffDistance"
,
force
.
getCutoffDistance
());
node
.
setDoubleProperty
(
"aEwald"
,
force
.
getAEwald
());
double
alpha
;
int
nx
,
ny
,
nz
;
force
.
getPMEParameters
(
alpha
,
nx
,
ny
,
nz
);
node
.
setDoubleProperty
(
"aEwald"
,
alpha
);
node
.
setDoubleProperty
(
"mutualInducedTargetEpsilon"
,
force
.
getMutualInducedTargetEpsilon
());
node
.
setDoubleProperty
(
"mutualInducedTargetEpsilon"
,
force
.
getMutualInducedTargetEpsilon
());
//node.setDoubleProperty("electricConstant", force.getElectricConstant());
node
.
setDoubleProperty
(
"ewaldErrorTolerance"
,
force
.
getEwaldErrorTolerance
());
node
.
setDoubleProperty
(
"ewaldErrorTolerance"
,
force
.
getEwaldErrorTolerance
());
std
::
vector
<
int
>
gridDimensions
;
force
.
getPmeGridDimensions
(
gridDimensions
);
SerializationNode
&
gridDimensionsNode
=
node
.
createChildNode
(
"MultipoleParticleGridDimension"
);
SerializationNode
&
gridDimensionsNode
=
node
.
createChildNode
(
"MultipoleParticleGridDimension"
);
gridDimensionsNode
.
setIntProperty
(
"d0"
,
gridDimensions
[
0
]).
setIntProperty
(
"d1"
,
gridDimensions
[
1
]).
setIntProperty
(
"d2"
,
gridDimensions
[
2
]);
gridDimensionsNode
.
setIntProperty
(
"d0"
,
nx
).
setIntProperty
(
"d1"
,
ny
).
setIntProperty
(
"d2"
,
nz
);
SerializationNode
&
coefficients
=
node
.
createChildNode
(
"ExtrapolationCoefficients"
);
vector
<
double
>
coeff
=
force
.
getExtrapolationCoefficients
();
for
(
int
i
=
0
;
i
<
coeff
.
size
();
i
++
)
{
stringstream
key
;
key
<<
"c"
<<
i
;
coefficients
.
setDoubleProperty
(
key
.
str
(),
coeff
[
i
]);
}
std
::
vector
<
std
::
string
>
covalentTypes
;
std
::
vector
<
std
::
string
>
covalentTypes
;
getCovalentTypes
(
covalentTypes
);
getCovalentTypes
(
covalentTypes
);
...
@@ -124,33 +131,38 @@ void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode&
...
@@ -124,33 +131,38 @@ void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode&
}
}
void
*
AmoebaMultipoleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaMultipoleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
>
2
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
0
||
version
>
4
)
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaMultipoleForce
*
force
=
new
AmoebaMultipoleForce
();
AmoebaMultipoleForce
*
force
=
new
AmoebaMultipoleForce
();
try
{
try
{
if
(
version
>
3
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
force
->
setNonbondedMethod
(
static_cast
<
AmoebaMultipoleForce
::
NonbondedMethod
>
(
node
.
getIntProperty
(
"nonbondedMethod"
)));
force
->
setNonbondedMethod
(
static_cast
<
AmoebaMultipoleForce
::
NonbondedMethod
>
(
node
.
getIntProperty
(
"nonbondedMethod"
)));
if
(
node
.
getIntProperty
(
"
version
"
)
=
=
2
)
{
if
(
version
>
=
2
)
force
->
setPolarizationType
(
static_cast
<
AmoebaMultipoleForce
::
PolarizationType
>
(
node
.
getIntProperty
(
"polarizationType"
)));
force
->
setPolarizationType
(
static_cast
<
AmoebaMultipoleForce
::
PolarizationType
>
(
node
.
getIntProperty
(
"polarizationType"
)));
}
//force->setPmeBSplineOrder(node.getIntProperty("pmeBSplineOrder"));
//force->setMutualInducedIterationMethod(static_cast<AmoebaMultipoleForce::MutualInducedIterationMethod>(node.getIntProperty("mutualInducedIterationMethod")));
force
->
setMutualInducedMaxIterations
(
node
.
getIntProperty
(
"mutualInducedMaxIterations"
));
force
->
setMutualInducedMaxIterations
(
node
.
getIntProperty
(
"mutualInducedMaxIterations"
));
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoffDistance"
));
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoffDistance"
));
force
->
setAEwald
(
node
.
getDoubleProperty
(
"aEwald"
));
force
->
setMutualInducedTargetEpsilon
(
node
.
getDoubleProperty
(
"mutualInducedTargetEpsilon"
));
force
->
setMutualInducedTargetEpsilon
(
node
.
getDoubleProperty
(
"mutualInducedTargetEpsilon"
));
//force->setElectricConstant(node.getDoubleProperty("electricConstant"));
force
->
setEwaldErrorTolerance
(
node
.
getDoubleProperty
(
"ewaldErrorTolerance"
));
force
->
setEwaldErrorTolerance
(
node
.
getDoubleProperty
(
"ewaldErrorTolerance"
));
std
::
vector
<
int
>
gridDimensions
;
const
SerializationNode
&
gridDimensionsNode
=
node
.
getChildNode
(
"MultipoleParticleGridDimension"
);
const
SerializationNode
&
gridDimensionsNode
=
node
.
getChildNode
(
"MultipoleParticleGridDimension"
);
gridDimensions
.
push_back
(
gridDimensionsNode
.
getIntProperty
(
"d0"
));
force
->
setPMEParameters
(
node
.
getDoubleProperty
(
"aEwald"
),
gridDimensionsNode
.
getIntProperty
(
"d0"
),
gridDimensionsNode
.
getIntProperty
(
"d1"
),
gridDimensionsNode
.
getIntProperty
(
"d2"
));
gridDimensions
.
push_back
(
gridDimensionsNode
.
getIntProperty
(
"d1"
));
gridDimensions
.
push_back
(
gridDimensionsNode
.
getIntProperty
(
"d2"
));
force
->
setPmeGridDimensions
(
gridDimensions
);
if
(
version
>=
3
)
{
const
SerializationNode
&
coefficients
=
node
.
getChildNode
(
"ExtrapolationCoefficients"
);
vector
<
double
>
coeff
;
for
(
int
i
=
0
;
;
i
++
)
{
stringstream
key
;
key
<<
"c"
<<
i
;
if
(
coefficients
.
getProperties
().
find
(
key
.
str
())
==
coefficients
.
getProperties
().
end
())
break
;
coeff
.
push_back
(
coefficients
.
getDoubleProperty
(
key
.
str
()));
}
force
->
setExtrapolationCoefficients
(
coeff
);
}
std
::
vector
<
std
::
string
>
covalentTypes
;
std
::
vector
<
std
::
string
>
covalentTypes
;
getCovalentTypes
(
covalentTypes
);
getCovalentTypes
(
covalentTypes
);
...
...
plugins/amoeba/serialization/src/AmoebaOutOfPlaneBendForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,8 +42,10 @@ AmoebaOutOfPlaneBendForceProxy::AmoebaOutOfPlaneBendForceProxy() : Serialization
...
@@ -42,8 +42,10 @@ AmoebaOutOfPlaneBendForceProxy::AmoebaOutOfPlaneBendForceProxy() : Serialization
}
}
void
AmoebaOutOfPlaneBendForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaOutOfPlaneBendForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
3
);
const
AmoebaOutOfPlaneBendForce
&
force
=
*
reinterpret_cast
<
const
AmoebaOutOfPlaneBendForce
*>
(
object
);
const
AmoebaOutOfPlaneBendForce
&
force
=
*
reinterpret_cast
<
const
AmoebaOutOfPlaneBendForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
node
.
setDoubleProperty
(
"cubic"
,
force
.
getAmoebaGlobalOutOfPlaneBendCubic
());
node
.
setDoubleProperty
(
"cubic"
,
force
.
getAmoebaGlobalOutOfPlaneBendCubic
());
node
.
setDoubleProperty
(
"quartic"
,
force
.
getAmoebaGlobalOutOfPlaneBendQuartic
());
node
.
setDoubleProperty
(
"quartic"
,
force
.
getAmoebaGlobalOutOfPlaneBendQuartic
());
node
.
setDoubleProperty
(
"pentic"
,
force
.
getAmoebaGlobalOutOfPlaneBendPentic
());
node
.
setDoubleProperty
(
"pentic"
,
force
.
getAmoebaGlobalOutOfPlaneBendPentic
());
...
@@ -59,11 +61,15 @@ void AmoebaOutOfPlaneBendForceProxy::serialize(const void* object, Serialization
...
@@ -59,11 +61,15 @@ void AmoebaOutOfPlaneBendForceProxy::serialize(const void* object, Serialization
}
}
void
*
AmoebaOutOfPlaneBendForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaOutOfPlaneBendForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
3
)
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaOutOfPlaneBendForce
*
force
=
new
AmoebaOutOfPlaneBendForce
();
AmoebaOutOfPlaneBendForce
*
force
=
new
AmoebaOutOfPlaneBendForce
();
try
{
try
{
if
(
version
>
1
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
2
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setAmoebaGlobalOutOfPlaneBendCubic
(
node
.
getDoubleProperty
(
"cubic"
));
force
->
setAmoebaGlobalOutOfPlaneBendCubic
(
node
.
getDoubleProperty
(
"cubic"
));
force
->
setAmoebaGlobalOutOfPlaneBendQuartic
(
node
.
getDoubleProperty
(
"quartic"
));
force
->
setAmoebaGlobalOutOfPlaneBendQuartic
(
node
.
getDoubleProperty
(
"quartic"
));
force
->
setAmoebaGlobalOutOfPlaneBendPentic
(
node
.
getDoubleProperty
(
"pentic"
));
force
->
setAmoebaGlobalOutOfPlaneBendPentic
(
node
.
getDoubleProperty
(
"pentic"
));
...
...
plugins/amoeba/serialization/src/AmoebaPiTorsionForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,8 +42,10 @@ AmoebaPiTorsionForceProxy::AmoebaPiTorsionForceProxy() : SerializationProxy("Amo
...
@@ -42,8 +42,10 @@ AmoebaPiTorsionForceProxy::AmoebaPiTorsionForceProxy() : SerializationProxy("Amo
}
}
void
AmoebaPiTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaPiTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
3
);
const
AmoebaPiTorsionForce
&
force
=
*
reinterpret_cast
<
const
AmoebaPiTorsionForce
*>
(
object
);
const
AmoebaPiTorsionForce
&
force
=
*
reinterpret_cast
<
const
AmoebaPiTorsionForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
SerializationNode
&
bonds
=
node
.
createChildNode
(
"PiTorsion"
);
SerializationNode
&
bonds
=
node
.
createChildNode
(
"PiTorsion"
);
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumPiTorsions
());
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumPiTorsions
());
ii
++
)
{
int
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle6
;
int
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle6
;
...
@@ -54,10 +56,15 @@ void AmoebaPiTorsionForceProxy::serialize(const void* object, SerializationNode&
...
@@ -54,10 +56,15 @@ void AmoebaPiTorsionForceProxy::serialize(const void* object, SerializationNode&
}
}
void
*
AmoebaPiTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaPiTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
3
)
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaPiTorsionForce
*
force
=
new
AmoebaPiTorsionForce
();
AmoebaPiTorsionForce
*
force
=
new
AmoebaPiTorsionForce
();
try
{
try
{
if
(
version
>
1
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
2
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"PiTorsion"
);
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"PiTorsion"
);
for
(
unsigned
int
ii
=
0
;
ii
<
bonds
.
getChildren
().
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
bonds
.
getChildren
().
size
();
ii
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
ii
];
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
ii
];
...
...
plugins/amoeba/serialization/src/AmoebaStretchBendForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010-201
5
Stanford University and the Authors. *
* Portions copyright (c) 2010-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,8 +42,10 @@ AmoebaStretchBendForceProxy::AmoebaStretchBendForceProxy() : SerializationProxy(
...
@@ -42,8 +42,10 @@ AmoebaStretchBendForceProxy::AmoebaStretchBendForceProxy() : SerializationProxy(
}
}
void
AmoebaStretchBendForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaStretchBendForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
2
);
node
.
setIntProperty
(
"version"
,
4
);
const
AmoebaStretchBendForce
&
force
=
*
reinterpret_cast
<
const
AmoebaStretchBendForce
*>
(
object
);
const
AmoebaStretchBendForce
&
force
=
*
reinterpret_cast
<
const
AmoebaStretchBendForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
SerializationNode
&
bonds
=
node
.
createChildNode
(
"StretchBendAngles"
);
SerializationNode
&
bonds
=
node
.
createChildNode
(
"StretchBendAngles"
);
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumStretchBends
());
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumStretchBends
());
ii
++
)
{
int
particle1
,
particle2
,
particle3
;
int
particle1
,
particle2
,
particle3
;
...
@@ -56,10 +58,14 @@ void AmoebaStretchBendForceProxy::serialize(const void* object, SerializationNod
...
@@ -56,10 +58,14 @@ void AmoebaStretchBendForceProxy::serialize(const void* object, SerializationNod
void
*
AmoebaStretchBendForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaStretchBendForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
int
version
=
node
.
getIntProperty
(
"version"
);
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
!=
1
&&
version
!=
2
)
if
(
version
<
1
||
version
>
4
)
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaStretchBendForce
*
force
=
new
AmoebaStretchBendForce
();
AmoebaStretchBendForce
*
force
=
new
AmoebaStretchBendForce
();
try
{
try
{
if
(
version
>
2
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
3
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"StretchBendAngles"
);
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"StretchBendAngles"
);
for
(
unsigned
int
ii
=
0
;
ii
<
(
int
)
bonds
.
getChildren
().
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
(
int
)
bonds
.
getChildren
().
size
();
ii
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
ii
];
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
ii
];
...
...
plugins/amoeba/serialization/src/AmoebaTorsionTorsionForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -63,8 +63,10 @@ static void loadGrid(const SerializationNode& grid, std::vector< std::vector< st
...
@@ -63,8 +63,10 @@ static void loadGrid(const SerializationNode& grid, std::vector< std::vector< st
}
}
void
AmoebaTorsionTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaTorsionTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
3
);
const
AmoebaTorsionTorsionForce
&
force
=
*
reinterpret_cast
<
const
AmoebaTorsionTorsionForce
*>
(
object
);
const
AmoebaTorsionTorsionForce
&
force
=
*
reinterpret_cast
<
const
AmoebaTorsionTorsionForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setBoolProperty
(
"usesPeriodic"
,
force
.
usesPeriodicBoundaryConditions
());
// grid[xIdx][yIdx][6 values]
// grid[xIdx][yIdx][6 values]
...
@@ -116,12 +118,16 @@ void AmoebaTorsionTorsionForceProxy::serialize(const void* object, Serialization
...
@@ -116,12 +118,16 @@ void AmoebaTorsionTorsionForceProxy::serialize(const void* object, Serialization
void
*
AmoebaTorsionTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaTorsionTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
int
version
=
node
.
getIntProperty
(
"version"
);
if
(
version
<
1
||
version
>
3
)
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaTorsionTorsionForce
*
force
=
new
AmoebaTorsionTorsionForce
();
AmoebaTorsionTorsionForce
*
force
=
new
AmoebaTorsionTorsionForce
();
try
{
try
{
if
(
version
>
1
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
if
(
version
>
2
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
grids
=
node
.
getChildNode
(
"TorsionTorsionGrids"
);
const
SerializationNode
&
grids
=
node
.
getChildNode
(
"TorsionTorsionGrids"
);
const
std
::
vector
<
SerializationNode
>&
gridList
=
grids
.
getChildren
();
const
std
::
vector
<
SerializationNode
>&
gridList
=
grids
.
getChildren
();
for
(
unsigned
int
ii
=
0
;
ii
<
gridList
.
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
gridList
.
size
();
ii
++
)
{
...
...
plugins/amoeba/serialization/src/AmoebaVdwForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,12 +42,13 @@ AmoebaVdwForceProxy::AmoebaVdwForceProxy() : SerializationProxy("AmoebaVdwForce"
...
@@ -42,12 +42,13 @@ AmoebaVdwForceProxy::AmoebaVdwForceProxy() : SerializationProxy("AmoebaVdwForce"
}
}
void
AmoebaVdwForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaVdwForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
AmoebaVdwForce
&
force
=
*
reinterpret_cast
<
const
AmoebaVdwForce
*>
(
object
);
const
AmoebaVdwForce
&
force
=
*
reinterpret_cast
<
const
AmoebaVdwForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setStringProperty
(
"SigmaCombiningRule"
,
force
.
getSigmaCombiningRule
());
node
.
setStringProperty
(
"SigmaCombiningRule"
,
force
.
getSigmaCombiningRule
());
node
.
setStringProperty
(
"EpsilonCombiningRule"
,
force
.
getEpsilonCombiningRule
());
node
.
setStringProperty
(
"EpsilonCombiningRule"
,
force
.
getEpsilonCombiningRule
());
node
.
setDoubleProperty
(
"VdwCutoff"
,
force
.
getCutoff
());
node
.
setDoubleProperty
(
"VdwCutoff"
,
force
.
getCutoff
Distance
());
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
node
.
setIntProperty
(
"method"
,
(
int
)
force
.
getNonbondedMethod
());
...
@@ -72,14 +73,16 @@ void AmoebaVdwForceProxy::serialize(const void* object, SerializationNode& node)
...
@@ -72,14 +73,16 @@ void AmoebaVdwForceProxy::serialize(const void* object, SerializationNode& node)
}
}
void
*
AmoebaVdwForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaVdwForceProxy
::
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"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaVdwForce
*
force
=
new
AmoebaVdwForce
();
AmoebaVdwForce
*
force
=
new
AmoebaVdwForce
();
try
{
try
{
if
(
version
>
1
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
force
->
setSigmaCombiningRule
(
node
.
getStringProperty
(
"SigmaCombiningRule"
));
force
->
setSigmaCombiningRule
(
node
.
getStringProperty
(
"SigmaCombiningRule"
));
force
->
setEpsilonCombiningRule
(
node
.
getStringProperty
(
"EpsilonCombiningRule"
));
force
->
setEpsilonCombiningRule
(
node
.
getStringProperty
(
"EpsilonCombiningRule"
));
force
->
setCutoff
(
node
.
getDoubleProperty
(
"VdwCutoff"
));
force
->
setCutoff
Distance
(
node
.
getDoubleProperty
(
"VdwCutoff"
));
force
->
setNonbondedMethod
((
AmoebaVdwForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
force
->
setNonbondedMethod
((
AmoebaVdwForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"VdwParticles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"VdwParticles"
);
...
...
plugins/amoeba/serialization/src/AmoebaWcaDispersionForceProxy.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -42,8 +42,9 @@ AmoebaWcaDispersionForceProxy::AmoebaWcaDispersionForceProxy() : SerializationPr
...
@@ -42,8 +42,9 @@ AmoebaWcaDispersionForceProxy::AmoebaWcaDispersionForceProxy() : SerializationPr
}
}
void
AmoebaWcaDispersionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
void
AmoebaWcaDispersionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
2
);
const
AmoebaWcaDispersionForce
&
force
=
*
reinterpret_cast
<
const
AmoebaWcaDispersionForce
*>
(
object
);
const
AmoebaWcaDispersionForce
&
force
=
*
reinterpret_cast
<
const
AmoebaWcaDispersionForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
node
.
setDoubleProperty
(
"Epso"
,
force
.
getEpso
());
node
.
setDoubleProperty
(
"Epso"
,
force
.
getEpso
());
node
.
setDoubleProperty
(
"Epsh"
,
force
.
getEpsh
());
node
.
setDoubleProperty
(
"Epsh"
,
force
.
getEpsh
());
node
.
setDoubleProperty
(
"Rmino"
,
force
.
getRmino
());
node
.
setDoubleProperty
(
"Rmino"
,
force
.
getRmino
());
...
@@ -63,12 +64,14 @@ void AmoebaWcaDispersionForceProxy::serialize(const void* object, SerializationN
...
@@ -63,12 +64,14 @@ void AmoebaWcaDispersionForceProxy::serialize(const void* object, SerializationN
}
}
void
*
AmoebaWcaDispersionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
void
*
AmoebaWcaDispersionForceProxy
::
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"
);
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaWcaDispersionForce
*
force
=
new
AmoebaWcaDispersionForce
();
AmoebaWcaDispersionForce
*
force
=
new
AmoebaWcaDispersionForce
();
try
{
try
{
if
(
version
>
1
)
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
force
->
setEpso
(
node
.
getDoubleProperty
(
"Epso"
));
force
->
setEpso
(
node
.
getDoubleProperty
(
"Epso"
));
force
->
setEpsh
(
node
.
getDoubleProperty
(
"Epsh"
));
force
->
setEpsh
(
node
.
getDoubleProperty
(
"Epsh"
));
force
->
setRmino
(
node
.
getDoubleProperty
(
"Rmino"
));
force
->
setRmino
(
node
.
getDoubleProperty
(
"Rmino"
));
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaAngleForce.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -45,6 +45,7 @@ void testSerialization() {
...
@@ -45,6 +45,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
AmoebaAngleForce
force1
;
AmoebaAngleForce
force1
;
force1
.
setForceGroup
(
3
);
force1
.
setAmoebaGlobalAngleCubic
(
12.3
);
force1
.
setAmoebaGlobalAngleCubic
(
12.3
);
force1
.
setAmoebaGlobalAngleQuartic
(
98.7
);
force1
.
setAmoebaGlobalAngleQuartic
(
98.7
);
force1
.
setAmoebaGlobalAnglePentic
(
91.7
);
force1
.
setAmoebaGlobalAnglePentic
(
91.7
);
...
@@ -53,6 +54,7 @@ void testSerialization() {
...
@@ -53,6 +54,7 @@ void testSerialization() {
force1
.
addAngle
(
0
,
2
,
3
,
2.0
,
2.1
);
force1
.
addAngle
(
0
,
2
,
3
,
2.0
,
2.1
);
force1
.
addAngle
(
2
,
3
,
5
,
3.0
,
2.2
);
force1
.
addAngle
(
2
,
3
,
5
,
3.0
,
2.2
);
force1
.
addAngle
(
5
,
1
,
8
,
4.0
,
2.3
);
force1
.
addAngle
(
5
,
1
,
8
,
4.0
,
2.3
);
force1
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
// Serialize and then deserialize it.
...
@@ -62,6 +64,8 @@ void testSerialization() {
...
@@ -62,6 +64,8 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
AmoebaAngleForce
&
force2
=
*
copy
;
AmoebaAngleForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force1
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force1
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalAngleCubic
(),
force2
.
getAmoebaGlobalAngleCubic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalAngleCubic
(),
force2
.
getAmoebaGlobalAngleCubic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalAngleQuartic
(),
force2
.
getAmoebaGlobalAngleQuartic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalAngleQuartic
(),
force2
.
getAmoebaGlobalAngleQuartic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalAnglePentic
(),
force2
.
getAmoebaGlobalAnglePentic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalAnglePentic
(),
force2
.
getAmoebaGlobalAnglePentic
());
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaBondForce.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -45,12 +45,14 @@ void testSerialization() {
...
@@ -45,12 +45,14 @@ void testSerialization() {
// Create a Force.
// Create a Force.
AmoebaBondForce
force1
;
AmoebaBondForce
force1
;
force1
.
setForceGroup
(
3
);
force1
.
setAmoebaGlobalBondCubic
(
12.3
);
force1
.
setAmoebaGlobalBondCubic
(
12.3
);
force1
.
setAmoebaGlobalBondQuartic
(
98.7
);
force1
.
setAmoebaGlobalBondQuartic
(
98.7
);
force1
.
addBond
(
0
,
1
,
1.0
,
2.0
);
force1
.
addBond
(
0
,
1
,
1.0
,
2.0
);
force1
.
addBond
(
0
,
2
,
2.0
,
2.1
);
force1
.
addBond
(
0
,
2
,
2.0
,
2.1
);
force1
.
addBond
(
2
,
3
,
3.0
,
2.2
);
force1
.
addBond
(
2
,
3
,
3.0
,
2.2
);
force1
.
addBond
(
5
,
1
,
4.0
,
2.3
);
force1
.
addBond
(
5
,
1
,
4.0
,
2.3
);
force1
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
// Serialize and then deserialize it.
...
@@ -60,6 +62,8 @@ void testSerialization() {
...
@@ -60,6 +62,8 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
AmoebaBondForce
&
force2
=
*
copy
;
AmoebaBondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force1
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force1
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalBondCubic
(),
force2
.
getAmoebaGlobalBondCubic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalBondCubic
(),
force2
.
getAmoebaGlobalBondCubic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalBondQuartic
(),
force2
.
getAmoebaGlobalBondQuartic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalBondQuartic
(),
force2
.
getAmoebaGlobalBondQuartic
());
ASSERT_EQUAL
(
force1
.
getNumBonds
(),
force2
.
getNumBonds
());
ASSERT_EQUAL
(
force1
.
getNumBonds
(),
force2
.
getNumBonds
());
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaGeneralizedKirkwoodForce.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -45,6 +45,7 @@ void testSerialization() {
...
@@ -45,6 +45,7 @@ void testSerialization() {
// Create a Force.
// Create a Force.
AmoebaGeneralizedKirkwoodForce
force1
;
AmoebaGeneralizedKirkwoodForce
force1
;
force1
.
setForceGroup
(
3
);
force1
.
setSolventDielectric
(
80.0
);
force1
.
setSolventDielectric
(
80.0
);
force1
.
setSoluteDielectric
(
1.0
);
force1
.
setSoluteDielectric
(
1.0
);
//force1.setDielectricOffset( 0.09);
//force1.setDielectricOffset( 0.09);
...
@@ -64,6 +65,7 @@ void testSerialization() {
...
@@ -64,6 +65,7 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
AmoebaGeneralizedKirkwoodForce
&
force2
=
*
copy
;
AmoebaGeneralizedKirkwoodForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force1
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force1
.
getSolventDielectric
(),
force2
.
getSolventDielectric
());
ASSERT_EQUAL
(
force1
.
getSolventDielectric
(),
force2
.
getSolventDielectric
());
ASSERT_EQUAL
(
force1
.
getSoluteDielectric
(),
force2
.
getSoluteDielectric
());
ASSERT_EQUAL
(
force1
.
getSoluteDielectric
(),
force2
.
getSoluteDielectric
());
//ASSERT_EQUAL(force1.getDielectricOffset(), force2.getDielectricOffset());
//ASSERT_EQUAL(force1.getDielectricOffset(), force2.getDielectricOffset());
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaInPlaneAngleForce.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -46,6 +46,7 @@ void testSerialization() {
...
@@ -46,6 +46,7 @@ void testSerialization() {
AmoebaInPlaneAngleForce
force1
;
AmoebaInPlaneAngleForce
force1
;
force1
.
setForceGroup
(
3
);
force1
.
setAmoebaGlobalInPlaneAngleCubic
(
12.3
);
force1
.
setAmoebaGlobalInPlaneAngleCubic
(
12.3
);
force1
.
setAmoebaGlobalInPlaneAngleQuartic
(
98.7
);
force1
.
setAmoebaGlobalInPlaneAngleQuartic
(
98.7
);
force1
.
setAmoebaGlobalInPlaneAnglePentic
(
91.7
);
force1
.
setAmoebaGlobalInPlaneAnglePentic
(
91.7
);
...
@@ -55,6 +56,7 @@ void testSerialization() {
...
@@ -55,6 +56,7 @@ void testSerialization() {
force1
.
addAngle
(
0
,
2
,
3
,
5
,
2.0
,
2.1
);
force1
.
addAngle
(
0
,
2
,
3
,
5
,
2.0
,
2.1
);
force1
.
addAngle
(
2
,
3
,
5
,
6
,
3.0
,
2.2
);
force1
.
addAngle
(
2
,
3
,
5
,
6
,
3.0
,
2.2
);
force1
.
addAngle
(
5
,
1
,
8
,
8
,
4.0
,
2.3
);
force1
.
addAngle
(
5
,
1
,
8
,
8
,
4.0
,
2.3
);
force1
.
setUsesPeriodicBoundaryConditions
(
true
);
// Serialize and then deserialize it.
// Serialize and then deserialize it.
...
@@ -65,6 +67,8 @@ void testSerialization() {
...
@@ -65,6 +67,8 @@ void testSerialization() {
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
AmoebaInPlaneAngleForce
&
force2
=
*
copy
;
AmoebaInPlaneAngleForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force1
.
getForceGroup
(),
force2
.
getForceGroup
());
ASSERT_EQUAL
(
force1
.
usesPeriodicBoundaryConditions
(),
force2
.
usesPeriodicBoundaryConditions
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalInPlaneAngleCubic
(),
force2
.
getAmoebaGlobalInPlaneAngleCubic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalInPlaneAngleCubic
(),
force2
.
getAmoebaGlobalInPlaneAngleCubic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalInPlaneAngleQuartic
(),
force2
.
getAmoebaGlobalInPlaneAngleQuartic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalInPlaneAngleQuartic
(),
force2
.
getAmoebaGlobalInPlaneAngleQuartic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalInPlaneAnglePentic
(),
force2
.
getAmoebaGlobalInPlaneAnglePentic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalInPlaneAnglePentic
(),
force2
.
getAmoebaGlobalInPlaneAnglePentic
());
...
...
Prev
1
…
10
11
12
13
14
15
16
17
18
…
20
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