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
f11bafd9
Commit
f11bafd9
authored
Feb 23, 2015
by
peastman
Browse files
Merge pull request #828 from peastman/cleanup
Cleanup to AMOEBA code
parents
162d69a2
d95b90b9
Changes
77
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
243 additions
and
282 deletions
+243
-282
plugins/amoeba/serialization/src/AmoebaMultipoleForceProxy.cpp
...ns/amoeba/serialization/src/AmoebaMultipoleForceProxy.cpp
+57
-57
plugins/amoeba/serialization/src/AmoebaOutOfPlaneBendForceProxy.cpp
...oeba/serialization/src/AmoebaOutOfPlaneBendForceProxy.cpp
+3
-3
plugins/amoeba/serialization/src/AmoebaPiTorsionForceProxy.cpp
...ns/amoeba/serialization/src/AmoebaPiTorsionForceProxy.cpp
+1
-1
plugins/amoeba/serialization/src/AmoebaStretchBendForceProxy.cpp
.../amoeba/serialization/src/AmoebaStretchBendForceProxy.cpp
+1
-1
plugins/amoeba/serialization/src/AmoebaTorsionTorsionForceProxy.cpp
...oeba/serialization/src/AmoebaTorsionTorsionForceProxy.cpp
+29
-29
plugins/amoeba/serialization/src/AmoebaVdwForceProxy.cpp
plugins/amoeba/serialization/src/AmoebaVdwForceProxy.cpp
+8
-8
plugins/amoeba/serialization/src/AmoebaWcaDispersionForceProxy.cpp
...moeba/serialization/src/AmoebaWcaDispersionForceProxy.cpp
+10
-10
plugins/amoeba/serialization/tests/TestSerializeAmoebaAngleForce.cpp
...eba/serialization/tests/TestSerializeAmoebaAngleForce.cpp
+4
-4
plugins/amoeba/serialization/tests/TestSerializeAmoebaBondForce.cpp
...oeba/serialization/tests/TestSerializeAmoebaBondForce.cpp
+2
-2
plugins/amoeba/serialization/tests/TestSerializeAmoebaGeneralizedKirkwoodForce.cpp
...ion/tests/TestSerializeAmoebaGeneralizedKirkwoodForce.cpp
+8
-16
plugins/amoeba/serialization/tests/TestSerializeAmoebaInPlaneAngleForce.cpp
...ialization/tests/TestSerializeAmoebaInPlaneAngleForce.cpp
+5
-5
plugins/amoeba/serialization/tests/TestSerializeAmoebaMultipoleForce.cpp
...serialization/tests/TestSerializeAmoebaMultipoleForce.cpp
+49
-56
plugins/amoeba/serialization/tests/TestSerializeAmoebaOutOfPlaneBendForce.cpp
...lization/tests/TestSerializeAmoebaOutOfPlaneBendForce.cpp
+4
-4
plugins/amoeba/serialization/tests/TestSerializeAmoebaTorsionTorsionForce.cpp
...lization/tests/TestSerializeAmoebaTorsionTorsionForce.cpp
+23
-31
plugins/amoeba/serialization/tests/TestSerializeAmoebaVdwForce.cpp
...moeba/serialization/tests/TestSerializeAmoebaVdwForce.cpp
+14
-22
plugins/amoeba/serialization/tests/TestSerializeAmoebaWcaDispersionForce.cpp
...alization/tests/TestSerializeAmoebaWcaDispersionForce.cpp
+10
-18
plugins/amoeba/wrappers/generateAmoebaWrappers.py
plugins/amoeba/wrappers/generateAmoebaWrappers.py
+15
-15
No files found.
plugins/amoeba/serialization/src/AmoebaMultipoleForceProxy.cpp
View file @
f11bafd9
...
@@ -41,29 +41,29 @@ using namespace std;
...
@@ -41,29 +41,29 @@ using namespace std;
AmoebaMultipoleForceProxy
::
AmoebaMultipoleForceProxy
()
:
SerializationProxy
(
"AmoebaMultipoleForce"
)
{
AmoebaMultipoleForceProxy
::
AmoebaMultipoleForceProxy
()
:
SerializationProxy
(
"AmoebaMultipoleForce"
)
{
}
}
static
void
getCovalentTypes
(
std
::
vector
<
std
::
string
>&
covalentTypes
){
static
void
getCovalentTypes
(
std
::
vector
<
std
::
string
>&
covalentTypes
)
{
covalentTypes
.
push_back
(
"Covalent12"
);
covalentTypes
.
push_back
(
"Covalent12"
);
covalentTypes
.
push_back
(
"Covalent13"
);
covalentTypes
.
push_back
(
"Covalent13"
);
covalentTypes
.
push_back
(
"Covalent14"
);
covalentTypes
.
push_back
(
"Covalent14"
);
covalentTypes
.
push_back
(
"Covalent15"
);
covalentTypes
.
push_back
(
"Covalent15"
);
covalentTypes
.
push_back
(
"PolarizationCovalent11"
);
covalentTypes
.
push_back
(
"PolarizationCovalent11"
);
covalentTypes
.
push_back
(
"PolarizationCovalent12"
);
covalentTypes
.
push_back
(
"PolarizationCovalent12"
);
covalentTypes
.
push_back
(
"PolarizationCovalent13"
);
covalentTypes
.
push_back
(
"PolarizationCovalent13"
);
covalentTypes
.
push_back
(
"PolarizationCovalent14"
);
covalentTypes
.
push_back
(
"PolarizationCovalent14"
);
}
}
static
void
addCovalentMap
(
SerializationNode
&
particleExclusions
,
int
particleIndex
,
std
::
string
mapName
,
std
::
vector
<
int
>
covalentMap
){
static
void
addCovalentMap
(
SerializationNode
&
particleExclusions
,
int
particleIndex
,
std
::
string
mapName
,
std
::
vector
<
int
>
covalentMap
)
{
SerializationNode
&
map
=
particleExclusions
.
createChildNode
(
mapName
);
SerializationNode
&
map
=
particleExclusions
.
createChildNode
(
mapName
);
for
(
unsigned
int
ii
=
0
;
ii
<
covalentMap
.
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
covalentMap
.
size
();
ii
++
)
{
map
.
createChildNode
(
"Cv"
).
setIntProperty
(
"v"
,
covalentMap
[
ii
]
);
map
.
createChildNode
(
"Cv"
).
setIntProperty
(
"v"
,
covalentMap
[
ii
]);
}
}
}
}
void
loadCovalentMap
(
const
SerializationNode
&
map
,
std
::
vector
<
int
>&
covalentMap
){
void
loadCovalentMap
(
const
SerializationNode
&
map
,
std
::
vector
<
int
>&
covalentMap
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
map
.
getChildren
().
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
map
.
getChildren
().
size
();
ii
++
)
{
covalentMap
.
push_back
(
map
.
getChildren
()[
ii
].
getIntProperty
(
"v"
)
);
covalentMap
.
push_back
(
map
.
getChildren
()[
ii
].
getIntProperty
(
"v"
)
);
}
}
}
}
...
@@ -84,12 +84,12 @@ void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode&
...
@@ -84,12 +84,12 @@ void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode&
node
.
setDoubleProperty
(
"ewaldErrorTolerance"
,
force
.
getEwaldErrorTolerance
());
node
.
setDoubleProperty
(
"ewaldErrorTolerance"
,
force
.
getEwaldErrorTolerance
());
std
::
vector
<
int
>
gridDimensions
;
std
::
vector
<
int
>
gridDimensions
;
force
.
getPmeGridDimensions
(
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"
,
gridDimensions
[
0
]).
setIntProperty
(
"d1"
,
gridDimensions
[
1
]).
setIntProperty
(
"d2"
,
gridDimensions
[
2
]);
std
::
vector
<
std
::
string
>
covalentTypes
;
std
::
vector
<
std
::
string
>
covalentTypes
;
getCovalentTypes
(
covalentTypes
);
getCovalentTypes
(
covalentTypes
);
SerializationNode
&
particles
=
node
.
createChildNode
(
"MultipoleParticles"
);
SerializationNode
&
particles
=
node
.
createChildNode
(
"MultipoleParticles"
);
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumMultipoles
());
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumMultipoles
());
ii
++
)
{
...
@@ -100,25 +100,25 @@ void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode&
...
@@ -100,25 +100,25 @@ void AmoebaMultipoleForceProxy::serialize(const void* object, SerializationNode&
std
::
vector
<
double
>
molecularDipole
;
std
::
vector
<
double
>
molecularDipole
;
std
::
vector
<
double
>
molecularQuadrupole
;
std
::
vector
<
double
>
molecularQuadrupole
;
force
.
getMultipoleParameters
(
ii
,
charge
,
molecularDipole
,
molecularQuadrupole
,
force
.
getMultipoleParameters
(
ii
,
charge
,
molecularDipole
,
molecularQuadrupole
,
axisType
,
multipoleAtomZ
,
multipoleAtomX
,
multipoleAtomY
,
thole
,
dampingFactor
,
polarity
);
axisType
,
multipoleAtomZ
,
multipoleAtomX
,
multipoleAtomY
,
thole
,
dampingFactor
,
polarity
);
SerializationNode
&
particle
=
particles
.
createChildNode
(
"Particle"
);
SerializationNode
&
particle
=
particles
.
createChildNode
(
"Particle"
);
particle
.
setIntProperty
(
"axisType"
,
axisType
).
setIntProperty
(
"multipoleAtomZ"
,
multipoleAtomZ
).
setIntProperty
(
"multipoleAtomX"
,
multipoleAtomX
).
setIntProperty
(
"multipoleAtomY"
,
multipoleAtomY
);
particle
.
setIntProperty
(
"axisType"
,
axisType
).
setIntProperty
(
"multipoleAtomZ"
,
multipoleAtomZ
).
setIntProperty
(
"multipoleAtomX"
,
multipoleAtomX
).
setIntProperty
(
"multipoleAtomY"
,
multipoleAtomY
);
particle
.
setDoubleProperty
(
"charge"
,
charge
).
setDoubleProperty
(
"thole"
,
thole
).
setDoubleProperty
(
"damp"
,
dampingFactor
).
setDoubleProperty
(
"polarity"
,
polarity
);
particle
.
setDoubleProperty
(
"charge"
,
charge
).
setDoubleProperty
(
"thole"
,
thole
).
setDoubleProperty
(
"damp"
,
dampingFactor
).
setDoubleProperty
(
"polarity"
,
polarity
);
SerializationNode
&
dipole
=
particle
.
createChildNode
(
"Dipole"
);
SerializationNode
&
dipole
=
particle
.
createChildNode
(
"Dipole"
);
dipole
.
setDoubleProperty
(
"d0"
,
molecularDipole
[
0
]
).
setDoubleProperty
(
"d1"
,
molecularDipole
[
1
]
).
setDoubleProperty
(
"d2"
,
molecularDipole
[
2
]
);
dipole
.
setDoubleProperty
(
"d0"
,
molecularDipole
[
0
]).
setDoubleProperty
(
"d1"
,
molecularDipole
[
1
]).
setDoubleProperty
(
"d2"
,
molecularDipole
[
2
]);
SerializationNode
&
quadrupole
=
particle
.
createChildNode
(
"Quadrupole"
);
SerializationNode
&
quadrupole
=
particle
.
createChildNode
(
"Quadrupole"
);
quadrupole
.
setDoubleProperty
(
"q0"
,
molecularQuadrupole
[
0
]
).
setDoubleProperty
(
"q1"
,
molecularQuadrupole
[
1
]
).
setDoubleProperty
(
"q2"
,
molecularQuadrupole
[
2
]
);
quadrupole
.
setDoubleProperty
(
"q0"
,
molecularQuadrupole
[
0
]).
setDoubleProperty
(
"q1"
,
molecularQuadrupole
[
1
]).
setDoubleProperty
(
"q2"
,
molecularQuadrupole
[
2
]);
quadrupole
.
setDoubleProperty
(
"q3"
,
molecularQuadrupole
[
3
]
).
setDoubleProperty
(
"q4"
,
molecularQuadrupole
[
4
]
).
setDoubleProperty
(
"q5"
,
molecularQuadrupole
[
5
]
);
quadrupole
.
setDoubleProperty
(
"q3"
,
molecularQuadrupole
[
3
]).
setDoubleProperty
(
"q4"
,
molecularQuadrupole
[
4
]).
setDoubleProperty
(
"q5"
,
molecularQuadrupole
[
5
]);
quadrupole
.
setDoubleProperty
(
"q6"
,
molecularQuadrupole
[
6
]
).
setDoubleProperty
(
"q7"
,
molecularQuadrupole
[
7
]
).
setDoubleProperty
(
"q8"
,
molecularQuadrupole
[
8
]
);
quadrupole
.
setDoubleProperty
(
"q6"
,
molecularQuadrupole
[
6
]).
setDoubleProperty
(
"q7"
,
molecularQuadrupole
[
7
]).
setDoubleProperty
(
"q8"
,
molecularQuadrupole
[
8
]);
for
(
unsigned
int
jj
=
0
;
jj
<
covalentTypes
.
size
();
jj
++
)
{
for
(
unsigned
int
jj
=
0
;
jj
<
covalentTypes
.
size
();
jj
++
)
{
std
::
vector
<
int
>
covalentMap
;
std
::
vector
<
int
>
covalentMap
;
force
.
getCovalentMap
(
ii
,
static_cast
<
AmoebaMultipoleForce
::
CovalentType
>
(
jj
),
covalentMap
);
force
.
getCovalentMap
(
ii
,
static_cast
<
AmoebaMultipoleForce
::
CovalentType
>
(
jj
),
covalentMap
);
addCovalentMap
(
particle
,
ii
,
covalentTypes
[
jj
],
covalentMap
);
addCovalentMap
(
particle
,
ii
,
covalentTypes
[
jj
],
covalentMap
);
}
}
}
}
}
}
...
@@ -130,54 +130,54 @@ void* AmoebaMultipoleForceProxy::deserialize(const SerializationNode& node) cons
...
@@ -130,54 +130,54 @@ void* AmoebaMultipoleForceProxy::deserialize(const SerializationNode& node) cons
try
{
try
{
force
->
setNonbondedMethod
(
static_cast
<
AmoebaMultipoleForce
::
NonbondedMethod
>
(
node
.
getIntProperty
(
"nonbondedMethod"
))
);
force
->
setNonbondedMethod
(
static_cast
<
AmoebaMultipoleForce
::
NonbondedMethod
>
(
node
.
getIntProperty
(
"nonbondedMethod"
)));
if
(
node
.
getIntProperty
(
"version"
)
==
2
){
if
(
node
.
getIntProperty
(
"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->setPmeBSplineOrder(node.getIntProperty("pmeBSplineOrder"
)
);
//force->setMutualInducedIterationMethod(
static_cast<AmoebaMultipoleForce::MutualInducedIterationMethod>(node.getIntProperty(
"mutualInducedIterationMethod"
) )
);
//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
->
setAEwald
(
node
.
getDoubleProperty
(
"aEwald"
)
);
force
->
setMutualInducedTargetEpsilon
(
node
.
getDoubleProperty
(
"mutualInducedTargetEpsilon"
)
);
force
->
setMutualInducedTargetEpsilon
(
node
.
getDoubleProperty
(
"mutualInducedTargetEpsilon"
)
);
//force->setElectricConstant(
node.getDoubleProperty(
"electricConstant"
)
);
//force->setElectricConstant(node.getDoubleProperty("electricConstant"
)
);
force
->
setEwaldErrorTolerance
(
node
.
getDoubleProperty
(
"ewaldErrorTolerance"
)
);
force
->
setEwaldErrorTolerance
(
node
.
getDoubleProperty
(
"ewaldErrorTolerance"
)
);
std
::
vector
<
int
>
gridDimensions
;
std
::
vector
<
int
>
gridDimensions
;
const
SerializationNode
&
gridDimensionsNode
=
node
.
getChildNode
(
"MultipoleParticleGridDimension"
);
const
SerializationNode
&
gridDimensionsNode
=
node
.
getChildNode
(
"MultipoleParticleGridDimension"
);
gridDimensions
.
push_back
(
gridDimensionsNode
.
getIntProperty
(
"d0"
));
gridDimensions
.
push_back
(
gridDimensionsNode
.
getIntProperty
(
"d0"
));
gridDimensions
.
push_back
(
gridDimensionsNode
.
getIntProperty
(
"d1"
));
gridDimensions
.
push_back
(
gridDimensionsNode
.
getIntProperty
(
"d1"
));
gridDimensions
.
push_back
(
gridDimensionsNode
.
getIntProperty
(
"d2"
));
gridDimensions
.
push_back
(
gridDimensionsNode
.
getIntProperty
(
"d2"
));
force
->
setPmeGridDimensions
(
gridDimensions
);
force
->
setPmeGridDimensions
(
gridDimensions
);
std
::
vector
<
std
::
string
>
covalentTypes
;
std
::
vector
<
std
::
string
>
covalentTypes
;
getCovalentTypes
(
covalentTypes
);
getCovalentTypes
(
covalentTypes
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"MultipoleParticles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"MultipoleParticles"
);
for
(
unsigned
int
ii
=
0
;
ii
<
particles
.
getChildren
().
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
particles
.
getChildren
().
size
();
ii
++
)
{
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
ii
];
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
ii
];
std
::
vector
<
double
>
molecularDipole
;
std
::
vector
<
double
>
molecularDipole
;
const
SerializationNode
&
dipole
=
particle
.
getChildNode
(
"Dipole"
);
const
SerializationNode
&
dipole
=
particle
.
getChildNode
(
"Dipole"
);
molecularDipole
.
push_back
(
dipole
.
getDoubleProperty
(
"d0"
)
);
molecularDipole
.
push_back
(
dipole
.
getDoubleProperty
(
"d0"
)
);
molecularDipole
.
push_back
(
dipole
.
getDoubleProperty
(
"d1"
)
);
molecularDipole
.
push_back
(
dipole
.
getDoubleProperty
(
"d1"
)
);
molecularDipole
.
push_back
(
dipole
.
getDoubleProperty
(
"d2"
)
);
molecularDipole
.
push_back
(
dipole
.
getDoubleProperty
(
"d2"
)
);
std
::
vector
<
double
>
molecularQuadrupole
;
std
::
vector
<
double
>
molecularQuadrupole
;
const
SerializationNode
&
quadrupole
=
particle
.
getChildNode
(
"Quadrupole"
);
const
SerializationNode
&
quadrupole
=
particle
.
getChildNode
(
"Quadrupole"
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q0"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q0"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q1"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q1"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q2"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q2"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q3"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q3"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q4"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q4"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q5"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q5"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q6"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q6"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q7"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q7"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q8"
)
);
molecularQuadrupole
.
push_back
(
quadrupole
.
getDoubleProperty
(
"q8"
)
);
force
->
addMultipole
(
particle
.
getDoubleProperty
(
"charge"
),
molecularDipole
,
molecularQuadrupole
,
force
->
addMultipole
(
particle
.
getDoubleProperty
(
"charge"
),
molecularDipole
,
molecularQuadrupole
,
particle
.
getIntProperty
(
"axisType"
),
particle
.
getIntProperty
(
"axisType"
),
particle
.
getIntProperty
(
"multipoleAtomZ"
),
particle
.
getIntProperty
(
"multipoleAtomZ"
),
particle
.
getIntProperty
(
"multipoleAtomX"
),
particle
.
getIntProperty
(
"multipoleAtomX"
),
...
@@ -189,8 +189,8 @@ void* AmoebaMultipoleForceProxy::deserialize(const SerializationNode& node) cons
...
@@ -189,8 +189,8 @@ void* AmoebaMultipoleForceProxy::deserialize(const SerializationNode& node) cons
for
(
unsigned
int
jj
=
0
;
jj
<
covalentTypes
.
size
();
jj
++
)
{
for
(
unsigned
int
jj
=
0
;
jj
<
covalentTypes
.
size
();
jj
++
)
{
std
::
vector
<
int
>
covalentMap
;
std
::
vector
<
int
>
covalentMap
;
loadCovalentMap
(
particle
.
getChildNode
(
covalentTypes
[
jj
]),
covalentMap
);
loadCovalentMap
(
particle
.
getChildNode
(
covalentTypes
[
jj
]),
covalentMap
);
force
->
setCovalentMap
(
ii
,
static_cast
<
AmoebaMultipoleForce
::
CovalentType
>
(
jj
),
covalentMap
);
force
->
setCovalentMap
(
ii
,
static_cast
<
AmoebaMultipoleForce
::
CovalentType
>
(
jj
),
covalentMap
);
}
}
}
}
...
...
plugins/amoeba/serialization/src/AmoebaOutOfPlaneBendForceProxy.cpp
View file @
f11bafd9
...
@@ -64,10 +64,10 @@ void* AmoebaOutOfPlaneBendForceProxy::deserialize(const SerializationNode& node)
...
@@ -64,10 +64,10 @@ void* AmoebaOutOfPlaneBendForceProxy::deserialize(const SerializationNode& node)
AmoebaOutOfPlaneBendForce
*
force
=
new
AmoebaOutOfPlaneBendForce
();
AmoebaOutOfPlaneBendForce
*
force
=
new
AmoebaOutOfPlaneBendForce
();
try
{
try
{
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"
));
force
->
setAmoebaGlobalOutOfPlaneBendSextic
(
node
.
getDoubleProperty
(
"sextic"
));
force
->
setAmoebaGlobalOutOfPlaneBendSextic
(
node
.
getDoubleProperty
(
"sextic"
));
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"OutOfPlaneBend"
);
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"OutOfPlaneBend"
);
for
(
unsigned
int
ii
=
0
;
ii
<
bonds
.
getChildren
().
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
bonds
.
getChildren
().
size
();
ii
++
)
{
...
...
plugins/amoeba/serialization/src/AmoebaPiTorsionForceProxy.cpp
View file @
f11bafd9
...
@@ -45,7 +45,7 @@ void AmoebaPiTorsionForceProxy::serialize(const void* object, SerializationNode&
...
@@ -45,7 +45,7 @@ void AmoebaPiTorsionForceProxy::serialize(const void* object, SerializationNode&
node
.
setIntProperty
(
"version"
,
1
);
node
.
setIntProperty
(
"version"
,
1
);
const
AmoebaPiTorsionForce
&
force
=
*
reinterpret_cast
<
const
AmoebaPiTorsionForce
*>
(
object
);
const
AmoebaPiTorsionForce
&
force
=
*
reinterpret_cast
<
const
AmoebaPiTorsionForce
*>
(
object
);
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
;
double
k
;
double
k
;
force
.
getPiTorsionParameters
(
ii
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle6
,
k
);
force
.
getPiTorsionParameters
(
ii
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle6
,
k
);
...
...
plugins/amoeba/serialization/src/AmoebaStretchBendForceProxy.cpp
View file @
f11bafd9
...
@@ -60,7 +60,7 @@ void* AmoebaStretchBendForceProxy::deserialize(const SerializationNode& node) co
...
@@ -60,7 +60,7 @@ void* AmoebaStretchBendForceProxy::deserialize(const SerializationNode& node) co
AmoebaStretchBendForce
*
force
=
new
AmoebaStretchBendForce
();
AmoebaStretchBendForce
*
force
=
new
AmoebaStretchBendForce
();
try
{
try
{
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
];
force
->
addStretchBend
(
bond
.
getIntProperty
(
"p1"
),
bond
.
getIntProperty
(
"p2"
),
bond
.
getIntProperty
(
"p3"
),
bond
.
getDoubleProperty
(
"dAB"
),
bond
.
getDoubleProperty
(
"dCB"
),
bond
.
getDoubleProperty
(
"angle"
),
bond
.
getDoubleProperty
(
"k1"
),
bond
.
getDoubleProperty
(
"k2"
));
force
->
addStretchBend
(
bond
.
getIntProperty
(
"p1"
),
bond
.
getIntProperty
(
"p2"
),
bond
.
getIntProperty
(
"p3"
),
bond
.
getDoubleProperty
(
"dAB"
),
bond
.
getDoubleProperty
(
"dCB"
),
bond
.
getDoubleProperty
(
"angle"
),
bond
.
getDoubleProperty
(
"k1"
),
bond
.
getDoubleProperty
(
"k2"
));
...
...
plugins/amoeba/serialization/src/AmoebaTorsionTorsionForceProxy.cpp
View file @
f11bafd9
...
@@ -41,23 +41,23 @@ using namespace std;
...
@@ -41,23 +41,23 @@ using namespace std;
AmoebaTorsionTorsionForceProxy
::
AmoebaTorsionTorsionForceProxy
()
:
SerializationProxy
(
"AmoebaTorsionTorsionForce"
)
{
AmoebaTorsionTorsionForceProxy
::
AmoebaTorsionTorsionForceProxy
()
:
SerializationProxy
(
"AmoebaTorsionTorsionForce"
)
{
}
}
static
void
loadGrid
(
const
SerializationNode
&
grid
,
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
gridVector
){
static
void
loadGrid
(
const
SerializationNode
&
grid
,
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
gridVector
)
{
const
std
::
vector
<
SerializationNode
>&
gridSerializationRows
=
grid
.
getChildren
();
const
std
::
vector
<
SerializationNode
>&
gridSerializationRows
=
grid
.
getChildren
();
gridVector
.
resize
(
gridSerializationRows
.
size
()
);
gridVector
.
resize
(
gridSerializationRows
.
size
());
for
(
unsigned
int
ii
=
0
;
ii
<
gridSerializationRows
.
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
gridSerializationRows
.
size
();
ii
++
)
{
const
std
::
vector
<
SerializationNode
>&
gridSerializationColumns
=
gridSerializationRows
[
ii
].
getChildren
();
const
std
::
vector
<
SerializationNode
>&
gridSerializationColumns
=
gridSerializationRows
[
ii
].
getChildren
();
gridVector
[
ii
].
resize
(
gridSerializationColumns
.
size
()
);
gridVector
[
ii
].
resize
(
gridSerializationColumns
.
size
());
for
(
unsigned
int
jj
=
0
;
jj
<
gridSerializationColumns
.
size
();
jj
++
)
{
for
(
unsigned
int
jj
=
0
;
jj
<
gridSerializationColumns
.
size
();
jj
++
)
{
const
SerializationNode
&
gridSerializationColumnNode
=
gridSerializationColumns
[
jj
];
const
SerializationNode
&
gridSerializationColumnNode
=
gridSerializationColumns
[
jj
];
gridVector
[
ii
][
jj
].
resize
(
6
);
gridVector
[
ii
][
jj
].
resize
(
6
);
gridVector
[
ii
][
jj
][
0
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"x"
);
gridVector
[
ii
][
jj
][
0
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"x"
);
gridVector
[
ii
][
jj
][
1
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"y"
);
gridVector
[
ii
][
jj
][
1
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"y"
);
gridVector
[
ii
][
jj
][
2
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"f"
);
gridVector
[
ii
][
jj
][
2
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"f"
);
gridVector
[
ii
][
jj
][
3
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"fx"
);
gridVector
[
ii
][
jj
][
3
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"fx"
);
gridVector
[
ii
][
jj
][
4
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"fy"
);
gridVector
[
ii
][
jj
][
4
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"fy"
);
gridVector
[
ii
][
jj
][
5
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"fxy"
);
gridVector
[
ii
][
jj
][
5
]
=
gridSerializationColumnNode
.
getDoubleProperty
(
"fxy"
);
}
}
}
}
}
}
...
@@ -78,28 +78,28 @@ void AmoebaTorsionTorsionForceProxy::serialize(const void* object, Serialization
...
@@ -78,28 +78,28 @@ void AmoebaTorsionTorsionForceProxy::serialize(const void* object, Serialization
SerializationNode
&
grids
=
node
.
createChildNode
(
"TorsionTorsionGrids"
);
SerializationNode
&
grids
=
node
.
createChildNode
(
"TorsionTorsionGrids"
);
for
(
unsigned
int
kk
=
0
;
kk
<
static_cast
<
unsigned
int
>
(
force
.
getNumTorsionTorsionGrids
());
kk
++
)
{
for
(
unsigned
int
kk
=
0
;
kk
<
static_cast
<
unsigned
int
>
(
force
.
getNumTorsionTorsionGrids
());
kk
++
)
{
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>
grid
=
force
.
getTorsionTorsionGrid
(
kk
);
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>
grid
=
force
.
getTorsionTorsionGrid
(
kk
);
unsigned
int
gridCount
=
0
;
unsigned
int
gridCount
=
0
;
unsigned
int
gridYsize
=
grid
[
0
].
size
();
unsigned
int
gridYsize
=
grid
[
0
].
size
();
for
(
unsigned
int
ii
=
0
;
ii
<
grid
.
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
grid
.
size
();
ii
++
)
{
gridCount
+=
grid
[
ii
].
size
();
gridCount
+=
grid
[
ii
].
size
();
}
}
SerializationNode
&
gridNode
=
grids
.
createChildNode
(
"TorsionTorsionGrid"
);
SerializationNode
&
gridNode
=
grids
.
createChildNode
(
"TorsionTorsionGrid"
);
for
(
unsigned
int
ii
=
0
;
ii
<
grid
.
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
grid
.
size
();
ii
++
)
{
SerializationNode
&
gridSerializationRow
=
gridNode
.
createChildNode
(
"RowNode"
);
SerializationNode
&
gridSerializationRow
=
gridNode
.
createChildNode
(
"RowNode"
);
gridSerializationRow
.
setIntProperty
(
"dim"
,
ii
);
gridSerializationRow
.
setIntProperty
(
"dim"
,
ii
);
for
(
unsigned
int
jj
=
0
;
jj
<
grid
[
ii
].
size
();
jj
++
)
{
for
(
unsigned
int
jj
=
0
;
jj
<
grid
[
ii
].
size
();
jj
++
)
{
SerializationNode
&
gridSerializationColumnNode
=
gridSerializationRow
.
createChildNode
(
"ColumnNode"
);
SerializationNode
&
gridSerializationColumnNode
=
gridSerializationRow
.
createChildNode
(
"ColumnNode"
);
gridSerializationColumnNode
.
setIntProperty
(
"dim"
,
jj
);
gridSerializationColumnNode
.
setIntProperty
(
"dim"
,
jj
);
unsigned
int
index
=
0
;
unsigned
int
index
=
0
;
gridSerializationColumnNode
.
setDoubleProperty
(
"x"
,
grid
[
ii
][
jj
][
index
++
]
);
gridSerializationColumnNode
.
setDoubleProperty
(
"x"
,
grid
[
ii
][
jj
][
index
++
]);
gridSerializationColumnNode
.
setDoubleProperty
(
"y"
,
grid
[
ii
][
jj
][
index
++
]
);
gridSerializationColumnNode
.
setDoubleProperty
(
"y"
,
grid
[
ii
][
jj
][
index
++
]);
gridSerializationColumnNode
.
setDoubleProperty
(
"f"
,
grid
[
ii
][
jj
][
index
++
]
);
gridSerializationColumnNode
.
setDoubleProperty
(
"f"
,
grid
[
ii
][
jj
][
index
++
]);
gridSerializationColumnNode
.
setDoubleProperty
(
"fx"
,
grid
[
ii
][
jj
][
index
++
]
);
gridSerializationColumnNode
.
setDoubleProperty
(
"fx"
,
grid
[
ii
][
jj
][
index
++
]);
gridSerializationColumnNode
.
setDoubleProperty
(
"fy"
,
grid
[
ii
][
jj
][
index
++
]
);
gridSerializationColumnNode
.
setDoubleProperty
(
"fy"
,
grid
[
ii
][
jj
][
index
++
]);
gridSerializationColumnNode
.
setDoubleProperty
(
"fxy"
,
grid
[
ii
][
jj
][
index
++
]
);
gridSerializationColumnNode
.
setDoubleProperty
(
"fxy"
,
grid
[
ii
][
jj
][
index
++
]);
}
}
}
}
}
}
...
@@ -108,8 +108,8 @@ void AmoebaTorsionTorsionForceProxy::serialize(const void* object, Serialization
...
@@ -108,8 +108,8 @@ void AmoebaTorsionTorsionForceProxy::serialize(const void* object, Serialization
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumTorsionTorsions
());
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumTorsionTorsions
());
ii
++
)
{
int
particle1
,
particle2
,
particle3
,
particle4
,
particle5
;
int
particle1
,
particle2
,
particle3
,
particle4
,
particle5
;
int
chiralCheckAtomIndex
,
gridIndex
;
int
chiralCheckAtomIndex
,
gridIndex
;
force
.
getTorsionTorsionParameters
(
ii
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
chiralCheckAtomIndex
,
gridIndex
);
force
.
getTorsionTorsionParameters
(
ii
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
chiralCheckAtomIndex
,
gridIndex
);
bonds
.
createChildNode
(
"TorsionTorsion"
).
setIntProperty
(
"p1"
,
particle1
).
setIntProperty
(
"p2"
,
particle2
).
setIntProperty
(
"p3"
,
particle3
).
setIntProperty
(
"p4"
,
particle4
).
setIntProperty
(
"p5"
,
particle5
).
setIntProperty
(
"chiralCheckAtomIndex"
,
chiralCheckAtomIndex
).
setIntProperty
(
"gridIndex"
,
gridIndex
);
bonds
.
createChildNode
(
"TorsionTorsion"
).
setIntProperty
(
"p1"
,
particle1
).
setIntProperty
(
"p2"
,
particle2
).
setIntProperty
(
"p3"
,
particle3
).
setIntProperty
(
"p4"
,
particle4
).
setIntProperty
(
"p5"
,
particle5
).
setIntProperty
(
"chiralCheckAtomIndex"
,
chiralCheckAtomIndex
).
setIntProperty
(
"gridIndex"
,
gridIndex
);
}
}
}
}
...
@@ -124,10 +124,10 @@ void* AmoebaTorsionTorsionForceProxy::deserialize(const SerializationNode& node)
...
@@ -124,10 +124,10 @@ void* AmoebaTorsionTorsionForceProxy::deserialize(const SerializationNode& node)
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
++
)
{
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>
gridVector
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>
gridVector
;
loadGrid
(
gridList
[
ii
],
gridVector
);
loadGrid
(
gridList
[
ii
],
gridVector
);
force
->
setTorsionTorsionGrid
(
ii
,
gridVector
);
force
->
setTorsionTorsionGrid
(
ii
,
gridVector
);
}
}
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"TorsionTorsion"
);
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"TorsionTorsion"
);
...
...
plugins/amoeba/serialization/src/AmoebaVdwForceProxy.cpp
View file @
f11bafd9
...
@@ -56,17 +56,17 @@ void AmoebaVdwForceProxy::serialize(const void* object, SerializationNode& node)
...
@@ -56,17 +56,17 @@ void AmoebaVdwForceProxy::serialize(const void* object, SerializationNode& node)
int
ivIndex
;
int
ivIndex
;
double
sigma
,
epsilon
,
reductionFactor
;
double
sigma
,
epsilon
,
reductionFactor
;
force
.
getParticleParameters
(
ii
,
ivIndex
,
sigma
,
epsilon
,
reductionFactor
);
force
.
getParticleParameters
(
ii
,
ivIndex
,
sigma
,
epsilon
,
reductionFactor
);
SerializationNode
&
particle
=
particles
.
createChildNode
(
"Particle"
);
SerializationNode
&
particle
=
particles
.
createChildNode
(
"Particle"
);
particle
.
setIntProperty
(
"ivIndex"
,
ivIndex
).
setDoubleProperty
(
"sigma"
,
sigma
).
setDoubleProperty
(
"epsilon"
,
epsilon
).
setDoubleProperty
(
"reductionFactor"
,
reductionFactor
);
particle
.
setIntProperty
(
"ivIndex"
,
ivIndex
).
setDoubleProperty
(
"sigma"
,
sigma
).
setDoubleProperty
(
"epsilon"
,
epsilon
).
setDoubleProperty
(
"reductionFactor"
,
reductionFactor
);
std
::
vector
<
int
>
exclusions
;
std
::
vector
<
int
>
exclusions
;
force
.
getParticleExclusions
(
ii
,
exclusions
);
force
.
getParticleExclusions
(
ii
,
exclusions
);
SerializationNode
&
particleExclusions
=
particle
.
createChildNode
(
"ParticleExclusions"
);
SerializationNode
&
particleExclusions
=
particle
.
createChildNode
(
"ParticleExclusions"
);
for
(
unsigned
int
jj
=
0
;
jj
<
exclusions
.
size
();
jj
++
)
{
for
(
unsigned
int
jj
=
0
;
jj
<
exclusions
.
size
();
jj
++
)
{
particleExclusions
.
createChildNode
(
"excl"
).
setIntProperty
(
"index"
,
exclusions
[
jj
]
);
particleExclusions
.
createChildNode
(
"excl"
).
setIntProperty
(
"index"
,
exclusions
[
jj
]);
}
}
}
}
}
}
...
@@ -77,9 +77,9 @@ void* AmoebaVdwForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -77,9 +77,9 @@ void* AmoebaVdwForceProxy::deserialize(const SerializationNode& node) const {
AmoebaVdwForce
*
force
=
new
AmoebaVdwForce
();
AmoebaVdwForce
*
force
=
new
AmoebaVdwForce
();
try
{
try
{
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
(
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"
);
...
@@ -92,9 +92,9 @@ void* AmoebaVdwForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -92,9 +92,9 @@ void* AmoebaVdwForceProxy::deserialize(const SerializationNode& node) const {
const
SerializationNode
&
particleExclusions
=
particle
.
getChildNode
(
"ParticleExclusions"
);
const
SerializationNode
&
particleExclusions
=
particle
.
getChildNode
(
"ParticleExclusions"
);
std
::
vector
<
int
>
exclusions
;
std
::
vector
<
int
>
exclusions
;
for
(
unsigned
int
jj
=
0
;
jj
<
particleExclusions
.
getChildren
().
size
();
jj
++
)
{
for
(
unsigned
int
jj
=
0
;
jj
<
particleExclusions
.
getChildren
().
size
();
jj
++
)
{
exclusions
.
push_back
(
particleExclusions
.
getChildren
()[
jj
].
getIntProperty
(
"index"
)
);
exclusions
.
push_back
(
particleExclusions
.
getChildren
()[
jj
].
getIntProperty
(
"index"
));
}
}
force
->
setParticleExclusions
(
ii
,
exclusions
);
force
->
setParticleExclusions
(
ii
,
exclusions
);
}
}
}
}
...
...
plugins/amoeba/serialization/src/AmoebaWcaDispersionForceProxy.cpp
View file @
f11bafd9
...
@@ -56,7 +56,7 @@ void AmoebaWcaDispersionForceProxy::serialize(const void* object, SerializationN
...
@@ -56,7 +56,7 @@ void AmoebaWcaDispersionForceProxy::serialize(const void* object, SerializationN
SerializationNode
&
particles
=
node
.
createChildNode
(
"WcaDispersionParticles"
);
SerializationNode
&
particles
=
node
.
createChildNode
(
"WcaDispersionParticles"
);
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumParticles
());
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force
.
getNumParticles
());
ii
++
)
{
double
radius
,
epsilon
;
double
radius
,
epsilon
;
force
.
getParticleParameters
(
ii
,
radius
,
epsilon
);
force
.
getParticleParameters
(
ii
,
radius
,
epsilon
);
particles
.
createChildNode
(
"Particle"
).
setDoubleProperty
(
"radius"
,
radius
).
setDoubleProperty
(
"epsilon"
,
epsilon
);
particles
.
createChildNode
(
"Particle"
).
setDoubleProperty
(
"radius"
,
radius
).
setDoubleProperty
(
"epsilon"
,
epsilon
);
}
}
...
@@ -69,21 +69,21 @@ void* AmoebaWcaDispersionForceProxy::deserialize(const SerializationNode& node)
...
@@ -69,21 +69,21 @@ void* AmoebaWcaDispersionForceProxy::deserialize(const SerializationNode& node)
try
{
try
{
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"
)
);
force
->
setRminh
(
node
.
getDoubleProperty
(
"Rminh"
)
);
force
->
setRminh
(
node
.
getDoubleProperty
(
"Rminh"
)
);
force
->
setAwater
(
node
.
getDoubleProperty
(
"Awater"
)
);
force
->
setAwater
(
node
.
getDoubleProperty
(
"Awater"
)
);
force
->
setShctd
(
node
.
getDoubleProperty
(
"Shctd"
)
);
force
->
setShctd
(
node
.
getDoubleProperty
(
"Shctd"
)
);
force
->
setDispoff
(
node
.
getDoubleProperty
(
"Dispoff"
)
);
force
->
setDispoff
(
node
.
getDoubleProperty
(
"Dispoff"
)
);
force
->
setSlevy
(
node
.
getDoubleProperty
(
"Slevy"
)
);
force
->
setSlevy
(
node
.
getDoubleProperty
(
"Slevy"
)
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"WcaDispersionParticles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"WcaDispersionParticles"
);
for
(
unsigned
int
ii
=
0
;
ii
<
particles
.
getChildren
().
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
particles
.
getChildren
().
size
();
ii
++
)
{
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
ii
];
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
ii
];
force
->
addParticle
(
particle
.
getDoubleProperty
(
"radius"
),
particle
.
getDoubleProperty
(
"epsilon"
));
force
->
addParticle
(
particle
.
getDoubleProperty
(
"radius"
),
particle
.
getDoubleProperty
(
"epsilon"
));
}
}
}
}
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaAngleForce.cpp
View file @
f11bafd9
...
@@ -45,10 +45,10 @@ void testSerialization() {
...
@@ -45,10 +45,10 @@ void testSerialization() {
// Create a Force.
// Create a Force.
AmoebaAngleForce
force1
;
AmoebaAngleForce
force1
;
force1
.
setAmoebaGlobalAngleCubic
(
12.3
);
force1
.
setAmoebaGlobalAngleCubic
(
12.3
);
force1
.
setAmoebaGlobalAngleQuartic
(
98.7
);
force1
.
setAmoebaGlobalAngleQuartic
(
98.7
);
force1
.
setAmoebaGlobalAnglePentic
(
91.7
);
force1
.
setAmoebaGlobalAnglePentic
(
91.7
);
force1
.
setAmoebaGlobalAngleSextic
(
93.7
);
force1
.
setAmoebaGlobalAngleSextic
(
93.7
);
force1
.
addAngle
(
0
,
1
,
3
,
1.0
,
2.0
);
force1
.
addAngle
(
0
,
1
,
3
,
1.0
,
2.0
);
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
);
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaBondForce.cpp
View file @
f11bafd9
...
@@ -45,8 +45,8 @@ void testSerialization() {
...
@@ -45,8 +45,8 @@ void testSerialization() {
// Create a Force.
// Create a Force.
AmoebaBondForce
force1
;
AmoebaBondForce
force1
;
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
);
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaGeneralizedKirkwoodForce.cpp
View file @
f11bafd9
...
@@ -45,12 +45,12 @@ void testSerialization() {
...
@@ -45,12 +45,12 @@ void testSerialization() {
// Create a Force.
// Create a Force.
AmoebaGeneralizedKirkwoodForce
force1
;
AmoebaGeneralizedKirkwoodForce
force1
;
force1
.
setSolventDielectric
(
80.0
);
force1
.
setSolventDielectric
(
80.0
);
force1
.
setSoluteDielectric
(
1.0
);
force1
.
setSoluteDielectric
(
1.0
);
//force1.setDielectricOffset(
0.09
);
//force1.setDielectricOffset( 0.09);
force1
.
setProbeRadius
(
1.40
);
force1
.
setProbeRadius
(
1.40
);
force1
.
setSurfaceAreaFactor
(
0.888
);
force1
.
setSurfaceAreaFactor
(
0.888
);
force1
.
setIncludeCavityTerm
(
1
);
force1
.
setIncludeCavityTerm
(
1
);
force1
.
addParticle
(
1.0
,
2.0
,
0.9
);
force1
.
addParticle
(
1.0
,
2.0
,
0.9
);
force1
.
addParticle
(
-
1.1
,
2.1
,
0.8
);
force1
.
addParticle
(
-
1.1
,
2.1
,
0.8
);
...
@@ -60,14 +60,6 @@ void testSerialization() {
...
@@ -60,14 +60,6 @@ void testSerialization() {
stringstream
buffer
;
stringstream
buffer
;
XmlSerializer
::
serialize
<
AmoebaGeneralizedKirkwoodForce
>
(
&
force1
,
"Force"
,
buffer
);
XmlSerializer
::
serialize
<
AmoebaGeneralizedKirkwoodForce
>
(
&
force1
,
"Force"
,
buffer
);
#ifdef AMOEBA_DEBUG
if
(
0
){
FILE
*
filePtr
=
fopen
(
"GeneralizedKirkwood.xml"
,
"w"
);
(
void
)
fprintf
(
filePtr
,
"%s"
,
buffer
.
str
().
c_str
()
);
(
void
)
fclose
(
filePtr
);
}
#endif
AmoebaGeneralizedKirkwoodForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaGeneralizedKirkwoodForce
>
(
buffer
);
AmoebaGeneralizedKirkwoodForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaGeneralizedKirkwoodForce
>
(
buffer
);
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
...
@@ -85,8 +77,8 @@ void testSerialization() {
...
@@ -85,8 +77,8 @@ void testSerialization() {
double
radius1
,
charge1
,
scaleFactor1
;
double
radius1
,
charge1
,
scaleFactor1
;
double
radius2
,
charge2
,
scaleFactor2
;
double
radius2
,
charge2
,
scaleFactor2
;
force1
.
getParticleParameters
(
ii
,
charge1
,
radius1
,
scaleFactor1
);
force1
.
getParticleParameters
(
ii
,
charge1
,
radius1
,
scaleFactor1
);
force2
.
getParticleParameters
(
ii
,
charge2
,
radius2
,
scaleFactor2
);
force2
.
getParticleParameters
(
ii
,
charge2
,
radius2
,
scaleFactor2
);
ASSERT_EQUAL
(
charge1
,
charge2
);
ASSERT_EQUAL
(
charge1
,
charge2
);
ASSERT_EQUAL
(
radius1
,
radius2
);
ASSERT_EQUAL
(
radius1
,
radius2
);
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaInPlaneAngleForce.cpp
View file @
f11bafd9
...
@@ -46,10 +46,10 @@ void testSerialization() {
...
@@ -46,10 +46,10 @@ void testSerialization() {
AmoebaInPlaneAngleForce
force1
;
AmoebaInPlaneAngleForce
force1
;
force1
.
setAmoebaGlobalInPlaneAngleCubic
(
12.3
);
force1
.
setAmoebaGlobalInPlaneAngleCubic
(
12.3
);
force1
.
setAmoebaGlobalInPlaneAngleQuartic
(
98.7
);
force1
.
setAmoebaGlobalInPlaneAngleQuartic
(
98.7
);
force1
.
setAmoebaGlobalInPlaneAnglePentic
(
91.7
);
force1
.
setAmoebaGlobalInPlaneAnglePentic
(
91.7
);
force1
.
setAmoebaGlobalInPlaneAngleSextic
(
93.7
);
force1
.
setAmoebaGlobalInPlaneAngleSextic
(
93.7
);
force1
.
addAngle
(
0
,
1
,
3
,
4
,
1.0
,
2.0
);
force1
.
addAngle
(
0
,
1
,
3
,
4
,
1.0
,
2.0
);
force1
.
addAngle
(
0
,
2
,
3
,
5
,
2.0
,
2.1
);
force1
.
addAngle
(
0
,
2
,
3
,
5
,
2.0
,
2.1
);
...
@@ -71,7 +71,7 @@ void testSerialization() {
...
@@ -71,7 +71,7 @@ void testSerialization() {
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalInPlaneAngleSextic
(),
force2
.
getAmoebaGlobalInPlaneAngleSextic
());
ASSERT_EQUAL
(
force1
.
getAmoebaGlobalInPlaneAngleSextic
(),
force2
.
getAmoebaGlobalInPlaneAngleSextic
());
ASSERT_EQUAL
(
force1
.
getNumAngles
(),
force2
.
getNumAngles
());
ASSERT_EQUAL
(
force1
.
getNumAngles
(),
force2
.
getNumAngles
());
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force1
.
getNumAngles
());
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force1
.
getNumAngles
());
ii
++
)
{
int
a1
,
a2
,
a3
,
a4
,
b1
,
b2
,
b3
,
b4
;
int
a1
,
a2
,
a3
,
a4
,
b1
,
b2
,
b3
,
b4
;
double
da
,
db
,
ka
,
kb
;
double
da
,
db
,
ka
,
kb
;
force1
.
getAngleParameters
(
ii
,
a1
,
a2
,
a3
,
a4
,
da
,
ka
);
force1
.
getAngleParameters
(
ii
,
a1
,
a2
,
a3
,
a4
,
da
,
ka
);
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaMultipoleForce.cpp
View file @
f11bafd9
...
@@ -42,56 +42,56 @@ using namespace std;
...
@@ -42,56 +42,56 @@ using namespace std;
extern
"C"
void
registerAmoebaSerializationProxies
();
extern
"C"
void
registerAmoebaSerializationProxies
();
static
void
getCovalentTypes
(
std
::
vector
<
std
::
string
>&
covalentTypes
){
static
void
getCovalentTypes
(
std
::
vector
<
std
::
string
>&
covalentTypes
)
{
covalentTypes
.
push_back
(
"Covalent12"
);
covalentTypes
.
push_back
(
"Covalent12"
);
covalentTypes
.
push_back
(
"Covalent13"
);
covalentTypes
.
push_back
(
"Covalent13"
);
covalentTypes
.
push_back
(
"Covalent14"
);
covalentTypes
.
push_back
(
"Covalent14"
);
covalentTypes
.
push_back
(
"Covalent15"
);
covalentTypes
.
push_back
(
"Covalent15"
);
covalentTypes
.
push_back
(
"PolarizationCovalent11"
);
covalentTypes
.
push_back
(
"PolarizationCovalent11"
);
covalentTypes
.
push_back
(
"PolarizationCovalent12"
);
covalentTypes
.
push_back
(
"PolarizationCovalent12"
);
covalentTypes
.
push_back
(
"PolarizationCovalent13"
);
covalentTypes
.
push_back
(
"PolarizationCovalent13"
);
covalentTypes
.
push_back
(
"PolarizationCovalent14"
);
covalentTypes
.
push_back
(
"PolarizationCovalent14"
);
}
}
void
testSerialization
()
{
void
testSerialization
()
{
// Create a Force.
// Create a Force.
AmoebaMultipoleForce
force1
;
AmoebaMultipoleForce
force1
;
force1
.
setNonbondedMethod
(
AmoebaMultipoleForce
::
NoCutoff
);
force1
.
setNonbondedMethod
(
AmoebaMultipoleForce
::
NoCutoff
);
force1
.
setCutoffDistance
(
0.9
);
force1
.
setCutoffDistance
(
0.9
);
force1
.
setAEwald
(
0.544
);
force1
.
setAEwald
(
0.544
);
//force1.setPmeBSplineOrder(
4
);
//force1.setPmeBSplineOrder(
4
);
std
::
vector
<
int
>
gridDimension
;
std
::
vector
<
int
>
gridDimension
;
gridDimension
.
push_back
(
64
);
gridDimension
.
push_back
(
64
);
gridDimension
.
push_back
(
63
);
gridDimension
.
push_back
(
63
);
gridDimension
.
push_back
(
61
);
gridDimension
.
push_back
(
61
);
force1
.
setPmeGridDimensions
(
gridDimension
);
force1
.
setPmeGridDimensions
(
gridDimension
);
//force1.setMutualInducedIterationMethod(
AmoebaMultipoleForce::SOR
);
//force1.setMutualInducedIterationMethod(AmoebaMultipoleForce::SOR);
force1
.
setMutualInducedMaxIterations
(
200
);
force1
.
setMutualInducedMaxIterations
(
200
);
force1
.
setMutualInducedTargetEpsilon
(
1.0e-05
);
force1
.
setMutualInducedTargetEpsilon
(
1.0e-05
);
//force1.setElectricConstant(
138.93
);
//force1.setElectricConstant(138.93);
force1
.
setEwaldErrorTolerance
(
1.0e-05
);
force1
.
setEwaldErrorTolerance
(
1.0e-05
);
std
::
vector
<
std
::
string
>
covalentTypes
;
std
::
vector
<
std
::
string
>
covalentTypes
;
getCovalentTypes
(
covalentTypes
);
getCovalentTypes
(
covalentTypes
);
for
(
unsigned
int
ii
=
0
;
ii
<
3
;
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
std
::
vector
<
double
>
molecularDipole
;
std
::
vector
<
double
>
molecularDipole
;
std
::
vector
<
double
>
molecularQuadrupole
;
std
::
vector
<
double
>
molecularQuadrupole
;
molecularDipole
.
push_back
(
0.1
);
molecularDipole
.
push_back
(
rand
()
);
molecularDipole
.
push_back
(
rand
()
);
molecularDipole
.
push_back
(
0.1
);
molecularDipole
.
push_back
(
rand
());
molecularDipole
.
push_back
(
rand
());
for
(
unsigned
int
jj
=
0
;
jj
<
9
;
jj
++
){
for
(
unsigned
int
jj
=
0
;
jj
<
9
;
jj
++
)
{
molecularQuadrupole
.
push_back
(
static_cast
<
double
>
(
rand
())
);
molecularQuadrupole
.
push_back
(
static_cast
<
double
>
(
rand
()));
}
}
force1
.
addMultipole
(
static_cast
<
double
>
(
ii
+
1
),
molecularDipole
,
molecularQuadrupole
,
AmoebaMultipoleForce
::
Bisector
,
force1
.
addMultipole
(
static_cast
<
double
>
(
ii
+
1
),
molecularDipole
,
molecularQuadrupole
,
AmoebaMultipoleForce
::
Bisector
,
ii
+
1
,
ii
+
2
,
ii
+
3
,
static_cast
<
double
>
(
rand
()),
static_cast
<
double
>
(
rand
()),
static_cast
<
double
>
(
rand
())
);
ii
+
1
,
ii
+
2
,
ii
+
3
,
static_cast
<
double
>
(
rand
()),
static_cast
<
double
>
(
rand
()),
static_cast
<
double
>
(
rand
()));
for
(
unsigned
int
jj
=
0
;
jj
<
covalentTypes
.
size
();
jj
++
){
for
(
unsigned
int
jj
=
0
;
jj
<
covalentTypes
.
size
();
jj
++
)
{
std
::
vector
<
int
>
covalentMap
;
std
::
vector
<
int
>
covalentMap
;
covalentMap
.
push_back
(
ii
*
jj
);
covalentMap
.
push_back
(
rand
()
);
covalentMap
.
push_back
(
rand
()
);
covalentMap
.
push_back
(
ii
*
jj
);
covalentMap
.
push_back
(
rand
());
covalentMap
.
push_back
(
rand
());
force1
.
setCovalentMap
(
ii
,
static_cast
<
AmoebaMultipoleForce
::
CovalentType
>
(
jj
),
covalentMap
);
force1
.
setCovalentMap
(
ii
,
static_cast
<
AmoebaMultipoleForce
::
CovalentType
>
(
jj
),
covalentMap
);
}
}
}
}
...
@@ -99,13 +99,6 @@ void testSerialization() {
...
@@ -99,13 +99,6 @@ void testSerialization() {
stringstream
buffer
;
stringstream
buffer
;
XmlSerializer
::
serialize
<
AmoebaMultipoleForce
>
(
&
force1
,
"Force"
,
buffer
);
XmlSerializer
::
serialize
<
AmoebaMultipoleForce
>
(
&
force1
,
"Force"
,
buffer
);
#ifdef AMOEBA_DEBUG
if
(
0
){
FILE
*
filePtr
=
fopen
(
"Multipole.xml"
,
"w"
);
(
void
)
fprintf
(
filePtr
,
"%s"
,
buffer
.
str
().
c_str
()
);
(
void
)
fclose
(
filePtr
);
}
#endif
AmoebaMultipoleForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaMultipoleForce
>
(
buffer
);
AmoebaMultipoleForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaMultipoleForce
>
(
buffer
);
...
@@ -125,10 +118,10 @@ void testSerialization() {
...
@@ -125,10 +118,10 @@ void testSerialization() {
std
::
vector
<
int
>
gridDimension1
;
std
::
vector
<
int
>
gridDimension1
;
std
::
vector
<
int
>
gridDimension2
;
std
::
vector
<
int
>
gridDimension2
;
force1
.
getPmeGridDimensions
(
gridDimension1
);
force1
.
getPmeGridDimensions
(
gridDimension1
);
force2
.
getPmeGridDimensions
(
gridDimension2
);
force2
.
getPmeGridDimensions
(
gridDimension2
);
ASSERT_EQUAL
(
gridDimension1
.
size
(),
gridDimension2
.
size
());
ASSERT_EQUAL
(
gridDimension1
.
size
(),
gridDimension2
.
size
());
for
(
unsigned
int
jj
=
0
;
jj
<
gridDimension1
.
size
();
jj
++
){
for
(
unsigned
int
jj
=
0
;
jj
<
gridDimension1
.
size
();
jj
++
)
{
ASSERT_EQUAL
(
gridDimension1
[
jj
],
gridDimension2
[
jj
]);
ASSERT_EQUAL
(
gridDimension1
[
jj
],
gridDimension2
[
jj
]);
}
}
...
@@ -147,11 +140,11 @@ void testSerialization() {
...
@@ -147,11 +140,11 @@ void testSerialization() {
std
::
vector
<
double
>
molecularDipole2
;
std
::
vector
<
double
>
molecularDipole2
;
std
::
vector
<
double
>
molecularQuadrupole2
;
std
::
vector
<
double
>
molecularQuadrupole2
;
force1
.
getMultipoleParameters
(
ii
,
charge1
,
molecularDipole1
,
molecularQuadrupole1
,
axisType1
,
multipoleAtomZ1
,
multipoleAtomX1
,
multipoleAtomY1
,
force1
.
getMultipoleParameters
(
ii
,
charge1
,
molecularDipole1
,
molecularQuadrupole1
,
axisType1
,
multipoleAtomZ1
,
multipoleAtomX1
,
multipoleAtomY1
,
thole1
,
dampingFactor1
,
polarity1
);
thole1
,
dampingFactor1
,
polarity1
);
force2
.
getMultipoleParameters
(
ii
,
charge2
,
molecularDipole2
,
molecularQuadrupole2
,
axisType2
,
multipoleAtomZ2
,
multipoleAtomX2
,
multipoleAtomY2
,
force2
.
getMultipoleParameters
(
ii
,
charge2
,
molecularDipole2
,
molecularQuadrupole2
,
axisType2
,
multipoleAtomZ2
,
multipoleAtomX2
,
multipoleAtomY2
,
thole2
,
dampingFactor2
,
polarity2
);
thole2
,
dampingFactor2
,
polarity2
);
ASSERT_EQUAL
(
charge1
,
charge2
);
ASSERT_EQUAL
(
charge1
,
charge2
);
ASSERT_EQUAL
(
axisType1
,
axisType2
);
ASSERT_EQUAL
(
axisType1
,
axisType2
);
...
@@ -162,25 +155,25 @@ void testSerialization() {
...
@@ -162,25 +155,25 @@ void testSerialization() {
ASSERT_EQUAL
(
dampingFactor1
,
dampingFactor2
);
ASSERT_EQUAL
(
dampingFactor1
,
dampingFactor2
);
ASSERT_EQUAL
(
polarity1
,
polarity2
);
ASSERT_EQUAL
(
polarity1
,
polarity2
);
ASSERT_EQUAL
(
molecularDipole1
.
size
(),
molecularDipole2
.
size
()
);
ASSERT_EQUAL
(
molecularDipole1
.
size
(),
molecularDipole2
.
size
());
ASSERT_EQUAL
(
molecularDipole1
.
size
(),
3
);
ASSERT_EQUAL
(
molecularDipole1
.
size
(),
3
);
for
(
unsigned
int
jj
=
0
;
jj
<
molecularDipole1
.
size
();
jj
++
)
{
for
(
unsigned
int
jj
=
0
;
jj
<
molecularDipole1
.
size
();
jj
++
)
{
ASSERT_EQUAL
(
molecularDipole1
[
jj
],
molecularDipole2
[
jj
]
);
ASSERT_EQUAL
(
molecularDipole1
[
jj
],
molecularDipole2
[
jj
]);
}
}
ASSERT_EQUAL
(
molecularQuadrupole1
.
size
(),
molecularQuadrupole2
.
size
()
);
ASSERT_EQUAL
(
molecularQuadrupole1
.
size
(),
molecularQuadrupole2
.
size
());
ASSERT_EQUAL
(
molecularQuadrupole1
.
size
(),
9
);
ASSERT_EQUAL
(
molecularQuadrupole1
.
size
(),
9
);
for
(
unsigned
int
jj
=
0
;
jj
<
molecularQuadrupole1
.
size
();
jj
++
)
{
for
(
unsigned
int
jj
=
0
;
jj
<
molecularQuadrupole1
.
size
();
jj
++
)
{
ASSERT_EQUAL
(
molecularQuadrupole1
[
jj
],
molecularQuadrupole2
[
jj
]
);
ASSERT_EQUAL
(
molecularQuadrupole1
[
jj
],
molecularQuadrupole2
[
jj
]);
}
}
for
(
unsigned
int
jj
=
0
;
jj
<
covalentTypes
.
size
();
jj
++
)
{
for
(
unsigned
int
jj
=
0
;
jj
<
covalentTypes
.
size
();
jj
++
)
{
std
::
vector
<
int
>
covalentMap1
;
std
::
vector
<
int
>
covalentMap1
;
std
::
vector
<
int
>
covalentMap2
;
std
::
vector
<
int
>
covalentMap2
;
force1
.
getCovalentMap
(
ii
,
static_cast
<
AmoebaMultipoleForce
::
CovalentType
>
(
jj
),
covalentMap1
);
force1
.
getCovalentMap
(
ii
,
static_cast
<
AmoebaMultipoleForce
::
CovalentType
>
(
jj
),
covalentMap1
);
force2
.
getCovalentMap
(
ii
,
static_cast
<
AmoebaMultipoleForce
::
CovalentType
>
(
jj
),
covalentMap2
);
force2
.
getCovalentMap
(
ii
,
static_cast
<
AmoebaMultipoleForce
::
CovalentType
>
(
jj
),
covalentMap2
);
ASSERT_EQUAL
(
covalentMap1
.
size
(),
covalentMap2
.
size
()
);
ASSERT_EQUAL
(
covalentMap1
.
size
(),
covalentMap2
.
size
());
for
(
unsigned
int
kk
=
0
;
kk
<
covalentMap1
.
size
();
kk
++
)
{
for
(
unsigned
int
kk
=
0
;
kk
<
covalentMap1
.
size
();
kk
++
)
{
ASSERT_EQUAL
(
covalentMap1
[
kk
],
covalentMap2
[
kk
]
);
ASSERT_EQUAL
(
covalentMap1
[
kk
],
covalentMap2
[
kk
]);
}
}
}
}
}
}
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaOutOfPlaneBendForce.cpp
View file @
f11bafd9
...
@@ -46,10 +46,10 @@ void testSerialization() {
...
@@ -46,10 +46,10 @@ void testSerialization() {
AmoebaOutOfPlaneBendForce
force1
;
AmoebaOutOfPlaneBendForce
force1
;
force1
.
setAmoebaGlobalOutOfPlaneBendCubic
(
12.3
);
force1
.
setAmoebaGlobalOutOfPlaneBendCubic
(
12.3
);
force1
.
setAmoebaGlobalOutOfPlaneBendQuartic
(
98.7
);
force1
.
setAmoebaGlobalOutOfPlaneBendQuartic
(
98.7
);
force1
.
setAmoebaGlobalOutOfPlaneBendPentic
(
91.7
);
force1
.
setAmoebaGlobalOutOfPlaneBendPentic
(
91.7
);
force1
.
setAmoebaGlobalOutOfPlaneBendSextic
(
93.7
);
force1
.
setAmoebaGlobalOutOfPlaneBendSextic
(
93.7
);
force1
.
addOutOfPlaneBend
(
0
,
1
,
3
,
4
,
2.0
);
force1
.
addOutOfPlaneBend
(
0
,
1
,
3
,
4
,
2.0
);
force1
.
addOutOfPlaneBend
(
0
,
2
,
3
,
5
,
2.1
);
force1
.
addOutOfPlaneBend
(
0
,
2
,
3
,
5
,
2.1
);
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaTorsionTorsionForce.cpp
View file @
f11bafd9
...
@@ -42,27 +42,27 @@ using namespace std;
...
@@ -42,27 +42,27 @@ using namespace std;
extern
"C"
void
registerAmoebaSerializationProxies
();
extern
"C"
void
registerAmoebaSerializationProxies
();
static
void
loadTorsionTorsionGrid
(
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
gridVector
){
static
void
loadTorsionTorsionGrid
(
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
gridVector
)
{
static
const
int
gridSize
=
25
;
static
const
int
gridSize
=
25
;
gridVector
.
resize
(
gridSize
);
gridVector
.
resize
(
gridSize
);
for
(
unsigned
int
ii
=
0
;
ii
<
gridSize
;
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
gridSize
;
ii
++
)
{
gridVector
[
ii
].
resize
(
gridSize
);
gridVector
[
ii
].
resize
(
gridSize
);
for
(
unsigned
int
jj
=
0
;
jj
<
gridSize
;
jj
++
){
for
(
unsigned
int
jj
=
0
;
jj
<
gridSize
;
jj
++
)
{
gridVector
[
ii
][
jj
].
resize
(
6
);
gridVector
[
ii
][
jj
].
resize
(
6
);
for
(
unsigned
int
kk
=
0
;
kk
<
6
;
kk
++
){
for
(
unsigned
int
kk
=
0
;
kk
<
6
;
kk
++
)
{
gridVector
[
ii
][
jj
][
0
]
=
-
180.0
+
15.0
*
static_cast
<
double
>
(
ii
);
gridVector
[
ii
][
jj
][
0
]
=
-
180.0
+
15.0
*
static_cast
<
double
>
(
ii
);
gridVector
[
ii
][
jj
][
1
]
=
-
180.0
+
15.0
*
static_cast
<
double
>
(
jj
);
gridVector
[
ii
][
jj
][
1
]
=
-
180.0
+
15.0
*
static_cast
<
double
>
(
jj
);
gridVector
[
ii
][
jj
][
2
]
=
static_cast
<
double
>
(
rand
());
gridVector
[
ii
][
jj
][
2
]
=
static_cast
<
double
>
(
rand
());
gridVector
[
ii
][
jj
][
3
]
=
static_cast
<
double
>
(
rand
());
gridVector
[
ii
][
jj
][
3
]
=
static_cast
<
double
>
(
rand
());
gridVector
[
ii
][
jj
][
4
]
=
static_cast
<
double
>
(
rand
());
gridVector
[
ii
][
jj
][
4
]
=
static_cast
<
double
>
(
rand
());
gridVector
[
ii
][
jj
][
5
]
=
static_cast
<
double
>
(
rand
());
gridVector
[
ii
][
jj
][
5
]
=
static_cast
<
double
>
(
rand
());
}
}
}
}
}
}
}
}
static
void
compareGrids
(
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
grid1
,
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
grid2
)
{
static
void
compareGrids
(
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
grid1
,
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
grid2
)
{
ASSERT_EQUAL
(
grid1
.
size
(),
grid2
.
size
());
ASSERT_EQUAL
(
grid1
.
size
(),
grid2
.
size
());
for
(
unsigned
int
ii
=
0
;
ii
<
grid1
.
size
();
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
grid1
.
size
();
ii
++
)
{
...
@@ -81,27 +81,19 @@ void testSerialization() {
...
@@ -81,27 +81,19 @@ void testSerialization() {
AmoebaTorsionTorsionForce
force1
;
AmoebaTorsionTorsionForce
force1
;
for
(
unsigned
int
ii
=
0
;
ii
<
5
;
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
5
;
ii
++
)
{
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>
gridVector
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>
gridVector
;
loadTorsionTorsionGrid
(
gridVector
);
loadTorsionTorsionGrid
(
gridVector
);
force1
.
setTorsionTorsionGrid
(
ii
,
gridVector
);
force1
.
setTorsionTorsionGrid
(
ii
,
gridVector
);
}
}
for
(
unsigned
int
ii
=
0
;
ii
<
5
;
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
5
;
ii
++
)
{
force1
.
addTorsionTorsion
(
ii
,
ii
+
1
,
ii
+
3
,
ii
+
4
,
ii
+
5
,
(
(
ii
%
2
)
?
1
:
0
),
(
ii
%
4
)
);
force1
.
addTorsionTorsion
(
ii
,
ii
+
1
,
ii
+
3
,
ii
+
4
,
ii
+
5
,
((
ii
%
2
)
?
1
:
0
),
(
ii
%
4
));
}
}
// Serialize and then deserialize it.
// Serialize and then deserialize it.
stringstream
buffer
;
stringstream
buffer
;
XmlSerializer
::
serialize
<
AmoebaTorsionTorsionForce
>
(
&
force1
,
"Force"
,
buffer
);
XmlSerializer
::
serialize
<
AmoebaTorsionTorsionForce
>
(
&
force1
,
"Force"
,
buffer
);
#ifdef AMOEBA_DEBUG
if
(
0
){
FILE
*
filePtr
=
fopen
(
"TorsionTorsion.xml"
,
"w"
);
(
void
)
fprintf
(
filePtr
,
"%s"
,
buffer
.
str
().
c_str
()
);
(
void
)
fclose
(
filePtr
);
}
#endif
AmoebaTorsionTorsionForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaTorsionTorsionForce
>
(
buffer
);
AmoebaTorsionTorsionForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaTorsionTorsionForce
>
(
buffer
);
// Compare the two force1s to see if they are identical.
// Compare the two force1s to see if they are identical.
...
@@ -112,8 +104,8 @@ void testSerialization() {
...
@@ -112,8 +104,8 @@ void testSerialization() {
int
a1
,
a2
,
a3
,
a4
,
a5
,
aChiral
,
aGridIndex
,
b1
,
b2
,
b3
,
b4
,
b5
,
bChiral
,
bGridIndex
;
int
a1
,
a2
,
a3
,
a4
,
a5
,
aChiral
,
aGridIndex
,
b1
,
b2
,
b3
,
b4
,
b5
,
bChiral
,
bGridIndex
;
force1
.
getTorsionTorsionParameters
(
ii
,
a1
,
a2
,
a3
,
a4
,
a5
,
aChiral
,
aGridIndex
);
force1
.
getTorsionTorsionParameters
(
ii
,
a1
,
a2
,
a3
,
a4
,
a5
,
aChiral
,
aGridIndex
);
force2
.
getTorsionTorsionParameters
(
ii
,
b1
,
b2
,
b3
,
b4
,
b5
,
bChiral
,
bGridIndex
);
force2
.
getTorsionTorsionParameters
(
ii
,
b1
,
b2
,
b3
,
b4
,
b5
,
bChiral
,
bGridIndex
);
ASSERT_EQUAL
(
a1
,
b1
);
ASSERT_EQUAL
(
a1
,
b1
);
ASSERT_EQUAL
(
a2
,
b2
);
ASSERT_EQUAL
(
a2
,
b2
);
...
@@ -121,14 +113,14 @@ void testSerialization() {
...
@@ -121,14 +113,14 @@ void testSerialization() {
ASSERT_EQUAL
(
a4
,
b4
);
ASSERT_EQUAL
(
a4
,
b4
);
ASSERT_EQUAL
(
a5
,
b5
);
ASSERT_EQUAL
(
a5
,
b5
);
ASSERT_EQUAL
(
aChiral
,
bChiral
);
ASSERT_EQUAL
(
aChiral
,
bChiral
);
ASSERT_EQUAL
(
aGridIndex
,
bGridIndex
);
ASSERT_EQUAL
(
aGridIndex
,
bGridIndex
);
}
}
ASSERT_EQUAL
(
force1
.
getNumTorsionTorsionGrids
(),
force2
.
getNumTorsionTorsionGrids
());
ASSERT_EQUAL
(
force1
.
getNumTorsionTorsionGrids
(),
force2
.
getNumTorsionTorsionGrids
());
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force1
.
getNumTorsionTorsionGrids
());
ii
++
)
{
for
(
unsigned
int
ii
=
0
;
ii
<
static_cast
<
unsigned
int
>
(
force1
.
getNumTorsionTorsionGrids
());
ii
++
)
{
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
grid1
=
force1
.
getTorsionTorsionGrid
(
ii
);
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
grid1
=
force1
.
getTorsionTorsionGrid
(
ii
);
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
grid2
=
force2
.
getTorsionTorsionGrid
(
ii
);
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
grid2
=
force2
.
getTorsionTorsionGrid
(
ii
);
compareGrids
(
grid1
,
grid2
);
compareGrids
(
grid1
,
grid2
);
}
}
}
}
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaVdwForce.cpp
View file @
f11bafd9
...
@@ -45,34 +45,26 @@ void testSerialization() {
...
@@ -45,34 +45,26 @@ void testSerialization() {
// Create a Force.
// Create a Force.
AmoebaVdwForce
force1
;
AmoebaVdwForce
force1
;
force1
.
setSigmaCombiningRule
(
"GEOMETRIC"
);
force1
.
setSigmaCombiningRule
(
"GEOMETRIC"
);
force1
.
setEpsilonCombiningRule
(
"GEOMETRIC"
);
force1
.
setEpsilonCombiningRule
(
"GEOMETRIC"
);
force1
.
setCutoff
(
0.9
);
force1
.
setCutoff
(
0.9
);
force1
.
setNonbondedMethod
(
AmoebaVdwForce
::
CutoffPeriodic
);
force1
.
setNonbondedMethod
(
AmoebaVdwForce
::
CutoffPeriodic
);
force1
.
addParticle
(
0
,
1.0
,
2.0
,
0.9
);
force1
.
addParticle
(
0
,
1.0
,
2.0
,
0.9
);
force1
.
addParticle
(
1
,
1.1
,
2.1
,
0.9
);
force1
.
addParticle
(
1
,
1.1
,
2.1
,
0.9
);
force1
.
addParticle
(
2
,
1.3
,
4.1
,
0.9
);
force1
.
addParticle
(
2
,
1.3
,
4.1
,
0.9
);
for
(
unsigned
int
ii
=
0
;
ii
<
3
;
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
3
;
ii
++
)
{
std
::
vector
<
int
>
exclusions
;
std
::
vector
<
int
>
exclusions
;
exclusions
.
push_back
(
ii
);
exclusions
.
push_back
(
ii
);
exclusions
.
push_back
(
ii
+
1
);
exclusions
.
push_back
(
ii
+
1
);
exclusions
.
push_back
(
ii
+
10
);
exclusions
.
push_back
(
ii
+
10
);
force1
.
setParticleExclusions
(
ii
,
exclusions
);
force1
.
setParticleExclusions
(
ii
,
exclusions
);
}
}
// Serialize and then deserialize it.
// Serialize and then deserialize it.
stringstream
buffer
;
stringstream
buffer
;
XmlSerializer
::
serialize
<
AmoebaVdwForce
>
(
&
force1
,
"Force"
,
buffer
);
XmlSerializer
::
serialize
<
AmoebaVdwForce
>
(
&
force1
,
"Force"
,
buffer
);
#ifdef AMOEBA_DEBUG
if
(
0
){
FILE
*
filePtr
=
fopen
(
"Vdw.xml"
,
"w"
);
(
void
)
fprintf
(
filePtr
,
"%s"
,
buffer
.
str
().
c_str
()
);
(
void
)
fclose
(
filePtr
);
}
#endif
AmoebaVdwForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaVdwForce
>
(
buffer
);
AmoebaVdwForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaVdwForce
>
(
buffer
);
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
...
@@ -93,10 +85,10 @@ void testSerialization() {
...
@@ -93,10 +85,10 @@ void testSerialization() {
double
sigma1
,
epsilon1
,
reductionFactor1
;
double
sigma1
,
epsilon1
,
reductionFactor1
;
double
sigma2
,
epsilon2
,
reductionFactor2
;
double
sigma2
,
epsilon2
,
reductionFactor2
;
force1
.
getParticleParameters
(
ii
,
ivIndex1
,
sigma1
,
epsilon1
,
reductionFactor1
);
force1
.
getParticleParameters
(
ii
,
ivIndex1
,
sigma1
,
epsilon1
,
reductionFactor1
);
force2
.
getParticleParameters
(
ii
,
ivIndex2
,
sigma2
,
epsilon2
,
reductionFactor2
);
force2
.
getParticleParameters
(
ii
,
ivIndex2
,
sigma2
,
epsilon2
,
reductionFactor2
);
ASSERT_EQUAL
(
ivIndex1
,
ivIndex2
);
ASSERT_EQUAL
(
ivIndex1
,
ivIndex2
);
ASSERT_EQUAL
(
sigma1
,
sigma2
);
ASSERT_EQUAL
(
sigma1
,
sigma2
);
ASSERT_EQUAL
(
epsilon1
,
epsilon2
);
ASSERT_EQUAL
(
epsilon1
,
epsilon2
);
ASSERT_EQUAL
(
reductionFactor1
,
reductionFactor2
);
ASSERT_EQUAL
(
reductionFactor1
,
reductionFactor2
);
...
@@ -106,14 +98,14 @@ void testSerialization() {
...
@@ -106,14 +98,14 @@ void testSerialization() {
std
::
vector
<
int
>
exclusions1
;
std
::
vector
<
int
>
exclusions1
;
std
::
vector
<
int
>
exclusions2
;
std
::
vector
<
int
>
exclusions2
;
force1
.
getParticleExclusions
(
ii
,
exclusions1
);
force1
.
getParticleExclusions
(
ii
,
exclusions1
);
force2
.
getParticleExclusions
(
ii
,
exclusions2
);
force2
.
getParticleExclusions
(
ii
,
exclusions2
);
ASSERT_EQUAL
(
exclusions1
.
size
(),
exclusions2
.
size
());
ASSERT_EQUAL
(
exclusions1
.
size
(),
exclusions2
.
size
());
for
(
unsigned
int
jj
=
0
;
jj
<
exclusions1
.
size
();
jj
++
)
{
for
(
unsigned
int
jj
=
0
;
jj
<
exclusions1
.
size
();
jj
++
)
{
int
hit
=
0
;
int
hit
=
0
;
for
(
unsigned
int
kk
=
0
;
kk
<
exclusions2
.
size
();
kk
++
)
{
for
(
unsigned
int
kk
=
0
;
kk
<
exclusions2
.
size
();
kk
++
)
{
if
(
exclusions2
[
jj
]
==
exclusions1
[
kk
]
)
hit
++
;
if
(
exclusions2
[
jj
]
==
exclusions1
[
kk
])
hit
++
;
}
}
ASSERT_EQUAL
(
hit
,
1
);
ASSERT_EQUAL
(
hit
,
1
);
}
}
...
...
plugins/amoeba/serialization/tests/TestSerializeAmoebaWcaDispersionForce.cpp
View file @
f11bafd9
...
@@ -45,14 +45,14 @@ void testSerialization() {
...
@@ -45,14 +45,14 @@ void testSerialization() {
// Create a Force.
// Create a Force.
AmoebaWcaDispersionForce
force1
;
AmoebaWcaDispersionForce
force1
;
force1
.
setEpso
(
1.0
);
force1
.
setEpso
(
1.0
);
force1
.
setEpsh
(
1.1
);
force1
.
setEpsh
(
1.1
);
force1
.
setRmino
(
1.2
);
force1
.
setRmino
(
1.2
);
force1
.
setRminh
(
1.3
);
force1
.
setRminh
(
1.3
);
force1
.
setAwater
(
1.4
);
force1
.
setAwater
(
1.4
);
force1
.
setShctd
(
1.5
);
force1
.
setShctd
(
1.5
);
force1
.
setDispoff
(
1.6
);
force1
.
setDispoff
(
1.6
);
force1
.
setSlevy
(
1.7
);
force1
.
setSlevy
(
1.7
);
force1
.
addParticle
(
1.0
,
2.0
);
force1
.
addParticle
(
1.0
,
2.0
);
force1
.
addParticle
(
1.1
,
2.1
);
force1
.
addParticle
(
1.1
,
2.1
);
...
@@ -62,14 +62,6 @@ void testSerialization() {
...
@@ -62,14 +62,6 @@ void testSerialization() {
stringstream
buffer
;
stringstream
buffer
;
XmlSerializer
::
serialize
<
AmoebaWcaDispersionForce
>
(
&
force1
,
"Force"
,
buffer
);
XmlSerializer
::
serialize
<
AmoebaWcaDispersionForce
>
(
&
force1
,
"Force"
,
buffer
);
#ifdef AMOEBA_DEBUG
if
(
0
){
FILE
*
filePtr
=
fopen
(
"WcaDispersion.xml"
,
"w"
);
(
void
)
fprintf
(
filePtr
,
"%s"
,
buffer
.
str
().
c_str
()
);
(
void
)
fclose
(
filePtr
);
}
#endif
AmoebaWcaDispersionForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaWcaDispersionForce
>
(
buffer
);
AmoebaWcaDispersionForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaWcaDispersionForce
>
(
buffer
);
// Compare the two forces to see if they are identical.
// Compare the two forces to see if they are identical.
...
@@ -91,8 +83,8 @@ void testSerialization() {
...
@@ -91,8 +83,8 @@ void testSerialization() {
double
radius1
,
epsilon1
;
double
radius1
,
epsilon1
;
double
radius2
,
epsilon2
;
double
radius2
,
epsilon2
;
force1
.
getParticleParameters
(
ii
,
radius1
,
epsilon1
);
force1
.
getParticleParameters
(
ii
,
radius1
,
epsilon1
);
force2
.
getParticleParameters
(
ii
,
radius2
,
epsilon2
);
force2
.
getParticleParameters
(
ii
,
radius2
,
epsilon2
);
ASSERT_EQUAL
(
radius1
,
radius2
);
ASSERT_EQUAL
(
radius1
,
radius2
);
ASSERT_EQUAL
(
epsilon1
,
epsilon2
);
ASSERT_EQUAL
(
epsilon1
,
epsilon2
);
...
...
plugins/amoeba/wrappers/generateAmoebaWrappers.py
View file @
f11bafd9
...
@@ -327,7 +327,7 @@ extern "C" {
...
@@ -327,7 +327,7 @@ extern "C" {
/* OpenMM_3D_DoubleArray */
/* OpenMM_3D_DoubleArray */
OPENMM_EXPORT_AMOEBA OpenMM_3D_DoubleArray* OpenMM_3D_DoubleArray_create(int size1, int size2, int size3);
OPENMM_EXPORT_AMOEBA OpenMM_3D_DoubleArray* OpenMM_3D_DoubleArray_create(int size1, int size2, int size3);
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_set(OpenMM_3D_DoubleArray* array, int index1, int index2, OpenMM_DoubleArray* values);
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_set(OpenMM_3D_DoubleArray* array, int index1, int index2, OpenMM_DoubleArray* values);
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_destroy(
OpenMM_3D_DoubleArray* array);"""
,
file
=
self
.
out
)
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_destroy(OpenMM_3D_DoubleArray* array);"""
,
file
=
self
.
out
)
self
.
writeClasses
()
self
.
writeClasses
()
...
@@ -586,29 +586,29 @@ OPENMM_EXPORT_AMOEBA int OpenMM_2D_IntArray_getSize(const OpenMM_2D_IntArray* ar
...
@@ -586,29 +586,29 @@ OPENMM_EXPORT_AMOEBA int OpenMM_2D_IntArray_getSize(const OpenMM_2D_IntArray* ar
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_resize(OpenMM_2D_IntArray* array, int size) {
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_resize(OpenMM_2D_IntArray* array, int size) {
reinterpret_cast<vector<vector<int> >*>(array)->resize(size);
reinterpret_cast<vector<vector<int> >*>(array)->resize(size);
}
}
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_append(OpenMM_2D_IntArray* array, int index1, int value
) {
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_append(OpenMM_2D_IntArray* array, int index1, int value) {
vector<vector<int> >* array2DInt = reinterpret_cast<vector<vector<int> >*>(array);
vector<vector<int> >* array2DInt = reinterpret_cast<vector<vector<int> >*>(array);
if
(
array2DInt->size() <= index1
){
if
(
array2DInt->size() <= index1)
{
array2DInt->resize(
index1+1
);
array2DInt->resize(index1+1);
}
}
(*array2DInt)[index1].push_back(
value
);
(*array2DInt)[index1].push_back(value);
}
}
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_set(OpenMM_2D_IntArray* array, int index1, int index2, int value) {
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_set(OpenMM_2D_IntArray* array, int index1, int index2, int value) {
vector<vector<int> >* array2DInt = reinterpret_cast<vector<vector<int> >*>(array);
vector<vector<int> >* array2DInt = reinterpret_cast<vector<vector<int> >*>(array);
if
(
array2DInt->size() <= index1
){
if
(
array2DInt->size() <= index1)
{
array2DInt->resize(
index1+1
);
array2DInt->resize(index1+1);
}
}
if
(
array2DInt[index1].size() <= index2
){
if
(
array2DInt[index1].size() <= index2)
{
array2DInt[index1].resize(
index2+1
);
array2DInt[index1].resize(index2+1);
}
}
(*array2DInt)[index1][index2] = value;
(*array2DInt)[index1][index2] = value;
}
}
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_get(const OpenMM_2D_IntArray* array, int index1, int index2, int* value) {
OPENMM_EXPORT_AMOEBA void OpenMM_2D_IntArray_get(const OpenMM_2D_IntArray* array, int index1, int index2, int* value) {
const vector<vector<int> >* array2DInt = reinterpret_cast<const vector<vector<int> >*>(array);
const vector<vector<int> >* array2DInt = reinterpret_cast<const vector<vector<int> >*>(array);
if (
array2DInt->size() <= index1
)
if (array2DInt->size() <= index1)
throw OpenMMException("OpenMM_2D_IntArray_get: first index out of range.");
throw OpenMMException("OpenMM_2D_IntArray_get: first index out of range.");
if (
(*array2DInt)[index1].size() <= index2
)
if ((*array2DInt)[index1].size() <= index2)
throw OpenMMException("OpenMM_2D_IntArray_get: second index out of range.");
throw OpenMMException("OpenMM_2D_IntArray_get: second index out of range.");
*value = (*array2DInt)[index1][index2];
*value = (*array2DInt)[index1][index2];
}
}
...
@@ -618,9 +618,9 @@ OPENMM_EXPORT_AMOEBA OpenMM_3D_DoubleArray* OpenMM_3D_DoubleArray_create(int siz
...
@@ -618,9 +618,9 @@ OPENMM_EXPORT_AMOEBA OpenMM_3D_DoubleArray* OpenMM_3D_DoubleArray_create(int siz
int ii, jj;
int ii, jj;
std::vector< std::vector< std::vector<double> > >* v3D_Array = new std::vector<std::vector<std::vector<double> > >(size1);
std::vector< std::vector< std::vector<double> > >* v3D_Array = new std::vector<std::vector<std::vector<double> > >(size1);
for
(
ii = 0; ii < size1; ii++
){
for
(
ii = 0; ii < size1; ii++)
{
(*v3D_Array)[ii].resize(size2);
(*v3D_Array)[ii].resize(size2);
for
(
jj = 0; jj < size2; jj++
){
for
(
jj = 0; jj < size2; jj++)
{
(*v3D_Array)[ii][jj].resize(size3);
(*v3D_Array)[ii][jj].resize(size3);
}
}
}
}
...
@@ -631,12 +631,12 @@ OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_set(OpenMM_3D_DoubleArray* array
...
@@ -631,12 +631,12 @@ OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_set(OpenMM_3D_DoubleArray* array
unsigned int ii;
unsigned int ii;
std::vector< std::vector< std::vector<double> > >* v3D_Array = reinterpret_cast<std::vector<std::vector<std::vector<double> > >*>(array);
std::vector< std::vector< std::vector<double> > >* v3D_Array = reinterpret_cast<std::vector<std::vector<std::vector<double> > >*>(array);
std::vector<double> * value_array = reinterpret_cast<std::vector<double> *>(values);
std::vector<double> * value_array = reinterpret_cast<std::vector<double> *>(values);
for
(
ii = 0; ii < (*value_array).size(); ii++
){
for
(
ii = 0; ii < (*value_array).size(); ii++)
{
(*v3D_Array)[index1][index2][ii] = (*value_array)[ii];
(*v3D_Array)[index1][index2][ii] = (*value_array)[ii];
}
}
}
}
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_destroy(
OpenMM_3D_DoubleArray* array) {
OPENMM_EXPORT_AMOEBA void OpenMM_3D_DoubleArray_destroy(OpenMM_3D_DoubleArray* array) {
delete reinterpret_cast<std::vector<std::vector<std::vector<double> > >*>(array);
delete reinterpret_cast<std::vector<std::vector<std::vector<double> > >*>(array);
}"""
,
file
=
self
.
out
)
}"""
,
file
=
self
.
out
)
...
...
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