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
aa8264d0
Unverified
Commit
aa8264d0
authored
Sep 29, 2021
by
Peter Eastman
Committed by
GitHub
Sep 29, 2021
Browse files
Barostat does not translate into a single periodic box (#3260)
parent
779400a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
28 deletions
+5
-28
platforms/common/src/kernels/monteCarloBarostat.cc
platforms/common/src/kernels/monteCarloBarostat.cc
+4
-9
platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
...erence/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
+1
-7
tests/TestMonteCarloAnisotropicBarostat.h
tests/TestMonteCarloAnisotropicBarostat.h
+0
-12
No files found.
platforms/common/src/kernels/monteCarloBarostat.cc
View file @
aa8264d0
...
...
@@ -24,17 +24,12 @@ KERNEL void scalePositions(float scaleX, float scaleY, float scaleZ, int numMole
center
.
y
*=
invNumAtoms
;
center
.
z
*=
invNumAtoms
;
// Move it into the first periodic box.
real3
oldCenter
=
center
;
APPLY_PERIODIC_TO_POS
(
center
)
real3
delta
=
make_real3
(
oldCenter
.
x
-
center
.
x
,
oldCenter
.
y
-
center
.
y
,
oldCenter
.
z
-
center
.
z
);
// Now scale the position of the molecule center.
delta
.
x
=
center
.
x
*
(
scaleX
-
1
)
-
delta
.
x
;
delta
.
y
=
center
.
y
*
(
scaleY
-
1
)
-
delta
.
y
;
delta
.
z
=
center
.
z
*
(
scaleZ
-
1
)
-
delta
.
z
;
real3
delta
;
delta
.
x
=
center
.
x
*
(
scaleX
-
1
);
delta
.
y
=
center
.
y
*
(
scaleY
-
1
);
delta
.
z
=
center
.
z
*
(
scaleZ
-
1
);
for
(
int
atom
=
first
;
atom
<
last
;
atom
++
)
{
real4
pos
=
posq
[
moleculeAtoms
[
atom
]];
pos
.
x
+=
delta
.
x
;
...
...
platforms/reference/src/SimTKReference/ReferenceMonteCarloBarostat.cpp
View file @
aa8264d0
...
...
@@ -82,15 +82,9 @@ void ReferenceMonteCarloBarostat::applyBarostat(vector<Vec3>& atomPositions, con
}
pos
/=
molecule
.
size
();
// Move it into the first periodic box.
Vec3
newPos
=
pos
;
newPos
-=
boxVectors
[
2
]
*
floor
(
newPos
[
2
]
/
boxVectors
[
2
][
2
]);
newPos
-=
boxVectors
[
1
]
*
floor
(
newPos
[
1
]
/
boxVectors
[
1
][
1
]);
newPos
-=
boxVectors
[
0
]
*
floor
(
newPos
[
0
]
/
boxVectors
[
0
][
0
]);
// Now scale the position of the molecule center.
Vec3
newPos
=
pos
;
newPos
[
0
]
*=
scaleX
;
newPos
[
1
]
*=
scaleY
;
newPos
[
2
]
*=
scaleZ
;
...
...
tests/TestMonteCarloAnisotropicBarostat.h
View file @
aa8264d0
...
...
@@ -301,18 +301,6 @@ void testTriclinic() {
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
ASSERT_EQUAL_VEC
(
Vec3
(
xscale
*
initialBox
[
i
][
0
],
yscale
*
initialBox
[
i
][
1
],
zscale
*
initialBox
[
i
][
2
]),
box
[
i
],
1e-5
);
}
// The barostat should have put all particles inside the first periodic box. One integration step
// has happened since then, so they may have moved slightly outside it.
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
{
Vec3
pos
=
state
.
getPositions
()[
i
];
ASSERT
(
pos
[
2
]
/
box
[
2
][
2
]
>
-
1
&&
pos
[
2
]
/
box
[
2
][
2
]
<
2
);
pos
-=
box
[
2
]
*
floor
(
pos
[
2
]
/
box
[
2
][
2
]);
ASSERT
(
pos
[
1
]
/
box
[
1
][
1
]
>
-
1
&&
pos
[
1
]
/
box
[
1
][
1
]
<
2
);
pos
-=
box
[
1
]
*
floor
(
pos
[
1
]
/
box
[
1
][
1
]);
ASSERT
(
pos
[
0
]
/
box
[
0
][
0
]
>
-
1
&&
pos
[
0
]
/
box
[
0
][
0
]
<
2
);
}
}
/**
...
...
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