This example shows how to create simple
IMP::core::ExcludedVolumeRestraint.
#-- File: simple_excluded_volume.py --#
import IMP
import IMP.core
import IMP.atom
import IMP.helper
m= IMP.Model()
sel = IMP.atom.CAlphaPDBSelector()
p0 = IMP.atom.read_pdb(
IMP.helper.get_example_path("input.pdb"), m, sel)
p1 = IMP.atom.read_pdb(
IMP.helper.get_example_path("input.pdb"), m, sel)
mhs = IMP.atom.Hierarchies()
mhs.append(p0)
mhs.append(p1)
ps = IMP.Particles()
for mh in mhs:
ps.append(mh.get_particle())
rbs = IMP.helper.set_rigid_bodies(mhs)
sev = IMP.helper.create_simple_excluded_volume_on_rigid_bodies(rbs)
r = sev.get_restraint()
m.add_restraint(r)
This example shows how to create simple
IMP::core::ConnectivityRestraint on molecules.
#-- File: simple_connectivity_on_molecules.py --#
import IMP
import IMP.core
import IMP.helper
m = IMP.Model()
IMP.core.create_xyzr_particles(m, 4, 1.0)
ps = m.get_particles()
mhs = IMP.atom.Hierarchies()
for p in ps:
mh = IMP.atom.Hierarchy.setup_particle(p)
mhs.append(mh)
sc = IMP.helper.create_simple_connectivity_on_molecules(mhs)
r = sc.get_restraint()
h = sc.get_harmonic_upper_bound()
sdps = sc.get_sphere_distance_pair_score()
sc.set_mean(10.0)
sc.set_stddev(3.5)
sc.set_k(0.1)
m.add_restraint(r)
r.show()
m.evaluate(False)
This example shows how to create simple
IMP::em::FitRestraint.
#-- File: simple_em_fit.py --#
import IMP
import IMP.atom
import IMP.helper
imp_model = IMP.Model()
# Create particle point 1
p1 = IMP.Particle(imp_model)
p1.add_attribute(IMP.FloatKey("x"), 12, True)
p1.add_attribute(IMP.FloatKey("y"), 12, True)
p1.add_attribute(IMP.FloatKey("z"), 12, True)
p1.add_attribute(IMP.FloatKey("radius"), 1.0)
p1.add_attribute(IMP.FloatKey("mass"), 1.0)
p1.add_attribute(IMP.FloatKey("protein"), 1.0)
p1.add_attribute(IMP.FloatKey("id"), 1.0)
# Create particle point 2
p2 = IMP.Particle(imp_model)
p2.add_attribute(IMP.FloatKey("x"), 15, True)
p2.add_attribute(IMP.FloatKey("y"), 6, True)
p2.add_attribute(IMP.FloatKey("z"), 6, True)
p2.add_attribute(IMP.FloatKey("radius"), 1.0)
p2.add_attribute(IMP.FloatKey("mass"), 1.0)
p2.add_attribute(IMP.FloatKey("protein"), 1.0)
p2.add_attribute(IMP.FloatKey("id"), 1.0)
# Create particle point 3
p3 = IMP.Particle(imp_model)
p3.add_attribute(IMP.FloatKey("x"), 6, True)
p3.add_attribute(IMP.FloatKey("y"), 15, True)
p3.add_attribute(IMP.FloatKey("z"), 15, True)
p3.add_attribute(IMP.FloatKey("radius"), 1.0)
p3.add_attribute(IMP.FloatKey("mass"), 1.0)
p3.add_attribute(IMP.FloatKey("protein"), 1.0)
p3.add_attribute(IMP.FloatKey("id"), 1.0)
mp = IMP.atom.Hierarchy.setup_particle(p1)
mp = IMP.atom.Hierarchy.setup_particle(p2)
mp = IMP.atom.Hierarchy.setup_particle(p3)
particles = IMP.Particles()
particles.append(p1)
particles.append(p2)
particles.append(p3)
mhs = IMP.atom.Hierarchies()
mhs.append(mp)
dmap = IMP.helper.load_em_density_map (
IMP.helper.get_example_path("in.mrc"), 1.0, 3.0)
se = IMP.helper.create_simple_em_fit(mhs, dmap)
r = se.get_restraint()
imp_model.add_restraint(r)
This example shows how to create simple
IMP::core::ConnectivityRestraint on rigid bodies.
#-- File: simple_connectivity_on_rigid_bodies --#
import IMP
import IMP.atom
import IMP.helper
m = IMP.Model()
sel = IMP.atom.CAlphaPDBSelector()
mh1 = IMP.atom.read_pdb(IMP.helper.get_example_path("input.pdb"), m, sel)
mh2 = IMP.atom.read_pdb(IMP.helper.get_example_path("input.pdb"), m, sel)
IMP.atom.add_radii(mh1)
IMP.atom.add_radii(mh2)
mhs = IMP.atom.Hierarchies()
mhs.append(mh1)
mhs.append(mh2)
rbs = IMP.helper.set_rigid_bodies(mhs)
sc = IMP.helper.create_simple_connectivity_on_rigid_bodies(rbs)
r = sc.get_restraint()
h = sc.get_harmonic_upper_bound()
ps = sc.get_sphere_distance_pair_score()
sc.set_mean(10.0)
sc.set_stddev(3.5)
sc.set_k(0.1)
m.add_restraint(r)
r.show()
m.evaluate(False)
This example shows how to create simple
IMP::core::DistanceRestraint.
#-- File: simple_distance.py --#
import IMP
import IMP.core
import IMP.helper
imp_model = IMP.Model()
# Create particle point 1
p1 = IMP.Particle(imp_model)
p1.add_attribute(IMP.FloatKey("x"), 0, True)
p1.add_attribute(IMP.FloatKey("y"), 0, True)
p1.add_attribute(IMP.FloatKey("z"), 0, True)
p1.add_attribute(IMP.FloatKey("radius"), 1.0, False)
# Create particle point 2
p2 = IMP.Particle(imp_model)
p2.add_attribute(IMP.FloatKey("x"), 100, True)
p2.add_attribute(IMP.FloatKey("y"), 100, True)
p2.add_attribute(IMP.FloatKey("z"), 100, True)
p2.add_attribute(IMP.FloatKey("radius"), 1.0, False)
particles = IMP.Particles()
particles.append(p1)
particles.append(p2)
sd = IMP.helper.create_simple_distance(particles)
r = sd.get_restraint()
h = sd.get_harmonic_upper_bound()
sd.set_mean(10.0)
sd.set_stddev(3.5)
sd.set_k(0.1)
imp_model.add_restraint(r)
r.show()
imp_model.evaluate(False)
This example shows how to create simple
IMP::core::DiameterRestraint.
#-- File: simple_diameter.py --#
import IMP
import IMP.core
import IMP.helper
imp_model = IMP.Model()
ps = IMP.core.create_xyzr_particles(imp_model, 50, 1.0)
diameter = 10
sd = IMP.helper.create_simple_diameter(ps, diameter)
r = sd.get_restraint()
h = sd.get_harmonic_upper_bound()
sd.set_mean(10.0)
sd.set_stddev(3.5)
sd.set_k(0.1)
imp_model.add_restraint(r)
r.show()
imp_model.evaluate(False)