IMP
2.0.1
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
display/display_log.py
A simple example of how to use one of the IMP.display.LogOptimizerStates.
1
## \example display/display_log.py
2
## A simple example of how to use one of the IMP.display.LogOptimizerStates.
3
4
import
IMP
5
import
IMP.display
6
import
IMP.core
7
import
IMP.container
8
9
m=
IMP.Model
()
10
ps=
IMP.core.create_xyzr_particles
(m, 20, 5)
11
c=
IMP.container.ListSingletonContainer
(ps)
12
13
# write it to a series of files, if the file name did not contain %1%, then
14
# it would concatenate the outputs into a single file instead. Concatenating the
15
# output can be quite useful with Pymol as that makes it less likely to crash.
16
log=
IMP.display.WriteOptimizerState
(
IMP.display.ChimeraWriter
(
"log_file.%1%.pym"
))
17
# the logging occurs ever two frames
18
log.set_period(2)
19
g=
IMP.core.XYZRsGeometry
(c)
20
g.set_name(
"my particles"
)
21
g.set_color(
IMP.display.Color
(1,0,0))
22
log.add_geometry(g)
23
24
r=
IMP.core.ExcludedVolumeRestraint
(c)
25
m.add_restraint(r)
26
27
o=
IMP.core.MonteCarlo
(m)
28
mv=
IMP.core.BallMover
(ps, 10)
29
o.add_mover(mv)
30
o.add_optimizer_state(log)
31
32
o.optimize(1000)