home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
2.22.0
The Integrative Modeling Platform
IMP Manual
Reference Guide
Tutorial Index
Modules
Classes
Examples
version 2.22.0
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.display
5
import
IMP.core
6
import
IMP.container
7
import
sys
8
9
IMP.setup_from_argv
(
10
sys.argv,
11
"Example of how to use one of the IMP.display.LogOptimizerStates"
)
12
13
m =
IMP.Model
()
14
ps =
IMP.core.create_xyzr_particles
(m, 20, 5)
15
c =
IMP.container.ListSingletonContainer
(m, ps)
16
17
# Write outputs into a single file.
18
log =
IMP.display.WriteOptimizerState
(
19
m,
IMP.display.PymolWriter
(
"log_file.pym"
))
20
# the logging occurs ever two frames
21
log.set_period(2)
22
g =
IMP.core.XYZRsGeometry
(c)
23
g.set_name(
"my particles"
)
24
g.set_color(
IMP.display.Color
(1, 0, 0))
25
log.add_geometry(g)
26
27
r =
IMP.core.ExcludedVolumeRestraint
(c)
28
r.set_log_level(IMP.VERBOSE)
29
30
o =
IMP.core.MonteCarlo
(m)
31
o.set_scoring_function([r])
32
mv =
IMP.core.BallMover
(m, ps, 10)
33
o.add_mover(mv)
34
o.add_optimizer_state(log)
35
36
o.optimize(1000)