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
0e9ef3f8
Unverified
Commit
0e9ef3f8
authored
Dec 17, 2023
by
Peter Eastman
Committed by
GitHub
Dec 17, 2023
Browse files
setVelocitiesToTemperature() works with massless Drude particles (#4356)
parent
d80ddda3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
plugins/drude/openmmapi/src/DrudeHelpers.cpp
plugins/drude/openmmapi/src/DrudeHelpers.cpp
+5
-1
plugins/drude/tests/TestDrudeSCFIntegrator.h
plugins/drude/tests/TestDrudeSCFIntegrator.h
+3
-3
No files found.
plugins/drude/openmmapi/src/DrudeHelpers.cpp
View file @
0e9ef3f8
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008-202
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-202
3
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -123,6 +123,10 @@ vector<Vec3> assignDrudeVelocities(const System &system, double temperature, dou
...
@@ -123,6 +123,10 @@ vector<Vec3> assignDrudeVelocities(const System &system, double temperature, dou
velocities
[
atom1
]
=
comVelocity
-
fracM2
*
relVelocity
;
velocities
[
atom1
]
=
comVelocity
-
fracM2
*
relVelocity
;
velocities
[
atom2
]
=
comVelocity
+
fracM1
*
relVelocity
;
velocities
[
atom2
]
=
comVelocity
+
fracM1
*
relVelocity
;
}
}
else
if
(
mass2
!=
0
)
{
double
velocityScale
=
sqrt
(
BOLTZ
*
temperature
/
mass2
);
velocities
[
atom2
]
=
Vec3
(
randoms
[
nextRandom
++
],
randoms
[
nextRandom
++
],
randoms
[
nextRandom
++
])
*
velocityScale
;
}
}
}
return
velocities
;
return
velocities
;
}
}
...
...
plugins/drude/tests/TestDrudeSCFIntegrator.h
View file @
0e9ef3f8
...
@@ -132,7 +132,7 @@ void testWater() {
...
@@ -132,7 +132,7 @@ void testWater() {
}
}
}
}
void
testInitialTemperature
()
{
void
testInitialTemperature
(
double
drudeMass
)
{
// Check temperature initialization for a collection of randomly placed particles
// Check temperature initialization for a collection of randomly placed particles
const
int
numRealParticles
=
50000
;
const
int
numRealParticles
=
50000
;
const
int
numParticles
=
2
*
numRealParticles
;
const
int
numParticles
=
2
*
numRealParticles
;
...
@@ -140,7 +140,6 @@ void testInitialTemperature() {
...
@@ -140,7 +140,6 @@ void testInitialTemperature() {
const
double
targetTemperature
=
300
;
const
double
targetTemperature
=
300
;
const
double
drudeTemperature
=
0
;
const
double
drudeTemperature
=
0
;
const
double
realMass
=
10
;
const
double
realMass
=
10
;
const
double
drudeMass
=
1
;
System
system
;
System
system
;
OpenMM_SFMT
::
SFMT
sfmt
;
OpenMM_SFMT
::
SFMT
sfmt
;
init_gen_rand
(
0
,
sfmt
);
init_gen_rand
(
0
,
sfmt
);
...
@@ -196,7 +195,8 @@ int main(int argc, char* argv[]) {
...
@@ -196,7 +195,8 @@ int main(int argc, char* argv[]) {
setupKernels
(
argc
,
argv
);
setupKernels
(
argc
,
argv
);
testWater
();
testWater
();
runPlatformTests
();
runPlatformTests
();
testInitialTemperature
();
testInitialTemperature
(
0
);
testInitialTemperature
(
1
);
}
}
catch
(
const
std
::
exception
&
e
)
{
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
...
...
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