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
86f07082
Unverified
Commit
86f07082
authored
Apr 27, 2023
by
Peter Eastman
Committed by
GitHub
Apr 27, 2023
Browse files
Fixed error in barostats (#4049)
parent
729c0990
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
7 deletions
+7
-7
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
+2
-2
openmmapi/src/MonteCarloBarostatImpl.cpp
openmmapi/src/MonteCarloBarostatImpl.cpp
+1
-1
openmmapi/src/MonteCarloFlexibleBarostatImpl.cpp
openmmapi/src/MonteCarloFlexibleBarostatImpl.cpp
+1
-1
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
+1
-1
platforms/common/src/CommonKernels.cpp
platforms/common/src/CommonKernels.cpp
+2
-2
No files found.
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
View file @
86f07082
...
...
@@ -111,7 +111,7 @@ void MonteCarloAnisotropicBarostatImpl::updateContextState(ContextImpl& context)
context
.
getOwner
().
setPeriodicBoxVectors
(
Vec3
(
box
[
0
][
0
]
*
lengthScale
[
0
],
box
[
0
][
1
]
*
lengthScale
[
1
],
box
[
0
][
2
]
*
lengthScale
[
2
]),
Vec3
(
box
[
1
][
0
]
*
lengthScale
[
0
],
box
[
1
][
1
]
*
lengthScale
[
1
],
box
[
1
][
2
]
*
lengthScale
[
2
]),
Vec3
(
box
[
2
][
0
]
*
lengthScale
[
0
],
box
[
2
][
1
]
*
lengthScale
[
1
],
box
[
2
][
2
]
*
lengthScale
[
2
]));
// Compute the energy of the modified system.
double
finalEnergy
=
context
.
getOwner
().
getState
(
State
::
Energy
,
false
,
groups
).
getPotentialEnergy
();
...
...
@@ -120,8 +120,8 @@ void MonteCarloAnisotropicBarostatImpl::updateContextState(ContextImpl& context)
if
(
w
>
0
&&
SimTKOpenMMUtilities
::
getUniformlyDistributedRandomNumber
()
>
exp
(
-
w
/
kT
))
{
// Reject the step.
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
context
.
getOwner
().
setPeriodicBoxVectors
(
box
[
0
],
box
[
1
],
box
[
2
]);
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
}
else
numAccepted
[
axis
]
++
;
...
...
openmmapi/src/MonteCarloBarostatImpl.cpp
View file @
86f07082
...
...
@@ -90,8 +90,8 @@ void MonteCarloBarostatImpl::updateContextState(ContextImpl& context, bool& forc
if
(
w
>
0
&&
SimTKOpenMMUtilities
::
getUniformlyDistributedRandomNumber
()
>
exp
(
-
w
/
kT
))
{
// Reject the step.
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
context
.
getOwner
().
setPeriodicBoxVectors
(
box
[
0
],
box
[
1
],
box
[
2
]);
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
}
else
{
numAccepted
++
;
...
...
openmmapi/src/MonteCarloFlexibleBarostatImpl.cpp
View file @
86f07082
...
...
@@ -115,8 +115,8 @@ void MonteCarloFlexibleBarostatImpl::updateContextState(ContextImpl& context, bo
if
(
w
>
0
&&
SimTKOpenMMUtilities
::
getUniformlyDistributedRandomNumber
()
>
exp
(
-
w
/
kT
))
{
// Reject the step.
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
context
.
getOwner
().
setPeriodicBoxVectors
(
box
[
0
],
box
[
1
],
box
[
2
]);
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
}
else
{
numAccepted
++
;
...
...
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
View file @
86f07082
...
...
@@ -121,8 +121,8 @@ void MonteCarloMembraneBarostatImpl::updateContextState(ContextImpl& context) {
if
(
w
>
0
&&
SimTKOpenMMUtilities
::
getUniformlyDistributedRandomNumber
()
>
exp
(
-
w
/
kT
))
{
// Reject the step.
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
context
.
getOwner
().
setPeriodicBoxVectors
(
box
[
0
],
box
[
1
],
box
[
2
]);
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
}
else
numAccepted
[
axis
]
++
;
...
...
platforms/common/src/CommonKernels.cpp
View file @
86f07082
...
...
@@ -7217,7 +7217,7 @@ void CommonIntegrateCustomStepKernel::execute(ContextImpl& context, CustomIntegr
energy
=
savedEnergy
[
forceGroups
];
if
(
needsGlobals
[
step
]
&&
!
deviceGlobalsAreCurrent
)
{
// Upload the global values to the device.
globalValues
.
upload
(
localGlobalValues
,
true
);
deviceGlobalsAreCurrent
=
true
;
}
...
...
@@ -7781,13 +7781,13 @@ void CommonApplyMonteCarloBarostatKernel::scaleCoordinates(ContextImpl& context,
cc
.
getLongForceBuffer
().
copyTo
(
savedLongForces
);
if
(
savedFloatForces
.
isInitialized
())
cc
.
getFloatForceBuffer
().
copyTo
(
savedFloatForces
);
lastPosCellOffsets
=
cc
.
getPosCellOffsets
();
kernel
->
setArg
(
0
,
(
float
)
scaleX
);
kernel
->
setArg
(
1
,
(
float
)
scaleY
);
kernel
->
setArg
(
2
,
(
float
)
scaleZ
);
setPeriodicBoxArgs
(
cc
,
kernel
,
4
);
kernel
->
execute
(
cc
.
getNumAtoms
());
lastAtomOrder
=
cc
.
getAtomIndex
();
lastPosCellOffsets
=
cc
.
getPosCellOffsets
();
}
void
CommonApplyMonteCarloBarostatKernel
::
restoreCoordinates
(
ContextImpl
&
context
)
{
...
...
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