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
717df453
Commit
717df453
authored
Jul 03, 2017
by
peastman
Browse files
CustomIntegrator avoids extra force computations when UpdateContextState doesn't change them
parent
feb79f77
Changes
45
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
31 additions
and
21 deletions
+31
-21
openmmapi/include/openmm/internal/AndersenThermostatImpl.h
openmmapi/include/openmm/internal/AndersenThermostatImpl.h
+1
-1
openmmapi/include/openmm/internal/CMAPTorsionForceImpl.h
openmmapi/include/openmm/internal/CMAPTorsionForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CMMotionRemoverImpl.h
openmmapi/include/openmm/internal/CMMotionRemoverImpl.h
+1
-1
openmmapi/include/openmm/internal/ContextImpl.h
openmmapi/include/openmm/internal/ContextImpl.h
+4
-1
openmmapi/include/openmm/internal/CustomAngleForceImpl.h
openmmapi/include/openmm/internal/CustomAngleForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CustomBondForceImpl.h
openmmapi/include/openmm/internal/CustomBondForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CustomCVForceImpl.h
openmmapi/include/openmm/internal/CustomCVForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CustomCentroidBondForceImpl.h
...api/include/openmm/internal/CustomCentroidBondForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CustomCompoundBondForceImpl.h
...api/include/openmm/internal/CustomCompoundBondForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CustomExternalForceImpl.h
openmmapi/include/openmm/internal/CustomExternalForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CustomGBForceImpl.h
openmmapi/include/openmm/internal/CustomGBForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CustomHbondForceImpl.h
openmmapi/include/openmm/internal/CustomHbondForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CustomManyParticleForceImpl.h
...api/include/openmm/internal/CustomManyParticleForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CustomNonbondedForceImpl.h
openmmapi/include/openmm/internal/CustomNonbondedForceImpl.h
+1
-1
openmmapi/include/openmm/internal/CustomTorsionForceImpl.h
openmmapi/include/openmm/internal/CustomTorsionForceImpl.h
+1
-1
openmmapi/include/openmm/internal/ForceImpl.h
openmmapi/include/openmm/internal/ForceImpl.h
+9
-2
openmmapi/include/openmm/internal/GBSAOBCForceImpl.h
openmmapi/include/openmm/internal/GBSAOBCForceImpl.h
+1
-1
openmmapi/include/openmm/internal/HarmonicAngleForceImpl.h
openmmapi/include/openmm/internal/HarmonicAngleForceImpl.h
+1
-1
openmmapi/include/openmm/internal/HarmonicBondForceImpl.h
openmmapi/include/openmm/internal/HarmonicBondForceImpl.h
+1
-1
openmmapi/include/openmm/internal/MonteCarloBarostatImpl.h
openmmapi/include/openmm/internal/MonteCarloBarostatImpl.h
+1
-1
No files found.
openmmapi/include/openmm/internal/AndersenThermostatImpl.h
View file @
717df453
...
@@ -52,7 +52,7 @@ public:
...
@@ -52,7 +52,7 @@ public:
const
AndersenThermostat
&
getOwner
()
const
{
const
AndersenThermostat
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
);
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
// This force doesn't apply forces to particles.
// This force doesn't apply forces to particles.
return
0.0
;
return
0.0
;
...
...
openmmapi/include/openmm/internal/CMAPTorsionForceImpl.h
View file @
717df453
...
@@ -52,7 +52,7 @@ public:
...
@@ -52,7 +52,7 @@ public:
const
CMAPTorsionForce
&
getOwner
()
const
{
const
CMAPTorsionForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CMMotionRemoverImpl.h
View file @
717df453
...
@@ -49,7 +49,7 @@ public:
...
@@ -49,7 +49,7 @@ public:
const
CMMotionRemover
&
getOwner
()
const
{
const
CMMotionRemover
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
);
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
// This force doesn't apply forces to particles.
// This force doesn't apply forces to particles.
return
0.0
;
return
0.0
;
...
...
openmmapi/include/openmm/internal/ContextImpl.h
View file @
717df453
...
@@ -210,8 +210,11 @@ public:
...
@@ -210,8 +210,11 @@ public:
/**
/**
* This should be called at the start of each time step. It calls updateContextState() on each
* This should be called at the start of each time step. It calls updateContextState() on each
* ForceImpl in the system, allowing them to modify the values of state variables.
* ForceImpl in the system, allowing them to modify the values of state variables.
*
* @return true if the state was modified in any way that would cause the forces on particles
* to change, false otherwise
*/
*/
void
updateContextState
();
bool
updateContextState
();
/**
/**
* Get the list of ForceImpls belonging to this ContextImpl.
* Get the list of ForceImpls belonging to this ContextImpl.
*/
*/
...
...
openmmapi/include/openmm/internal/CustomAngleForceImpl.h
View file @
717df453
...
@@ -53,7 +53,7 @@ public:
...
@@ -53,7 +53,7 @@ public:
const
CustomAngleForce
&
getOwner
()
const
{
const
CustomAngleForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CustomBondForceImpl.h
View file @
717df453
...
@@ -53,7 +53,7 @@ public:
...
@@ -53,7 +53,7 @@ public:
const
CustomBondForce
&
getOwner
()
const
{
const
CustomBondForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CustomCVForceImpl.h
View file @
717df453
...
@@ -56,7 +56,7 @@ public:
...
@@ -56,7 +56,7 @@ public:
const
CustomCVForce
&
getOwner
()
const
{
const
CustomCVForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CustomCentroidBondForceImpl.h
View file @
717df453
...
@@ -58,7 +58,7 @@ public:
...
@@ -58,7 +58,7 @@ public:
const
CustomCentroidBondForce
&
getOwner
()
const
{
const
CustomCentroidBondForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CustomCompoundBondForceImpl.h
View file @
717df453
...
@@ -57,7 +57,7 @@ public:
...
@@ -57,7 +57,7 @@ public:
const
CustomCompoundBondForce
&
getOwner
()
const
{
const
CustomCompoundBondForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CustomExternalForceImpl.h
View file @
717df453
...
@@ -53,7 +53,7 @@ public:
...
@@ -53,7 +53,7 @@ public:
const
CustomExternalForce
&
getOwner
()
const
{
const
CustomExternalForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CustomGBForceImpl.h
View file @
717df453
...
@@ -53,7 +53,7 @@ public:
...
@@ -53,7 +53,7 @@ public:
const
CustomGBForce
&
getOwner
()
const
{
const
CustomGBForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CustomHbondForceImpl.h
View file @
717df453
...
@@ -57,7 +57,7 @@ public:
...
@@ -57,7 +57,7 @@ public:
const
CustomHbondForce
&
getOwner
()
const
{
const
CustomHbondForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CustomManyParticleForceImpl.h
View file @
717df453
...
@@ -57,7 +57,7 @@ public:
...
@@ -57,7 +57,7 @@ public:
const
CustomManyParticleForce
&
getOwner
()
const
{
const
CustomManyParticleForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CustomNonbondedForceImpl.h
View file @
717df453
...
@@ -54,7 +54,7 @@ public:
...
@@ -54,7 +54,7 @@ public:
const
CustomNonbondedForce
&
getOwner
()
const
{
const
CustomNonbondedForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/CustomTorsionForceImpl.h
View file @
717df453
...
@@ -53,7 +53,7 @@ public:
...
@@ -53,7 +53,7 @@ public:
const
CustomTorsionForce
&
getOwner
()
const
{
const
CustomTorsionForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/ForceImpl.h
View file @
717df453
...
@@ -73,9 +73,16 @@ public:
...
@@ -73,9 +73,16 @@ public:
* to modify the state variables (positions, velocities, and parameters) stored in the
* to modify the state variables (positions, velocities, and parameters) stored in the
* Context in arbitrary ways before integration is performed.
* Context in arbitrary ways before integration is performed.
*
*
* @param context the context in which the system is being simulated
* @param context the context in which the system is being simulated
* @param forcesInvalid if the state was modified in any way that might cause previously
* calculated forces to no longer be valid (such as modifying
* positions or parameters), the method should set this to true.
*/
virtual
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
);
/**
* @deprecated This version exists for backward compatibility. Subclasses should implement the other version instead.
*/
*/
virtual
void
updateContextState
(
ContextImpl
&
context
)
=
0
;
virtual
void
updateContextState
(
ContextImpl
&
context
);
/**
/**
* Calculate the force on each particle generated by this ForceImpl and/or this ForceImpl's
* Calculate the force on each particle generated by this ForceImpl and/or this ForceImpl's
* contribution to the potential energy of the system.
* contribution to the potential energy of the system.
...
...
openmmapi/include/openmm/internal/GBSAOBCForceImpl.h
View file @
717df453
...
@@ -50,7 +50,7 @@ public:
...
@@ -50,7 +50,7 @@ public:
const
GBSAOBCForce
&
getOwner
()
const
{
const
GBSAOBCForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/HarmonicAngleForceImpl.h
View file @
717df453
...
@@ -53,7 +53,7 @@ public:
...
@@ -53,7 +53,7 @@ public:
const
HarmonicAngleForce
&
getOwner
()
const
{
const
HarmonicAngleForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/HarmonicBondForceImpl.h
View file @
717df453
...
@@ -53,7 +53,7 @@ public:
...
@@ -53,7 +53,7 @@ public:
const
HarmonicBondForce
&
getOwner
()
const
{
const
HarmonicBondForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/MonteCarloBarostatImpl.h
View file @
717df453
...
@@ -51,7 +51,7 @@ public:
...
@@ -51,7 +51,7 @@ public:
const
MonteCarloBarostat
&
getOwner
()
const
{
const
MonteCarloBarostat
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
);
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
// This force doesn't apply forces to particles.
// This force doesn't apply forces to particles.
return
0.0
;
return
0.0
;
...
...
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