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
6ed5bc4e
Commit
6ed5bc4e
authored
Apr 20, 2017
by
Rafal Wiewiora
Committed by
GitHub
Apr 20, 2017
Browse files
Merge branch 'master' into master
parents
656d0e3b
fbf193fe
Changes
121
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
152 additions
and
263 deletions
+152
-263
plugins/drude/serialization/src/DrudeForceProxy.cpp
plugins/drude/serialization/src/DrudeForceProxy.cpp
+2
-6
plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
+8
-9
plugins/rpmd/platforms/cuda/src/CudaRpmdKernels.cpp
plugins/rpmd/platforms/cuda/src/CudaRpmdKernels.cpp
+8
-8
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
+10
-10
plugins/rpmd/platforms/reference/src/ReferenceRpmdKernels.cpp
...ins/rpmd/platforms/reference/src/ReferenceRpmdKernels.cpp
+9
-9
serialization/src/CMAPTorsionForceProxy.cpp
serialization/src/CMAPTorsionForceProxy.cpp
+4
-7
serialization/src/CustomAngleForceProxy.cpp
serialization/src/CustomAngleForceProxy.cpp
+4
-11
serialization/src/CustomBondForceProxy.cpp
serialization/src/CustomBondForceProxy.cpp
+4
-11
serialization/src/CustomCentroidBondForceProxy.cpp
serialization/src/CustomCentroidBondForceProxy.cpp
+12
-21
serialization/src/CustomCompoundBondForceProxy.cpp
serialization/src/CustomCompoundBondForceProxy.cpp
+7
-15
serialization/src/CustomExternalForceProxy.cpp
serialization/src/CustomExternalForceProxy.cpp
+3
-8
serialization/src/CustomGBForceProxy.cpp
serialization/src/CustomGBForceProxy.cpp
+10
-24
serialization/src/CustomHbondForceProxy.cpp
serialization/src/CustomHbondForceProxy.cpp
+9
-20
serialization/src/CustomIntegratorProxy.cpp
serialization/src/CustomIntegratorProxy.cpp
+24
-29
serialization/src/CustomManyParticleForceProxy.cpp
serialization/src/CustomManyParticleForceProxy.cpp
+11
-21
serialization/src/CustomNonbondedForceProxy.cpp
serialization/src/CustomNonbondedForceProxy.cpp
+19
-31
serialization/src/CustomTorsionForceProxy.cpp
serialization/src/CustomTorsionForceProxy.cpp
+4
-11
serialization/src/GBSAOBCForceProxy.cpp
serialization/src/GBSAOBCForceProxy.cpp
+1
-3
serialization/src/GayBerneForceProxy.cpp
serialization/src/GayBerneForceProxy.cpp
+2
-6
serialization/src/HarmonicAngleForceProxy.cpp
serialization/src/HarmonicAngleForceProxy.cpp
+1
-3
No files found.
plugins/drude/serialization/src/DrudeForceProxy.cpp
View file @
6ed5bc4e
...
@@ -67,16 +67,12 @@ void* DrudeForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -67,16 +67,12 @@ void* DrudeForceProxy::deserialize(const SerializationNode& node) const {
DrudeForce
*
force
=
new
DrudeForce
();
DrudeForce
*
force
=
new
DrudeForce
();
try
{
try
{
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
particle
:
particles
.
getChildren
())
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
force
->
addParticle
(
particle
.
getIntProperty
(
"p"
),
particle
.
getIntProperty
(
"p1"
),
particle
.
getIntProperty
(
"p2"
),
particle
.
getIntProperty
(
"p3"
),
particle
.
getIntProperty
(
"p4"
),
force
->
addParticle
(
particle
.
getIntProperty
(
"p"
),
particle
.
getIntProperty
(
"p1"
),
particle
.
getIntProperty
(
"p2"
),
particle
.
getIntProperty
(
"p3"
),
particle
.
getIntProperty
(
"p4"
),
particle
.
getDoubleProperty
(
"charge"
),
particle
.
getDoubleProperty
(
"polarizability"
),
particle
.
getDoubleProperty
(
"a12"
),
particle
.
getDoubleProperty
(
"a34"
));
particle
.
getDoubleProperty
(
"charge"
),
particle
.
getDoubleProperty
(
"polarizability"
),
particle
.
getDoubleProperty
(
"a12"
),
particle
.
getDoubleProperty
(
"a34"
));
}
const
SerializationNode
&
pairs
=
node
.
getChildNode
(
"ScreenedPairs"
);
const
SerializationNode
&
pairs
=
node
.
getChildNode
(
"ScreenedPairs"
);
for
(
int
i
=
0
;
i
<
(
int
)
pairs
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
pair
:
pairs
.
getChildren
())
const
SerializationNode
&
pair
=
pairs
.
getChildren
()[
i
];
force
->
addScreenedPair
(
pair
.
getIntProperty
(
"p1"
),
pair
.
getIntProperty
(
"p2"
),
pair
.
getDoubleProperty
(
"thole"
));
force
->
addScreenedPair
(
pair
.
getIntProperty
(
"p1"
),
pair
.
getIntProperty
(
"p2"
),
pair
.
getDoubleProperty
(
"thole"
));
}
}
}
catch
(...)
{
catch
(...)
{
delete
force
;
delete
force
;
...
...
plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
View file @
6ed5bc4e
...
@@ -119,13 +119,13 @@ State RPMDIntegrator::getState(int copy, int types, bool enforcePeriodicBox, int
...
@@ -119,13 +119,13 @@ State RPMDIntegrator::getState(int copy, int types, bool enforcePeriodicBox, int
const
vector
<
vector
<
int
>
>&
molecules
=
context
->
getMolecules
();
const
vector
<
vector
<
int
>
>&
molecules
=
context
->
getMolecules
();
Vec3
periodicBoxSize
[
3
];
Vec3
periodicBoxSize
[
3
];
state2
.
getPeriodicBoxVectors
(
periodicBoxSize
[
0
],
periodicBoxSize
[
1
],
periodicBoxSize
[
2
]);
state2
.
getPeriodicBoxVectors
(
periodicBoxSize
[
0
],
periodicBoxSize
[
1
],
periodicBoxSize
[
2
]);
for
(
int
i
=
0
;
i
<
(
int
)
molecules
.
size
();
i
++
)
{
for
(
auto
&
mol
:
molecules
)
{
// Find the molecule center.
// Find the molecule center.
Vec3
center
;
Vec3
center
;
for
(
int
j
=
0
;
j
<
(
int
)
molecules
[
i
].
size
();
j
++
)
for
(
int
j
:
mol
)
center
+=
refPos
[
molecules
[
i
][
j
]
];
center
+=
refPos
[
j
];
center
*=
1.0
/
mol
ecules
[
i
]
.
size
();
center
*=
1.0
/
mol
.
size
();
// Find the displacement to move it into the first periodic box.
// Find the displacement to move it into the first periodic box.
Vec3
diff
;
Vec3
diff
;
...
@@ -134,8 +134,8 @@ State RPMDIntegrator::getState(int copy, int types, bool enforcePeriodicBox, int
...
@@ -134,8 +134,8 @@ State RPMDIntegrator::getState(int copy, int types, bool enforcePeriodicBox, int
diff
+=
periodicBoxSize
[
0
]
*
floor
((
center
[
0
]
-
diff
[
0
])
/
periodicBoxSize
[
0
][
0
]);
diff
+=
periodicBoxSize
[
0
]
*
floor
((
center
[
0
]
-
diff
[
0
])
/
periodicBoxSize
[
0
][
0
]);
// Translate all the particles in the molecule.
// Translate all the particles in the molecule.
for
(
int
j
=
0
;
j
<
(
int
)
molecules
[
i
].
size
();
j
++
)
{
for
(
int
j
:
mol
)
{
Vec3
&
pos
=
positions
[
molecules
[
i
][
j
]
];
Vec3
&
pos
=
positions
[
j
];
pos
-=
diff
;
pos
-=
diff
;
}
}
}
}
...
@@ -188,9 +188,8 @@ void RPMDIntegrator::step(int steps) {
...
@@ -188,9 +188,8 @@ void RPMDIntegrator::step(int steps) {
context
->
getOwner
().
setPositions
(
p
);
context
->
getOwner
().
setPositions
(
p
);
isFirstStep
=
false
;
isFirstStep
=
false
;
}
}
vector
<
ForceImpl
*>&
forceImpls
=
context
->
getForceImpls
();
for
(
auto
impl
:
context
->
getForceImpls
())
{
for
(
int
i
=
0
;
i
<
(
int
)
forceImpls
.
size
();
i
++
)
{
RPMDUpdater
*
updater
=
dynamic_cast
<
RPMDUpdater
*>
(
impl
);
RPMDUpdater
*
updater
=
dynamic_cast
<
RPMDUpdater
*>
(
forceImpls
[
i
]);
if
(
updater
!=
NULL
)
if
(
updater
!=
NULL
)
updater
->
updateRPMDState
(
*
context
);
updater
->
updateRPMDState
(
*
context
);
}
}
...
...
plugins/rpmd/platforms/cuda/src/CudaRpmdKernels.cpp
View file @
6ed5bc4e
...
@@ -116,9 +116,9 @@ void CudaIntegrateRPMDStepKernel::initialize(const System& system, const RPMDInt
...
@@ -116,9 +116,9 @@ void CudaIntegrateRPMDStepKernel::initialize(const System& system, const RPMDInt
groupsNotContracted
=
-
1
;
groupsNotContracted
=
-
1
;
const
map
<
int
,
int
>&
contractions
=
integrator
.
getContractions
();
const
map
<
int
,
int
>&
contractions
=
integrator
.
getContractions
();
int
maxContractedCopies
=
0
;
int
maxContractedCopies
=
0
;
for
(
map
<
int
,
int
>::
const_iterator
iter
=
contractions
.
begin
();
iter
!=
contractions
.
end
();
++
iter
)
{
for
(
auto
&
c
:
contractions
)
{
int
group
=
iter
->
first
;
int
group
=
c
.
first
;
int
copies
=
iter
->
second
;
int
copies
=
c
.
second
;
if
(
group
<
0
||
group
>
31
)
if
(
group
<
0
||
group
>
31
)
throw
OpenMMException
(
"RPMDIntegrator: Force group must be between 0 and 31"
);
throw
OpenMMException
(
"RPMDIntegrator: Force group must be between 0 and 31"
);
if
(
copies
<
0
||
copies
>
numCopies
)
if
(
copies
<
0
||
copies
>
numCopies
)
...
@@ -166,8 +166,8 @@ void CudaIntegrateRPMDStepKernel::initialize(const System& system, const RPMDInt
...
@@ -166,8 +166,8 @@ void CudaIntegrateRPMDStepKernel::initialize(const System& system, const RPMDInt
// Create kernels for doing contractions.
// Create kernels for doing contractions.
for
(
map
<
int
,
int
>::
const_iterator
iter
=
groupsByCopies
.
begin
();
iter
!=
groupsByCopies
.
end
();
++
iter
)
{
for
(
auto
&
g
:
groupsByCopies
)
{
int
copies
=
iter
->
first
;
int
copies
=
g
.
first
;
replacements
.
clear
();
replacements
.
clear
();
replacements
[
"NUM_CONTRACTED_COPIES"
]
=
cu
.
intToString
(
copies
);
replacements
[
"NUM_CONTRACTED_COPIES"
]
=
cu
.
intToString
(
copies
);
replacements
[
"POS_SCALE"
]
=
cu
.
doubleToString
(
1.0
/
numCopies
);
replacements
[
"POS_SCALE"
]
=
cu
.
doubleToString
(
1.0
/
numCopies
);
...
@@ -267,9 +267,9 @@ void CudaIntegrateRPMDStepKernel::computeForces(ContextImpl& context) {
...
@@ -267,9 +267,9 @@ void CudaIntegrateRPMDStepKernel::computeForces(ContextImpl& context) {
// Now loop over contractions and compute forces from them.
// Now loop over contractions and compute forces from them.
for
(
map
<
int
,
int
>::
const_iterator
iter
=
groupsByCopies
.
begin
();
iter
!=
groupsByCopies
.
end
();
++
iter
)
{
for
(
auto
&
g
:
groupsByCopies
)
{
int
copies
=
iter
->
first
;
int
copies
=
g
.
first
;
int
groupFlags
=
iter
->
second
;
int
groupFlags
=
g
.
second
;
// Find the contracted positions.
// Find the contracted positions.
...
...
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
View file @
6ed5bc4e
...
@@ -96,9 +96,9 @@ void OpenCLIntegrateRPMDStepKernel::initialize(const System& system, const RPMDI
...
@@ -96,9 +96,9 @@ void OpenCLIntegrateRPMDStepKernel::initialize(const System& system, const RPMDI
groupsNotContracted
=
-
1
;
groupsNotContracted
=
-
1
;
const
map
<
int
,
int
>&
contractions
=
integrator
.
getContractions
();
const
map
<
int
,
int
>&
contractions
=
integrator
.
getContractions
();
int
maxContractedCopies
=
0
;
int
maxContractedCopies
=
0
;
for
(
map
<
int
,
int
>::
const_iterator
iter
=
contractions
.
begin
();
iter
!=
contractions
.
end
();
++
iter
)
{
for
(
auto
&
c
:
contractions
)
{
int
group
=
iter
->
first
;
int
group
=
c
.
first
;
int
copies
=
iter
->
second
;
int
copies
=
c
.
second
;
if
(
group
<
0
||
group
>
31
)
if
(
group
<
0
||
group
>
31
)
throw
OpenMMException
(
"RPMDIntegrator: Force group must be between 0 and 31"
);
throw
OpenMMException
(
"RPMDIntegrator: Force group must be between 0 and 31"
);
if
(
copies
<
0
||
copies
>
numCopies
)
if
(
copies
<
0
||
copies
>
numCopies
)
...
@@ -146,8 +146,8 @@ void OpenCLIntegrateRPMDStepKernel::initialize(const System& system, const RPMDI
...
@@ -146,8 +146,8 @@ void OpenCLIntegrateRPMDStepKernel::initialize(const System& system, const RPMDI
// Create kernels for doing contractions.
// Create kernels for doing contractions.
for
(
map
<
int
,
int
>::
const_iterator
iter
=
groupsByCopies
.
begin
();
iter
!=
groupsByCopies
.
end
();
++
iter
)
{
for
(
auto
&
g
:
groupsByCopies
)
{
int
copies
=
iter
->
first
;
int
copies
=
g
.
first
;
replacements
.
clear
();
replacements
.
clear
();
replacements
[
"NUM_CONTRACTED_COPIES"
]
=
cl
.
intToString
(
copies
);
replacements
[
"NUM_CONTRACTED_COPIES"
]
=
cl
.
intToString
(
copies
);
replacements
[
"POS_SCALE"
]
=
cl
.
doubleToString
(
1.0
/
numCopies
);
replacements
[
"POS_SCALE"
]
=
cl
.
doubleToString
(
1.0
/
numCopies
);
...
@@ -182,8 +182,8 @@ void OpenCLIntegrateRPMDStepKernel::initializeKernels(ContextImpl& context) {
...
@@ -182,8 +182,8 @@ void OpenCLIntegrateRPMDStepKernel::initializeKernels(ContextImpl& context) {
copyFromContextKernel
.
setArg
<
cl
::
Buffer
>
(
3
,
velocities
->
getDeviceBuffer
());
copyFromContextKernel
.
setArg
<
cl
::
Buffer
>
(
3
,
velocities
->
getDeviceBuffer
());
copyFromContextKernel
.
setArg
<
cl
::
Buffer
>
(
4
,
cl
.
getPosq
().
getDeviceBuffer
());
copyFromContextKernel
.
setArg
<
cl
::
Buffer
>
(
4
,
cl
.
getPosq
().
getDeviceBuffer
());
copyFromContextKernel
.
setArg
<
cl
::
Buffer
>
(
6
,
cl
.
getAtomIndexArray
().
getDeviceBuffer
());
copyFromContextKernel
.
setArg
<
cl
::
Buffer
>
(
6
,
cl
.
getAtomIndexArray
().
getDeviceBuffer
());
for
(
map
<
int
,
int
>::
const_iterator
iter
=
groupsByCopies
.
begin
();
iter
!=
groupsByCopies
.
end
();
++
iter
)
{
for
(
auto
&
g
:
groupsByCopies
)
{
int
copies
=
iter
->
first
;
int
copies
=
g
.
first
;
positionContractionKernels
[
copies
].
setArg
<
cl
::
Buffer
>
(
0
,
positions
->
getDeviceBuffer
());
positionContractionKernels
[
copies
].
setArg
<
cl
::
Buffer
>
(
0
,
positions
->
getDeviceBuffer
());
positionContractionKernels
[
copies
].
setArg
<
cl
::
Buffer
>
(
1
,
contractedPositions
->
getDeviceBuffer
());
positionContractionKernels
[
copies
].
setArg
<
cl
::
Buffer
>
(
1
,
contractedPositions
->
getDeviceBuffer
());
forceContractionKernels
[
copies
].
setArg
<
cl
::
Buffer
>
(
0
,
forces
->
getDeviceBuffer
());
forceContractionKernels
[
copies
].
setArg
<
cl
::
Buffer
>
(
0
,
forces
->
getDeviceBuffer
());
...
@@ -286,9 +286,9 @@ void OpenCLIntegrateRPMDStepKernel::computeForces(ContextImpl& context) {
...
@@ -286,9 +286,9 @@ void OpenCLIntegrateRPMDStepKernel::computeForces(ContextImpl& context) {
copyToContextKernel
.
setArg
<
cl
::
Buffer
>
(
2
,
contractedPositions
->
getDeviceBuffer
());
copyToContextKernel
.
setArg
<
cl
::
Buffer
>
(
2
,
contractedPositions
->
getDeviceBuffer
());
copyFromContextKernel
.
setArg
<
cl
::
Buffer
>
(
1
,
contractedForces
->
getDeviceBuffer
());
copyFromContextKernel
.
setArg
<
cl
::
Buffer
>
(
1
,
contractedForces
->
getDeviceBuffer
());
copyFromContextKernel
.
setArg
<
cl
::
Buffer
>
(
5
,
contractedPositions
->
getDeviceBuffer
());
copyFromContextKernel
.
setArg
<
cl
::
Buffer
>
(
5
,
contractedPositions
->
getDeviceBuffer
());
for
(
map
<
int
,
int
>::
const_iterator
iter
=
groupsByCopies
.
begin
();
iter
!=
groupsByCopies
.
end
();
++
iter
)
{
for
(
auto
&
g
:
groupsByCopies
)
{
int
copies
=
iter
->
first
;
int
copies
=
g
.
first
;
int
groupFlags
=
iter
->
second
;
int
groupFlags
=
g
.
second
;
// Find the contracted positions.
// Find the contracted positions.
...
...
plugins/rpmd/platforms/reference/src/ReferenceRpmdKernels.cpp
View file @
6ed5bc4e
...
@@ -55,9 +55,9 @@ static vector<Vec3>& extractForces(ContextImpl& context) {
...
@@ -55,9 +55,9 @@ static vector<Vec3>& extractForces(ContextImpl& context) {
ReferenceIntegrateRPMDStepKernel
::~
ReferenceIntegrateRPMDStepKernel
()
{
ReferenceIntegrateRPMDStepKernel
::~
ReferenceIntegrateRPMDStepKernel
()
{
if
(
fft
!=
NULL
)
if
(
fft
!=
NULL
)
fftpack_destroy
(
fft
);
fftpack_destroy
(
fft
);
for
(
map
<
int
,
fftpack
*>::
const_iterator
iter
=
contractionFFT
.
begin
();
iter
!=
contractionFFT
.
end
();
++
iter
)
for
(
auto
&
c
:
contractionFFT
)
if
(
iter
->
second
!=
NULL
)
if
(
c
.
second
!=
NULL
)
fftpack_destroy
(
iter
->
second
);
fftpack_destroy
(
c
.
second
);
}
}
void
ReferenceIntegrateRPMDStepKernel
::
initialize
(
const
System
&
system
,
const
RPMDIntegrator
&
integrator
)
{
void
ReferenceIntegrateRPMDStepKernel
::
initialize
(
const
System
&
system
,
const
RPMDIntegrator
&
integrator
)
{
...
@@ -79,9 +79,9 @@ void ReferenceIntegrateRPMDStepKernel::initialize(const System& system, const RP
...
@@ -79,9 +79,9 @@ void ReferenceIntegrateRPMDStepKernel::initialize(const System& system, const RP
groupsNotContracted
=
-
1
;
groupsNotContracted
=
-
1
;
const
map
<
int
,
int
>&
contractions
=
integrator
.
getContractions
();
const
map
<
int
,
int
>&
contractions
=
integrator
.
getContractions
();
int
maxContractedCopies
=
0
;
int
maxContractedCopies
=
0
;
for
(
map
<
int
,
int
>::
const_iterator
iter
=
contractions
.
begin
();
iter
!=
contractions
.
end
();
++
iter
)
{
for
(
auto
&
c
:
contractions
)
{
int
group
=
iter
->
first
;
int
group
=
c
.
first
;
int
copies
=
iter
->
second
;
int
copies
=
c
.
second
;
if
(
group
<
0
||
group
>
31
)
if
(
group
<
0
||
group
>
31
)
throw
OpenMMException
(
"RPMDIntegrator: Force group must be between 0 and 31"
);
throw
OpenMMException
(
"RPMDIntegrator: Force group must be between 0 and 31"
);
if
(
copies
<
0
||
copies
>
numCopies
)
if
(
copies
<
0
||
copies
>
numCopies
)
...
@@ -290,9 +290,9 @@ void ReferenceIntegrateRPMDStepKernel::computeForces(ContextImpl& context, const
...
@@ -290,9 +290,9 @@ void ReferenceIntegrateRPMDStepKernel::computeForces(ContextImpl& context, const
// Now loop over contractions and compute forces from them.
// Now loop over contractions and compute forces from them.
for
(
map
<
int
,
int
>::
const_iterator
iter
=
groupsByCopies
.
begin
();
iter
!=
groupsByCopies
.
end
();
++
iter
)
{
for
(
auto
&
g
:
groupsByCopies
)
{
int
copies
=
iter
->
first
;
int
copies
=
g
.
first
;
int
groupFlags
=
iter
->
second
;
int
groupFlags
=
g
.
second
;
fftpack
*
shortFFT
=
contractionFFT
[
copies
];
fftpack
*
shortFFT
=
contractionFFT
[
copies
];
// Find the contracted positions.
// Find the contracted positions.
...
...
serialization/src/CMAPTorsionForceProxy.cpp
View file @
6ed5bc4e
...
@@ -52,8 +52,8 @@ void CMAPTorsionForceProxy::serialize(const void* object, SerializationNode& nod
...
@@ -52,8 +52,8 @@ void CMAPTorsionForceProxy::serialize(const void* object, SerializationNode& nod
vector
<
double
>
energy
;
vector
<
double
>
energy
;
force
.
getMapParameters
(
i
,
size
,
energy
);
force
.
getMapParameters
(
i
,
size
,
energy
);
SerializationNode
&
map
=
maps
.
createChildNode
(
"Map"
).
setIntProperty
(
"size"
,
size
);
SerializationNode
&
map
=
maps
.
createChildNode
(
"Map"
).
setIntProperty
(
"size"
,
size
);
for
(
int
i
=
0
;
i
<
(
int
)
energy
.
size
();
i
++
)
for
(
auto
e
:
energy
)
map
.
createChildNode
(
"Energy"
).
setDoubleProperty
(
"e"
,
e
nergy
[
i
]
);
map
.
createChildNode
(
"Energy"
).
setDoubleProperty
(
"e"
,
e
);
}
}
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
SerializationNode
&
torsions
=
node
.
createChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
...
@@ -73,8 +73,7 @@ void* CMAPTorsionForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -73,8 +73,7 @@ void* CMAPTorsionForceProxy::deserialize(const SerializationNode& node) const {
if
(
version
>
1
)
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
maps
=
node
.
getChildNode
(
"Maps"
);
const
SerializationNode
&
maps
=
node
.
getChildNode
(
"Maps"
);
for
(
int
i
=
0
;
i
<
(
int
)
maps
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
map
:
maps
.
getChildren
())
{
const
SerializationNode
&
map
=
maps
.
getChildren
()[
i
];
int
size
=
map
.
getIntProperty
(
"size"
);
int
size
=
map
.
getIntProperty
(
"size"
);
if
(
size
*
size
!=
map
.
getChildren
().
size
())
if
(
size
*
size
!=
map
.
getChildren
().
size
())
throw
OpenMMException
(
"Wrong number of values specified for CMAP"
);
throw
OpenMMException
(
"Wrong number of values specified for CMAP"
);
...
@@ -84,11 +83,9 @@ void* CMAPTorsionForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -84,11 +83,9 @@ void* CMAPTorsionForceProxy::deserialize(const SerializationNode& node) const {
force
->
addMap
(
size
,
energy
);
force
->
addMap
(
size
,
energy
);
}
}
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
torsion
:
torsions
.
getChildren
())
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
force
->
addTorsion
(
torsion
.
getIntProperty
(
"map"
),
torsion
.
getIntProperty
(
"a1"
),
torsion
.
getIntProperty
(
"a2"
),
torsion
.
getIntProperty
(
"a3"
),
torsion
.
getIntProperty
(
"a4"
),
force
->
addTorsion
(
torsion
.
getIntProperty
(
"map"
),
torsion
.
getIntProperty
(
"a1"
),
torsion
.
getIntProperty
(
"a2"
),
torsion
.
getIntProperty
(
"a3"
),
torsion
.
getIntProperty
(
"a4"
),
torsion
.
getIntProperty
(
"b1"
),
torsion
.
getIntProperty
(
"b2"
),
torsion
.
getIntProperty
(
"b3"
),
torsion
.
getIntProperty
(
"b4"
));
torsion
.
getIntProperty
(
"b1"
),
torsion
.
getIntProperty
(
"b2"
),
torsion
.
getIntProperty
(
"b3"
),
torsion
.
getIntProperty
(
"b4"
));
}
}
}
catch
(...)
{
catch
(...)
{
delete
force
;
delete
force
;
...
...
serialization/src/CustomAngleForceProxy.cpp
View file @
6ed5bc4e
...
@@ -85,26 +85,19 @@ void* CustomAngleForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -85,26 +85,19 @@ void* CustomAngleForceProxy::deserialize(const SerializationNode& node) const {
if
(
version
>
1
)
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
perAngleParams
=
node
.
getChildNode
(
"PerAngleParameters"
);
const
SerializationNode
&
perAngleParams
=
node
.
getChildNode
(
"PerAngleParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perAngleParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perAngleParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perAngleParams
.
getChildren
()[
i
];
force
->
addPerAngleParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerAngleParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
globalParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
globalParams
.
getChildren
())
const
SerializationNode
&
parameter
=
globalParams
.
getChildren
()[
i
];
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
}
if
(
version
>
2
)
{
if
(
version
>
2
)
{
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
for
(
int
i
=
0
;
i
<
(
int
)
energyDerivs
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
energyDerivs
.
getChildren
())
const
SerializationNode
&
parameter
=
energyDerivs
.
getChildren
()[
i
];
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
}
}
}
const
SerializationNode
&
angles
=
node
.
getChildNode
(
"Angles"
);
const
SerializationNode
&
angles
=
node
.
getChildNode
(
"Angles"
);
vector
<
double
>
params
(
force
->
getNumPerAngleParameters
());
vector
<
double
>
params
(
force
->
getNumPerAngleParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
angles
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
angle
:
angles
.
getChildren
())
{
const
SerializationNode
&
angle
=
angles
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"param"
;
key
<<
"param"
;
...
...
serialization/src/CustomBondForceProxy.cpp
View file @
6ed5bc4e
...
@@ -85,26 +85,19 @@ void* CustomBondForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -85,26 +85,19 @@ void* CustomBondForceProxy::deserialize(const SerializationNode& node) const {
if
(
version
>
1
)
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
perBondParams
=
node
.
getChildNode
(
"PerBondParameters"
);
const
SerializationNode
&
perBondParams
=
node
.
getChildNode
(
"PerBondParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perBondParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perBondParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perBondParams
.
getChildren
()[
i
];
force
->
addPerBondParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerBondParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
globalParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
globalParams
.
getChildren
())
const
SerializationNode
&
parameter
=
globalParams
.
getChildren
()[
i
];
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
}
if
(
version
>
2
)
{
if
(
version
>
2
)
{
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
for
(
int
i
=
0
;
i
<
(
int
)
energyDerivs
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
energyDerivs
.
getChildren
())
const
SerializationNode
&
parameter
=
energyDerivs
.
getChildren
()[
i
];
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
}
}
}
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
vector
<
double
>
params
(
force
->
getNumPerBondParameters
());
vector
<
double
>
params
(
force
->
getNumPerBondParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
bond
:
bonds
.
getChildren
())
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"param"
;
key
<<
"param"
;
...
...
serialization/src/CustomCentroidBondForceProxy.cpp
View file @
6ed5bc4e
...
@@ -108,39 +108,31 @@ void* CustomCentroidBondForceProxy::deserialize(const SerializationNode& node) c
...
@@ -108,39 +108,31 @@ void* CustomCentroidBondForceProxy::deserialize(const SerializationNode& node) c
if
(
version
>
1
)
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
perBondParams
=
node
.
getChildNode
(
"PerBondParameters"
);
const
SerializationNode
&
perBondParams
=
node
.
getChildNode
(
"PerBondParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perBondParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perBondParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perBondParams
.
getChildren
()[
i
];
force
->
addPerBondParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerBondParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
globalParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
globalParams
.
getChildren
())
const
SerializationNode
&
parameter
=
globalParams
.
getChildren
()[
i
];
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
}
if
(
version
>
2
)
{
if
(
version
>
2
)
{
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
for
(
int
i
=
0
;
i
<
(
int
)
energyDerivs
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
energyDerivs
.
getChildren
())
const
SerializationNode
&
parameter
=
energyDerivs
.
getChildren
()[
i
];
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
}
}
}
const
SerializationNode
&
groups
=
node
.
getChildNode
(
"Groups"
);
const
SerializationNode
&
groups
=
node
.
getChildNode
(
"Groups"
);
for
(
int
i
=
0
;
i
<
(
int
)
groups
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
group
:
groups
.
getChildren
())
{
const
SerializationNode
&
group
=
groups
.
getChildren
()[
i
];
vector
<
int
>
particles
;
vector
<
int
>
particles
;
vector
<
double
>
weights
;
vector
<
double
>
weights
;
for
(
int
j
=
0
;
j
<
(
int
)
group
.
getChildren
()
.
size
();
j
++
)
{
for
(
auto
&
child
:
group
.
getChildren
())
{
particles
.
push_back
(
group
.
getChildren
()[
j
]
.
getIntProperty
(
"p"
));
particles
.
push_back
(
child
.
getIntProperty
(
"p"
));
if
(
group
.
getChildren
()[
j
]
.
hasProperty
(
"weight"
))
if
(
child
.
hasProperty
(
"weight"
))
weights
.
push_back
(
group
.
getChildren
()[
j
]
.
getDoubleProperty
(
"weight"
));
weights
.
push_back
(
child
.
getDoubleProperty
(
"weight"
));
}
}
force
->
addGroup
(
particles
,
weights
);
force
->
addGroup
(
particles
,
weights
);
}
}
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
vector
<
int
>
bondGroups
(
force
->
getNumGroupsPerBond
());
vector
<
int
>
bondGroups
(
force
->
getNumGroupsPerBond
());
vector
<
double
>
params
(
force
->
getNumPerBondParameters
());
vector
<
double
>
params
(
force
->
getNumPerBondParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
bond
:
bonds
.
getChildren
())
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
bondGroups
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
bondGroups
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"g"
;
key
<<
"g"
;
...
@@ -156,8 +148,7 @@ void* CustomCentroidBondForceProxy::deserialize(const SerializationNode& node) c
...
@@ -156,8 +148,7 @@ void* CustomCentroidBondForceProxy::deserialize(const SerializationNode& node) c
force
->
addBond
(
bondGroups
,
params
);
force
->
addBond
(
bondGroups
,
params
);
}
}
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
function
:
functions
.
getChildren
())
{
const
SerializationNode
&
function
=
functions
.
getChildren
()[
i
];
if
(
function
.
hasProperty
(
"type"
))
{
if
(
function
.
hasProperty
(
"type"
))
{
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
}
}
...
@@ -166,8 +157,8 @@ void* CustomCentroidBondForceProxy::deserialize(const SerializationNode& node) c
...
@@ -166,8 +157,8 @@ void* CustomCentroidBondForceProxy::deserialize(const SerializationNode& node) c
const
SerializationNode
&
valuesNode
=
function
.
getChildNode
(
"Values"
);
const
SerializationNode
&
valuesNode
=
function
.
getChildNode
(
"Values"
);
vector
<
double
>
values
;
vector
<
double
>
values
;
for
(
int
j
=
0
;
j
<
(
int
)
valuesNode
.
getChildren
()
.
size
();
j
++
)
for
(
auto
&
child
:
valuesNode
.
getChildren
())
values
.
push_back
(
valuesNode
.
getChildren
()[
j
]
.
getDoubleProperty
(
"v"
));
values
.
push_back
(
child
.
getDoubleProperty
(
"v"
));
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
new
Continuous1DFunction
(
values
,
function
.
getDoubleProperty
(
"min"
),
function
.
getDoubleProperty
(
"max"
)));
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
new
Continuous1DFunction
(
values
,
function
.
getDoubleProperty
(
"min"
),
function
.
getDoubleProperty
(
"max"
)));
}
}
}
}
...
...
serialization/src/CustomCompoundBondForceProxy.cpp
View file @
6ed5bc4e
...
@@ -95,27 +95,20 @@ void* CustomCompoundBondForceProxy::deserialize(const SerializationNode& node) c
...
@@ -95,27 +95,20 @@ void* CustomCompoundBondForceProxy::deserialize(const SerializationNode& node) c
if
(
version
>
1
)
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
perBondParams
=
node
.
getChildNode
(
"PerBondParameters"
);
const
SerializationNode
&
perBondParams
=
node
.
getChildNode
(
"PerBondParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perBondParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perBondParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perBondParams
.
getChildren
()[
i
];
force
->
addPerBondParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerBondParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
globalParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
globalParams
.
getChildren
())
const
SerializationNode
&
parameter
=
globalParams
.
getChildren
()[
i
];
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
}
if
(
version
>
2
)
{
if
(
version
>
2
)
{
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
for
(
int
i
=
0
;
i
<
(
int
)
energyDerivs
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
energyDerivs
.
getChildren
())
const
SerializationNode
&
parameter
=
energyDerivs
.
getChildren
()[
i
];
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
}
}
}
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
vector
<
int
>
particles
(
force
->
getNumParticlesPerBond
());
vector
<
int
>
particles
(
force
->
getNumParticlesPerBond
());
vector
<
double
>
params
(
force
->
getNumPerBondParameters
());
vector
<
double
>
params
(
force
->
getNumPerBondParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
bond
:
bonds
.
getChildren
())
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
particles
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
particles
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"p"
;
key
<<
"p"
;
...
@@ -131,8 +124,7 @@ void* CustomCompoundBondForceProxy::deserialize(const SerializationNode& node) c
...
@@ -131,8 +124,7 @@ void* CustomCompoundBondForceProxy::deserialize(const SerializationNode& node) c
force
->
addBond
(
particles
,
params
);
force
->
addBond
(
particles
,
params
);
}
}
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
function
:
functions
.
getChildren
())
{
const
SerializationNode
&
function
=
functions
.
getChildren
()[
i
];
if
(
function
.
hasProperty
(
"type"
))
{
if
(
function
.
hasProperty
(
"type"
))
{
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
}
}
...
@@ -141,8 +133,8 @@ void* CustomCompoundBondForceProxy::deserialize(const SerializationNode& node) c
...
@@ -141,8 +133,8 @@ void* CustomCompoundBondForceProxy::deserialize(const SerializationNode& node) c
const
SerializationNode
&
valuesNode
=
function
.
getChildNode
(
"Values"
);
const
SerializationNode
&
valuesNode
=
function
.
getChildNode
(
"Values"
);
vector
<
double
>
values
;
vector
<
double
>
values
;
for
(
int
j
=
0
;
j
<
(
int
)
valuesNode
.
getChildren
()
.
size
();
j
++
)
for
(
auto
&
child
:
valuesNode
.
getChildren
())
values
.
push_back
(
valuesNode
.
getChildren
()[
j
]
.
getDoubleProperty
(
"v"
));
values
.
push_back
(
child
.
getDoubleProperty
(
"v"
));
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
new
Continuous1DFunction
(
values
,
function
.
getDoubleProperty
(
"min"
),
function
.
getDoubleProperty
(
"max"
)));
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
new
Continuous1DFunction
(
values
,
function
.
getDoubleProperty
(
"min"
),
function
.
getDoubleProperty
(
"max"
)));
}
}
}
}
...
...
serialization/src/CustomExternalForceProxy.cpp
View file @
6ed5bc4e
...
@@ -77,19 +77,14 @@ void* CustomExternalForceProxy::deserialize(const SerializationNode& node) const
...
@@ -77,19 +77,14 @@ void* CustomExternalForceProxy::deserialize(const SerializationNode& node) const
CustomExternalForce
*
force
=
new
CustomExternalForce
(
node
.
getStringProperty
(
"energy"
));
CustomExternalForce
*
force
=
new
CustomExternalForce
(
node
.
getStringProperty
(
"energy"
));
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
const
SerializationNode
&
perParticleParams
=
node
.
getChildNode
(
"PerParticleParameters"
);
const
SerializationNode
&
perParticleParams
=
node
.
getChildNode
(
"PerParticleParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perParticleParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perParticleParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perParticleParams
.
getChildren
()[
i
];
force
->
addPerParticleParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerParticleParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
globalParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
globalParams
.
getChildren
())
const
SerializationNode
&
parameter
=
globalParams
.
getChildren
()[
i
];
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
}
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
vector
<
double
>
params
(
force
->
getNumPerParticleParameters
());
vector
<
double
>
params
(
force
->
getNumPerParticleParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
particle
:
particles
.
getChildren
())
{
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"param"
;
key
<<
"param"
;
...
...
serialization/src/CustomGBForceProxy.cpp
View file @
6ed5bc4e
...
@@ -107,36 +107,25 @@ void* CustomGBForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -107,36 +107,25 @@ void* CustomGBForceProxy::deserialize(const SerializationNode& node) const {
force
->
setNonbondedMethod
((
CustomGBForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
force
->
setNonbondedMethod
((
CustomGBForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoff"
));
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoff"
));
const
SerializationNode
&
perParticleParams
=
node
.
getChildNode
(
"PerParticleParameters"
);
const
SerializationNode
&
perParticleParams
=
node
.
getChildNode
(
"PerParticleParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perParticleParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perParticleParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perParticleParams
.
getChildren
()[
i
];
force
->
addPerParticleParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerParticleParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
globalParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
globalParams
.
getChildren
())
const
SerializationNode
&
parameter
=
globalParams
.
getChildren
()[
i
];
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
}
if
(
version
>
1
)
{
if
(
version
>
1
)
{
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
for
(
int
i
=
0
;
i
<
(
int
)
energyDerivs
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
energyDerivs
.
getChildren
())
const
SerializationNode
&
parameter
=
energyDerivs
.
getChildren
()[
i
];
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
}
}
}
const
SerializationNode
&
computedValues
=
node
.
getChildNode
(
"ComputedValues"
);
const
SerializationNode
&
computedValues
=
node
.
getChildNode
(
"ComputedValues"
);
for
(
int
i
=
0
;
i
<
(
int
)
computedValues
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
value
:
computedValues
.
getChildren
())
const
SerializationNode
&
value
=
computedValues
.
getChildren
()[
i
];
force
->
addComputedValue
(
value
.
getStringProperty
(
"name"
),
value
.
getStringProperty
(
"expression"
),
(
CustomGBForce
::
ComputationType
)
value
.
getIntProperty
(
"type"
));
force
->
addComputedValue
(
value
.
getStringProperty
(
"name"
),
value
.
getStringProperty
(
"expression"
),
(
CustomGBForce
::
ComputationType
)
value
.
getIntProperty
(
"type"
));
}
const
SerializationNode
&
energyTerms
=
node
.
getChildNode
(
"EnergyTerms"
);
const
SerializationNode
&
energyTerms
=
node
.
getChildNode
(
"EnergyTerms"
);
for
(
int
i
=
0
;
i
<
(
int
)
energyTerms
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
term
:
energyTerms
.
getChildren
())
const
SerializationNode
&
term
=
energyTerms
.
getChildren
()[
i
];
force
->
addEnergyTerm
(
term
.
getStringProperty
(
"expression"
),
(
CustomGBForce
::
ComputationType
)
term
.
getIntProperty
(
"type"
));
force
->
addEnergyTerm
(
term
.
getStringProperty
(
"expression"
),
(
CustomGBForce
::
ComputationType
)
term
.
getIntProperty
(
"type"
));
}
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
vector
<
double
>
params
(
force
->
getNumPerParticleParameters
());
vector
<
double
>
params
(
force
->
getNumPerParticleParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
particle
:
particles
.
getChildren
())
{
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"param"
;
key
<<
"param"
;
...
@@ -146,13 +135,10 @@ void* CustomGBForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -146,13 +135,10 @@ void* CustomGBForceProxy::deserialize(const SerializationNode& node) const {
force
->
addParticle
(
params
);
force
->
addParticle
(
params
);
}
}
const
SerializationNode
&
exclusions
=
node
.
getChildNode
(
"Exclusions"
);
const
SerializationNode
&
exclusions
=
node
.
getChildNode
(
"Exclusions"
);
for
(
int
i
=
0
;
i
<
(
int
)
exclusions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
exclusion
:
exclusions
.
getChildren
())
const
SerializationNode
&
exclusion
=
exclusions
.
getChildren
()[
i
];
force
->
addExclusion
(
exclusion
.
getIntProperty
(
"p1"
),
exclusion
.
getIntProperty
(
"p2"
));
force
->
addExclusion
(
exclusion
.
getIntProperty
(
"p1"
),
exclusion
.
getIntProperty
(
"p2"
));
}
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
function
:
functions
.
getChildren
())
{
const
SerializationNode
&
function
=
functions
.
getChildren
()[
i
];
if
(
function
.
hasProperty
(
"type"
))
{
if
(
function
.
hasProperty
(
"type"
))
{
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
}
}
...
@@ -161,8 +147,8 @@ void* CustomGBForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -161,8 +147,8 @@ void* CustomGBForceProxy::deserialize(const SerializationNode& node) const {
const
SerializationNode
&
valuesNode
=
function
.
getChildNode
(
"Values"
);
const
SerializationNode
&
valuesNode
=
function
.
getChildNode
(
"Values"
);
vector
<
double
>
values
;
vector
<
double
>
values
;
for
(
int
j
=
0
;
j
<
(
int
)
valuesNode
.
getChildren
()
.
size
();
j
++
)
for
(
auto
&
child
:
valuesNode
.
getChildren
())
values
.
push_back
(
valuesNode
.
getChildren
()[
j
]
.
getDoubleProperty
(
"v"
));
values
.
push_back
(
child
.
getDoubleProperty
(
"v"
));
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
new
Continuous1DFunction
(
values
,
function
.
getDoubleProperty
(
"min"
),
function
.
getDoubleProperty
(
"max"
)));
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
new
Continuous1DFunction
(
values
,
function
.
getDoubleProperty
(
"min"
),
function
.
getDoubleProperty
(
"max"
)));
}
}
}
}
...
...
serialization/src/CustomHbondForceProxy.cpp
View file @
6ed5bc4e
...
@@ -107,24 +107,17 @@ void* CustomHbondForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -107,24 +107,17 @@ void* CustomHbondForceProxy::deserialize(const SerializationNode& node) const {
force
->
setNonbondedMethod
((
CustomHbondForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
force
->
setNonbondedMethod
((
CustomHbondForce
::
NonbondedMethod
)
node
.
getIntProperty
(
"method"
));
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoff"
));
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoff"
));
const
SerializationNode
&
perDonorParams
=
node
.
getChildNode
(
"PerDonorParameters"
);
const
SerializationNode
&
perDonorParams
=
node
.
getChildNode
(
"PerDonorParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perDonorParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perDonorParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perDonorParams
.
getChildren
()[
i
];
force
->
addPerDonorParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerDonorParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
perAcceptorParams
=
node
.
getChildNode
(
"PerAcceptorParameters"
);
const
SerializationNode
&
perAcceptorParams
=
node
.
getChildNode
(
"PerAcceptorParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perAcceptorParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perAcceptorParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perAcceptorParams
.
getChildren
()[
i
];
force
->
addPerAcceptorParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerAcceptorParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
globalParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
globalParams
.
getChildren
())
const
SerializationNode
&
parameter
=
globalParams
.
getChildren
()[
i
];
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
}
const
SerializationNode
&
donors
=
node
.
getChildNode
(
"Donors"
);
const
SerializationNode
&
donors
=
node
.
getChildNode
(
"Donors"
);
vector
<
double
>
params
(
force
->
getNumPerDonorParameters
());
vector
<
double
>
params
(
force
->
getNumPerDonorParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
donors
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
donor
:
donors
.
getChildren
())
{
const
SerializationNode
&
donor
=
donors
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"param"
;
key
<<
"param"
;
...
@@ -135,8 +128,7 @@ void* CustomHbondForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -135,8 +128,7 @@ void* CustomHbondForceProxy::deserialize(const SerializationNode& node) const {
}
}
const
SerializationNode
&
acceptors
=
node
.
getChildNode
(
"Acceptors"
);
const
SerializationNode
&
acceptors
=
node
.
getChildNode
(
"Acceptors"
);
params
.
resize
(
force
->
getNumPerAcceptorParameters
());
params
.
resize
(
force
->
getNumPerAcceptorParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
acceptors
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
acceptor
:
acceptors
.
getChildren
())
{
const
SerializationNode
&
acceptor
=
acceptors
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"param"
;
key
<<
"param"
;
...
@@ -146,13 +138,10 @@ void* CustomHbondForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -146,13 +138,10 @@ void* CustomHbondForceProxy::deserialize(const SerializationNode& node) const {
force
->
addAcceptor
(
acceptor
.
getIntProperty
(
"p1"
),
acceptor
.
getIntProperty
(
"p2"
),
acceptor
.
getIntProperty
(
"p3"
),
params
);
force
->
addAcceptor
(
acceptor
.
getIntProperty
(
"p1"
),
acceptor
.
getIntProperty
(
"p2"
),
acceptor
.
getIntProperty
(
"p3"
),
params
);
}
}
const
SerializationNode
&
exclusions
=
node
.
getChildNode
(
"Exclusions"
);
const
SerializationNode
&
exclusions
=
node
.
getChildNode
(
"Exclusions"
);
for
(
int
i
=
0
;
i
<
(
int
)
exclusions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
exclusion
:
exclusions
.
getChildren
())
const
SerializationNode
&
exclusion
=
exclusions
.
getChildren
()[
i
];
force
->
addExclusion
(
exclusion
.
getIntProperty
(
"donor"
),
exclusion
.
getIntProperty
(
"acceptor"
));
force
->
addExclusion
(
exclusion
.
getIntProperty
(
"donor"
),
exclusion
.
getIntProperty
(
"acceptor"
));
}
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
function
:
functions
.
getChildren
())
{
const
SerializationNode
&
function
=
functions
.
getChildren
()[
i
];
if
(
function
.
hasProperty
(
"type"
))
{
if
(
function
.
hasProperty
(
"type"
))
{
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
}
}
...
@@ -161,8 +150,8 @@ void* CustomHbondForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -161,8 +150,8 @@ void* CustomHbondForceProxy::deserialize(const SerializationNode& node) const {
const
SerializationNode
&
valuesNode
=
function
.
getChildNode
(
"Values"
);
const
SerializationNode
&
valuesNode
=
function
.
getChildNode
(
"Values"
);
vector
<
double
>
values
;
vector
<
double
>
values
;
for
(
int
j
=
0
;
j
<
(
int
)
valuesNode
.
getChildren
()
.
size
();
j
++
)
for
(
auto
&
child
:
valuesNode
.
getChildren
())
values
.
push_back
(
valuesNode
.
getChildren
()[
j
]
.
getDoubleProperty
(
"v"
));
values
.
push_back
(
child
.
getDoubleProperty
(
"v"
));
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
new
Continuous1DFunction
(
values
,
function
.
getDoubleProperty
(
"min"
),
function
.
getDoubleProperty
(
"max"
)));
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
new
Continuous1DFunction
(
values
,
function
.
getDoubleProperty
(
"min"
),
function
.
getDoubleProperty
(
"max"
)));
}
}
}
}
...
...
serialization/src/CustomIntegratorProxy.cpp
View file @
6ed5bc4e
...
@@ -74,45 +74,40 @@ void* CustomIntegratorProxy::deserialize(const SerializationNode& node) const {
...
@@ -74,45 +74,40 @@ void* CustomIntegratorProxy::deserialize(const SerializationNode& node) const {
throw
OpenMMException
(
"Unsupported version number"
);
throw
OpenMMException
(
"Unsupported version number"
);
CustomIntegrator
*
integrator
=
new
CustomIntegrator
(
node
.
getDoubleProperty
(
"stepSize"
));
CustomIntegrator
*
integrator
=
new
CustomIntegrator
(
node
.
getDoubleProperty
(
"stepSize"
));
const
SerializationNode
&
globalVariablesNode
=
node
.
getChildNode
(
"GlobalVariables"
);
const
SerializationNode
&
globalVariablesNode
=
node
.
getChildNode
(
"GlobalVariables"
);
const
map
<
string
,
string
>
&
globalVariableProp
=
globalVariablesNode
.
getProperties
();
for
(
auto
&
prop
:
globalVariablesNode
.
getProperties
())
for
(
map
<
string
,
string
>::
const_iterator
cit
=
globalVariableProp
.
begin
();
cit
!=
globalVariableProp
.
end
();
cit
++
)
{
integrator
->
addGlobalVariable
(
prop
.
first
,
globalVariablesNode
.
getDoubleProperty
(
prop
.
first
));
integrator
->
addGlobalVariable
(
cit
->
first
,
globalVariablesNode
.
getDoubleProperty
(
cit
->
first
));
}
const
SerializationNode
&
perDofVariablesNode
=
node
.
getChildNode
(
"PerDofVariables"
);
const
SerializationNode
&
perDofVariablesNode
=
node
.
getChildNode
(
"PerDofVariables"
);
const
vector
<
SerializationNode
>&
perDofVariableList
=
perDofVariablesNode
.
getChildren
();
int
count
=
0
;
int
count
=
0
;
for
(
vector
<
SerializationNode
>::
const_iterator
cit
=
perDofVariableList
.
begin
();
cit
!=
perDofVariableList
.
end
();
cit
++
,
count
++
)
{
for
(
auto
&
var
:
perDofVariablesNode
.
getChildren
())
{
const
vector
<
SerializationNode
>&
perDofVariableVector
=
cit
->
getChildren
();
integrator
->
addPerDofVariable
(
var
.
getName
(),
0
);
integrator
->
addPerDofVariable
(
cit
->
getName
(),
0
);
vector
<
Vec3
>
perDofValues
;
vector
<
Vec3
>
perDofValues
;
for
(
vector
<
SerializationNode
>::
const_iterator
dit
=
perDofVariableVector
.
begin
();
dit
!=
perDofVariableVector
.
end
();
dit
++
)
{
for
(
auto
&
child
:
var
.
getChildren
())
perDofValues
.
push_back
(
Vec3
(
dit
->
getDoubleProperty
(
"x"
),
dit
->
getDoubleProperty
(
"y"
),
dit
->
getDoubleProperty
(
"z"
)));
perDofValues
.
push_back
(
Vec3
(
child
.
getDoubleProperty
(
"x"
),
child
.
getDoubleProperty
(
"y"
),
child
.
getDoubleProperty
(
"z"
)));
}
integrator
->
setPerDofVariable
(
count
,
perDofValues
);
integrator
->
setPerDofVariable
(
count
,
perDofValues
);
count
++
;
}
}
const
SerializationNode
&
computationsNode
=
node
.
getChildNode
(
"Computations"
);
const
SerializationNode
&
computationsNode
=
node
.
getChildNode
(
"Computations"
);
const
vector
<
SerializationNode
>&
computationsList
=
computationsNode
.
getChildren
();
for
(
auto
&
comp
:
computationsNode
.
getChildren
())
{
for
(
vector
<
SerializationNode
>::
const_iterator
cit
=
computationsList
.
begin
();
cit
!=
computationsList
.
end
();
cit
++
)
{
CustomIntegrator
::
ComputationType
computationType
=
static_cast
<
CustomIntegrator
::
ComputationType
>
(
comp
.
getIntProperty
(
"computationType"
));
CustomIntegrator
::
ComputationType
computationType
=
static_cast
<
CustomIntegrator
::
ComputationType
>
(
cit
->
getIntProperty
(
"computationType"
));
// make sure that the int casts to a valid enum
// make sure that the int casts to a valid enum
if
(
computationType
==
CustomIntegrator
::
ComputeGlobal
)
{
if
(
computationType
==
CustomIntegrator
::
ComputeGlobal
)
{
integrator
->
addComputeGlobal
(
c
it
->
getStringProperty
(
"computationVariable"
),
c
it
->
getStringProperty
(
"computationExpression"
));
integrator
->
addComputeGlobal
(
c
omp
.
getStringProperty
(
"computationVariable"
),
c
omp
.
getStringProperty
(
"computationExpression"
));
}
else
if
(
computationType
==
CustomIntegrator
::
ComputePerDof
)
{
}
else
if
(
computationType
==
CustomIntegrator
::
ComputePerDof
)
{
integrator
->
addComputePerDof
(
c
it
->
getStringProperty
(
"computationVariable"
),
c
it
->
getStringProperty
(
"computationExpression"
));
integrator
->
addComputePerDof
(
c
omp
.
getStringProperty
(
"computationVariable"
),
c
omp
.
getStringProperty
(
"computationExpression"
));
}
else
if
(
computationType
==
CustomIntegrator
::
ComputeSum
)
{
}
else
if
(
computationType
==
CustomIntegrator
::
ComputeSum
)
{
integrator
->
addComputeSum
(
c
it
->
getStringProperty
(
"computationVariable"
),
c
it
->
getStringProperty
(
"computationExpression"
));
integrator
->
addComputeSum
(
c
omp
.
getStringProperty
(
"computationVariable"
),
c
omp
.
getStringProperty
(
"computationExpression"
));
}
else
if
(
computationType
==
CustomIntegrator
::
ConstrainPositions
)
{
}
else
if
(
computationType
==
CustomIntegrator
::
ConstrainPositions
)
{
integrator
->
addConstrainPositions
();
integrator
->
addConstrainPositions
();
}
else
if
(
computationType
==
CustomIntegrator
::
ConstrainVelocities
)
{
}
else
if
(
computationType
==
CustomIntegrator
::
ConstrainVelocities
)
{
integrator
->
addConstrainVelocities
();
integrator
->
addConstrainVelocities
();
}
else
if
(
computationType
==
CustomIntegrator
::
UpdateContextState
)
{
}
else
if
(
computationType
==
CustomIntegrator
::
UpdateContextState
)
{
integrator
->
addUpdateContextState
();
integrator
->
addUpdateContextState
();
}
else
if
(
computationType
==
CustomIntegrator
::
IfBlockStart
)
{
}
else
if
(
computationType
==
CustomIntegrator
::
IfBlockStart
)
{
integrator
->
beginIfBlock
(
c
it
->
getStringProperty
(
"computationExpression"
));
integrator
->
beginIfBlock
(
c
omp
.
getStringProperty
(
"computationExpression"
));
}
else
if
(
computationType
==
CustomIntegrator
::
WhileBlockStart
)
{
}
else
if
(
computationType
==
CustomIntegrator
::
WhileBlockStart
)
{
integrator
->
beginWhileBlock
(
c
it
->
getStringProperty
(
"computationExpression"
));
integrator
->
beginWhileBlock
(
c
omp
.
getStringProperty
(
"computationExpression"
));
}
else
if
(
computationType
==
CustomIntegrator
::
BlockEnd
)
{
}
else
if
(
computationType
==
CustomIntegrator
::
BlockEnd
)
{
integrator
->
endBlock
();
integrator
->
endBlock
();
}
else
{
}
else
{
throw
(
OpenMMException
(
"Custom Integrator Deserialization: Unknown computation type"
));
throw
(
OpenMMException
(
"Custom Integrator Deserialization: Unknown computation type"
));
}
}
...
...
serialization/src/CustomManyParticleForceProxy.cpp
View file @
6ed5bc4e
...
@@ -84,10 +84,10 @@ void CustomManyParticleForceProxy::serialize(const void* object, SerializationNo
...
@@ -84,10 +84,10 @@ void CustomManyParticleForceProxy::serialize(const void* object, SerializationNo
force
.
getTypeFilter
(
i
,
types
);
force
.
getTypeFilter
(
i
,
types
);
stringstream
list
;
stringstream
list
;
bool
first
=
true
;
bool
first
=
true
;
for
(
set
<
int
>::
const_iterator
iter
=
types
.
begin
();
iter
!=
types
.
end
();
++
iter
)
{
for
(
int
type
:
types
)
{
if
(
!
first
)
if
(
!
first
)
list
<<
","
;
list
<<
","
;
list
<<
*
iter
;
list
<<
type
;
first
=
false
;
first
=
false
;
}
}
filters
.
createChildNode
(
"Filter"
).
setIntProperty
(
"index"
,
i
).
setStringProperty
(
"types"
,
list
.
str
());
filters
.
createChildNode
(
"Filter"
).
setIntProperty
(
"index"
,
i
).
setStringProperty
(
"types"
,
list
.
str
());
...
@@ -108,19 +108,14 @@ void* CustomManyParticleForceProxy::deserialize(const SerializationNode& node) c
...
@@ -108,19 +108,14 @@ void* CustomManyParticleForceProxy::deserialize(const SerializationNode& node) c
force
->
setPermutationMode
((
CustomManyParticleForce
::
PermutationMode
)
node
.
getIntProperty
(
"permutationMode"
));
force
->
setPermutationMode
((
CustomManyParticleForce
::
PermutationMode
)
node
.
getIntProperty
(
"permutationMode"
));
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoff"
));
force
->
setCutoffDistance
(
node
.
getDoubleProperty
(
"cutoff"
));
const
SerializationNode
&
perParticleParams
=
node
.
getChildNode
(
"PerParticleParameters"
);
const
SerializationNode
&
perParticleParams
=
node
.
getChildNode
(
"PerParticleParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perParticleParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perParticleParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perParticleParams
.
getChildren
()[
i
];
force
->
addPerParticleParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerParticleParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
globalParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
globalParams
.
getChildren
())
const
SerializationNode
&
parameter
=
globalParams
.
getChildren
()[
i
];
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
}
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
vector
<
double
>
params
(
force
->
getNumPerParticleParameters
());
vector
<
double
>
params
(
force
->
getNumPerParticleParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
particle
:
particles
.
getChildren
())
{
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"param"
;
key
<<
"param"
;
...
@@ -130,13 +125,10 @@ void* CustomManyParticleForceProxy::deserialize(const SerializationNode& node) c
...
@@ -130,13 +125,10 @@ void* CustomManyParticleForceProxy::deserialize(const SerializationNode& node) c
force
->
addParticle
(
params
,
particle
.
getIntProperty
(
"type"
));
force
->
addParticle
(
params
,
particle
.
getIntProperty
(
"type"
));
}
}
const
SerializationNode
&
exclusions
=
node
.
getChildNode
(
"Exclusions"
);
const
SerializationNode
&
exclusions
=
node
.
getChildNode
(
"Exclusions"
);
for
(
int
i
=
0
;
i
<
(
int
)
exclusions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
exclusion
:
exclusions
.
getChildren
())
const
SerializationNode
&
exclusion
=
exclusions
.
getChildren
()[
i
];
force
->
addExclusion
(
exclusion
.
getIntProperty
(
"p1"
),
exclusion
.
getIntProperty
(
"p2"
));
force
->
addExclusion
(
exclusion
.
getIntProperty
(
"p1"
),
exclusion
.
getIntProperty
(
"p2"
));
}
const
SerializationNode
&
filters
=
node
.
getChildNode
(
"TypeFilters"
);
const
SerializationNode
&
filters
=
node
.
getChildNode
(
"TypeFilters"
);
for
(
int
i
=
0
;
i
<
(
int
)
filters
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
filter
:
filters
.
getChildren
())
{
const
SerializationNode
&
filter
=
filters
.
getChildren
()[
i
];
string
typesString
=
filter
.
getStringProperty
(
"types"
);
string
typesString
=
filter
.
getStringProperty
(
"types"
);
vector
<
string
>
splitTypes
;
vector
<
string
>
splitTypes
;
size_t
searchPos
=
0
,
nextPos
;
size_t
searchPos
=
0
,
nextPos
;
...
@@ -146,20 +138,18 @@ void* CustomManyParticleForceProxy::deserialize(const SerializationNode& node) c
...
@@ -146,20 +138,18 @@ void* CustomManyParticleForceProxy::deserialize(const SerializationNode& node) c
}
}
splitTypes
.
push_back
(
typesString
.
substr
(
searchPos
));
splitTypes
.
push_back
(
typesString
.
substr
(
searchPos
));
set
<
int
>
types
;
set
<
int
>
types
;
for
(
int
j
=
0
;
j
<
(
int
)
splitTypes
.
size
();
j
++
)
{
for
(
auto
&
t
:
splitTypes
)
{
if
(
splitTypes
[
j
]
.
size
()
>
0
)
{
if
(
t
.
size
()
>
0
)
{
int
type
;
int
type
;
stringstream
(
splitTypes
[
j
]
)
>>
type
;
stringstream
(
t
)
>>
type
;
types
.
insert
(
type
);
types
.
insert
(
type
);
}
}
}
}
force
->
setTypeFilter
(
filter
.
getIntProperty
(
"index"
),
types
);
force
->
setTypeFilter
(
filter
.
getIntProperty
(
"index"
),
types
);
}
}
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
function
:
functions
.
getChildren
())
const
SerializationNode
&
function
=
functions
.
getChildren
()[
i
];
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
}
return
force
;
return
force
;
}
}
catch
(...)
{
catch
(...)
{
...
...
serialization/src/CustomNonbondedForceProxy.cpp
View file @
6ed5bc4e
...
@@ -92,11 +92,11 @@ void CustomNonbondedForceProxy::serialize(const void* object, SerializationNode&
...
@@ -92,11 +92,11 @@ void CustomNonbondedForceProxy::serialize(const void* object, SerializationNode&
std
::
set
<
int
>
set2
;
std
::
set
<
int
>
set2
;
force
.
getInteractionGroupParameters
(
i
,
set1
,
set2
);
force
.
getInteractionGroupParameters
(
i
,
set1
,
set2
);
SerializationNode
&
set1node
=
interactionGroup
.
createChildNode
(
"Set1"
);
SerializationNode
&
set1node
=
interactionGroup
.
createChildNode
(
"Set1"
);
for
(
std
::
set
<
int
>::
iterator
it
=
set1
.
begin
();
it
!=
set1
.
end
();
++
it
)
for
(
int
p
:
set1
)
set1node
.
createChildNode
(
"Particle"
).
setIntProperty
(
"index"
,
*
it
);
set1node
.
createChildNode
(
"Particle"
).
setIntProperty
(
"index"
,
p
);
SerializationNode
&
set2node
=
interactionGroup
.
createChildNode
(
"Set2"
);
SerializationNode
&
set2node
=
interactionGroup
.
createChildNode
(
"Set2"
);
for
(
std
::
set
<
int
>::
iterator
it
=
set2
.
begin
();
it
!=
set2
.
end
();
++
it
)
for
(
int
p
:
set2
)
set2node
.
createChildNode
(
"Particle"
).
setIntProperty
(
"index"
,
*
it
);
set2node
.
createChildNode
(
"Particle"
).
setIntProperty
(
"index"
,
p
);
}
}
}
}
...
@@ -114,26 +114,19 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons
...
@@ -114,26 +114,19 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons
force
->
setSwitchingDistance
(
node
.
getDoubleProperty
(
"switchingDistance"
,
-
1.0
));
force
->
setSwitchingDistance
(
node
.
getDoubleProperty
(
"switchingDistance"
,
-
1.0
));
force
->
setUseLongRangeCorrection
(
node
.
getBoolProperty
(
"useLongRangeCorrection"
,
false
));
force
->
setUseLongRangeCorrection
(
node
.
getBoolProperty
(
"useLongRangeCorrection"
,
false
));
const
SerializationNode
&
perParticleParams
=
node
.
getChildNode
(
"PerParticleParameters"
);
const
SerializationNode
&
perParticleParams
=
node
.
getChildNode
(
"PerParticleParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perParticleParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perParticleParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perParticleParams
.
getChildren
()[
i
];
force
->
addPerParticleParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerParticleParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
globalParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
globalParams
.
getChildren
())
const
SerializationNode
&
parameter
=
globalParams
.
getChildren
()[
i
];
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
}
if
(
version
>
1
)
{
if
(
version
>
1
)
{
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
for
(
int
i
=
0
;
i
<
(
int
)
energyDerivs
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
energyDerivs
.
getChildren
())
const
SerializationNode
&
parameter
=
energyDerivs
.
getChildren
()[
i
];
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
}
}
}
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
vector
<
double
>
params
(
force
->
getNumPerParticleParameters
());
vector
<
double
>
params
(
force
->
getNumPerParticleParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
particle
:
particles
.
getChildren
())
{
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"param"
;
key
<<
"param"
;
...
@@ -143,13 +136,10 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons
...
@@ -143,13 +136,10 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons
force
->
addParticle
(
params
);
force
->
addParticle
(
params
);
}
}
const
SerializationNode
&
exclusions
=
node
.
getChildNode
(
"Exclusions"
);
const
SerializationNode
&
exclusions
=
node
.
getChildNode
(
"Exclusions"
);
for
(
int
i
=
0
;
i
<
(
int
)
exclusions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
exclusion
:
exclusions
.
getChildren
())
const
SerializationNode
&
exclusion
=
exclusions
.
getChildren
()[
i
];
force
->
addExclusion
(
exclusion
.
getIntProperty
(
"p1"
),
exclusion
.
getIntProperty
(
"p2"
));
force
->
addExclusion
(
exclusion
.
getIntProperty
(
"p1"
),
exclusion
.
getIntProperty
(
"p2"
));
}
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
const
SerializationNode
&
functions
=
node
.
getChildNode
(
"Functions"
);
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
function
:
functions
.
getChildren
())
{
const
SerializationNode
&
function
=
functions
.
getChildren
()[
i
];
if
(
function
.
hasProperty
(
"type"
))
{
if
(
function
.
hasProperty
(
"type"
))
{
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
function
.
decodeObject
<
TabulatedFunction
>
());
}
}
...
@@ -158,30 +148,28 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons
...
@@ -158,30 +148,28 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons
const
SerializationNode
&
valuesNode
=
function
.
getChildNode
(
"Values"
);
const
SerializationNode
&
valuesNode
=
function
.
getChildNode
(
"Values"
);
vector
<
double
>
values
;
vector
<
double
>
values
;
for
(
int
j
=
0
;
j
<
(
int
)
valuesNode
.
getChildren
()
.
size
();
j
++
)
for
(
auto
&
child
:
valuesNode
.
getChildren
())
values
.
push_back
(
valuesNode
.
getChildren
()[
j
]
.
getDoubleProperty
(
"v"
));
values
.
push_back
(
child
.
getDoubleProperty
(
"v"
));
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
new
Continuous1DFunction
(
values
,
function
.
getDoubleProperty
(
"min"
),
function
.
getDoubleProperty
(
"max"
)));
force
->
addTabulatedFunction
(
function
.
getStringProperty
(
"name"
),
new
Continuous1DFunction
(
values
,
function
.
getDoubleProperty
(
"min"
),
function
.
getDoubleProperty
(
"max"
)));
}
}
}
}
bool
hasInteractionGroups
=
false
;
// Older files will be missing this block.
bool
hasInteractionGroups
=
false
;
// Older files will be missing this block.
for
(
int
i
=
0
;
i
<
(
int
)
node
.
getChildren
()
.
size
();
i
++
)
{
for
(
auto
&
child
:
node
.
getChildren
()
)
if
(
node
.
getChildren
()[
i
]
.
getName
()
==
"InteractionGroups"
)
if
(
child
.
getName
()
==
"InteractionGroups"
)
hasInteractionGroups
=
true
;
hasInteractionGroups
=
true
;
}
if
(
hasInteractionGroups
)
{
if
(
hasInteractionGroups
)
{
const
SerializationNode
&
interactionGroups
=
node
.
getChildNode
(
"InteractionGroups"
);
const
SerializationNode
&
interactionGroups
=
node
.
getChildNode
(
"InteractionGroups"
);
for
(
int
i
=
0
;
i
<
(
int
)
interactionGroups
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
interactionGroup
:
interactionGroups
.
getChildren
())
{
const
SerializationNode
&
interactionGroup
=
interactionGroups
.
getChildren
()[
i
];
// Get set 1.
// Get set 1.
const
SerializationNode
&
set1node
=
interactionGroup
.
getChildNode
(
"Set1"
);
const
SerializationNode
&
set1node
=
interactionGroup
.
getChildNode
(
"Set1"
);
std
::
set
<
int
>
set1
;
std
::
set
<
int
>
set1
;
for
(
int
j
=
0
;
j
<
(
int
)
set1node
.
getChildren
()
.
size
();
j
++
)
for
(
auto
&
child
:
set1node
.
getChildren
())
set1
.
insert
(
set1node
.
getChildren
()[
j
]
.
getIntProperty
(
"index"
));
set1
.
insert
(
child
.
getIntProperty
(
"index"
));
// Get set 2.
// Get set 2.
const
SerializationNode
&
set2node
=
interactionGroup
.
getChildNode
(
"Set2"
);
const
SerializationNode
&
set2node
=
interactionGroup
.
getChildNode
(
"Set2"
);
std
::
set
<
int
>
set2
;
std
::
set
<
int
>
set2
;
for
(
int
j
=
0
;
j
<
(
int
)
set2node
.
getChildren
()
.
size
();
j
++
)
for
(
auto
&
child
:
set2node
.
getChildren
())
set2
.
insert
(
set2node
.
getChildren
()[
j
]
.
getIntProperty
(
"index"
));
set2
.
insert
(
child
.
getIntProperty
(
"index"
));
force
->
addInteractionGroup
(
set1
,
set2
);
force
->
addInteractionGroup
(
set1
,
set2
);
}
}
}
}
...
...
serialization/src/CustomTorsionForceProxy.cpp
View file @
6ed5bc4e
...
@@ -85,26 +85,19 @@ void* CustomTorsionForceProxy::deserialize(const SerializationNode& node) const
...
@@ -85,26 +85,19 @@ void* CustomTorsionForceProxy::deserialize(const SerializationNode& node) const
if
(
version
>
1
)
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
perTorsionParams
=
node
.
getChildNode
(
"PerTorsionParameters"
);
const
SerializationNode
&
perTorsionParams
=
node
.
getChildNode
(
"PerTorsionParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
perTorsionParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
perTorsionParams
.
getChildren
())
const
SerializationNode
&
parameter
=
perTorsionParams
.
getChildren
()[
i
];
force
->
addPerTorsionParameter
(
parameter
.
getStringProperty
(
"name"
));
force
->
addPerTorsionParameter
(
parameter
.
getStringProperty
(
"name"
));
}
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
const
SerializationNode
&
globalParams
=
node
.
getChildNode
(
"GlobalParameters"
);
for
(
int
i
=
0
;
i
<
(
int
)
globalParams
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
globalParams
.
getChildren
())
const
SerializationNode
&
parameter
=
globalParams
.
getChildren
()[
i
];
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
force
->
addGlobalParameter
(
parameter
.
getStringProperty
(
"name"
),
parameter
.
getDoubleProperty
(
"default"
));
}
if
(
version
>
2
)
{
if
(
version
>
2
)
{
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
const
SerializationNode
&
energyDerivs
=
node
.
getChildNode
(
"EnergyParameterDerivatives"
);
for
(
int
i
=
0
;
i
<
(
int
)
energyDerivs
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
parameter
:
energyDerivs
.
getChildren
())
const
SerializationNode
&
parameter
=
energyDerivs
.
getChildren
()[
i
];
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
force
->
addEnergyParameterDerivative
(
parameter
.
getStringProperty
(
"name"
));
}
}
}
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
const
SerializationNode
&
torsions
=
node
.
getChildNode
(
"Torsions"
);
vector
<
double
>
params
(
force
->
getNumPerTorsionParameters
());
vector
<
double
>
params
(
force
->
getNumPerTorsionParameters
());
for
(
int
i
=
0
;
i
<
(
int
)
torsions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
torsion
:
torsions
.
getChildren
())
{
const
SerializationNode
&
torsion
=
torsions
.
getChildren
()[
i
];
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
params
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"param"
;
key
<<
"param"
;
...
...
serialization/src/GBSAOBCForceProxy.cpp
View file @
6ed5bc4e
...
@@ -72,10 +72,8 @@ void* GBSAOBCForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -72,10 +72,8 @@ void* GBSAOBCForceProxy::deserialize(const SerializationNode& node) const {
if
(
version
>
1
)
if
(
version
>
1
)
force
->
setSurfaceAreaEnergy
(
node
.
getDoubleProperty
(
"surfaceAreaEnergy"
));
force
->
setSurfaceAreaEnergy
(
node
.
getDoubleProperty
(
"surfaceAreaEnergy"
));
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
particle
:
particles
.
getChildren
())
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
force
->
addParticle
(
particle
.
getDoubleProperty
(
"q"
),
particle
.
getDoubleProperty
(
"r"
),
particle
.
getDoubleProperty
(
"scale"
));
force
->
addParticle
(
particle
.
getDoubleProperty
(
"q"
),
particle
.
getDoubleProperty
(
"r"
),
particle
.
getDoubleProperty
(
"scale"
));
}
}
}
catch
(...)
{
catch
(...)
{
delete
force
;
delete
force
;
...
...
serialization/src/GayBerneForceProxy.cpp
View file @
6ed5bc4e
...
@@ -78,17 +78,13 @@ void* GayBerneForceProxy::deserialize(const SerializationNode& node) const {
...
@@ -78,17 +78,13 @@ void* GayBerneForceProxy::deserialize(const SerializationNode& node) const {
force
->
setUseSwitchingFunction
(
node
.
getBoolProperty
(
"useSwitchingFunction"
,
false
));
force
->
setUseSwitchingFunction
(
node
.
getBoolProperty
(
"useSwitchingFunction"
,
false
));
force
->
setSwitchingDistance
(
node
.
getDoubleProperty
(
"switchingDistance"
,
-
1.0
));
force
->
setSwitchingDistance
(
node
.
getDoubleProperty
(
"switchingDistance"
,
-
1.0
));
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
const
SerializationNode
&
particles
=
node
.
getChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
particle
:
particles
.
getChildren
())
const
SerializationNode
&
particle
=
particles
.
getChildren
()[
i
];
force
->
addParticle
(
particle
.
getDoubleProperty
(
"sig"
),
particle
.
getDoubleProperty
(
"eps"
),
particle
.
getIntProperty
(
"xparticle"
),
force
->
addParticle
(
particle
.
getDoubleProperty
(
"sig"
),
particle
.
getDoubleProperty
(
"eps"
),
particle
.
getIntProperty
(
"xparticle"
),
particle
.
getIntProperty
(
"yparticle"
),
particle
.
getDoubleProperty
(
"sx"
),
particle
.
getDoubleProperty
(
"sy"
),
particle
.
getDoubleProperty
(
"sz"
),
particle
.
getIntProperty
(
"yparticle"
),
particle
.
getDoubleProperty
(
"sx"
),
particle
.
getDoubleProperty
(
"sy"
),
particle
.
getDoubleProperty
(
"sz"
),
particle
.
getDoubleProperty
(
"ex"
),
particle
.
getDoubleProperty
(
"ey"
),
particle
.
getDoubleProperty
(
"ez"
));
particle
.
getDoubleProperty
(
"ex"
),
particle
.
getDoubleProperty
(
"ey"
),
particle
.
getDoubleProperty
(
"ez"
));
}
const
SerializationNode
&
exceptions
=
node
.
getChildNode
(
"Exceptions"
);
const
SerializationNode
&
exceptions
=
node
.
getChildNode
(
"Exceptions"
);
for
(
int
i
=
0
;
i
<
(
int
)
exceptions
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
exception
:
exceptions
.
getChildren
())
const
SerializationNode
&
exception
=
exceptions
.
getChildren
()[
i
];
force
->
addException
(
exception
.
getIntProperty
(
"p1"
),
exception
.
getIntProperty
(
"p2"
),
exception
.
getDoubleProperty
(
"sig"
),
exception
.
getDoubleProperty
(
"eps"
));
force
->
addException
(
exception
.
getIntProperty
(
"p1"
),
exception
.
getIntProperty
(
"p2"
),
exception
.
getDoubleProperty
(
"sig"
),
exception
.
getDoubleProperty
(
"eps"
));
}
}
}
catch
(...)
{
catch
(...)
{
delete
force
;
delete
force
;
...
...
serialization/src/HarmonicAngleForceProxy.cpp
View file @
6ed5bc4e
...
@@ -65,10 +65,8 @@ void* HarmonicAngleForceProxy::deserialize(const SerializationNode& node) const
...
@@ -65,10 +65,8 @@ void* HarmonicAngleForceProxy::deserialize(const SerializationNode& node) const
if
(
version
>
1
)
if
(
version
>
1
)
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
force
->
setUsesPeriodicBoundaryConditions
(
node
.
getBoolProperty
(
"usesPeriodic"
));
const
SerializationNode
&
angles
=
node
.
getChildNode
(
"Angles"
);
const
SerializationNode
&
angles
=
node
.
getChildNode
(
"Angles"
);
for
(
int
i
=
0
;
i
<
(
int
)
angles
.
getChildren
().
size
();
i
++
)
{
for
(
auto
&
angle
:
angles
.
getChildren
())
const
SerializationNode
&
angle
=
angles
.
getChildren
()[
i
];
force
->
addAngle
(
angle
.
getIntProperty
(
"p1"
),
angle
.
getIntProperty
(
"p2"
),
angle
.
getIntProperty
(
"p3"
),
angle
.
getDoubleProperty
(
"a"
),
angle
.
getDoubleProperty
(
"k"
));
force
->
addAngle
(
angle
.
getIntProperty
(
"p1"
),
angle
.
getIntProperty
(
"p2"
),
angle
.
getIntProperty
(
"p3"
),
angle
.
getDoubleProperty
(
"a"
),
angle
.
getDoubleProperty
(
"k"
));
}
}
}
catch
(...)
{
catch
(...)
{
delete
force
;
delete
force
;
...
...
Prev
1
2
3
4
5
6
7
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