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
7bdf028c
Unverified
Commit
7bdf028c
authored
Mar 10, 2025
by
Peter Eastman
Committed by
GitHub
Mar 10, 2025
Browse files
Examples use DCDReporter instead of PDBReporter (#4838)
parent
68c97c5b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
21 deletions
+21
-21
docs-source/usersguide/application/02_running_sims.rst
docs-source/usersguide/application/02_running_sims.rst
+17
-17
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
No files found.
docs-source/usersguide/application/02_running_sims.rst
View file @
7bdf028c
...
...
@@ -13,7 +13,7 @@ A First Example
Let
’
s
begin
with
our
first
example
of
an
OpenMM
script
.
It
loads
a
PDB
file
called
:
file
:`
input
.
pdb
`
that
defines
a
biomolecular
system
,
parameterizes
it
using
the
Amber14
force
field
and
TIP3P
-
FB
water
model
,
energy
minimizes
it
,
simulates
it
for
10
,
000
steps
with
a
Langevin
integrator
,
and
saves
a
snapshot
frame
to
a
PDB
file
called
:
file
:`
output
.
pdb
`
every
1000
time
integrator
,
and
saves
a
snapshot
frame
to
a
DCD
file
called
:
file
:`
output
.
dcd
`
every
1000
time
steps
.
..
samepage
::
...
...
@@ -32,7 +32,7 @@ steps.
simulation
=
Simulation
(
pdb
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
pdb
.
positions
)
simulation
.
minimizeEnergy
()
simulation
.
reporters
.
append
(
PDB
Reporter
(
'output.
pdb
'
,
1000
))
simulation
.
reporters
.
append
(
DCD
Reporter
(
'output.
dcd
'
,
1000
))
simulation
.
reporters
.
append
(
StateDataReporter
(
stdout
,
1000
,
step
=
True
,
potentialEnergy
=
True
,
temperature
=
True
))
simulation
.
step
(
10000
)
...
...
@@ -152,12 +152,12 @@ good idea to do this at the start of a simulation, since the coordinates in the
PDB
file
might
produce
very
large
forces
.
::
simulation
.
reporters
.
append
(
PDB
Reporter
(
'output.
pdb
'
,
1000
))
simulation
.
reporters
.
append
(
DCD
Reporter
(
'output.
dcd
'
,
1000
))
This
line
creates
a
“
reporter
”
to
generate
output
during
the
simulation
,
and
adds
it
to
the
:
class
:`
Simulation
`
object
’
s
list
of
reporters
.
A
:
class
:`
PDB
Reporter
`
writes
structures
to
a
PDB
file
.
We
specify
that
the
output
file
should
be
called
:
file
:`
output
.
pdb
`,
and
that
a
structure
should
be
written
every
1000
time
steps
.
adds
it
to
the
:
class
:`
Simulation
`
object
’
s
list
of
reporters
.
A
:
class
:`
DCD
Reporter
`
writes
structures
to
a
DCD
file
.
We
specify
that
the
output
file
should
be
called
:
file
:`
output
.
dcd
`,
and
that
a
structure
should
be
written
every
1000
time
steps
.
::
simulation
.
reporters
.
append
(
StateDataReporter
(
stdout
,
1000
,
step
=
True
,
...
...
@@ -169,13 +169,13 @@ information every 1000 time steps: the current step index, the potential energy
of
the
system
,
and
the
temperature
.
We
specify
:
code
:`
stdout
`
(
not
in
quotes
)
as
the
output
file
,
which
means
to
write
the
results
to
the
console
.
We
also
could
have
given
a
file
name
(
in
quotes
),
just
as
we
did
for
the
:
class
:`
PDB
Reporter
`,
to
write
the
information
to
a
file
.
:
class
:`
DCD
Reporter
`,
to
write
the
information
to
a
file
.
::
simulation
.
step
(
10000
)
Finally
,
we
run
the
simulation
,
integrating
the
equations
of
motion
for
10
,
000
time
steps
.
Once
it
is
finished
,
you
can
load
the
PDB
file
into
any
program
you
time
steps
.
Once
it
is
finished
,
you
can
load
the
DCD
file
into
any
program
you
want
for
analysis
and
visualization
(
VMD_
,
PyMol_
,
AmberTools_
,
etc
.).
..
_VMD
:
http
://
www
.
ks
.
uiuc
.
edu
/
Research
/
vmd
/
...
...
@@ -210,7 +210,7 @@ found in OpenMM’s :file:`examples` folder with the name :file:`simulateAmber.p
simulation
=
Simulation
(
prmtop
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
inpcrd
.
positions
)
simulation
.
minimizeEnergy
()
simulation
.
reporters
.
append
(
PDB
Reporter
(
'output.
pdb
'
,
1000
))
simulation
.
reporters
.
append
(
DCD
Reporter
(
'output.
dcd
'
,
1000
))
simulation
.
reporters
.
append
(
StateDataReporter
(
stdout
,
1000
,
step
=
True
,
potentialEnergy
=
True
,
temperature
=
True
))
simulation
.
step
(
10000
)
...
...
@@ -300,7 +300,7 @@ with the name :file:`simulateGromacs.py`.
simulation
=
Simulation
(
top
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
gro
.
positions
)
simulation
.
minimizeEnergy
()
simulation
.
reporters
.
append
(
PDB
Reporter
(
'output.
pdb
'
,
1000
))
simulation
.
reporters
.
append
(
DCD
Reporter
(
'output.
dcd
'
,
1000
))
simulation
.
reporters
.
append
(
StateDataReporter
(
stdout
,
1000
,
step
=
True
,
potentialEnergy
=
True
,
temperature
=
True
))
simulation
.
step
(
10000
)
...
...
@@ -358,7 +358,7 @@ on the :class:`CharmmPsfFile`.
simulation
=
Simulation
(
psf
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
pdb
.
positions
)
simulation
.
minimizeEnergy
()
simulation
.
reporters
.
append
(
PDB
Reporter
(
'output.
pdb
'
,
1000
))
simulation
.
reporters
.
append
(
DCD
Reporter
(
'output.
dcd
'
,
1000
))
simulation
.
reporters
.
append
(
StateDataReporter
(
stdout
,
1000
,
step
=
True
,
potentialEnergy
=
True
,
temperature
=
True
))
simulation
.
step
(
10000
)
...
...
@@ -1384,15 +1384,15 @@ To save a trajectory, just add a “reporter” to the simulation, as shown in t
example scripts above:
::
simulation.reporters.append(
PDB
Reporter('
output
.
pdb
', 1000))
simulation.reporters.append(
DCD
Reporter('
output
.
dcd
', 1000))
The two parameters of the :class:`
PDB
Reporter` are the output filename and how often (in
number of time steps) output structures should be written. To use PDBx/mmCIF,
DCD
or XTC format, just replace :class:`
PDB
Reporter` with :class:`PDBxReporter`,
:class:`DCDReporter`
or :class:`XTCReporter`. The parameters represent the same values:
The two parameters of the :class:`
DCD
Reporter` are the output filename and how often (in
number of time steps) output structures should be written. To use
PDB,
PDBx/mmCIF,
or XTC format, just replace :class:`
DCD
Reporter` with
:class:`PDBReporter`,
:class:`PDBxReporter`,
or :class:`XTCReporter`. The parameters represent the same values:
::
simulation.reporters.append(
DCD
Reporter('
output
.
dcd
', 1000))
simulation.reporters.append(
XTC
Reporter('
output
.
xtc
', 1000))
Recording Other Data
====================
...
...
examples/simulateAmber.py
View file @
7bdf028c
...
...
@@ -10,6 +10,6 @@ integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picosecond
simulation
=
Simulation
(
prmtop
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
inpcrd
.
positions
)
simulation
.
minimizeEnergy
()
simulation
.
reporters
.
append
(
PDB
Reporter
(
'output.
pdb
'
,
1000
))
simulation
.
reporters
.
append
(
DCD
Reporter
(
'output.
dcd
'
,
1000
))
simulation
.
reporters
.
append
(
StateDataReporter
(
stdout
,
1000
,
step
=
True
,
potentialEnergy
=
True
,
temperature
=
True
))
simulation
.
step
(
10000
)
examples/simulateCharmm.py
View file @
7bdf028c
...
...
@@ -25,7 +25,7 @@ integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picosecond
simulation
=
Simulation
(
psf
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
pdb
.
getPositions
())
simulation
.
minimizeEnergy
()
simulation
.
reporters
.
append
(
PDB
Reporter
(
'
ch_
output.
pdb
'
,
1000
))
simulation
.
reporters
.
append
(
DCD
Reporter
(
'output.
dcd
'
,
1000
))
simulation
.
reporters
.
append
(
StateDataReporter
(
stdout
,
1000
,
step
=
True
,
potentialEnergy
=
True
,
temperature
=
True
)
...
...
examples/simulateGromacs.py
View file @
7bdf028c
...
...
@@ -10,6 +10,6 @@ integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picosecond
simulation
=
Simulation
(
top
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
gro
.
positions
)
simulation
.
minimizeEnergy
()
simulation
.
reporters
.
append
(
PDB
Reporter
(
'output.
pdb
'
,
1000
))
simulation
.
reporters
.
append
(
DCD
Reporter
(
'output.
dcd
'
,
1000
))
simulation
.
reporters
.
append
(
StateDataReporter
(
stdout
,
1000
,
step
=
True
,
potentialEnergy
=
True
,
temperature
=
True
))
simulation
.
step
(
10000
)
examples/simulatePdb.py
View file @
7bdf028c
...
...
@@ -10,6 +10,6 @@ integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picosecond
simulation
=
Simulation
(
pdb
.
topology
,
system
,
integrator
)
simulation
.
context
.
setPositions
(
pdb
.
positions
)
simulation
.
minimizeEnergy
()
simulation
.
reporters
.
append
(
PDB
Reporter
(
'output.
pdb
'
,
1000
))
simulation
.
reporters
.
append
(
DCD
Reporter
(
'output.
dcd
'
,
1000
))
simulation
.
reporters
.
append
(
StateDataReporter
(
stdout
,
1000
,
step
=
True
,
potentialEnergy
=
True
,
temperature
=
True
))
simulation
.
step
(
10000
)
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