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
ebde66b4
Unverified
Commit
ebde66b4
authored
Jul 01, 2025
by
Peter Eastman
Committed by
GitHub
Jul 01, 2025
Browse files
Fixed bug in computing pressure (#4980)
parent
643473ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
platforms/common/src/kernels/monteCarloBarostat.cc
platforms/common/src/kernels/monteCarloBarostat.cc
+1
-1
platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
...erence/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
+1
-1
tests/TestMonteCarloBarostat.h
tests/TestMonteCarloBarostat.h
+2
-2
No files found.
platforms/common/src/kernels/monteCarloBarostat.cc
View file @
ebde66b4
...
@@ -79,7 +79,7 @@ KERNEL void computeMolecularKineticEnergy(int numMolecules, GLOBAL mixed4* RESTR
...
@@ -79,7 +79,7 @@ KERNEL void computeMolecularKineticEnergy(int numMolecules, GLOBAL mixed4* RESTR
molVel
+=
mass
*
trimTo3
(
v
);
molVel
+=
mass
*
trimTo3
(
v
);
molMass
+=
mass
;
molMass
+=
mass
;
}
}
molVel
*=
RECIP
((
mixed
)
numAtom
s
);
molVel
*=
RECIP
((
mixed
)
molMas
s
);
#if COMPONENTS == 1
#if COMPONENTS == 1
ke
[
0
]
+=
0.5
f
*
molMass
*
dot
(
molVel
,
molVel
);
ke
[
0
]
+=
0.5
f
*
molMass
*
dot
(
molVel
,
molVel
);
#else
#else
...
...
platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
View file @
ebde66b4
...
@@ -133,7 +133,7 @@ void ReferenceMonteCarloBarostat::computeMolecularKineticEnergy(const vector<Vec
...
@@ -133,7 +133,7 @@ void ReferenceMonteCarloBarostat::computeMolecularKineticEnergy(const vector<Vec
molVel
+=
masses
[
atom
]
*
velocities
[
atom
];
molVel
+=
masses
[
atom
]
*
velocities
[
atom
];
molMass
+=
masses
[
atom
];
molMass
+=
masses
[
atom
];
}
}
molVel
/=
mol
ecule
.
size
()
;
molVel
/=
mol
Mass
;
if
(
components
==
1
)
if
(
components
==
1
)
ke
[
0
]
+=
0.5
*
molMass
*
molVel
.
dot
(
molVel
);
ke
[
0
]
+=
0.5
*
molMass
*
molVel
.
dot
(
molVel
);
else
{
else
{
...
...
tests/TestMonteCarloBarostat.h
View file @
ebde66b4
...
@@ -167,8 +167,8 @@ void testMolecularGas() {
...
@@ -167,8 +167,8 @@ void testMolecularGas() {
init_gen_rand
(
0
,
sfmt
);
init_gen_rand
(
0
,
sfmt
);
for
(
int
i
=
0
;
i
<
numMolecules
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numMolecules
;
++
i
)
{
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1
.0
);
system
.
addParticle
(
2
.0
);
system
.
addParticle
(
1
.0
);
system
.
addParticle
(
3
.0
);
Vec3
pos
(
initialLength
*
genrand_real2
(
sfmt
),
0.5
*
initialLength
*
genrand_real2
(
sfmt
),
2
*
initialLength
*
genrand_real2
(
sfmt
));
Vec3
pos
(
initialLength
*
genrand_real2
(
sfmt
),
0.5
*
initialLength
*
genrand_real2
(
sfmt
),
2
*
initialLength
*
genrand_real2
(
sfmt
));
bonds
->
addBond
(
positions
.
size
(),
positions
.
size
()
+
1
,
0.1
,
10.0
);
bonds
->
addBond
(
positions
.
size
(),
positions
.
size
()
+
1
,
0.1
,
10.0
);
system
.
addConstraint
(
positions
.
size
(),
positions
.
size
()
+
2
,
0.1
);
system
.
addConstraint
(
positions
.
size
(),
positions
.
size
()
+
2
,
0.1
);
...
...
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