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
3aa4bb8c
Unverified
Commit
3aa4bb8c
authored
Feb 08, 2021
by
Peter Eastman
Committed by
GitHub
Feb 08, 2021
Browse files
Code cleanup (#3014)
parent
84a93cf8
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
48 additions
and
67 deletions
+48
-67
devtools/run-ctest.py
devtools/run-ctest.py
+0
-1
examples/benchmark.py
examples/benchmark.py
+0
-4
examples/simulateCharmm.py
examples/simulateCharmm.py
+1
-1
platforms/common/src/ComputeParameterSet.cpp
platforms/common/src/ComputeParameterSet.cpp
+9
-9
platforms/cpu/src/CpuBondForce.cpp
platforms/cpu/src/CpuBondForce.cpp
+2
-2
platforms/reference/include/ReferenceBondIxn.h
platforms/reference/include/ReferenceBondIxn.h
+1
-1
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceMultipoleForce.cpp
...ence/src/SimTKReference/AmoebaReferenceMultipoleForce.cpp
+2
-2
plugins/amoeba/wrappers/generateAmoebaWrappers.py
plugins/amoeba/wrappers/generateAmoebaWrappers.py
+2
-9
serialization/src/CustomAngleForceProxy.cpp
serialization/src/CustomAngleForceProxy.cpp
+2
-2
serialization/src/CustomBondForceProxy.cpp
serialization/src/CustomBondForceProxy.cpp
+2
-2
serialization/src/CustomCVForceProxy.cpp
serialization/src/CustomCVForceProxy.cpp
+2
-2
serialization/src/CustomCentroidBondForceProxy.cpp
serialization/src/CustomCentroidBondForceProxy.cpp
+3
-3
serialization/src/CustomCompoundBondForceProxy.cpp
serialization/src/CustomCompoundBondForceProxy.cpp
+3
-3
serialization/src/CustomExternalForceProxy.cpp
serialization/src/CustomExternalForceProxy.cpp
+4
-4
serialization/src/CustomGBForceProxy.cpp
serialization/src/CustomGBForceProxy.cpp
+2
-2
serialization/src/CustomHbondForceProxy.cpp
serialization/src/CustomHbondForceProxy.cpp
+4
-4
serialization/src/CustomManyParticleForceProxy.cpp
serialization/src/CustomManyParticleForceProxy.cpp
+3
-3
serialization/src/CustomNonbondedForceProxy.cpp
serialization/src/CustomNonbondedForceProxy.cpp
+2
-2
serialization/src/CustomTorsionForceProxy.cpp
serialization/src/CustomTorsionForceProxy.cpp
+2
-2
wrappers/generateWrappers.py
wrappers/generateWrappers.py
+2
-9
No files found.
devtools/run-ctest.py
View file @
3aa4bb8c
...
@@ -12,7 +12,6 @@ import os.path
...
@@ -12,7 +12,6 @@ import os.path
import
shutil
import
shutil
import
time
import
time
from
glob
import
glob
from
glob
import
glob
from
os.path
import
join
,
exists
from
subprocess
import
call
from
subprocess
import
call
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
...
...
examples/benchmark.py
View file @
3aa4bb8c
...
@@ -2,7 +2,6 @@ from __future__ import print_function
...
@@ -2,7 +2,6 @@ from __future__ import print_function
import
openmm.app
as
app
import
openmm.app
as
app
import
openmm
as
mm
import
openmm
as
mm
import
openmm.unit
as
unit
import
openmm.unit
as
unit
import
sys
from
datetime
import
datetime
from
datetime
import
datetime
import
os
import
os
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
...
@@ -68,8 +67,6 @@ def runOneTest(testName, options):
...
@@ -68,8 +67,6 @@ def runOneTest(testName, options):
else
:
else
:
ff
=
app
.
ForceField
(
'amoeba2009.xml'
,
'amoeba2009_gk.xml'
)
ff
=
app
.
ForceField
(
'amoeba2009.xml'
,
'amoeba2009_gk.xml'
)
pdb
=
app
.
PDBFile
(
'5dfr_minimized.pdb'
)
pdb
=
app
.
PDBFile
(
'5dfr_minimized.pdb'
)
cutoff
=
2.0
*
unit
.
nanometers
vdwCutoff
=
1.2
*
unit
.
nanometers
system
=
ff
.
createSystem
(
pdb
.
topology
,
nonbondedMethod
=
app
.
NoCutoff
,
constraints
=
constraints
,
mutualInducedTargetEpsilon
=
epsilon
,
polarization
=
options
.
polarization
)
system
=
ff
.
createSystem
(
pdb
.
topology
,
nonbondedMethod
=
app
.
NoCutoff
,
constraints
=
constraints
,
mutualInducedTargetEpsilon
=
epsilon
,
polarization
=
options
.
polarization
)
for
f
in
system
.
getForces
():
for
f
in
system
.
getForces
():
if
isinstance
(
f
,
mm
.
AmoebaMultipoleForce
)
or
isinstance
(
f
,
mm
.
AmoebaVdwForce
)
or
isinstance
(
f
,
mm
.
AmoebaGeneralizedKirkwoodForce
)
or
isinstance
(
f
,
mm
.
AmoebaWcaDispersionForce
):
if
isinstance
(
f
,
mm
.
AmoebaMultipoleForce
)
or
isinstance
(
f
,
mm
.
AmoebaVdwForce
)
or
isinstance
(
f
,
mm
.
AmoebaGeneralizedKirkwoodForce
)
or
isinstance
(
f
,
mm
.
AmoebaWcaDispersionForce
):
...
@@ -86,7 +83,6 @@ def runOneTest(testName, options):
...
@@ -86,7 +83,6 @@ def runOneTest(testName, options):
fileName
=
names
[
testName
]
fileName
=
names
[
testName
]
prmtop
=
app
.
AmberPrmtopFile
(
os
.
path
.
join
(
dirname
,
f
'PME/Topologies/
{
fileName
}
.prmtop'
))
prmtop
=
app
.
AmberPrmtopFile
(
os
.
path
.
join
(
dirname
,
f
'PME/Topologies/
{
fileName
}
.prmtop'
))
inpcrd
=
app
.
AmberInpcrdFile
(
os
.
path
.
join
(
dirname
,
f
'PME/Coordinates/
{
fileName
}
.inpcrd'
))
inpcrd
=
app
.
AmberInpcrdFile
(
os
.
path
.
join
(
dirname
,
f
'PME/Coordinates/
{
fileName
}
.inpcrd'
))
topology
=
prmtop
.
topology
positions
=
inpcrd
.
positions
positions
=
inpcrd
.
positions
dt
=
0.004
*
unit
.
picoseconds
dt
=
0.004
*
unit
.
picoseconds
method
=
app
.
PME
method
=
app
.
PME
...
...
examples/simulateCharmm.py
View file @
3aa4bb8c
from
openmm.app
import
*
from
openmm.app
import
*
from
openmm
import
*
from
openmm
import
*
from
openmm.unit
import
*
from
openmm.unit
import
*
from
sys
import
stdout
,
exit
,
stderr
from
sys
import
stdout
# Read the PSF
# Read the PSF
psf
=
CharmmPsfFile
(
'ala_ala_ala.psf'
)
psf
=
CharmmPsfFile
(
'ala_ala_ala.psf'
)
...
...
platforms/common/src/ComputeParameterSet.cpp
View file @
3aa4bb8c
...
@@ -40,25 +40,25 @@ ComputeParameterSet::ComputeParameterSet(ComputeContext& context, int numParamet
...
@@ -40,25 +40,25 @@ ComputeParameterSet::ComputeParameterSet(ComputeContext& context, int numParamet
string
elementType
=
(
useDoublePrecision
?
"double"
:
"float"
);
string
elementType
=
(
useDoublePrecision
?
"double"
:
"float"
);
if
(
!
arrayPerParameter
)
{
if
(
!
arrayPerParameter
)
{
while
(
params
>
2
)
{
while
(
params
>
2
)
{
std
::
stringstream
n
ame
;
std
::
stringstream
arrayN
ame
;
n
ame
<<
"param"
<<
(
++
bufferCount
);
arrayN
ame
<<
"param"
<<
(
++
bufferCount
);
arrays
.
push_back
(
context
.
createArray
());
arrays
.
push_back
(
context
.
createArray
());
arrays
.
back
()
->
initialize
(
context
,
numObjects
,
elementSize
*
4
,
n
ame
.
str
());
arrays
.
back
()
->
initialize
(
context
,
numObjects
,
elementSize
*
4
,
arrayN
ame
.
str
());
params
-=
4
;
params
-=
4
;
}
}
if
(
params
>
1
)
{
if
(
params
>
1
)
{
std
::
stringstream
n
ame
;
std
::
stringstream
arrayN
ame
;
n
ame
<<
"param"
<<
(
++
bufferCount
);
arrayN
ame
<<
"param"
<<
(
++
bufferCount
);
arrays
.
push_back
(
context
.
createArray
());
arrays
.
push_back
(
context
.
createArray
());
arrays
.
back
()
->
initialize
(
context
,
numObjects
,
elementSize
*
2
,
n
ame
.
str
());
arrays
.
back
()
->
initialize
(
context
,
numObjects
,
elementSize
*
2
,
arrayN
ame
.
str
());
params
-=
2
;
params
-=
2
;
}
}
}
}
while
(
params
>
0
)
{
while
(
params
>
0
)
{
std
::
stringstream
n
ame
;
std
::
stringstream
arrayN
ame
;
n
ame
<<
"param"
<<
(
++
bufferCount
);
arrayN
ame
<<
"param"
<<
(
++
bufferCount
);
arrays
.
push_back
(
context
.
createArray
());
arrays
.
push_back
(
context
.
createArray
());
arrays
.
back
()
->
initialize
(
context
,
numObjects
,
elementSize
,
n
ame
.
str
());
arrays
.
back
()
->
initialize
(
context
,
numObjects
,
elementSize
,
arrayN
ame
.
str
());
params
--
;
params
--
;
}
}
for
(
ArrayInterface
*
array
:
arrays
)
for
(
ArrayInterface
*
array
:
arrays
)
...
...
platforms/cpu/src/CpuBondForce.cpp
View file @
3aa4bb8c
...
@@ -159,8 +159,8 @@ void CpuBondForce::assignBond(int bond, int thread, vector<int>& atomThread, vec
...
@@ -159,8 +159,8 @@ void CpuBondForce::assignBond(int bond, int thread, vector<int>& atomThread, vec
if
(
atom
!=
-
1
)
if
(
atom
!=
-
1
)
throw
OpenMMException
(
"CpuBondForce: Internal error: atoms assigned to threads incorrectly"
);
throw
OpenMMException
(
"CpuBondForce: Internal error: atoms assigned to threads incorrectly"
);
atom
=
thread
;
atom
=
thread
;
for
(
int
bond
:
atomBonds
[
atom
])
for
(
int
bond
Index
:
atomBonds
[
atom
])
candidateBonds
.
push_back
(
bond
);
candidateBonds
.
push_back
(
bond
Index
);
}
}
}
}
...
...
platforms/reference/include/ReferenceBondIxn.h
View file @
3aa4bb8c
...
@@ -51,7 +51,7 @@ class OPENMM_EXPORT ReferenceBondIxn {
...
@@ -51,7 +51,7 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
~
ReferenceBondIxn
();
virtual
~
ReferenceBondIxn
();
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceMultipoleForce.cpp
View file @
3aa4bb8c
...
@@ -4894,7 +4894,7 @@ AmoebaReferencePmeMultipoleForce::~AmoebaReferencePmeMultipoleForce()
...
@@ -4894,7 +4894,7 @@ AmoebaReferencePmeMultipoleForce::~AmoebaReferencePmeMultipoleForce()
fftpack_destroy(_fftplan);
fftpack_destroy(_fftplan);
}
}
if (_pmeGrid) {
if (_pmeGrid) {
delete _pmeGrid;
delete
[]
_pmeGrid;
}
}
};
};
...
@@ -4980,7 +4980,7 @@ void AmoebaReferencePmeMultipoleForce::resizePmeArrays()
...
@@ -4980,7 +4980,7 @@ void AmoebaReferencePmeMultipoleForce::resizePmeArrays()
_totalGridSize = _pmeGridDimensions[0]*_pmeGridDimensions[1]*_pmeGridDimensions[2];
_totalGridSize = _pmeGridDimensions[0]*_pmeGridDimensions[1]*_pmeGridDimensions[2];
if (_pmeGridSize < _totalGridSize) {
if (_pmeGridSize < _totalGridSize) {
if (_pmeGrid) {
if (_pmeGrid) {
delete _pmeGrid;
delete
[]
_pmeGrid;
}
}
_pmeGrid = new t_complex[_totalGridSize];
_pmeGrid = new t_complex[_totalGridSize];
_pmeGridSize = _totalGridSize;
_pmeGridSize = _totalGridSize;
...
...
plugins/amoeba/wrappers/generateAmoebaWrappers.py
View file @
3aa4bb8c
from
__future__
import
print_function
from
__future__
import
print_function
import
sys
,
os
import
sys
,
os
import
time
import
getopt
import
re
import
re
import
xml.etree.ElementTree
as
etree
import
xml.etree.ElementTree
as
etree
...
@@ -97,7 +95,7 @@ class WrapperGenerator:
...
@@ -97,7 +95,7 @@ class WrapperGenerator:
self
.
findBaseNodes
(
node
,
orderedClassNodes
)
self
.
findBaseNodes
(
node
,
orderedClassNodes
)
return
orderedClassNodes
return
orderedClassNodes
def
findBaseNodes
(
self
,
node
,
excludedClassNodes
=
[]
):
def
findBaseNodes
(
self
,
node
,
excludedClassNodes
):
if
node
in
excludedClassNodes
:
if
node
in
excludedClassNodes
:
return
return
if
node
.
attrib
[
'prot'
]
==
'private'
:
if
node
.
attrib
[
'prot'
]
==
'private'
:
...
@@ -114,7 +112,6 @@ class WrapperGenerator:
...
@@ -114,7 +112,6 @@ class WrapperGenerator:
def
getClassMethods
(
self
,
classNode
):
def
getClassMethods
(
self
,
classNode
):
className
=
getText
(
"compoundname"
,
classNode
)
className
=
getText
(
"compoundname"
,
classNode
)
shortClassName
=
stripOpenMMPrefix
(
className
)
methodList
=
[]
methodList
=
[]
for
section
in
findNodes
(
classNode
,
"sectiondef"
,
kind
=
"public-static-func"
)
+
findNodes
(
classNode
,
"sectiondef"
,
kind
=
"public-func"
):
for
section
in
findNodes
(
classNode
,
"sectiondef"
,
kind
=
"public-static-func"
)
+
findNodes
(
classNode
,
"sectiondef"
,
kind
=
"public-func"
):
for
memberNode
in
findNodes
(
section
,
"memberdef"
,
kind
=
"function"
,
prot
=
"public"
):
for
memberNode
in
findNodes
(
section
,
"memberdef"
,
kind
=
"function"
,
prot
=
"public"
):
...
@@ -202,7 +199,6 @@ class CHeaderGenerator(WrapperGenerator):
...
@@ -202,7 +199,6 @@ class CHeaderGenerator(WrapperGenerator):
for
node
in
findNodes
(
section
,
"memberdef"
,
kind
=
"enum"
,
prot
=
"public"
):
for
node
in
findNodes
(
section
,
"memberdef"
,
kind
=
"enum"
,
prot
=
"public"
):
enumNodes
.
append
(
node
)
enumNodes
.
append
(
node
)
className
=
getText
(
"compoundname"
,
classNode
)
className
=
getText
(
"compoundname"
,
classNode
)
shortClassName
=
stripOpenMMPrefix
(
className
)
typeName
=
convertOpenMMPrefix
(
className
)
typeName
=
convertOpenMMPrefix
(
className
)
for
enumNode
in
enumNodes
:
for
enumNode
in
enumNodes
:
enumName
=
getText
(
"name"
,
enumNode
)
enumName
=
getText
(
"name"
,
enumNode
)
...
@@ -1023,7 +1019,6 @@ class FortranSourceGenerator(WrapperGenerator):
...
@@ -1023,7 +1019,6 @@ class FortranSourceGenerator(WrapperGenerator):
def
writeOneConstructor
(
self
,
classNode
,
methodNode
,
functionName
,
wrapperFunctionName
):
def
writeOneConstructor
(
self
,
classNode
,
methodNode
,
functionName
,
wrapperFunctionName
):
className
=
getText
(
"compoundname"
,
classNode
)
className
=
getText
(
"compoundname"
,
classNode
)
shortClassName
=
stripOpenMMPrefix
(
className
)
typeName
=
convertOpenMMPrefix
(
className
)
typeName
=
convertOpenMMPrefix
(
className
)
self
.
out
.
write
(
"OPENMM_EXPORT_AMOEBA void %s(%s*& result"
%
(
wrapperFunctionName
,
typeName
))
self
.
out
.
write
(
"OPENMM_EXPORT_AMOEBA void %s(%s*& result"
%
(
wrapperFunctionName
,
typeName
))
self
.
writeArguments
(
methodNode
,
True
)
self
.
writeArguments
(
methodNode
,
True
)
...
@@ -1049,8 +1044,6 @@ class FortranSourceGenerator(WrapperGenerator):
...
@@ -1049,8 +1044,6 @@ class FortranSourceGenerator(WrapperGenerator):
returnType
=
self
.
getType
(
methodType
)
returnType
=
self
.
getType
(
methodType
)
hasReturnValue
=
(
returnType
in
(
'int'
,
'bool'
,
'double'
))
hasReturnValue
=
(
returnType
in
(
'int'
,
'bool'
,
'double'
))
hasReturnArg
=
not
(
hasReturnValue
or
returnType
==
'void'
)
hasReturnArg
=
not
(
hasReturnValue
or
returnType
==
'void'
)
if
methodType
in
self
.
classesByShortName
:
methodType
=
self
.
classesByShortName
[
methodType
]
self
.
out
.
write
(
"OPENMM_EXPORT_AMOEBA "
)
self
.
out
.
write
(
"OPENMM_EXPORT_AMOEBA "
)
if
hasReturnValue
:
if
hasReturnValue
:
self
.
out
.
write
(
returnType
)
self
.
out
.
write
(
returnType
)
...
@@ -1069,7 +1062,7 @@ class FortranSourceGenerator(WrapperGenerator):
...
@@ -1069,7 +1062,7 @@ class FortranSourceGenerator(WrapperGenerator):
returnArg
=
'char* result'
returnArg
=
'char* result'
else
:
else
:
returnArg
=
"%s& result"
%
returnType
returnArg
=
"%s& result"
%
returnType
numArgs
=
self
.
writeArguments
(
methodNode
,
isInstanceMethod
,
returnArg
)
self
.
writeArguments
(
methodNode
,
isInstanceMethod
,
returnArg
)
if
hasReturnArg
and
returnType
==
'const char*'
:
if
hasReturnArg
and
returnType
==
'const char*'
:
self
.
out
.
write
(
", int result_length"
)
self
.
out
.
write
(
", int result_length"
)
self
.
out
.
write
(
") {
\n
"
)
self
.
out
.
write
(
") {
\n
"
)
...
...
serialization/src/CustomAngleForceProxy.cpp
View file @
3aa4bb8c
...
@@ -64,12 +64,12 @@ void CustomAngleForceProxy::serialize(const void* object, SerializationNode& nod
...
@@ -64,12 +64,12 @@ void CustomAngleForceProxy::serialize(const void* object, SerializationNode& nod
int
p1
,
p2
,
p3
;
int
p1
,
p2
,
p3
;
vector
<
double
>
params
;
vector
<
double
>
params
;
force
.
getAngleParameters
(
i
,
p1
,
p2
,
p3
,
params
);
force
.
getAngleParameters
(
i
,
p1
,
p2
,
p3
,
params
);
SerializationNode
&
nod
e
=
angles
.
createChildNode
(
"Angle"
).
setIntProperty
(
"p1"
,
p1
).
setIntProperty
(
"p2"
,
p2
).
setIntProperty
(
"p3"
,
p3
);
SerializationNode
&
angl
e
=
angles
.
createChildNode
(
"Angle"
).
setIntProperty
(
"p1"
,
p1
).
setIntProperty
(
"p2"
,
p2
).
setIntProperty
(
"p3"
,
p3
);
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
nod
e
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
angl
e
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
}
}
...
...
serialization/src/CustomBondForceProxy.cpp
View file @
3aa4bb8c
...
@@ -64,12 +64,12 @@ void CustomBondForceProxy::serialize(const void* object, SerializationNode& node
...
@@ -64,12 +64,12 @@ void CustomBondForceProxy::serialize(const void* object, SerializationNode& node
int
p1
,
p2
;
int
p1
,
p2
;
vector
<
double
>
params
;
vector
<
double
>
params
;
force
.
getBondParameters
(
i
,
p1
,
p2
,
params
);
force
.
getBondParameters
(
i
,
p1
,
p2
,
params
);
SerializationNode
&
node
=
bonds
.
createChildNode
(
"Bond"
).
setIntProperty
(
"p1"
,
p1
).
setIntProperty
(
"p2"
,
p2
);
SerializationNode
&
bond
=
bonds
.
createChildNode
(
"Bond"
).
setIntProperty
(
"p1"
,
p1
).
setIntProperty
(
"p2"
,
p2
);
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
node
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
bond
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
}
}
...
...
serialization/src/CustomCVForceProxy.cpp
View file @
3aa4bb8c
...
@@ -56,8 +56,8 @@ void CustomCVForceProxy::serialize(const void* object, SerializationNode& node)
...
@@ -56,8 +56,8 @@ void CustomCVForceProxy::serialize(const void* object, SerializationNode& node)
}
}
SerializationNode
&
cvs
=
node
.
createChildNode
(
"CollectiveVariables"
);
SerializationNode
&
cvs
=
node
.
createChildNode
(
"CollectiveVariables"
);
for
(
int
i
=
0
;
i
<
force
.
getNumCollectiveVariables
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumCollectiveVariables
();
i
++
)
{
SerializationNode
&
node
=
cvs
.
createChildNode
(
"CollectiveVariable"
).
setStringProperty
(
"name"
,
force
.
getCollectiveVariableName
(
i
));
SerializationNode
&
cv
=
cvs
.
createChildNode
(
"CollectiveVariable"
).
setStringProperty
(
"name"
,
force
.
getCollectiveVariableName
(
i
));
node
.
createChildNode
(
"Force"
,
&
force
.
getCollectiveVariable
(
i
));
cv
.
createChildNode
(
"Force"
,
&
force
.
getCollectiveVariable
(
i
));
}
}
SerializationNode
&
functions
=
node
.
createChildNode
(
"Functions"
);
SerializationNode
&
functions
=
node
.
createChildNode
(
"Functions"
);
for
(
int
i
=
0
;
i
<
force
.
getNumTabulatedFunctions
();
i
++
)
for
(
int
i
=
0
;
i
<
force
.
getNumTabulatedFunctions
();
i
++
)
...
...
serialization/src/CustomCentroidBondForceProxy.cpp
View file @
3aa4bb8c
...
@@ -78,18 +78,18 @@ void CustomCentroidBondForceProxy::serialize(const void* object, SerializationNo
...
@@ -78,18 +78,18 @@ void CustomCentroidBondForceProxy::serialize(const void* object, SerializationNo
vector
<
int
>
groups
;
vector
<
int
>
groups
;
vector
<
double
>
params
;
vector
<
double
>
params
;
force
.
getBondParameters
(
i
,
groups
,
params
);
force
.
getBondParameters
(
i
,
groups
,
params
);
SerializationNode
&
node
=
bonds
.
createChildNode
(
"Bond"
);
SerializationNode
&
bond
=
bonds
.
createChildNode
(
"Bond"
);
for
(
int
j
=
0
;
j
<
(
int
)
groups
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
groups
.
size
();
j
++
)
{
stringstream
key
;
stringstream
key
;
key
<<
"g"
;
key
<<
"g"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
node
.
setIntProperty
(
key
.
str
(),
groups
[
j
]);
bond
.
setIntProperty
(
key
.
str
(),
groups
[
j
]);
}
}
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
node
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
bond
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
SerializationNode
&
functions
=
node
.
createChildNode
(
"Functions"
);
SerializationNode
&
functions
=
node
.
createChildNode
(
"Functions"
);
...
...
serialization/src/CustomCompoundBondForceProxy.cpp
View file @
3aa4bb8c
...
@@ -65,18 +65,18 @@ void CustomCompoundBondForceProxy::serialize(const void* object, SerializationNo
...
@@ -65,18 +65,18 @@ void CustomCompoundBondForceProxy::serialize(const void* object, SerializationNo
vector
<
int
>
particles
;
vector
<
int
>
particles
;
vector
<
double
>
params
;
vector
<
double
>
params
;
force
.
getBondParameters
(
i
,
particles
,
params
);
force
.
getBondParameters
(
i
,
particles
,
params
);
SerializationNode
&
node
=
bonds
.
createChildNode
(
"Bond"
);
SerializationNode
&
bond
=
bonds
.
createChildNode
(
"Bond"
);
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
node
.
setIntProperty
(
key
.
str
(),
particles
[
j
]);
bond
.
setIntProperty
(
key
.
str
(),
particles
[
j
]);
}
}
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
node
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
bond
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
SerializationNode
&
functions
=
node
.
createChildNode
(
"Functions"
);
SerializationNode
&
functions
=
node
.
createChildNode
(
"Functions"
);
...
...
serialization/src/CustomExternalForceProxy.cpp
View file @
3aa4bb8c
...
@@ -56,15 +56,15 @@ void CustomExternalForceProxy::serialize(const void* object, SerializationNode&
...
@@ -56,15 +56,15 @@ void CustomExternalForceProxy::serialize(const void* object, SerializationNode&
}
}
SerializationNode
&
particles
=
node
.
createChildNode
(
"Particles"
);
SerializationNode
&
particles
=
node
.
createChildNode
(
"Particles"
);
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
int
particle
;
int
particle
Index
;
vector
<
double
>
params
;
vector
<
double
>
params
;
force
.
getParticleParameters
(
i
,
particle
,
params
);
force
.
getParticleParameters
(
i
,
particle
Index
,
params
);
SerializationNode
&
nod
e
=
particles
.
createChildNode
(
"Particle"
).
setIntProperty
(
"index"
,
particle
);
SerializationNode
&
particl
e
=
particles
.
createChildNode
(
"Particle"
).
setIntProperty
(
"index"
,
particle
Index
);
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
nod
e
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
particl
e
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
}
}
...
...
serialization/src/CustomGBForceProxy.cpp
View file @
3aa4bb8c
...
@@ -77,12 +77,12 @@ void CustomGBForceProxy::serialize(const void* object, SerializationNode& node)
...
@@ -77,12 +77,12 @@ void CustomGBForceProxy::serialize(const void* object, SerializationNode& node)
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
vector
<
double
>
params
;
vector
<
double
>
params
;
force
.
getParticleParameters
(
i
,
params
);
force
.
getParticleParameters
(
i
,
params
);
SerializationNode
&
nod
e
=
particles
.
createChildNode
(
"Particle"
);
SerializationNode
&
particl
e
=
particles
.
createChildNode
(
"Particle"
);
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
nod
e
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
particl
e
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
SerializationNode
&
exclusions
=
node
.
createChildNode
(
"Exclusions"
);
SerializationNode
&
exclusions
=
node
.
createChildNode
(
"Exclusions"
);
...
...
serialization/src/CustomHbondForceProxy.cpp
View file @
3aa4bb8c
...
@@ -65,12 +65,12 @@ void CustomHbondForceProxy::serialize(const void* object, SerializationNode& nod
...
@@ -65,12 +65,12 @@ void CustomHbondForceProxy::serialize(const void* object, SerializationNode& nod
int
p1
,
p2
,
p3
;
int
p1
,
p2
,
p3
;
vector
<
double
>
params
;
vector
<
double
>
params
;
force
.
getDonorParameters
(
i
,
p1
,
p2
,
p3
,
params
);
force
.
getDonorParameters
(
i
,
p1
,
p2
,
p3
,
params
);
SerializationNode
&
node
=
donors
.
createChildNode
(
"Donor"
).
setIntProperty
(
"p1"
,
p1
).
setIntProperty
(
"p2"
,
p2
).
setIntProperty
(
"p3"
,
p3
);
SerializationNode
&
donor
=
donors
.
createChildNode
(
"Donor"
).
setIntProperty
(
"p1"
,
p1
).
setIntProperty
(
"p2"
,
p2
).
setIntProperty
(
"p3"
,
p3
);
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
node
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
donor
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
SerializationNode
&
acceptors
=
node
.
createChildNode
(
"Acceptors"
);
SerializationNode
&
acceptors
=
node
.
createChildNode
(
"Acceptors"
);
...
@@ -78,12 +78,12 @@ void CustomHbondForceProxy::serialize(const void* object, SerializationNode& nod
...
@@ -78,12 +78,12 @@ void CustomHbondForceProxy::serialize(const void* object, SerializationNode& nod
int
p1
,
p2
,
p3
;
int
p1
,
p2
,
p3
;
vector
<
double
>
params
;
vector
<
double
>
params
;
force
.
getAcceptorParameters
(
i
,
p1
,
p2
,
p3
,
params
);
force
.
getAcceptorParameters
(
i
,
p1
,
p2
,
p3
,
params
);
SerializationNode
&
node
=
acceptors
.
createChildNode
(
"Acceptor"
).
setIntProperty
(
"p1"
,
p1
).
setIntProperty
(
"p2"
,
p2
).
setIntProperty
(
"p3"
,
p3
);
SerializationNode
&
acceptor
=
acceptors
.
createChildNode
(
"Acceptor"
).
setIntProperty
(
"p1"
,
p1
).
setIntProperty
(
"p2"
,
p2
).
setIntProperty
(
"p3"
,
p3
);
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
node
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
acceptor
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
SerializationNode
&
exclusions
=
node
.
createChildNode
(
"Exclusions"
);
SerializationNode
&
exclusions
=
node
.
createChildNode
(
"Exclusions"
);
...
...
serialization/src/CustomManyParticleForceProxy.cpp
View file @
3aa4bb8c
...
@@ -63,13 +63,13 @@ void CustomManyParticleForceProxy::serialize(const void* object, SerializationNo
...
@@ -63,13 +63,13 @@ void CustomManyParticleForceProxy::serialize(const void* object, SerializationNo
vector
<
double
>
params
;
vector
<
double
>
params
;
int
type
;
int
type
;
force
.
getParticleParameters
(
i
,
params
,
type
);
force
.
getParticleParameters
(
i
,
params
,
type
);
SerializationNode
&
nod
e
=
particles
.
createChildNode
(
"Particle"
);
SerializationNode
&
particl
e
=
particles
.
createChildNode
(
"Particle"
);
nod
e
.
setIntProperty
(
"type"
,
type
);
particl
e
.
setIntProperty
(
"type"
,
type
);
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
nod
e
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
particl
e
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
SerializationNode
&
exclusions
=
node
.
createChildNode
(
"Exclusions"
);
SerializationNode
&
exclusions
=
node
.
createChildNode
(
"Exclusions"
);
...
...
serialization/src/CustomNonbondedForceProxy.cpp
View file @
3aa4bb8c
...
@@ -67,12 +67,12 @@ void CustomNonbondedForceProxy::serialize(const void* object, SerializationNode&
...
@@ -67,12 +67,12 @@ void CustomNonbondedForceProxy::serialize(const void* object, SerializationNode&
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
for
(
int
i
=
0
;
i
<
force
.
getNumParticles
();
i
++
)
{
vector
<
double
>
params
;
vector
<
double
>
params
;
force
.
getParticleParameters
(
i
,
params
);
force
.
getParticleParameters
(
i
,
params
);
SerializationNode
&
nod
e
=
particles
.
createChildNode
(
"Particle"
);
SerializationNode
&
particl
e
=
particles
.
createChildNode
(
"Particle"
);
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
nod
e
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
particl
e
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
SerializationNode
&
exclusions
=
node
.
createChildNode
(
"Exclusions"
);
SerializationNode
&
exclusions
=
node
.
createChildNode
(
"Exclusions"
);
...
...
serialization/src/CustomTorsionForceProxy.cpp
View file @
3aa4bb8c
...
@@ -64,12 +64,12 @@ void CustomTorsionForceProxy::serialize(const void* object, SerializationNode& n
...
@@ -64,12 +64,12 @@ void CustomTorsionForceProxy::serialize(const void* object, SerializationNode& n
int
p1
,
p2
,
p3
,
p4
;
int
p1
,
p2
,
p3
,
p4
;
vector
<
double
>
params
;
vector
<
double
>
params
;
force
.
getTorsionParameters
(
i
,
p1
,
p2
,
p3
,
p4
,
params
);
force
.
getTorsionParameters
(
i
,
p1
,
p2
,
p3
,
p4
,
params
);
SerializationNode
&
node
=
torsions
.
createChildNode
(
"Torsion"
).
setIntProperty
(
"p1"
,
p1
).
setIntProperty
(
"p2"
,
p2
).
setIntProperty
(
"p3"
,
p3
).
setIntProperty
(
"p4"
,
p4
);
SerializationNode
&
torsion
=
torsions
.
createChildNode
(
"Torsion"
).
setIntProperty
(
"p1"
,
p1
).
setIntProperty
(
"p2"
,
p2
).
setIntProperty
(
"p3"
,
p3
).
setIntProperty
(
"p4"
,
p4
);
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"
;
key
<<
j
+
1
;
key
<<
j
+
1
;
node
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
torsion
.
setDoubleProperty
(
key
.
str
(),
params
[
j
]);
}
}
}
}
}
}
...
...
wrappers/generateWrappers.py
View file @
3aa4bb8c
from
__future__
import
print_function
from
__future__
import
print_function
import
sys
,
os
import
sys
,
os
import
time
import
getopt
import
re
import
re
import
xml.etree.ElementTree
as
etree
import
xml.etree.ElementTree
as
etree
...
@@ -110,7 +108,7 @@ class WrapperGenerator:
...
@@ -110,7 +108,7 @@ class WrapperGenerator:
self
.
findBaseNodes
(
node
,
orderedClassNodes
)
self
.
findBaseNodes
(
node
,
orderedClassNodes
)
return
orderedClassNodes
return
orderedClassNodes
def
findBaseNodes
(
self
,
node
,
excludedClassNodes
=
[]
):
def
findBaseNodes
(
self
,
node
,
excludedClassNodes
):
if
node
in
excludedClassNodes
:
if
node
in
excludedClassNodes
:
return
return
if
node
.
attrib
[
'prot'
]
==
'private'
:
if
node
.
attrib
[
'prot'
]
==
'private'
:
...
@@ -127,7 +125,6 @@ class WrapperGenerator:
...
@@ -127,7 +125,6 @@ class WrapperGenerator:
def
getClassMethods
(
self
,
classNode
):
def
getClassMethods
(
self
,
classNode
):
className
=
getText
(
"compoundname"
,
classNode
)
className
=
getText
(
"compoundname"
,
classNode
)
shortClassName
=
stripOpenMMPrefix
(
className
)
methodList
=
[]
methodList
=
[]
for
section
in
findNodes
(
classNode
,
"sectiondef"
,
kind
=
"public-static-func"
)
+
findNodes
(
classNode
,
"sectiondef"
,
kind
=
"public-func"
):
for
section
in
findNodes
(
classNode
,
"sectiondef"
,
kind
=
"public-static-func"
)
+
findNodes
(
classNode
,
"sectiondef"
,
kind
=
"public-func"
):
for
memberNode
in
findNodes
(
section
,
"memberdef"
,
kind
=
"function"
,
prot
=
"public"
):
for
memberNode
in
findNodes
(
section
,
"memberdef"
,
kind
=
"function"
,
prot
=
"public"
):
...
@@ -211,7 +208,6 @@ class CHeaderGenerator(WrapperGenerator):
...
@@ -211,7 +208,6 @@ class CHeaderGenerator(WrapperGenerator):
for
node
in
findNodes
(
section
,
"memberdef"
,
kind
=
"enum"
,
prot
=
"public"
):
for
node
in
findNodes
(
section
,
"memberdef"
,
kind
=
"enum"
,
prot
=
"public"
):
enumNodes
.
append
(
node
)
enumNodes
.
append
(
node
)
className
=
getText
(
"compoundname"
,
classNode
)
className
=
getText
(
"compoundname"
,
classNode
)
shortClassName
=
stripOpenMMPrefix
(
className
)
typeName
=
convertOpenMMPrefix
(
className
)
typeName
=
convertOpenMMPrefix
(
className
)
for
enumNode
in
enumNodes
:
for
enumNode
in
enumNodes
:
enumName
=
getText
(
"name"
,
enumNode
)
enumName
=
getText
(
"name"
,
enumNode
)
...
@@ -1590,7 +1586,6 @@ class FortranSourceGenerator(WrapperGenerator):
...
@@ -1590,7 +1586,6 @@ class FortranSourceGenerator(WrapperGenerator):
def
writeOneConstructor
(
self
,
classNode
,
methodNode
,
functionName
,
wrapperFunctionName
):
def
writeOneConstructor
(
self
,
classNode
,
methodNode
,
functionName
,
wrapperFunctionName
):
className
=
getText
(
"compoundname"
,
classNode
)
className
=
getText
(
"compoundname"
,
classNode
)
shortClassName
=
stripOpenMMPrefix
(
className
)
typeName
=
convertOpenMMPrefix
(
className
)
typeName
=
convertOpenMMPrefix
(
className
)
self
.
out
.
write
(
"OPENMM_EXPORT void %s(%s*& result"
%
(
wrapperFunctionName
,
typeName
))
self
.
out
.
write
(
"OPENMM_EXPORT void %s(%s*& result"
%
(
wrapperFunctionName
,
typeName
))
self
.
writeArguments
(
methodNode
,
True
)
self
.
writeArguments
(
methodNode
,
True
)
...
@@ -1616,8 +1611,6 @@ class FortranSourceGenerator(WrapperGenerator):
...
@@ -1616,8 +1611,6 @@ class FortranSourceGenerator(WrapperGenerator):
returnType
=
self
.
getType
(
methodType
)
returnType
=
self
.
getType
(
methodType
)
hasReturnValue
=
(
returnType
in
(
'int'
,
'bool'
,
'double'
))
hasReturnValue
=
(
returnType
in
(
'int'
,
'bool'
,
'double'
))
hasReturnArg
=
not
(
hasReturnValue
or
returnType
==
'void'
)
hasReturnArg
=
not
(
hasReturnValue
or
returnType
==
'void'
)
if
methodType
in
self
.
classesByShortName
:
methodType
=
self
.
classesByShortName
[
methodType
]
self
.
out
.
write
(
"OPENMM_EXPORT "
)
self
.
out
.
write
(
"OPENMM_EXPORT "
)
if
hasReturnValue
:
if
hasReturnValue
:
self
.
out
.
write
(
returnType
)
self
.
out
.
write
(
returnType
)
...
@@ -1636,7 +1629,7 @@ class FortranSourceGenerator(WrapperGenerator):
...
@@ -1636,7 +1629,7 @@ class FortranSourceGenerator(WrapperGenerator):
returnArg
=
'char* result'
returnArg
=
'char* result'
else
:
else
:
returnArg
=
"%s& result"
%
returnType
returnArg
=
"%s& result"
%
returnType
numArgs
=
self
.
writeArguments
(
methodNode
,
isInstanceMethod
,
returnArg
)
self
.
writeArguments
(
methodNode
,
isInstanceMethod
,
returnArg
)
if
hasReturnArg
and
returnType
==
'const char*'
:
if
hasReturnArg
and
returnType
==
'const char*'
:
self
.
out
.
write
(
", int result_length"
)
self
.
out
.
write
(
", int result_length"
)
self
.
out
.
write
(
") {
\n
"
)
self
.
out
.
write
(
") {
\n
"
)
...
...
Prev
1
2
3
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