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
0be0772b
Commit
0be0772b
authored
Oct 24, 2013
by
peastman
Browse files
Fixed errors in Python wrapping of AmoebaMultipoleForce
parent
a5bcc4be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
wrappers/python/src/swig_doxygen/swigInputConfig.py
wrappers/python/src/swig_doxygen/swigInputConfig.py
+3
-0
wrappers/python/src/swig_doxygen/swig_lib/python/typemaps.i
wrappers/python/src/swig_doxygen/swig_lib/python/typemaps.i
+27
-1
No files found.
wrappers/python/src/swig_doxygen/swigInputConfig.py
View file @
0be0772b
...
@@ -161,6 +161,8 @@ NO_OUTPUT_ARGS = [('LocalEnergyMinimizer', 'minimize', 'context'),
...
@@ -161,6 +161,8 @@ NO_OUTPUT_ARGS = [('LocalEnergyMinimizer', 'minimize', 'context'),
(
'AmoebaMultipoleForce'
,
'addParticle'
,
'molecularDipole'
),
(
'AmoebaMultipoleForce'
,
'addParticle'
,
'molecularDipole'
),
(
'AmoebaMultipoleForce'
,
'addParticle'
,
'molecularQuadrupole'
),
(
'AmoebaMultipoleForce'
,
'addParticle'
,
'molecularQuadrupole'
),
(
'AmoebaMultipoleForce'
,
'setCovalentMap'
,
'covalentAtoms'
),
(
'AmoebaMultipoleForce'
,
'setCovalentMap'
,
'covalentAtoms'
),
(
'AmoebaMultipoleForce'
,
'getElectrostaticPotential'
,
'context'
),
(
'AmoebaMultipoleForce'
,
'getInducedDipoles'
,
'context'
),
]
]
# SWIG assumes the target language shadow class owns the C++ class
# SWIG assumes the target language shadow class owns the C++ class
...
@@ -285,6 +287,7 @@ UNITS = {
...
@@ -285,6 +287,7 @@ UNITS = {
#("AmoebaMultipoleForce", "getElectrostaticPotential") : ( None, ('unit.kilojoule_per_mole')),
#("AmoebaMultipoleForce", "getElectrostaticPotential") : ( None, ('unit.kilojoule_per_mole')),
#("AmoebaMultipoleForce", "getElectrostaticPotential") : ( ('unit.kilojoule_per_mole'), ()),
#("AmoebaMultipoleForce", "getElectrostaticPotential") : ( ('unit.kilojoule_per_mole'), ()),
(
"AmoebaMultipoleForce"
,
"getElectrostaticPotential"
)
:
(
None
,
()),
(
"AmoebaMultipoleForce"
,
"getElectrostaticPotential"
)
:
(
None
,
()),
(
"AmoebaMultipoleForce"
,
"getInducedDipoles"
)
:
(
None
,
()),
(
"AmoebaMultipoleForce"
,
"getSystemMultipoleMoments"
)
:
(
None
,
()),
(
"AmoebaMultipoleForce"
,
"getSystemMultipoleMoments"
)
:
(
None
,
()),
(
"AmoebaOutOfPlaneBendForce"
,
"getNumOutOfPlaneBends"
)
:
(
None
,
()),
(
"AmoebaOutOfPlaneBendForce"
,
"getNumOutOfPlaneBends"
)
:
(
None
,
()),
...
...
wrappers/python/src/swig_doxygen/swig_lib/python/typemaps.i
View file @
0be0772b
/* Convert python list of tuples to C++ std::vector of Vec3 objects */
/* Convert python list of tuples to C++ std::vector of Vec3 objects */
%
typemap
(
in
)
std
::
vector
<
Vec3
>
&
(
std
::
vector
<
OpenMM
::
Vec3
>
vVec
)
{
%
typemap
(
in
)
const
std
::
vector
<
Vec3
>
&
(
std
::
vector
<
OpenMM
::
Vec3
>
vVec
)
{
// typemap -- %typemap(in) std::vector<Vec3>& (std::vector<OpenMM::Vec3> vVec)
// typemap -- %typemap(in) std::vector<Vec3>& (std::vector<OpenMM::Vec3> vVec)
int
i
,
pLength
,
itemLength
;
int
i
,
pLength
,
itemLength
;
double
x
,
y
,
z
;
double
x
,
y
,
z
;
...
@@ -34,6 +34,32 @@
...
@@ -34,6 +34,32 @@
$
1
=
&
vVec;
$
1
=
&
vVec;
}
}
/* The following two typemaps cause a non-const vector<Vec3>& to become a return value. */
%
typemap
(
in
,
numinputs
=
0
)
std
::
vector
<
Vec3
>
&
(
std
::
vector
<
Vec3
>
temp
)
{
$
1
=
&
temp;
}
%
typemap
(
argout
)
std
::
vector
<
Vec3
>
&
{
int
i
,
n
;
PyObject
*
pyList
;
n
=
(
*
$
1
)
.
size
()
;
pyList
=
PyList_New
(
n
)
;
PyObject
*
mm
=
PyImport_AddModule
(
"simtk.openmm"
)
;
PyObject
*
vec3
=
PyObject_GetAttrString
(
mm
,
"Vec3"
)
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
OpenMM
::
Vec3&
v
=
(
*
$
1
)
.
at
(
i
)
;
PyObject
*
args
=
Py_BuildValue
(
"(d,d,d)"
,
v
[
0
],
v
[
1
],
v
[
2
])
;
PyObject
*
pyVec
=
PyObject_CallObject
(
vec3
,
args
)
;
Py_DECREF
(
args
)
;
PyList_SET_ITEM
(
pyList
,
i
,
pyVec
)
;
}
$
result
=
pyList
;
}
/* const vector<Vec3> should NOT become an output. */
%
typemap
(
argout
)
const
std
::
vector
<
Vec3
>
&
{
}
/* Convert python tuple to C++ Vec3 object*/
/* Convert python tuple to C++ Vec3 object*/
%
typemap
(
typecheck
)
Vec3
{
%
typemap
(
typecheck
)
Vec3
{
...
...
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