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_em_fit.py
1
## \example restrainer/simple_em_fit.py
2
# This example shows how to create simple IMP::em::FitRestraint.
3
#
4
5
# -- File: simple_em_fit.py --#
6
7
import
IMP
8
import
IMP.atom
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"
), 12,
True
)
16
p1.add_attribute(
IMP.FloatKey
(
"y"
), 12,
True
)
17
p1.add_attribute(
IMP.FloatKey
(
"z"
), 12,
True
)
18
p1.add_attribute(
IMP.FloatKey
(
"radius"
), 1.0)
19
p1.add_attribute(
IMP.FloatKey
(
"mass"
), 1.0)
20
p1.add_attribute(
IMP.FloatKey
(
"protein"
), 1.0)
21
p1.add_attribute(
IMP.FloatKey
(
"id"
), 1.0)
22
23
# Create particle point 2
24
p2 =
IMP.kernel.Particle
(imp_model)
25
p2.add_attribute(
IMP.FloatKey
(
"x"
), 15,
True
)
26
p2.add_attribute(
IMP.FloatKey
(
"y"
), 6,
True
)
27
p2.add_attribute(
IMP.FloatKey
(
"z"
), 6,
True
)
28
p2.add_attribute(
IMP.FloatKey
(
"radius"
), 1.0)
29
p2.add_attribute(
IMP.FloatKey
(
"mass"
), 1.0)
30
p2.add_attribute(
IMP.FloatKey
(
"protein"
), 1.0)
31
p2.add_attribute(
IMP.FloatKey
(
"id"
), 1.0)
32
33
# Create particle point 3
34
p3 =
IMP.kernel.Particle
(imp_model)
35
p3.add_attribute(
IMP.FloatKey
(
"x"
), 6,
True
)
36
p3.add_attribute(
IMP.FloatKey
(
"y"
), 15,
True
)
37
p3.add_attribute(
IMP.FloatKey
(
"z"
), 15,
True
)
38
p3.add_attribute(
IMP.FloatKey
(
"radius"
), 1.0)
39
p3.add_attribute(
IMP.FloatKey
(
"mass"
), 1.0)
40
p3.add_attribute(
IMP.FloatKey
(
"protein"
), 1.0)
41
p3.add_attribute(
IMP.FloatKey
(
"id"
), 1.0)
42
43
mp =
IMP.atom.Hierarchy.setup_particle
(p1)
44
mp =
IMP.atom.Hierarchy.setup_particle
(p2)
45
mp =
IMP.atom.Hierarchy.setup_particle
(p3)
46
47
particles = []
48
particles.append(p1)
49
particles.append(p2)
50
particles.append(p3)
51
52
mhs =
IMP.atom.Hierarchies
()
53
mhs.append(mp)
54
55
dmap =
IMP.restrainer.load_em_density_map
(
56
IMP.restrainer.get_example_path
(
"in.mrc"
), 1.0, 3.0)
57
58
se =
IMP.restrainer.create_simple_em_fit
(mhs, dmap)
59
60
r = se.get_restraint()
61
62
imp_model.add_restraint(r)
IMP::kernel::Key< 0, true >
IMP::restrainer::create_simple_em_fit
SimpleEMFit create_simple_em_fit(atom::Hierarchy const &mh, em::DensityMap *dmap)
Creates EM FitRestraint.
IMP::restrainer
See IMP.restrainer for more information.
Definition:
restrainer_config.h:127
IMP::base::Vector< Hierarchy >
IMP::atom::Hierarchy::setup_particle
static Hierarchy setup_particle(kernel::Model *m, kernel::ParticleIndex pi, kernel::ParticleIndexesAdaptor children=kernel::ParticleIndexesAdaptor())
Definition:
atom/Hierarchy.h:259
IMP::kernel::Particle
Class to handle individual model particles.
Definition:
kernel/declare_Particle.h:34
IMP::restrainer::get_example_path
std::string get_example_path(std::string file_name)
Return the path to installed example data for this module.
IMP::restrainer::load_em_density_map
em::DensityMap * load_em_density_map(char const *map_fn, float spacing, float resolution)
IMP::atom
See IMP.atom for more information.
Definition:
angle_decorators.h:15
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/declare_Model.h:72