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
7af565ed
Unverified
Commit
7af565ed
authored
Apr 27, 2023
by
Peter Eastman
Committed by
GitHub
Apr 27, 2023
Browse files
Use more efficient version of updateContextState() (#4054)
parent
86f07082
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
8 deletions
+12
-8
openmmapi/include/openmm/internal/GayBerneForceImpl.h
openmmapi/include/openmm/internal/GayBerneForceImpl.h
+1
-1
openmmapi/include/openmm/internal/MonteCarloAnisotropicBarostatImpl.h
...clude/openmm/internal/MonteCarloAnisotropicBarostatImpl.h
+1
-1
openmmapi/include/openmm/internal/MonteCarloMembraneBarostatImpl.h
.../include/openmm/internal/MonteCarloMembraneBarostatImpl.h
+1
-1
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
+4
-2
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
+4
-2
plugins/rpmd/openmmapi/include/openmm/internal/RPMDMonteCarloBarostatImpl.h
...mapi/include/openmm/internal/RPMDMonteCarloBarostatImpl.h
+1
-1
No files found.
openmmapi/include/openmm/internal/GayBerneForceImpl.h
View file @
7af565ed
...
@@ -55,7 +55,7 @@ public:
...
@@ -55,7 +55,7 @@ public:
const
GayBerneForce
&
getOwner
()
const
{
const
GayBerneForce
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This force field doesn't update the state directly.
// This force field doesn't update the state directly.
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
...
...
openmmapi/include/openmm/internal/MonteCarloAnisotropicBarostatImpl.h
View file @
7af565ed
...
@@ -50,7 +50,7 @@ public:
...
@@ -50,7 +50,7 @@ public:
const
MonteCarloAnisotropicBarostat
&
getOwner
()
const
{
const
MonteCarloAnisotropicBarostat
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
);
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
// This force doesn't apply forces to particles.
// This force doesn't apply forces to particles.
return
0.0
;
return
0.0
;
...
...
openmmapi/include/openmm/internal/MonteCarloMembraneBarostatImpl.h
View file @
7af565ed
...
@@ -50,7 +50,7 @@ public:
...
@@ -50,7 +50,7 @@ public:
const
MonteCarloMembraneBarostat
&
getOwner
()
const
{
const
MonteCarloMembraneBarostat
&
getOwner
()
const
{
return
owner
;
return
owner
;
}
}
void
updateContextState
(
ContextImpl
&
context
);
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
);
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
// This force doesn't apply forces to particles.
// This force doesn't apply forces to particles.
return
0.0
;
return
0.0
;
...
...
openmmapi/src/MonteCarloAnisotropicBarostatImpl.cpp
View file @
7af565ed
...
@@ -62,7 +62,7 @@ void MonteCarloAnisotropicBarostatImpl::initialize(ContextImpl& context) {
...
@@ -62,7 +62,7 @@ void MonteCarloAnisotropicBarostatImpl::initialize(ContextImpl& context) {
SimTKOpenMMUtilities
::
setRandomNumberSeed
(
owner
.
getRandomNumberSeed
());
SimTKOpenMMUtilities
::
setRandomNumberSeed
(
owner
.
getRandomNumberSeed
());
}
}
void
MonteCarloAnisotropicBarostatImpl
::
updateContextState
(
ContextImpl
&
context
)
{
void
MonteCarloAnisotropicBarostatImpl
::
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
if
(
++
step
<
owner
.
getFrequency
()
||
owner
.
getFrequency
()
==
0
)
if
(
++
step
<
owner
.
getFrequency
()
||
owner
.
getFrequency
()
==
0
)
return
;
return
;
if
(
!
owner
.
getScaleX
()
&&
!
owner
.
getScaleY
()
&&
!
owner
.
getScaleZ
())
if
(
!
owner
.
getScaleX
()
&&
!
owner
.
getScaleY
()
&&
!
owner
.
getScaleZ
())
...
@@ -123,8 +123,10 @@ void MonteCarloAnisotropicBarostatImpl::updateContextState(ContextImpl& context)
...
@@ -123,8 +123,10 @@ void MonteCarloAnisotropicBarostatImpl::updateContextState(ContextImpl& context)
context
.
getOwner
().
setPeriodicBoxVectors
(
box
[
0
],
box
[
1
],
box
[
2
]);
context
.
getOwner
().
setPeriodicBoxVectors
(
box
[
0
],
box
[
1
],
box
[
2
]);
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
}
}
else
else
{
numAccepted
[
axis
]
++
;
numAccepted
[
axis
]
++
;
forcesInvalid
=
true
;
}
numAttempted
[
axis
]
++
;
numAttempted
[
axis
]
++
;
if
(
numAttempted
[
axis
]
>=
10
)
{
if
(
numAttempted
[
axis
]
>=
10
)
{
if
(
numAccepted
[
axis
]
<
0.25
*
numAttempted
[
axis
])
{
if
(
numAccepted
[
axis
]
<
0.25
*
numAttempted
[
axis
])
{
...
...
openmmapi/src/MonteCarloMembraneBarostatImpl.cpp
View file @
7af565ed
...
@@ -62,7 +62,7 @@ void MonteCarloMembraneBarostatImpl::initialize(ContextImpl& context) {
...
@@ -62,7 +62,7 @@ void MonteCarloMembraneBarostatImpl::initialize(ContextImpl& context) {
SimTKOpenMMUtilities
::
setRandomNumberSeed
(
owner
.
getRandomNumberSeed
());
SimTKOpenMMUtilities
::
setRandomNumberSeed
(
owner
.
getRandomNumberSeed
());
}
}
void
MonteCarloMembraneBarostatImpl
::
updateContextState
(
ContextImpl
&
context
)
{
void
MonteCarloMembraneBarostatImpl
::
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
if
(
++
step
<
owner
.
getFrequency
()
||
owner
.
getFrequency
()
==
0
)
if
(
++
step
<
owner
.
getFrequency
()
||
owner
.
getFrequency
()
==
0
)
return
;
return
;
step
=
0
;
step
=
0
;
...
@@ -124,8 +124,10 @@ void MonteCarloMembraneBarostatImpl::updateContextState(ContextImpl& context) {
...
@@ -124,8 +124,10 @@ void MonteCarloMembraneBarostatImpl::updateContextState(ContextImpl& context) {
context
.
getOwner
().
setPeriodicBoxVectors
(
box
[
0
],
box
[
1
],
box
[
2
]);
context
.
getOwner
().
setPeriodicBoxVectors
(
box
[
0
],
box
[
1
],
box
[
2
]);
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
kernel
.
getAs
<
ApplyMonteCarloBarostatKernel
>
().
restoreCoordinates
(
context
);
}
}
else
else
{
numAccepted
[
axis
]
++
;
numAccepted
[
axis
]
++
;
forcesInvalid
=
true
;
}
numAttempted
[
axis
]
++
;
numAttempted
[
axis
]
++
;
if
(
numAttempted
[
axis
]
>=
10
)
{
if
(
numAttempted
[
axis
]
>=
10
)
{
if
(
numAccepted
[
axis
]
<
0.25
*
numAttempted
[
axis
])
{
if
(
numAccepted
[
axis
]
<
0.25
*
numAttempted
[
axis
])
{
...
...
plugins/rpmd/openmmapi/include/openmm/internal/RPMDMonteCarloBarostatImpl.h
View file @
7af565ed
...
@@ -54,7 +54,7 @@ public:
...
@@ -54,7 +54,7 @@ public:
return
owner
;
return
owner
;
}
}
void
updateRPMDState
(
ContextImpl
&
context
);
void
updateRPMDState
(
ContextImpl
&
context
);
void
updateContextState
(
ContextImpl
&
context
)
{
void
updateContextState
(
ContextImpl
&
context
,
bool
&
forcesInvalid
)
{
// This is unused, since the updating is done in updateRPMDState().
// This is unused, since the updating is done in updateRPMDState().
}
}
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
)
{
...
...
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