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
4a30156a
Commit
4a30156a
authored
May 27, 2020
by
peastman
Browse files
Added Integrator.setIntegrationForceGroups()
parent
f902295b
Changes
31
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
76 additions
and
43 deletions
+76
-43
docs-source/usersguide/theory.rst
docs-source/usersguide/theory.rst
+11
-3
openmmapi/include/openmm/Integrator.h
openmmapi/include/openmm/Integrator.h
+13
-0
openmmapi/src/BrownianIntegrator.cpp
openmmapi/src/BrownianIntegrator.cpp
+2
-2
openmmapi/src/Integrator.cpp
openmmapi/src/Integrator.cpp
+10
-2
openmmapi/src/LangevinIntegrator.cpp
openmmapi/src/LangevinIntegrator.cpp
+2
-2
openmmapi/src/LangevinMiddleIntegrator.cpp
openmmapi/src/LangevinMiddleIntegrator.cpp
+1
-1
openmmapi/src/LocalEnergyMinimizer.cpp
openmmapi/src/LocalEnergyMinimizer.cpp
+2
-2
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
+4
-3
openmmapi/src/MonteCarloBarostatImpl.cpp
openmmapi/src/MonteCarloBarostatImpl.cpp
+4
-3
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
+4
-3
openmmapi/src/NoseHooverIntegrator.cpp
openmmapi/src/NoseHooverIntegrator.cpp
+2
-2
openmmapi/src/VariableLangevinIntegrator.cpp
openmmapi/src/VariableLangevinIntegrator.cpp
+3
-3
openmmapi/src/VariableVerletIntegrator.cpp
openmmapi/src/VariableVerletIntegrator.cpp
+3
-3
openmmapi/src/VerletIntegrator.cpp
openmmapi/src/VerletIntegrator.cpp
+2
-2
platforms/common/src/CommonKernels.cpp
platforms/common/src/CommonKernels.cpp
+2
-2
platforms/reference/src/SimTKReference/ReferenceCustomDynamics.cpp
.../reference/src/SimTKReference/ReferenceCustomDynamics.cpp
+2
-2
platforms/reference/src/SimTKReference/ReferenceNoseHooverDynamics.cpp
...erence/src/SimTKReference/ReferenceNoseHooverDynamics.cpp
+2
-1
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
+3
-3
plugins/drude/platforms/common/src/CommonDrudeKernels.cpp
plugins/drude/platforms/common/src/CommonDrudeKernels.cpp
+2
-2
plugins/drude/platforms/reference/src/ReferenceDrudeKernels.cpp
...s/drude/platforms/reference/src/ReferenceDrudeKernels.cpp
+2
-2
No files found.
docs-source/usersguide/theory.rst
View file @
4a30156a
...
...
@@ -1623,7 +1623,8 @@ Force Groups
************
It is possible to split the Force objects in a System into groups. Those groups
can then be evaluated independently of each other. Some Force classes also
can then be evaluated independently of each other. This is done by calling
:code:`setForceGroup()` on the Force. Some Force classes also
provide finer grained control over grouping. For example, NonbondedForce allows
direct space computations to be in one group and reciprocal space computations
in a different group.
...
...
@@ -1631,8 +1632,15 @@ in a different group.
The most important use of force groups is for implementing multiple time step
algorithms with CustomIntegrator. For example, you might evaluate the slowly
changing nonbonded interactions less frequently than the quickly changing bonded
ones. It also is useful if you want the ability to query a subset of the forces
acting on the system.
ones. This can be done by putting the slow and fast forces into separate
groups, then using a :class:`MTSIntegrator` or :class:`MTSLangevinIntegrator`
that evaluates the groups at different frequencies.
Another important use is to define forces that are not used when integrating
the equations of motion, but can still be queried efficiently. To do this,
call :code:`setIntegrationForceGroups()` on the :class:`Integrator`. Any groups
omitted will be ignored during simulation, but can be queried at any time by
calling :code:`getState()`.
Virtual Sites
*************
...
...
openmmapi/include/openmm/Integrator.h
View file @
4a30156a
...
...
@@ -85,6 +85,18 @@ public:
* @param steps the number of time steps to take
*/
virtual
void
step
(
int
steps
)
=
0
;
/**
* Get which force groups to use for integration. By default, all force groups
* are included. This is interpreted as a set if bit flags: the forces from group i
* will be included if (groups&(1<<i)) != 0.
*/
virtual
int
getIntegrationForceGroups
()
const
;
/**
* Set which force groups to use for integration. By default, all force groups
* are included. This is interpreted as a set if bit flags: the forces from group i
* will be included if (groups&(1<<i)) != 0.
*/
virtual
void
setIntegrationForceGroups
(
int
groups
);
protected:
friend
class
Context
;
friend
class
ContextImpl
;
...
...
@@ -166,6 +178,7 @@ protected:
}
private:
double
stepSize
,
constraintTol
;
int
forceGroups
;
};
}
// namespace OpenMM
...
...
openmmapi/src/BrownianIntegrator.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-20
19
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -80,7 +80,7 @@ void BrownianIntegrator::step(int steps) {
throw
OpenMMException
(
"This Integrator is not bound to a context!"
);
for
(
int
i
=
0
;
i
<
steps
;
++
i
)
{
context
->
updateContextState
();
context
->
calcForcesAndEnergy
(
true
,
false
);
context
->
calcForcesAndEnergy
(
true
,
false
,
getIntegrationForceGroups
()
);
kernel
.
getAs
<
IntegrateBrownianStepKernel
>
().
execute
(
*
context
,
*
this
);
}
}
openmmapi/src/Integrator.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2013-20
15
Stanford University and the Authors. *
* Portions copyright (c) 2013-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -39,7 +39,7 @@
using
namespace
OpenMM
;
Integrator
::
Integrator
()
:
owner
(
NULL
),
context
(
NULL
)
{
Integrator
::
Integrator
()
:
owner
(
NULL
),
context
(
NULL
)
,
forceGroups
(
0xFFFFFFFF
)
{
}
Integrator
::~
Integrator
()
{
...
...
@@ -69,6 +69,14 @@ void Integrator::setConstraintTolerance(double tol) {
constraintTol
=
tol
;
}
int
Integrator
::
getIntegrationForceGroups
()
const
{
return
forceGroups
;
}
void
Integrator
::
setIntegrationForceGroups
(
int
groups
)
{
forceGroups
=
groups
;
}
std
::
vector
<
Vec3
>
Integrator
::
getVelocitiesForTemperature
(
const
System
&
system
,
double
temperature
,
int
randomSeed
)
const
{
// Generate the list of Gaussian random numbers.
OpenMM_SFMT
::
SFMT
sfmt
;
...
...
openmmapi/src/LangevinIntegrator.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-20
1
2 Stanford University and the Authors. *
* Portions copyright (c) 2008-202
0
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -76,7 +76,7 @@ void LangevinIntegrator::step(int steps) {
throw
OpenMMException
(
"This Integrator is not bound to a context!"
);
for
(
int
i
=
0
;
i
<
steps
;
++
i
)
{
context
->
updateContextState
();
context
->
calcForcesAndEnergy
(
true
,
false
);
context
->
calcForcesAndEnergy
(
true
,
false
,
getIntegrationForceGroups
()
);
kernel
.
getAs
<
IntegrateLangevinStepKernel
>
().
execute
(
*
context
,
*
this
);
}
}
openmmapi/src/LangevinMiddleIntegrator.cpp
View file @
4a30156a
...
...
@@ -80,7 +80,7 @@ void LangevinMiddleIntegrator::step(int steps) {
throw
OpenMMException
(
"This Integrator is not bound to a context!"
);
for
(
int
i
=
0
;
i
<
steps
;
++
i
)
{
context
->
updateContextState
();
context
->
calcForcesAndEnergy
(
true
,
false
);
context
->
calcForcesAndEnergy
(
true
,
false
,
getIntegrationForceGroups
()
);
kernel
.
getAs
<
IntegrateLangevinMiddleStepKernel
>
().
execute
(
*
context
,
*
this
);
}
}
openmmapi/src/LocalEnergyMinimizer.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-20
16
Stanford University and the Authors. *
* Portions copyright (c) 2010-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -79,7 +79,7 @@ struct MinimizerData {
static
double
computeForcesAndEnergy
(
Context
&
context
,
const
vector
<
Vec3
>&
positions
,
lbfgsfloatval_t
*
g
)
{
context
.
setPositions
(
positions
);
context
.
computeVirtualSites
();
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
,
false
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
const
vector
<
Vec3
>&
forces
=
state
.
getForces
();
const
System
&
system
=
context
.
getSystem
();
for
(
int
i
=
0
;
i
<
forces
.
size
();
i
++
)
{
...
...
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-20
19
Stanford University and the Authors. *
* Portions copyright (c) 2010-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman, Lee-Ping Wang *
* Contributors: *
* *
...
...
@@ -72,7 +72,8 @@ void MonteCarloAnisotropicBarostatImpl::updateContextState(ContextImpl& context)
// Compute the current potential energy.
double
initialEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
).
getPotentialEnergy
();
int
groups
=
context
.
getIntegrator
().
getIntegrationForceGroups
();
double
initialEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
,
false
,
groups
).
getPotentialEnergy
();
double
pressure
;
// Choose which axis to modify at random.
...
...
@@ -114,7 +115,7 @@ void MonteCarloAnisotropicBarostatImpl::updateContextState(ContextImpl& context)
// Compute the energy of the modified system.
double
finalEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
).
getPotentialEnergy
();
double
finalEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
,
false
,
groups
).
getPotentialEnergy
();
double
kT
=
BOLTZ
*
context
.
getParameter
(
MonteCarloAnisotropicBarostat
::
Temperature
());
double
w
=
finalEnergy
-
initialEnergy
+
pressure
*
deltaVolume
-
context
.
getMolecules
().
size
()
*
kT
*
std
::
log
(
newVolume
/
volume
);
if
(
w
>
0
&&
SimTKOpenMMUtilities
::
getUniformlyDistributedRandomNumber
()
>
std
::
exp
(
-
w
/
kT
))
{
...
...
openmmapi/src/MonteCarloBarostatImpl.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-20
19
Stanford University and the Authors. *
* Portions copyright (c) 2010-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -68,7 +68,8 @@ void MonteCarloBarostatImpl::updateContextState(ContextImpl& context, bool& forc
// Compute the current potential energy.
double
initialEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
).
getPotentialEnergy
();
int
groups
=
context
.
getIntegrator
().
getIntegrationForceGroups
();
double
initialEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
,
false
,
groups
).
getPotentialEnergy
();
// Modify the periodic box size.
...
...
@@ -83,7 +84,7 @@ void MonteCarloBarostatImpl::updateContextState(ContextImpl& context, bool& forc
// Compute the energy of the modified system.
double
finalEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
).
getPotentialEnergy
();
double
finalEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
,
false
,
groups
).
getPotentialEnergy
();
double
pressure
=
context
.
getParameter
(
MonteCarloBarostat
::
Pressure
())
*
(
AVOGADRO
*
1e-25
);
double
kT
=
BOLTZ
*
context
.
getParameter
(
MonteCarloBarostat
::
Temperature
());
double
w
=
finalEnergy
-
initialEnergy
+
pressure
*
deltaVolume
-
context
.
getMolecules
().
size
()
*
kT
*
std
::
log
(
newVolume
/
volume
);
...
...
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-20
19
Stanford University and the Authors. *
* Portions copyright (c) 2010-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman, Lee-Ping Wang *
* Contributors: *
* *
...
...
@@ -70,7 +70,8 @@ void MonteCarloMembraneBarostatImpl::updateContextState(ContextImpl& context) {
// Compute the current potential energy.
double
initialEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
).
getPotentialEnergy
();
int
groups
=
context
.
getIntegrator
().
getIntegrationForceGroups
();
double
initialEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
,
false
,
groups
).
getPotentialEnergy
();
double
pressure
=
context
.
getParameter
(
MonteCarloMembraneBarostat
::
Pressure
())
*
(
AVOGADRO
*
1e-25
);
double
tension
=
context
.
getParameter
(
MonteCarloMembraneBarostat
::
SurfaceTension
())
*
(
AVOGADRO
*
1e-25
);
...
...
@@ -115,7 +116,7 @@ void MonteCarloMembraneBarostatImpl::updateContextState(ContextImpl& context) {
// Compute the energy of the modified system.
double
finalEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
).
getPotentialEnergy
();
double
finalEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
,
false
,
groups
).
getPotentialEnergy
();
double
kT
=
BOLTZ
*
context
.
getParameter
(
MonteCarloMembraneBarostat
::
Temperature
());
double
w
=
finalEnergy
-
initialEnergy
+
pressure
*
deltaVolume
-
tension
*
deltaArea
-
context
.
getMolecules
().
size
()
*
kT
*
std
::
log
(
newVolume
/
volume
);
if
(
w
>
0
&&
SimTKOpenMMUtilities
::
getUniformlyDistributedRandomNumber
()
>
std
::
exp
(
-
w
/
kT
))
{
...
...
openmmapi/src/NoseHooverIntegrator.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2019 Stanford University and the Authors.
*
* Portions copyright (c) 2019
-2020
Stanford University and the Authors. *
* Authors: Andreas Krämer and Andrew C. Simmonett *
* Contributors: *
* *
...
...
@@ -337,7 +337,7 @@ void NoseHooverIntegrator::step(int steps) {
for
(
int
i
=
0
;
i
<
steps
;
++
i
)
{
if
(
context
->
updateContextState
())
forcesAreValid
=
false
;
context
->
calcForcesAndEnergy
(
true
,
false
);
context
->
calcForcesAndEnergy
(
true
,
false
,
getIntegrationForceGroups
()
);
kernel
.
getAs
<
IntegrateNoseHooverStepKernel
>
().
execute
(
*
context
,
*
this
,
forcesAreValid
);
}
}
...
...
openmmapi/src/VariableLangevinIntegrator.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-20
19
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -80,7 +80,7 @@ void VariableLangevinIntegrator::step(int steps) {
throw
OpenMMException
(
"This Integrator is not bound to a context!"
);
for
(
int
i
=
0
;
i
<
steps
;
++
i
)
{
context
->
updateContextState
();
context
->
calcForcesAndEnergy
(
true
,
false
);
context
->
calcForcesAndEnergy
(
true
,
false
,
getIntegrationForceGroups
()
);
setStepSize
(
kernel
.
getAs
<
IntegrateVariableLangevinStepKernel
>
().
execute
(
*
context
,
*
this
,
std
::
numeric_limits
<
double
>::
infinity
()));
}
}
...
...
@@ -90,7 +90,7 @@ void VariableLangevinIntegrator::stepTo(double time) {
throw
OpenMMException
(
"This Integrator is not bound to a context!"
);
while
(
time
>
context
->
getTime
())
{
context
->
updateContextState
();
context
->
calcForcesAndEnergy
(
true
,
false
);
context
->
calcForcesAndEnergy
(
true
,
false
,
getIntegrationForceGroups
()
);
setStepSize
(
kernel
.
getAs
<
IntegrateVariableLangevinStepKernel
>
().
execute
(
*
context
,
*
this
,
time
));
}
}
openmmapi/src/VariableVerletIntegrator.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-20
19
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -74,7 +74,7 @@ void VariableVerletIntegrator::step(int steps) {
throw
OpenMMException
(
"This Integrator is not bound to a context!"
);
for
(
int
i
=
0
;
i
<
steps
;
++
i
)
{
context
->
updateContextState
();
context
->
calcForcesAndEnergy
(
true
,
false
);
context
->
calcForcesAndEnergy
(
true
,
false
,
getIntegrationForceGroups
()
);
setStepSize
(
kernel
.
getAs
<
IntegrateVariableVerletStepKernel
>
().
execute
(
*
context
,
*
this
,
std
::
numeric_limits
<
double
>::
infinity
()));
}
}
...
...
@@ -84,7 +84,7 @@ void VariableVerletIntegrator::stepTo(double time) {
throw
OpenMMException
(
"This Integrator is not bound to a context!"
);
while
(
time
>
context
->
getTime
())
{
context
->
updateContextState
();
context
->
calcForcesAndEnergy
(
true
,
false
);
context
->
calcForcesAndEnergy
(
true
,
false
,
getIntegrationForceGroups
()
);
setStepSize
(
kernel
.
getAs
<
IntegrateVariableVerletStepKernel
>
().
execute
(
*
context
,
*
this
,
time
));
}
}
openmmapi/src/VerletIntegrator.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-20
1
2 Stanford University and the Authors. *
* Portions copyright (c) 2008-202
0
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -73,7 +73,7 @@ void VerletIntegrator::step(int steps) {
throw
OpenMMException
(
"This Integrator is not bound to a context!"
);
for
(
int
i
=
0
;
i
<
steps
;
++
i
)
{
context
->
updateContextState
();
context
->
calcForcesAndEnergy
(
true
,
false
);
context
->
calcForcesAndEnergy
(
true
,
false
,
getIntegrationForceGroups
()
);
kernel
.
getAs
<
IntegrateVerletStepKernel
>
().
execute
(
*
context
,
*
this
);
}
}
platforms/common/src/CommonKernels.cpp
View file @
4a30156a
...
...
@@ -5709,7 +5709,7 @@ void CommonIntegrateNoseHooverStepKernel::execute(ContextImpl& context, const No
// If the atom reordering has occured, the forces from the previous step are permuted and thus invalid.
// They need to be either sorted or recomputed; here we choose the latter.
if
(
!
forcesAreValid
||
cc
.
getAtomsWereReordered
())
context
.
calcForcesAndEnergy
(
true
,
false
);
if (!forcesAreValid || cc.getAtomsWereReordered()) context.calcForcesAndEnergy(true, false
, integrator.getIntegrationForceGroups()
);
const auto& atomList = integrator.getAllThermostatedIndividualParticles();
const auto& pairList = integrator.getAllThermostatedPairs();
...
...
@@ -6770,7 +6770,7 @@ void CommonIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context
// Record the variable names and flags for the force and energy in each step.
forceGroupFlags
.
resize
(
numSteps
,
-
1
);
forceGroupFlags.resize(numSteps,
integrator.getIntegrationForceGroups()
);
vector<string> forceGroupName;
vector<string> energyGroupName;
for (int i = 0; i < 32; i++) {
...
...
platforms/reference/src/SimTKReference/ReferenceCustomDynamics.cpp
View file @
4a30156a
/* Portions copyright (c) 2011-20
17
Stanford University and Simbios.
/* Portions copyright (c) 2011-20
20
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -171,7 +171,7 @@ void ReferenceCustomDynamics::initialize(ContextImpl& context, vector<double>& m
// Record the force group flags for each step.
forceGroupFlags
.
resize
(
numSteps
,
-
1
);
forceGroupFlags
.
resize
(
numSteps
,
integrator
.
getIntegrationForceGroups
()
);
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
if
(
forceGroup
[
i
]
>
-
1
)
forceGroupFlags
[
i
]
=
1
<<
forceGroup
[
i
];
...
...
platforms/reference/src/SimTKReference/ReferenceNoseHooverDynamics.cpp
View file @
4a30156a
...
...
@@ -26,6 +26,7 @@
#include <iostream>
#include <sstream>
#include "openmm/Integrator.h"
#include "openmm/OpenMMException.h"
#include "SimTKOpenMMUtilities.h"
#include "openmm/internal/ContextImpl.h"
...
...
@@ -55,7 +56,7 @@ void ReferenceNoseHooverDynamics::step1(OpenMM::ContextImpl &context, const Open
double
maxPairDistance
)
{
// first-time-through initialization
if
(
!
forcesAreValid
)
context
.
calcForcesAndEnergy
(
true
,
false
);
if
(
!
forcesAreValid
)
context
.
calcForcesAndEnergy
(
true
,
false
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
if
(
getTimeStep
()
==
0
)
{
// invert masses
...
...
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-20
18
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman, Mark Friedrichs *
* Contributors: *
* *
...
...
@@ -1782,7 +1782,7 @@ void CudaCalcAmoebaMultipoleForceKernel::ensureMultipolesValid(ContextImpl& cont
}
}
if
(
!
multipolesAreValid
)
context
.
calcForcesAndEnergy
(
false
,
false
,
-
1
);
context
.
calcForcesAndEnergy
(
false
,
false
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
}
...
...
@@ -3650,7 +3650,7 @@ void CudaCalcHippoNonbondedForceKernel::ensureMultipolesValid(ContextImpl& conte
}
}
if
(
!
multipolesAreValid
)
context
.
calcForcesAndEnergy
(
false
,
false
,
-
1
);
context
.
calcForcesAndEnergy
(
false
,
false
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
}
void
CudaCalcHippoNonbondedForceKernel
::
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
...
...
plugins/drude/platforms/common/src/CommonDrudeKernels.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2013-20
19
Stanford University and the Authors. *
* Portions copyright (c) 2013-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -516,7 +516,7 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
// Compute the forces and energy for this configuration.
double
energy
=
context
.
calcForcesAndEnergy
(
true
,
true
);
double
energy
=
context
.
calcForcesAndEnergy
(
true
,
true
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
long
long
*
force
=
(
long
long
*
)
cc
.
getPinnedBuffer
();
cc
.
getLongForceBuffer
().
download
(
force
);
double
forceScale
=
-
1.0
/
0x100000000
;
...
...
plugins/drude/platforms/reference/src/ReferenceDrudeKernels.cpp
View file @
4a30156a
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2011-20
14
Stanford University and the Authors. *
* Portions copyright (c) 2011-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -497,7 +497,7 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
vector
<
Vec3
>&
force
=
extractForces
(
context
);
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
pos
[
drudeParticles
[
i
]]
=
Vec3
(
x
[
3
*
i
],
x
[
3
*
i
+
1
],
x
[
3
*
i
+
2
]);
double
energy
=
context
.
calcForcesAndEnergy
(
true
,
true
);
double
energy
=
context
.
calcForcesAndEnergy
(
true
,
true
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
{
Vec3
f
=
force
[
drudeParticles
[
i
]];
g
[
3
*
i
]
=
-
f
[
0
];
...
...
Prev
1
2
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