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
65ee8fd7
"wrappers/python/vscode:/vscode.git/clone" did not exist on "ff55a3a0866dc095ec97029f58acf70b140ba6b2"
Commit
65ee8fd7
authored
Feb 14, 2020
by
Peter Eastman
Browse files
Renamed BAOABLangevinIntegrator to LangevinMiddleIntegrator
parent
ba9f6b0a
Changes
43
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
104 additions
and
104 deletions
+104
-104
docs-source/usersguide/application.rst
docs-source/usersguide/application.rst
+13
-13
docs-source/usersguide/library.rst
docs-source/usersguide/library.rst
+3
-3
docs-source/usersguide/theory.rst
docs-source/usersguide/theory.rst
+2
-2
examples/HelloSodiumChloride.cpp
examples/HelloSodiumChloride.cpp
+1
-1
examples/HelloSodiumChlorideInC.c
examples/HelloSodiumChlorideInC.c
+1
-1
examples/HelloSodiumChlorideInFortran.f90
examples/HelloSodiumChlorideInFortran.f90
+3
-3
examples/simulateAmber.py
examples/simulateAmber.py
+1
-1
examples/simulateCharmm.py
examples/simulateCharmm.py
+1
-1
examples/simulateGromacs.py
examples/simulateGromacs.py
+1
-1
examples/simulatePdb.py
examples/simulatePdb.py
+1
-1
olla/include/openmm/kernels.h
olla/include/openmm/kernels.h
+11
-11
openmmapi/include/OpenMM.h
openmmapi/include/OpenMM.h
+1
-1
openmmapi/include/openmm/CustomIntegrator.h
openmmapi/include/openmm/CustomIntegrator.h
+1
-1
openmmapi/include/openmm/LangevinMiddleIntegrator.h
openmmapi/include/openmm/LangevinMiddleIntegrator.h
+6
-6
openmmapi/src/LangevinMiddleIntegrator.cpp
openmmapi/src/LangevinMiddleIntegrator.cpp
+13
-13
platforms/common/include/openmm/common/CommonKernels.h
platforms/common/include/openmm/common/CommonKernels.h
+9
-9
platforms/common/src/CommonKernels.cpp
platforms/common/src/CommonKernels.cpp
+9
-9
platforms/common/src/kernels/langevinMiddle.cc
platforms/common/src/kernels/langevinMiddle.cc
+8
-8
platforms/cpu/include/CpuKernels.h
platforms/cpu/include/CpuKernels.h
+12
-12
platforms/cpu/include/CpuLangevinMiddleDynamics.h
platforms/cpu/include/CpuLangevinMiddleDynamics.h
+7
-7
No files found.
docs-source/usersguide/application.rst
View file @
65ee8fd7
...
...
@@ -120,7 +120,7 @@ steps.
forcefield
=
ForceField
(
'amber14-all.xml'
,
'amber14/tip3pfb.xml'
)
system
=
forcefield
.
createSystem
(
pdb
.
topology
,
nonbondedMethod
=
PME
,
nonbondedCutoff
=
1
*
nanometer
,
constraints
=
HBonds
)
integrator
=
BAOAB
LangevinIntegrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
integrator
=
Langevin
Middle
Integrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
simulation
=
Simulation
(
pdb
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
pdb
.
positions
)
simulation
.
minimizeEnergy
()
...
...
@@ -210,10 +210,10 @@ convenient and less error-prone. We could have equivalently specified
The
units
system
will
be
described
in
more
detail
later
,
in
Section
:
ref
:`
units
-
and
-
dimensional
-
analysis
`.
::
integrator
=
BAOAB
LangevinIntegrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
integrator
=
Langevin
Middle
Integrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
This
line
creates
the
integrator
to
use
for
advancing
the
equations
of
motion
.
It
specifies
a
:
class
:`
BAOAB
LangevinIntegrator
`,
which
performs
Langevin
dynamics
,
It
specifies
a
:
class
:`
Langevin
Middle
Integrator
`,
which
performs
Langevin
dynamics
,
and
assigns
it
to
a
variable
called
:
code
:`
integrator
`\
.
It
also
specifies
the
values
of
three
parameters
that
are
specific
to
Langevin
dynamics
:
the
simulation
temperature
(
300
K
),
the
friction
coefficient
(
1
ps
\
:
sup
:`-
1
`\
),
and
...
...
@@ -295,7 +295,7 @@ found in OpenMM’s :file:`examples` folder with the name :file:`simulateAmber.p
inpcrd
=
AmberInpcrdFile
(
'input.inpcrd'
)
system
=
prmtop
.
createSystem
(
nonbondedMethod
=
PME
,
nonbondedCutoff
=
1
*
nanometer
,
constraints
=
HBonds
)
integrator
=
BAOAB
LangevinIntegrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
integrator
=
Langevin
Middle
Integrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
simulation
=
Simulation
(
prmtop
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
inpcrd
.
positions
)
if
inpcrd
.
boxVectors
is
not
None
:
...
...
@@ -389,7 +389,7 @@ with the name :file:`simulateGromacs.py`.
includeDir
=
'/usr/local/gromacs/share/gromacs/top'
)
system
=
top
.
createSystem
(
nonbondedMethod
=
PME
,
nonbondedCutoff
=
1
*
nanometer
,
constraints
=
HBonds
)
integrator
=
BAOAB
LangevinIntegrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
integrator
=
Langevin
Middle
Integrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
simulation
=
Simulation
(
top
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
gro
.
positions
)
simulation
.
minimizeEnergy
()
...
...
@@ -453,7 +453,7 @@ on the :class:`CharmmPsfFile`.
params
=
CharmmParameterSet
(
'charmm22.rtf'
,
'charmm22.prm'
)
system
=
psf
.
createSystem
(
params
,
nonbondedMethod
=
NoCutoff
,
nonbondedCutoff
=
1
*
nanometer
,
constraints
=
HBonds
)
integrator
=
BAOAB
LangevinIntegrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
integrator
=
Langevin
Middle
Integrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
simulation
=
Simulation
(
psf
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
pdb
.
positions
)
simulation
.
minimizeEnergy
()
...
...
@@ -1031,7 +1031,7 @@ BAOAB Langevin Integrator
In the examples of the previous sections, we used Langevin integration:
::
integrator =
BAOAB
LangevinIntegrator(300*kelvin, 1/picosecond, 0.004*picoseconds)
integrator = Langevin
Middle
Integrator(300*kelvin, 1/picosecond, 0.004*picoseconds)
The three parameter values in this line are the simulation temperature (300 K),
the friction coefficient (1 ps\ :sup:`-1`\ ), and the step size (0.004 ps). You
...
...
@@ -1043,11 +1043,11 @@ equivalent.
Langevin Integrator
-------------------
:code:`LangevinIntegrator` is very similar to :code:`
BAOAB
LangevinIntegrator`,
:code:`LangevinIntegrator` is very similar to :code:`Langevin
Middle
Integrator`,
but it uses a different discretization of the Langevin equation.
:code:`
BAOAB
LangevinIntegrator` tends to produce more accurate configurational
:code:`Langevin
Middle
Integrator` tends to produce more accurate configurational
sampling, and therefore is preferred for most applications. Also note that
:code:`LangevinIntegrator` (unlike :code:`
BAOAB
LangevinIntegrator`) is a leapfrog
:code:`LangevinIntegrator` (unlike :code:`Langevin
Middle
Integrator`) is a leapfrog
integrator, so the velocities are offset by half a time step from the positions.
Leapfrog Verlet Integrator
...
...
@@ -1158,7 +1158,7 @@ previous section:
system = prmtop.createSystem(nonbondedMethod=PME, nonbondedCutoff=1*nanometer,
constraints=HBonds)
system.addForce(MonteCarloBarostat(1*bar, 300*kelvin))
integrator =
BAOAB
LangevinIntegrator(300*kelvin, 1/picosecond, 0.004*picoseconds)
integrator = Langevin
Middle
Integrator(300*kelvin, 1/picosecond, 0.004*picoseconds)
...
The parameters of the Monte Carlo barostat are the pressure (1 bar) and
...
...
@@ -1718,7 +1718,7 @@ executing 1000 time steps at each temperature:
:
autonumber
:`
Example
,
simulated
annealing
`
This
code
needs
very
little
explanation
.
The
loop
is
executed
100
times
.
Each
time
through
,
it
adjusts
the
temperature
of
the
:
class
:`
BAOAB
LangevinIntegrator
`
and
then
time
through
,
it
adjusts
the
temperature
of
the
:
class
:`
Langevin
Middle
Integrator
`
and
then
calls
:
code
:`
step
(
1000
)`
to
take
1000
time
steps
.
Applying
an
External
Force
to
Particles
:
a
Spherical
Container
...
...
@@ -1750,7 +1750,7 @@ coordinates. Here is the code to do it:
system
.
addForce
(
force
)
for
i
in
range
(
system
.
getNumParticles
()):
force
.
addParticle
(
i
,
[])
integrator
=
BAOAB
LangevinIntegrator
(
300
*
kelvin
,
91
/
picosecond
,
0.004
*
picoseconds
)
integrator
=
Langevin
Middle
Integrator
(
300
*
kelvin
,
91
/
picosecond
,
0.004
*
picoseconds
)
...
..
caption
::
...
...
docs-source/usersguide/library.rst
View file @
65ee8fd7
...
...
@@ -243,14 +243,14 @@ simulation might look like:
angles
->
addAngle
(
angle
[
i
].
particle1
,
angle
[
i
].
particle2
,
angle
[
i
].
particle3
,
angle
[
i
].
angle
,
angle
[
i
].
k
);
//
...
create
and
initialize
other
force
field
terms
in
the
same
way
BAOAB
LangevinIntegrator
integrator
(
temperature
,
friction
,
stepSize
);
Langevin
Middle
Integrator
integrator
(
temperature
,
friction
,
stepSize
);
Context
context
(
system
,
integrator
);
context
.
setPositions
(
initialPositions
);
context
.
setVelocities
(
initialVelocities
);
integrator
.
step
(
10000
);
We
create
a
System
,
add
various
Forces
to
it
,
and
set
parameters
on
both
the
System
and
the
Forces
.
We
then
create
a
BAOAB
LangevinIntegrator
,
initialize
a
System
and
the
Forces
.
We
then
create
a
Langevin
Middle
Integrator
,
initialize
a
Context
in
which
to
run
a
simulation
,
and
instruct
the
Integrator
to
advance
the
simulation
for
10
,
000
time
steps
.
...
...
@@ -1631,7 +1631,7 @@ along with the handle :code:`omm`\ , back to the calling function.
//
best
available
Platform
.
Initialize
the
configuration
from
the
default
//
positions
we
collected
above
.
Initial
velocities
will
be
zero
but
could
//
have
been
set
here
.
omm
->
integrator
=
new
OpenMM
::
BAOAB
LangevinIntegrator
(
temperature
,
omm
->
integrator
=
new
OpenMM
::
Langevin
Middle
Integrator
(
temperature
,
frictionInPs
,
stepSizeInFs
*
OpenMM
::
PsPerFs
);
omm
->
context
=
new
OpenMM
::
Context
(*
omm
->
system
,
*
omm
->
integrator
);
...
...
docs-source/usersguide/theory.rst
View file @
65ee8fd7
...
...
@@ -1353,8 +1353,8 @@ random number, and :math:`\alpha=\exp(-\gamma\Delta t)`.
The same comments about the offset between positions and velocities apply to
this integrator as to VerletIntegrator.
BAOAB
LangevinIntegrator
***********************
Langevin
Middle
Integrator
***********************
*
This integrator is similar to LangevinIntegerator, but it instead uses the BAOAB
discretization. :cite:`Leimkuhler2013` In each step, the positions and velocities
...
...
examples/HelloSodiumChloride.cpp
View file @
65ee8fd7
...
...
@@ -249,7 +249,7 @@ myInitializeOpenMM( const MyAtomInfo atoms[],
// best available Platform. Initialize the configuration from the default
// positions we collected above. Initial velocities will be zero but could
// have been set here.
omm
->
integrator
=
new
OpenMM
::
BAOAB
LangevinIntegrator
(
temperature
,
frictionInPs
,
omm
->
integrator
=
new
OpenMM
::
Langevin
Middle
Integrator
(
temperature
,
frictionInPs
,
stepSizeInFs
*
OpenMM
::
PsPerFs
);
omm
->
context
=
new
OpenMM
::
Context
(
*
omm
->
system
,
*
omm
->
integrator
);
omm
->
context
->
setPositions
(
initialPosInNm
);
...
...
examples/HelloSodiumChlorideInC.c
View file @
65ee8fd7
...
...
@@ -252,7 +252,7 @@ myInitializeOpenMM( const MyAtomInfo atoms[],
* best available Platform. Initialize the configuration from the default
* positions we collected above. Initial velocities will be zero but could
* have been set here. */
omm
->
integrator
=
(
OpenMM_Integrator
*
)
OpenMM_
BAOAB
LangevinIntegrator_create
(
omm
->
integrator
=
(
OpenMM_Integrator
*
)
OpenMM_Langevin
Middle
Integrator_create
(
temperature
,
frictionInPerPs
,
stepSizeInFs
*
OpenMM_PsPerFs
);
omm
->
context
=
OpenMM_Context_create
(
omm
->
system
,
omm
->
integrator
);
...
...
examples/HelloSodiumChlorideInFortran.f90
View file @
65ee8fd7
...
...
@@ -171,7 +171,7 @@ SUBROUTINE myInitializeOpenMM(ommHandle, platformName)
! These are the objects we'll create here thare are stored in the
! Context for later access. Don't forget to delete them at the end.
type
(
OpenMM_System
)
system
type
(
OpenMM_
BAOAB
LangevinIntegrator
)
langevin
type
(
OpenMM_Langevin
Middle
Integrator
)
langevin
type
(
OpenMM_Context
)
context
! These are temporary OpenMM objects used and discarded here.
...
...
@@ -236,11 +236,11 @@ SUBROUTINE myInitializeOpenMM(ommHandle, platformName)
! best available Platform. Initialize the configuration from the default
! positions we collected above. Initial velocities will be zero but could
! have been set here.
call
OpenMM_
BAOAB
LangevinIntegrator_create
(
langevin
,
&
call
OpenMM_Langevin
Middle
Integrator_create
(
langevin
,
&
Temperature
,
FrictionInPerPs
,
&
StepSizeInFs
*
OpenMM_PsPerFs
)
! Convert
BAOAB
LangevinIntegrator to generic Integrator type for this call.
! Convert Langevin
Middle
Integrator to generic Integrator type for this call.
call
OpenMM_Context_create
(
context
,
system
,
&
transfer
(
langevin
,
OpenMM_Integrator
(
0
)))
call
OpenMM_Context_setPositions
(
context
,
initialPosInNm
)
...
...
examples/simulateAmber.py
View file @
65ee8fd7
...
...
@@ -6,7 +6,7 @@ from sys import stdout
prmtop
=
AmberPrmtopFile
(
'input.prmtop'
)
inpcrd
=
AmberInpcrdFile
(
'input.inpcrd'
)
system
=
prmtop
.
createSystem
(
nonbondedMethod
=
PME
,
nonbondedCutoff
=
1
*
nanometer
,
constraints
=
HBonds
)
integrator
=
BAOAB
LangevinIntegrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
integrator
=
Langevin
Middle
Integrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
simulation
=
Simulation
(
prmtop
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
inpcrd
.
positions
)
if
inpcrd
.
boxVectors
is
not
None
:
...
...
examples/simulateCharmm.py
View file @
65ee8fd7
...
...
@@ -21,7 +21,7 @@ params = CharmmParameterSet('charmm22.rtf', 'charmm22.par')
# Instantiate the system
system
=
psf
.
createSystem
(
params
,
nonbondedMethod
=
NoCutoff
,
constraints
=
HBonds
)
integrator
=
BAOAB
LangevinIntegrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
integrator
=
Langevin
Middle
Integrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
simulation
=
Simulation
(
psf
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
pdb
.
getPositions
())
simulation
.
minimizeEnergy
()
...
...
examples/simulateGromacs.py
View file @
65ee8fd7
...
...
@@ -6,7 +6,7 @@ from sys import stdout
gro
=
GromacsGroFile
(
'input.gro'
)
top
=
GromacsTopFile
(
'input.top'
,
periodicBoxVectors
=
gro
.
getPeriodicBoxVectors
())
system
=
top
.
createSystem
(
nonbondedMethod
=
PME
,
nonbondedCutoff
=
1
*
nanometer
,
constraints
=
HBonds
)
integrator
=
BAOAB
LangevinIntegrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
integrator
=
Langevin
Middle
Integrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
simulation
=
Simulation
(
top
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
gro
.
positions
)
simulation
.
minimizeEnergy
()
...
...
examples/simulatePdb.py
View file @
65ee8fd7
...
...
@@ -6,7 +6,7 @@ from sys import stdout
pdb
=
PDBFile
(
'input.pdb'
)
forcefield
=
ForceField
(
'amber14-all.xml'
,
'amber14/tip3pfb.xml'
)
system
=
forcefield
.
createSystem
(
pdb
.
topology
,
nonbondedMethod
=
PME
,
nonbondedCutoff
=
1
*
nanometer
,
constraints
=
HBonds
)
integrator
=
BAOAB
LangevinIntegrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
integrator
=
Langevin
Middle
Integrator
(
300
*
kelvin
,
1
/
picosecond
,
0.004
*
picoseconds
)
simulation
=
Simulation
(
pdb
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
pdb
.
positions
)
simulation
.
minimizeEnergy
()
...
...
olla/include/openmm/kernels.h
View file @
65ee8fd7
...
...
@@ -33,7 +33,7 @@
* -------------------------------------------------------------------------- */
#include "openmm/AndersenThermostat.h"
#include "openmm/
BAOAB
LangevinIntegrator.h"
#include "openmm/Langevin
Middle
Integrator.h"
#include "openmm/BrownianIntegrator.h"
#include "openmm/CMAPTorsionForce.h"
#include "openmm/CMMotionRemover.h"
...
...
@@ -1129,36 +1129,36 @@ public:
};
/**
* This kernel is invoked by
BAOAB
LangevinIntegrator to take one time step.
* This kernel is invoked by Langevin
Middle
Integrator to take one time step.
*/
class
Integrate
BAOAB
StepKernel
:
public
KernelImpl
{
class
Integrate
LangevinMiddle
StepKernel
:
public
KernelImpl
{
public:
static
std
::
string
Name
()
{
return
"Integrate
BAOAB
Step"
;
return
"Integrate
LangevinMiddle
Step"
;
}
Integrate
BAOAB
StepKernel
(
std
::
string
name
,
const
Platform
&
platform
)
:
KernelImpl
(
name
,
platform
)
{
Integrate
LangevinMiddle
StepKernel
(
std
::
string
name
,
const
Platform
&
platform
)
:
KernelImpl
(
name
,
platform
)
{
}
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
* @param integrator the
BAOAB
LangevinIntegrator this kernel will be used for
* @param integrator the Langevin
Middle
Integrator this kernel will be used for
*/
virtual
void
initialize
(
const
System
&
system
,
const
BAOAB
LangevinIntegrator
&
integrator
)
=
0
;
virtual
void
initialize
(
const
System
&
system
,
const
Langevin
Middle
Integrator
&
integrator
)
=
0
;
/**
* Execute the kernel.
*
* @param context the context in which to execute this kernel
* @param integrator the
BAOAB
LangevinIntegrator this kernel is being used for
* @param integrator the Langevin
Middle
Integrator this kernel is being used for
*/
virtual
void
execute
(
ContextImpl
&
context
,
const
BAOAB
LangevinIntegrator
&
integrator
)
=
0
;
virtual
void
execute
(
ContextImpl
&
context
,
const
Langevin
Middle
Integrator
&
integrator
)
=
0
;
/**
* Compute the kinetic energy.
*
* @param context the context in which to execute this kernel
* @param integrator the
BAOAB
LangevinIntegrator this kernel is being used for
* @param integrator the Langevin
Middle
Integrator this kernel is being used for
*/
virtual
double
computeKineticEnergy
(
ContextImpl
&
context
,
const
BAOAB
LangevinIntegrator
&
integrator
)
=
0
;
virtual
double
computeKineticEnergy
(
ContextImpl
&
context
,
const
Langevin
Middle
Integrator
&
integrator
)
=
0
;
};
/**
...
...
openmmapi/include/OpenMM.h
View file @
65ee8fd7
...
...
@@ -33,7 +33,6 @@
* -------------------------------------------------------------------------- */
#include "openmm/AndersenThermostat.h"
#include "openmm/BAOABLangevinIntegrator.h"
#include "openmm/BrownianIntegrator.h"
#include "openmm/CMAPTorsionForce.h"
#include "openmm/CMMotionRemover.h"
...
...
@@ -57,6 +56,7 @@
#include "openmm/HarmonicBondForce.h"
#include "openmm/Integrator.h"
#include "openmm/LangevinIntegrator.h"
#include "openmm/LangevinMiddleIntegrator.h"
#include "openmm/LocalEnergyMinimizer.h"
#include "openmm/MonteCarloAnisotropicBarostat.h"
#include "openmm/MonteCarloBarostat.h"
...
...
openmmapi/include/openmm/CustomIntegrator.h
View file @
65ee8fd7
...
...
@@ -236,7 +236,7 @@ namespace OpenMM {
* </pre></tt>
*
* The second one implements the algorithm used by the standard
*
BAOAB
LangevinIntegrator class. kB is Boltzmann's constant.
* Langevin
Middle
Integrator class. kB is Boltzmann's constant.
*
* <tt><pre>
* CustomIntegrator integrator(dt);
...
...
openmmapi/include/openmm/
BAOAB
LangevinIntegrator.h
→
openmmapi/include/openmm/Langevin
Middle
Integrator.h
View file @
65ee8fd7
#ifndef OPENMM_
BAOAB
LANGEVININTEGRATOR_H_
#define OPENMM_
BAOAB
LANGEVININTEGRATOR_H_
#ifndef OPENMM_LANGEVIN
MIDDLE
INTEGRATOR_H_
#define OPENMM_LANGEVIN
MIDDLE
INTEGRATOR_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
...
...
@@ -45,16 +45,16 @@ namespace OpenMM {
* discretizations, such as the one used in LangevinIntegrator.
*/
class
OPENMM_EXPORT
BAOAB
LangevinIntegrator
:
public
Integrator
{
class
OPENMM_EXPORT
Langevin
Middle
Integrator
:
public
Integrator
{
public:
/**
* Create a
BAOAB
LangevinIntegrator.
* Create a Langevin
Middle
Integrator.
*
* @param temperature the temperature of the heat bath (in Kelvin)
* @param frictionCoeff the friction coefficient which couples the system to the heat bath (in inverse picoseconds)
* @param stepSize the step size with which to integrate the system (in picoseconds)
*/
BAOAB
LangevinIntegrator
(
double
temperature
,
double
frictionCoeff
,
double
stepSize
);
Langevin
Middle
Integrator
(
double
temperature
,
double
frictionCoeff
,
double
stepSize
);
/**
* Get the temperature of the heat bath (in Kelvin).
*
...
...
@@ -148,4 +148,4 @@ private:
}
// namespace OpenMM
#endif
/*OPENMM_
BAOAB
LANGEVININTEGRATOR_H_*/
#endif
/*OPENMM_LANGEVIN
MIDDLE
INTEGRATOR_H_*/
openmmapi/src/
BAOAB
LangevinIntegrator.cpp
→
openmmapi/src/Langevin
Middle
Integrator.cpp
View file @
65ee8fd7
...
...
@@ -29,7 +29,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/
BAOAB
LangevinIntegrator.h"
#include "openmm/Langevin
Middle
Integrator.h"
#include "openmm/Context.h"
#include "openmm/OpenMMException.h"
#include "openmm/internal/ContextImpl.h"
...
...
@@ -40,7 +40,7 @@ using namespace OpenMM;
using
std
::
string
;
using
std
::
vector
;
BAOAB
LangevinIntegrator
::
BAOAB
LangevinIntegrator
(
double
temperature
,
double
frictionCoeff
,
double
stepSize
)
{
Langevin
Middle
Integrator
::
Langevin
Middle
Integrator
(
double
temperature
,
double
frictionCoeff
,
double
stepSize
)
{
setTemperature
(
temperature
);
setFriction
(
frictionCoeff
);
setStepSize
(
stepSize
);
...
...
@@ -48,39 +48,39 @@ BAOABLangevinIntegrator::BAOABLangevinIntegrator(double temperature, double fric
setRandomNumberSeed
(
0
);
}
void
BAOAB
LangevinIntegrator
::
initialize
(
ContextImpl
&
contextRef
)
{
void
Langevin
Middle
Integrator
::
initialize
(
ContextImpl
&
contextRef
)
{
if
(
owner
!=
NULL
&&
&
contextRef
.
getOwner
()
!=
owner
)
throw
OpenMMException
(
"This Integrator is already bound to a context"
);
context
=
&
contextRef
;
owner
=
&
contextRef
.
getOwner
();
kernel
=
context
->
getPlatform
().
createKernel
(
Integrate
BAOAB
StepKernel
::
Name
(),
contextRef
);
kernel
.
getAs
<
Integrate
BAOAB
StepKernel
>
().
initialize
(
contextRef
.
getSystem
(),
*
this
);
kernel
=
context
->
getPlatform
().
createKernel
(
Integrate
LangevinMiddle
StepKernel
::
Name
(),
contextRef
);
kernel
.
getAs
<
Integrate
LangevinMiddle
StepKernel
>
().
initialize
(
contextRef
.
getSystem
(),
*
this
);
}
void
BAOAB
LangevinIntegrator
::
cleanup
()
{
void
Langevin
Middle
Integrator
::
cleanup
()
{
kernel
=
Kernel
();
}
vector
<
string
>
BAOAB
LangevinIntegrator
::
getKernelNames
()
{
vector
<
string
>
Langevin
Middle
Integrator
::
getKernelNames
()
{
std
::
vector
<
std
::
string
>
names
;
names
.
push_back
(
Integrate
BAOAB
StepKernel
::
Name
());
names
.
push_back
(
Integrate
LangevinMiddle
StepKernel
::
Name
());
return
names
;
}
double
BAOAB
LangevinIntegrator
::
computeKineticEnergy
()
{
return
kernel
.
getAs
<
Integrate
BAOAB
StepKernel
>
().
computeKineticEnergy
(
*
context
,
*
this
);
double
Langevin
Middle
Integrator
::
computeKineticEnergy
()
{
return
kernel
.
getAs
<
Integrate
LangevinMiddle
StepKernel
>
().
computeKineticEnergy
(
*
context
,
*
this
);
}
bool
BAOAB
LangevinIntegrator
::
kineticEnergyRequiresForce
()
const
{
bool
Langevin
Middle
Integrator
::
kineticEnergyRequiresForce
()
const
{
return
false
;
}
void
BAOAB
LangevinIntegrator
::
step
(
int
steps
)
{
void
Langevin
Middle
Integrator
::
step
(
int
steps
)
{
if
(
context
==
NULL
)
throw
OpenMMException
(
"This Integrator is not bound to a context!"
);
for
(
int
i
=
0
;
i
<
steps
;
++
i
)
{
context
->
updateContextState
();
context
->
calcForcesAndEnergy
(
true
,
false
);
kernel
.
getAs
<
Integrate
BAOAB
StepKernel
>
().
execute
(
*
context
,
*
this
);
kernel
.
getAs
<
Integrate
LangevinMiddle
StepKernel
>
().
execute
(
*
context
,
*
this
);
}
}
platforms/common/include/openmm/common/CommonKernels.h
View file @
65ee8fd7
...
...
@@ -905,34 +905,34 @@ private:
};
/**
* This kernel is invoked by
BAOAB
LangevinIntegrator to take one time step.
* This kernel is invoked by Langevin
Middle
Integrator to take one time step.
*/
class
CommonIntegrate
BAOAB
StepKernel
:
public
Integrate
BAOAB
StepKernel
{
class
CommonIntegrate
LangevinMiddle
StepKernel
:
public
Integrate
LangevinMiddle
StepKernel
{
public:
CommonIntegrate
BAOAB
StepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ComputeContext
&
cc
)
:
Integrate
BAOAB
StepKernel
(
name
,
platform
),
cc
(
cc
),
CommonIntegrate
LangevinMiddle
StepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ComputeContext
&
cc
)
:
Integrate
LangevinMiddle
StepKernel
(
name
,
platform
),
cc
(
cc
),
hasInitializedKernels
(
false
)
{
}
/**
* Initialize the kernel, setting up the particle masses.
*
* @param system the System this kernel will be applied to
* @param integrator the
BAOAB
LangevinIntegrator this kernel will be used for
* @param integrator the Langevin
Middle
Integrator this kernel will be used for
*/
void
initialize
(
const
System
&
system
,
const
BAOAB
LangevinIntegrator
&
integrator
);
void
initialize
(
const
System
&
system
,
const
Langevin
Middle
Integrator
&
integrator
);
/**
* Execute the kernel.
*
* @param context the context in which to execute this kernel
* @param integrator the
BAOAB
LangevinIntegrator this kernel is being used for
* @param integrator the Langevin
Middle
Integrator this kernel is being used for
*/
void
execute
(
ContextImpl
&
context
,
const
BAOAB
LangevinIntegrator
&
integrator
);
void
execute
(
ContextImpl
&
context
,
const
Langevin
Middle
Integrator
&
integrator
);
/**
* Compute the kinetic energy.
*
* @param context the context in which to execute this kernel
* @param integrator the
BAOAB
LangevinIntegrator this kernel is being used for
* @param integrator the Langevin
Middle
Integrator this kernel is being used for
*/
double
computeKineticEnergy
(
ContextImpl
&
context
,
const
BAOAB
LangevinIntegrator
&
integrator
);
double
computeKineticEnergy
(
ContextImpl
&
context
,
const
Langevin
Middle
Integrator
&
integrator
);
private:
ComputeContext
&
cc
;
double
prevTemp
,
prevFriction
,
prevStepSize
;
...
...
platforms/common/src/CommonKernels.cpp
View file @
65ee8fd7
...
...
@@ -5547,26 +5547,26 @@ double CommonIntegrateLangevinStepKernel::computeKineticEnergy(ContextImpl& cont
return
cc
.
getIntegrationUtilities
().
computeKineticEnergy
(
0.5
*
integrator
.
getStepSize
());
}
void
CommonIntegrate
BAOAB
StepKernel
::
initialize
(
const
System
&
system
,
const
BAOAB
LangevinIntegrator
&
integrator
)
{
void
CommonIntegrate
LangevinMiddle
StepKernel
::
initialize
(
const
System
&
system
,
const
Langevin
Middle
Integrator
&
integrator
)
{
cc
.
initializeContexts
();
cc
.
setAsCurrent
();
cc
.
getIntegrationUtilities
().
initRandomNumberGenerator
(
integrator
.
getRandomNumberSeed
());
ComputeProgram
program
=
cc
.
compileProgram
(
CommonKernelSources
::
baoab
);
kernel1
=
program
->
createKernel
(
"integrate
BAOAB
Part1"
);
kernel2
=
program
->
createKernel
(
"integrate
BAOAB
Part2"
);
kernel3
=
program
->
createKernel
(
"integrate
BAOAB
Part3"
);
ComputeProgram
program
=
cc
.
compileProgram
(
CommonKernelSources
::
langevinMiddle
);
kernel1
=
program
->
createKernel
(
"integrate
LangevinMiddle
Part1"
);
kernel2
=
program
->
createKernel
(
"integrate
LangevinMiddle
Part2"
);
kernel3
=
program
->
createKernel
(
"integrate
LangevinMiddle
Part3"
);
if
(
cc
.
getUseDoublePrecision
()
||
cc
.
getUseMixedPrecision
())
{
params
.
initialize
<
double
>
(
cc
,
2
,
"
baoab
Params"
);
params
.
initialize
<
double
>
(
cc
,
2
,
"
langevinMiddle
Params"
);
oldDelta
.
initialize
<
mm_double4
>
(
cc
,
cc
.
getPaddedNumAtoms
(),
"oldDelta"
);
}
else
{
params
.
initialize
<
float
>
(
cc
,
2
,
"
baoab
Params"
);
params
.
initialize
<
float
>
(
cc
,
2
,
"
langevinMiddle
Params"
);
oldDelta
.
initialize
<
mm_float4
>
(
cc
,
cc
.
getPaddedNumAtoms
(),
"oldDelta"
);
}
prevStepSize
=
-
1.0
;
}
void
CommonIntegrate
BAOAB
StepKernel
::
execute
(
ContextImpl
&
context
,
const
BAOAB
LangevinIntegrator
&
integrator
)
{
void
CommonIntegrate
LangevinMiddle
StepKernel
::
execute
(
ContextImpl
&
context
,
const
Langevin
Middle
Integrator
&
integrator
)
{
IntegrationUtilities
&
integration
=
cc
.
getIntegrationUtilities
();
int
numAtoms
=
cc
.
getNumAtoms
();
int
paddedNumAtoms
=
cc
.
getPaddedNumAtoms
();
...
...
@@ -5636,7 +5636,7 @@ void CommonIntegrateBAOABStepKernel::execute(ContextImpl& context, const BAOABLa
#endif
}
double
CommonIntegrate
BAOAB
StepKernel
::
computeKineticEnergy
(
ContextImpl
&
context
,
const
BAOAB
LangevinIntegrator
&
integrator
)
{
double
CommonIntegrate
LangevinMiddle
StepKernel
::
computeKineticEnergy
(
ContextImpl
&
context
,
const
Langevin
Middle
Integrator
&
integrator
)
{
return
cc
.
getIntegrationUtilities
().
computeKineticEnergy
(
0.0
);
}
...
...
platforms/common/src/kernels/
baoab
.cc
→
platforms/common/src/kernels/
langevinMiddle
.cc
View file @
65ee8fd7
enum
{
VelScale
,
NoiseScale
};
/**
* Perform the first part of
BAOAB
integration: velocity
half step, then position half
step.
* Perform the first part of integration: velocity step.
*/
KERNEL
void
integrate
BAOAB
Part1
(
int
numAtoms
,
int
paddedNumAtoms
,
GLOBAL
mixed4
*
RESTRICT
velm
,
GLOBAL
const
mm_long
*
RESTRICT
force
,
KERNEL
void
integrate
LangevinMiddle
Part1
(
int
numAtoms
,
int
paddedNumAtoms
,
GLOBAL
mixed4
*
RESTRICT
velm
,
GLOBAL
const
mm_long
*
RESTRICT
force
,
GLOBAL
const
mixed2
*
RESTRICT
dt
)
{
mixed
fscale
=
dt
[
0
].
y
/
(
mixed
)
0x100000000
;
for
(
int
index
=
GLOBAL_ID
;
index
<
numAtoms
;
index
+=
GLOBAL_SIZE
)
{
...
...
@@ -19,11 +19,11 @@ KERNEL void integrateBAOABPart1(int numAtoms, int paddedNumAtoms, GLOBAL mixed4*
}
/**
* Perform the second part of
BAOAB
integration:
apply constraint forces to velocities
, then interact with heat bath,
* then position half step.
* Perform the second part of integration:
position half step
, then interact with heat bath,
* then
another
position half step.
*/
KERNEL
void
integrate
BAOAB
Part2
(
int
numAtoms
,
GLOBAL
mixed4
*
RESTRICT
velm
,
GLOBAL
mixed4
*
RESTRICT
posDelta
,
KERNEL
void
integrate
LangevinMiddle
Part2
(
int
numAtoms
,
GLOBAL
mixed4
*
RESTRICT
velm
,
GLOBAL
mixed4
*
RESTRICT
posDelta
,
GLOBAL
mixed4
*
RESTRICT
oldDelta
,
GLOBAL
const
mixed
*
RESTRICT
paramBuffer
,
GLOBAL
const
mixed2
*
RESTRICT
dt
,
GLOBAL
const
float4
*
RESTRICT
random
,
unsigned
int
randomIndex
)
{
mixed
vscale
=
paramBuffer
[
VelScale
];
...
...
@@ -50,11 +50,11 @@ KERNEL void integrateBAOABPart2(int numAtoms, GLOBAL mixed4* RESTRICT velm, GLOB
}
/**
* Perform the third part of
BAOAB
integration: apply constraint forces to velocities, then record
* the constrained positions
in preparation for computing forces
.
* Perform the third part of integration: apply constraint forces to velocities, then record
* the constrained positions.
*/
KERNEL
void
integrate
BAOAB
Part3
(
int
numAtoms
,
GLOBAL
real4
*
RESTRICT
posq
,
GLOBAL
mixed4
*
RESTRICT
velm
,
KERNEL
void
integrate
LangevinMiddle
Part3
(
int
numAtoms
,
GLOBAL
real4
*
RESTRICT
posq
,
GLOBAL
mixed4
*
RESTRICT
velm
,
GLOBAL
mixed4
*
RESTRICT
posDelta
,
GLOBAL
mixed4
*
RESTRICT
oldDelta
,
GLOBAL
const
mixed2
*
RESTRICT
dt
#ifdef USE_MIXED_PRECISION
,
GLOBAL
real4
*
RESTRICT
posqCorrection
...
...
platforms/cpu/include/CpuKernels.h
View file @
65ee8fd7
...
...
@@ -32,7 +32,6 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "CpuBAOABDynamics.h"
#include "CpuBondForce.h"
#include "CpuCustomGBForce.h"
#include "CpuCustomManyParticleForce.h"
...
...
@@ -40,6 +39,7 @@
#include "CpuGayBerneForce.h"
#include "CpuGBSAOBCForce.h"
#include "CpuLangevinDynamics.h"
#include "CpuLangevinMiddleDynamics.h"
#include "CpuNeighborList.h"
#include "CpuNonbondedForce.h"
#include "CpuPlatform.h"
...
...
@@ -538,38 +538,38 @@ private:
};
/**
* This kernel is invoked by
BAOAB
LangevinIntegrator to take one time step.
* This kernel is invoked by Langevin
Middle
Integrator to take one time step.
*/
class
CpuIntegrate
BAOAB
StepKernel
:
public
Integrate
BAOAB
StepKernel
{
class
CpuIntegrate
LangevinMiddle
StepKernel
:
public
Integrate
LangevinMiddle
StepKernel
{
public:
CpuIntegrate
BAOAB
StepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CpuPlatform
::
PlatformData
&
data
)
:
Integrate
BAOAB
StepKernel
(
name
,
platform
),
CpuIntegrate
LangevinMiddle
StepKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CpuPlatform
::
PlatformData
&
data
)
:
Integrate
LangevinMiddle
StepKernel
(
name
,
platform
),
data
(
data
),
dynamics
(
0
)
{
}
~
CpuIntegrate
BAOAB
StepKernel
();
~
CpuIntegrate
LangevinMiddle
StepKernel
();
/**
* Initialize the kernel, setting up the particle masses.
*
* @param system the System this kernel will be applied to
* @param integrator the
BAOAB
LangevinIntegrator this kernel will be used for
* @param integrator the Langevin
Middle
Integrator this kernel will be used for
*/
void
initialize
(
const
System
&
system
,
const
BAOAB
LangevinIntegrator
&
integrator
);
void
initialize
(
const
System
&
system
,
const
Langevin
Middle
Integrator
&
integrator
);
/**
* Execute the kernel.
*
* @param context the context in which to execute this kernel
* @param integrator the
BAOAB
LangevinIntegrator this kernel is being used for
* @param integrator the Langevin
Middle
Integrator this kernel is being used for
*/
void
execute
(
ContextImpl
&
context
,
const
BAOAB
LangevinIntegrator
&
integrator
);
void
execute
(
ContextImpl
&
context
,
const
Langevin
Middle
Integrator
&
integrator
);
/**
* Compute the kinetic energy.
*
* @param context the context in which to execute this kernel
* @param integrator the
BAOAB
LangevinIntegrator this kernel is being used for
* @param integrator the Langevin
Middle
Integrator this kernel is being used for
*/
double
computeKineticEnergy
(
ContextImpl
&
context
,
const
BAOAB
LangevinIntegrator
&
integrator
);
double
computeKineticEnergy
(
ContextImpl
&
context
,
const
Langevin
Middle
Integrator
&
integrator
);
private:
CpuPlatform
::
PlatformData
&
data
;
Cpu
BAOAB
Dynamics
*
dynamics
;
Cpu
LangevinMiddle
Dynamics
*
dynamics
;
std
::
vector
<
double
>
masses
;
double
prevTemp
,
prevFriction
,
prevStepSize
;
};
...
...
platforms/cpu/include/Cpu
BAOAB
Dynamics.h
→
platforms/cpu/include/Cpu
LangevinMiddle
Dynamics.h
View file @
65ee8fd7
...
...
@@ -23,17 +23,17 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __CPU_
BAOAB
_DYNAMICS_H__
#define __CPU_
BAOAB
_DYNAMICS_H__
#ifndef __CPU_
LANGEVIN_MIDDLE
_DYNAMICS_H__
#define __CPU_
LANGEVIN_MIDDLE
_DYNAMICS_H__
#include "Reference
BAOAB
Dynamics.h"
#include "Reference
LangevinMiddle
Dynamics.h"
#include "CpuRandom.h"
#include "openmm/internal/ThreadPool.h"
#include "sfmt/SFMT.h"
namespace
OpenMM
{
class
Cpu
BAOAB
Dynamics
:
public
Reference
BAOAB
Dynamics
{
class
Cpu
LangevinMiddle
Dynamics
:
public
Reference
LangevinMiddle
Dynamics
{
public:
/**
* Constructor.
...
...
@@ -45,12 +45,12 @@ public:
* @param threads thread pool for parallelizing computation
* @param random random number generator
*/
Cpu
BAOAB
Dynamics
(
int
numberOfAtoms
,
double
deltaT
,
double
friction
,
double
temperature
,
OpenMM
::
ThreadPool
&
threads
,
OpenMM
::
CpuRandom
&
random
);
Cpu
LangevinMiddle
Dynamics
(
int
numberOfAtoms
,
double
deltaT
,
double
friction
,
double
temperature
,
OpenMM
::
ThreadPool
&
threads
,
OpenMM
::
CpuRandom
&
random
);
/**
* Destructor.
*/
~
Cpu
BAOAB
Dynamics
();
~
Cpu
LangevinMiddle
Dynamics
();
/**
* First update step.
...
...
@@ -105,4 +105,4 @@ private:
}
// namespace OpenMM
#endif // __CPU_
BAOAB
_DYNAMICS_H__
#endif // __CPU_
LANGEVIN_MIDDLE
_DYNAMICS_H__
Prev
1
2
3
Next
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