IMP
2.1.0
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
simple_distance.py
1
## \example restrainer/simple_distance.py
2
# This example shows how to create simple IMP::core::DistanceRestraint.
3
#
4
5
# -- File: simple_distance.py --#
6
7
import
IMP
8
import
IMP.core
9
import
IMP.restrainer
10
11
imp_model =
IMP.kernel.Model
()
12
13
# Create particle point 1
14
p1 =
IMP.kernel.Particle
(imp_model)
15
p1.add_attribute(
IMP.FloatKey
(
"x"
), 0,
True
)
16
p1.add_attribute(
IMP.FloatKey
(
"y"
), 0,
True
)
17
p1.add_attribute(
IMP.FloatKey
(
"z"
), 0,
True
)
18
p1.add_attribute(
IMP.FloatKey
(
"radius"
), 1.0,
False
)
19
20
# Create particle point 2
21
p2 =
IMP.kernel.Particle
(imp_model)
22
p2.add_attribute(
IMP.FloatKey
(
"x"
), 100,
True
)
23
p2.add_attribute(
IMP.FloatKey
(
"y"
), 100,
True
)
24
p2.add_attribute(
IMP.FloatKey
(
"z"
), 100,
True
)
25
p2.add_attribute(
IMP.FloatKey
(
"radius"
), 1.0,
False
)
26
27
particles = []
28
particles.append(p1)
29
particles.append(p2)
30
31
sd =
IMP.restrainer.create_simple_distance
(particles)
32
33
r = sd.get_restraint()
34
h = sd.get_harmonic_upper_bound()
35
36
sd.set_mean(10.0)
37
sd.set_standard_deviation(3.5)
38
sd.set_k(0.1)
39
40
imp_model.add_restraint(r)
41
r.show()
42
43
imp_model.evaluate(
False
)
IMP::kernel::Key< 0, true >
IMP::restrainer
See IMP.restrainer for more information.
Definition:
restrainer_config.h:127
IMP::kernel::Particle
Class to handle individual model particles.
Definition:
kernel/declare_Particle.h:34
IMP::core
See IMP.core for more information.
Definition:
AngleRestraint.h:19
IMP::restrainer::create_simple_distance
SimpleDistance create_simple_distance(const kernel::Particles &ps)
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/declare_Model.h:72