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
e1971877
Unverified
Commit
e1971877
authored
Dec 06, 2017
by
peastman
Committed by
GitHub
Dec 06, 2017
Browse files
Merge pull request #1954 from peastman/globalparam
Improved documentation on how to set parameters
parents
357d66d2
46f889dd
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
60 additions
and
12 deletions
+60
-12
docs-source/usersguide/theory.rst
docs-source/usersguide/theory.rst
+26
-0
openmmapi/include/openmm/CustomAngleForce.h
openmmapi/include/openmm/CustomAngleForce.h
+3
-1
openmmapi/include/openmm/CustomBondForce.h
openmmapi/include/openmm/CustomBondForce.h
+3
-1
openmmapi/include/openmm/CustomCVForce.h
openmmapi/include/openmm/CustomCVForce.h
+3
-1
openmmapi/include/openmm/CustomCentroidBondForce.h
openmmapi/include/openmm/CustomCentroidBondForce.h
+3
-1
openmmapi/include/openmm/CustomCompoundBondForce.h
openmmapi/include/openmm/CustomCompoundBondForce.h
+3
-1
openmmapi/include/openmm/CustomExternalForce.h
openmmapi/include/openmm/CustomExternalForce.h
+3
-1
openmmapi/include/openmm/CustomGBForce.h
openmmapi/include/openmm/CustomGBForce.h
+3
-1
openmmapi/include/openmm/CustomHbondForce.h
openmmapi/include/openmm/CustomHbondForce.h
+3
-1
openmmapi/include/openmm/CustomManyParticleForce.h
openmmapi/include/openmm/CustomManyParticleForce.h
+3
-1
openmmapi/include/openmm/CustomNonbondedForce.h
openmmapi/include/openmm/CustomNonbondedForce.h
+4
-2
openmmapi/include/openmm/CustomTorsionForce.h
openmmapi/include/openmm/CustomTorsionForce.h
+3
-1
No files found.
docs-source/usersguide/theory.rst
View file @
e1971877
...
@@ -1212,6 +1212,32 @@ is exactly equivalent to
...
@@ -1212,6 +1212,32 @@ is exactly equivalent to
The definition of an intermediate value may itself involve other intermediate
The definition of an intermediate value may itself involve other intermediate
values. All uses of a value must appear *before* that value’s definition.
values. All uses of a value must appear *before* that value’s definition.
Setting Parameters
******************
Most custom forces have two types of parameters you can define. The simplest type
are global parameters, which represent a single number. The value is stored in
the :class:`Context`, and can be changed at any time by calling :meth:`setParameter`
on it. Global parameters are designed to be very inexpensive to change. Even if
you set a new value for a global parameter on every time step, the overhead will
usually be quite small. There can be exceptions to this rule, however. For
example, if a :class:`CustomNonbondedForce` uses a long range correction, changing
a global parameter may require the correction coefficient to be recalculated,
which is expensive.
The other type of parameter is ones that record many values, one for each element
of the force, such as per-particle or per-bond parameters. These values are stored
directly in the force object itself, and hence are part of the system definition.
When a :class:`Context` is created, the values are copied over to it, and thereafter
the two are disconnected. Modifying the force will have no effect on any
:class:`Context` that already exists.
Some forces do provide a way to modify these parameters via an :meth:`updateParametersInContext`
method. These methods tend to be somewhat expensive, so it is best not to call
them too often. On the other hand, they are still much less expensive than calling
:meth:`reinitialize` on the :class:`Context`, which is the other way of updating
the system definition for a running simulation.
Parameter Derivatives
Parameter Derivatives
*********************
*********************
...
...
openmmapi/include/openmm/CustomAngleForce.h
View file @
e1971877
...
@@ -138,7 +138,9 @@ public:
...
@@ -138,7 +138,9 @@ public:
*/
*/
void
setPerAngleParameterName
(
int
index
,
const
std
::
string
&
name
);
void
setPerAngleParameterName
(
int
index
,
const
std
::
string
&
name
);
/**
/**
* Add a new global parameter that the interaction may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
openmmapi/include/openmm/CustomBondForce.h
View file @
e1971877
...
@@ -138,7 +138,9 @@ public:
...
@@ -138,7 +138,9 @@ public:
*/
*/
void
setPerBondParameterName
(
int
index
,
const
std
::
string
&
name
);
void
setPerBondParameterName
(
int
index
,
const
std
::
string
&
name
);
/**
/**
* Add a new global parameter that the interaction may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
openmmapi/include/openmm/CustomCVForce.h
View file @
e1971877
...
@@ -148,7 +148,9 @@ public:
...
@@ -148,7 +148,9 @@ public:
*/
*/
const
Force
&
getCollectiveVariable
(
int
index
)
const
;
const
Force
&
getCollectiveVariable
(
int
index
)
const
;
/**
/**
* Add a new global parameter that the interaction may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
openmmapi/include/openmm/CustomCentroidBondForce.h
View file @
e1971877
...
@@ -205,7 +205,9 @@ public:
...
@@ -205,7 +205,9 @@ public:
*/
*/
void
setPerBondParameterName
(
int
index
,
const
std
::
string
&
name
);
void
setPerBondParameterName
(
int
index
,
const
std
::
string
&
name
);
/**
/**
* Add a new global parameter that the interaction may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
openmmapi/include/openmm/CustomCompoundBondForce.h
View file @
e1971877
...
@@ -188,7 +188,9 @@ public:
...
@@ -188,7 +188,9 @@ public:
*/
*/
void
setPerBondParameterName
(
int
index
,
const
std
::
string
&
name
);
void
setPerBondParameterName
(
int
index
,
const
std
::
string
&
name
);
/**
/**
* Add a new global parameter that the interaction may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
openmmapi/include/openmm/CustomExternalForce.h
View file @
e1971877
...
@@ -138,7 +138,9 @@ public:
...
@@ -138,7 +138,9 @@ public:
*/
*/
void
setPerParticleParameterName
(
int
index
,
const
std
::
string
&
name
);
void
setPerParticleParameterName
(
int
index
,
const
std
::
string
&
name
);
/**
/**
* Add a new global parameter that the force may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
openmmapi/include/openmm/CustomGBForce.h
View file @
e1971877
...
@@ -288,7 +288,9 @@ public:
...
@@ -288,7 +288,9 @@ public:
*/
*/
void
setPerParticleParameterName
(
int
index
,
const
std
::
string
&
name
);
void
setPerParticleParameterName
(
int
index
,
const
std
::
string
&
name
);
/**
/**
* Add a new global parameter that the interaction may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
openmmapi/include/openmm/CustomHbondForce.h
View file @
e1971877
...
@@ -250,7 +250,9 @@ public:
...
@@ -250,7 +250,9 @@ public:
*/
*/
void
setPerAcceptorParameterName
(
int
index
,
const
std
::
string
&
name
);
void
setPerAcceptorParameterName
(
int
index
,
const
std
::
string
&
name
);
/**
/**
* Add a new global parameter that the interaction may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
openmmapi/include/openmm/CustomManyParticleForce.h
View file @
e1971877
...
@@ -305,7 +305,9 @@ public:
...
@@ -305,7 +305,9 @@ public:
*/
*/
void
setPerParticleParameterName
(
int
index
,
const
std
::
string
&
name
);
void
setPerParticleParameterName
(
int
index
,
const
std
::
string
&
name
);
/**
/**
* Add a new global parameter that the interaction may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
openmmapi/include/openmm/CustomNonbondedForce.h
View file @
e1971877
...
@@ -297,7 +297,9 @@ public:
...
@@ -297,7 +297,9 @@ public:
*/
*/
void
setPerParticleParameterName
(
int
index
,
const
std
::
string
&
name
);
void
setPerParticleParameterName
(
int
index
,
const
std
::
string
&
name
);
/**
/**
* Add a new global parameter that the interaction may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
openmmapi/include/openmm/CustomTorsionForce.h
View file @
e1971877
...
@@ -143,7 +143,9 @@ public:
...
@@ -143,7 +143,9 @@ public:
*/
*/
void
setPerTorsionParameterName
(
int
index
,
const
std
::
string
&
name
);
void
setPerTorsionParameterName
(
int
index
,
const
std
::
string
&
name
);
/**
/**
* Add a new global parameter that the interaction may depend on.
* Add a new global parameter that the interaction may depend on. The default value provided to
* this method is the initial value of the parameter in newly created Contexts. You can change
* the value at any time by calling setParameter() on the Context.
*
*
* @param name the name of the parameter
* @param name the name of the parameter
* @param defaultValue the default value of the parameter
* @param defaultValue the default value of the parameter
...
...
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