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
77ea3bb6
Commit
77ea3bb6
authored
Sep 23, 2014
by
peastman
Browse files
Merge pull request #627 from rmcgibbo/integrator-by-name
CustomIntegrator::get*VariableByName
parents
392a7b04
8ab5b907
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
openmmapi/include/openmm/CustomIntegrator.h
openmmapi/include/openmm/CustomIntegrator.h
+15
-0
openmmapi/src/CustomIntegrator.cpp
openmmapi/src/CustomIntegrator.cpp
+19
-0
wrappers/python/src/swig_doxygen/swigInputConfig.py
wrappers/python/src/swig_doxygen/swigInputConfig.py
+1
-0
No files found.
openmmapi/include/openmm/CustomIntegrator.h
View file @
77ea3bb6
...
...
@@ -302,6 +302,13 @@ public:
* @return the current value of the variable
*/
double
getGlobalVariable
(
int
index
)
const
;
/**
* Get the current value of a global variable, specified by name.
*
* @param name the name of the variable to get
* @return the current value of the parameter
*/
double
getGlobalVariableByName
(
const
std
::
string
&
name
)
const
;
/**
* Set the value of a global variable.
*
...
...
@@ -324,6 +331,14 @@ public:
* are stored into this
*/
void
getPerDofVariable
(
int
index
,
std
::
vector
<
Vec3
>&
values
)
const
;
/**
* Get the value of a per-DOF variable, specified by name.
*
* @param name the name of the variable to get
* @param values the values of the variable for all degrees of freedom
* are stored into this
*/
void
getPerDofVariableByName
(
const
std
::
string
&
name
,
std
::
vector
<
Vec3
>&
values
)
const
;
/**
* Set the value of a per-DOF variable.
*
...
...
openmmapi/src/CustomIntegrator.cpp
View file @
77ea3bb6
...
...
@@ -124,6 +124,15 @@ double CustomIntegrator::getGlobalVariable(int index) const {
return
globalValues
[
index
];
}
double
CustomIntegrator
::
getGlobalVariableByName
(
const
string
&
name
)
const
{
for
(
int
i
=
0
;
i
<
(
int
)
globalNames
.
size
();
i
++
)
{
if
(
name
==
globalNames
[
i
])
{
return
getGlobalVariable
(
i
);
}
}
throw
OpenMMException
(
"Illegal global variable name: "
+
name
);
}
void
CustomIntegrator
::
setGlobalVariable
(
int
index
,
double
value
)
{
ASSERT_VALID_INDEX
(
index
,
globalValues
);
if
(
owner
!=
NULL
&&
!
globalsAreCurrent
)
{
...
...
@@ -152,6 +161,16 @@ void CustomIntegrator::getPerDofVariable(int index, vector<Vec3>& values) const
kernel
.
getAs
<
const
IntegrateCustomStepKernel
>
().
getPerDofVariable
(
*
context
,
index
,
values
);
}
void
CustomIntegrator
::
getPerDofVariableByName
(
const
string
&
name
,
vector
<
Vec3
>&
values
)
const
{
for
(
int
i
=
0
;
i
<
(
int
)
perDofNames
.
size
();
i
++
)
{
if
(
name
==
perDofNames
[
i
])
{
getPerDofVariable
(
i
,
values
);
return
;
}
}
throw
OpenMMException
(
"Illegal per-DOF variable name: "
+
name
);
}
void
CustomIntegrator
::
setPerDofVariable
(
int
index
,
const
vector
<
Vec3
>&
values
)
{
ASSERT_VALID_INDEX
(
index
,
perDofValues
);
if
(
owner
!=
NULL
&&
values
.
size
()
!=
context
->
getSystem
().
getNumParticles
())
...
...
wrappers/python/src/swig_doxygen/swigInputConfig.py
View file @
77ea3bb6
...
...
@@ -161,6 +161,7 @@ UNITS = {
(
"*"
,
"getEwaldErrorTolerance"
)
:
(
None
,
()),
(
"*"
,
"getFriction"
)
:
(
"1/unit.picosecond"
,
()),
(
"*"
,
"getGlobalVariable"
)
:
(
None
,
()),
(
"*"
,
"getGlobalVariableByName"
)
:
(
None
,
()),
(
"*"
,
"getIntegrator"
)
:
(
None
,
()),
(
"*"
,
"getMapParameters"
)
:
(
None
,
()),
(
"*"
,
"getName"
)
:
(
None
,
()),
...
...
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