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
644dc1ec
"platforms/cpu/tests/TestCpuLangevinIntegrator.cpp" did not exist on "f14182c5dbe96961440f055fd15d3fc2811db9e0"
Unverified
Commit
644dc1ec
authored
Jul 03, 2023
by
Peter Eastman
Committed by
GitHub
Jul 03, 2023
Browse files
Fixed DOF calculation for NoseHooverIntegrator (#4128)
parent
3f3bba3f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
12 deletions
+19
-12
openmmapi/src/NoseHooverIntegrator.cpp
openmmapi/src/NoseHooverIntegrator.cpp
+17
-9
plugins/drude/tests/TestDrudeNoseHoover.h
plugins/drude/tests/TestDrudeNoseHoover.h
+2
-3
No files found.
openmmapi/src/NoseHooverIntegrator.cpp
View file @
644dc1ec
...
...
@@ -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-202
0
Stanford University and the Authors. *
* Portions copyright (c) 2019-202
3
Stanford University and the Authors. *
* Authors: Andreas Krämer and Andrew C. Simmonett *
* Contributors: Peter Eastman *
* *
...
...
@@ -178,18 +178,26 @@ void NoseHooverIntegrator::initializeThermostats(const System &system) {
}
}
// remove 3 degrees of freedom from thermostats that act on absolute motions
int
numForces
=
system
.
getNumForces
();
if
(
thermostatedPairs
.
size
()
==
0
){
for
(
int
forceNum
=
0
;
forceNum
<
numForces
;
++
forceNum
)
{
if
(
dynamic_cast
<
const
CMMotionRemover
*>
(
&
system
.
getForce
(
forceNum
)))
nDOF
-=
3
;
}
}
// set number of DoFs for chain
thermostat
.
setNumDegreesOfFreedom
(
nDOF
);
}
// If there is a CMMotionRemover, remove 3 degrees of freedom from the largest thermostat.
for
(
int
force
=
0
;
force
<
system
.
getNumForces
();
++
force
)
{
if
(
dynamic_cast
<
const
CMMotionRemover
*>
(
&
system
.
getForce
(
force
)))
{
int
largest
=
0
;
int
largestSize
=
noseHooverChains
[
0
].
getThermostatedAtoms
().
size
()
+
noseHooverChains
[
0
].
getThermostatedPairs
().
size
();
for
(
int
chain
=
1
;
chain
<
noseHooverChains
.
size
();
chain
++
)
{
int
size
=
noseHooverChains
[
chain
].
getThermostatedAtoms
().
size
()
+
noseHooverChains
[
chain
].
getThermostatedPairs
().
size
();
if
(
size
>
largestSize
)
{
largest
=
chain
;
largestSize
=
size
;
}
}
noseHooverChains
[
largest
].
setNumDegreesOfFreedom
(
noseHooverChains
[
largest
].
getNumDegreesOfFreedom
()
-
3
);
break
;
}
}
for
(
int
chain1
=
0
;
chain1
<
noseHooverChains
.
size
();
++
chain1
){
const
auto
&
nhc
=
noseHooverChains
[
chain1
];
...
...
plugins/drude/tests/TestDrudeNoseHoover.h
View file @
644dc1ec
...
...
@@ -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-202
2
Stanford University and the Authors. *
* Portions copyright (c) 2019-202
3
Stanford University and the Authors. *
* Authors: Andreas Krämer and Andrew C. Simmonett *
* Contributors: Peter Eastman *
* *
...
...
@@ -115,9 +115,8 @@ void testWaterBox() {
build_waterbox
(
system
,
gridSize
,
polarizability
,
positions
);
const
int
numMolecules
=
gridSize
*
gridSize
*
gridSize
;
int
numStandardDof
=
3
*
3
*
numMolecules
-
system
.
getNumConstraints
();
int
numStandardDof
=
3
*
3
*
numMolecules
-
system
.
getNumConstraints
()
-
3
;
int
numDrudeDof
=
3
*
numMolecules
;
int
numDof
=
numStandardDof
+
numDrudeDof
;
const
double
temperature
=
300.0
;
const
double
temperatureDrude
=
10.0
;
...
...
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