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
90f0d823
Unverified
Commit
90f0d823
authored
Feb 27, 2020
by
Andy Simmonett
Browse files
Attempt to apply KE computation optimization and corresponding fix from #2524
parent
61a248ca
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
openmmapi/include/openmm/NoseHooverIntegrator.h
openmmapi/include/openmm/NoseHooverIntegrator.h
+4
-0
openmmapi/src/NoseHooverIntegrator.cpp
openmmapi/src/NoseHooverIntegrator.cpp
+7
-1
No files found.
openmmapi/include/openmm/NoseHooverIntegrator.h
View file @
90f0d823
...
...
@@ -264,6 +264,10 @@ protected:
* Compute the kinetic energy of the system at the current time.
*/
virtual
double
computeKineticEnergy
();
/**
* Computing kinetic energy for this integrator does not require forces.
*/
bool
kineticEnergyRequiresForce
()
const
override
;
std
::
vector
<
NoseHooverChain
>
noseHooverChains
;
std
::
vector
<
int
>
allAtoms
;
...
...
openmmapi/src/NoseHooverIntegrator.cpp
View file @
90f0d823
...
...
@@ -267,6 +267,7 @@ void NoseHooverIntegrator::setRelativeCollisionFrequency(double frequency, int c
}
double
NoseHooverIntegrator
::
computeKineticEnergy
()
{
forcesAreValid
=
false
;
double
kE
=
0.0
;
if
(
noseHooverChains
.
size
()
>
0
)
{
for
(
const
auto
&
nhc
:
noseHooverChains
){
...
...
@@ -278,6 +279,10 @@ double NoseHooverIntegrator::computeKineticEnergy() {
return
kE
;
}
bool
NoseHooverIntegrator
::
kineticEnergyRequiresForce
()
const
{
return
false
;
}
double
NoseHooverIntegrator
::
computeHeatBathEnergy
()
{
double
energy
=
0
;
for
(
auto
&
nhc
:
noseHooverChains
)
{
...
...
@@ -340,7 +345,8 @@ void NoseHooverIntegrator::step(int steps) {
throw
OpenMMException
(
"This Integrator is not bound to a context!"
);
std
::
pair
<
double
,
double
>
scale
,
kineticEnergy
;
for
(
int
i
=
0
;
i
<
steps
;
++
i
)
{
context
->
updateContextState
();
if
(
context
->
updateContextState
())
forcesAreValid
=
false
;
for
(
auto
&
nhc
:
noseHooverChains
)
{
kineticEnergy
=
nhcKernel
.
getAs
<
NoseHooverChainKernel
>
().
computeMaskedKineticEnergy
(
*
context
,
nhc
,
false
);
scale
=
nhcKernel
.
getAs
<
NoseHooverChainKernel
>
().
propagateChain
(
*
context
,
nhc
,
kineticEnergy
,
getStepSize
());
...
...
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