IMP
2.0.0
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
range_restriction.py
1
## \example example/range_restriction.py
2
## This example shows how to use the example singleton modifier to constrain the
3
## coordinates of a set of particles to remain within a box.
4
5
import
IMP.example
6
import
IMP.core
7
import
IMP.container
8
import
sys
9
10
# you can use this argument to shorten the test, if necessary
11
IMP.base.add_bool_flag
(
"test"
,
"Run a minimal test on the script"
)
12
13
# parse standard IMP flags
14
IMP.base.setup_from_argv
(sys.argv,
"A trivial example of an example."
)
15
16
17
bb=
IMP.algebra.BoundingBox3D
(
IMP.algebra.Vector3D
(0,0,0),
18
IMP.algebra.Vector3D
(10,10,10))
19
20
m=
IMP.Model
()
21
ps=
IMP.core.create_xyzr_particles
(m, 20, 1)
22
sc=
IMP.container.ListSingletonContainer
(ps)
23
24
# apply the range restriction modifier to each each particle in sc
25
ss=
IMP.container.SingletonsConstraint
(
IMP.example.ExampleSingletonModifier
(bb),
None
, sc)
26
m.add_score_state(ss)
27
28
# now optimize and things
29
# ...