1 """@namespace IMP.em2d.restraints
2 Utility functions to handle restraints.
10 import IMP.em2d.imp_general.representation
as representation
17 log = logging.getLogger(
"restraints")
21 n_pairs=1, spring_constant=1):
23 Set a connectivity restraint for the leaves of a set of particles
25 The intended use is that the each particle is a hierarchy. Each
26 hierarchy contains leaves that are atoms, or particles
27 that are a coarse representation of a molecule
35 cr.set_particles(particles)
40 images_selection_file,
44 """ Sets a restraint for comparing the model to a set of EM images
46 model = assembly.get_model()
50 r.setup(sc, restraint_params)
51 names = em2d.read_selection_file(images_selection_file)
52 names = [base.get_relative_path(images_selection_file, x)
for x
in names]
53 log.debug(
"names of the images %s", names)
55 imgs = em2d.read_images(names, srw)
58 ps = atom.get_leaves(assembly)
62 if (mode ==
"coarse"):
63 r.set_coarse_registration_mode(
True)
64 elif (mode ==
"fast"):
65 r.set_fast_mode(n_optimized)
66 elif(mode ==
"complete"):
69 raise ValueError(
"Em2DRestraint mode not recognized")
A harmonic upper bound on the distance between two spheres.
See IMP.em2d for more information.
Return the hierarchy leaves under a particle.
See IMP.container for more information.
See IMP.base for more information.
Store a kernel::ParticleIndexes.
Ensure that a set of particles remains connected with one another.
static const IMP::core::HierarchyTraits & get_traits()
Get the molecular hierarchy HierararchyTraits.
See IMP.core for more information.
def get_connectivity_restraint
Set a connectivity restraint for the leaves of a set of particles.
See IMP.atom for more information.
See IMP.domino for more information.
def get_em2d_restraint
Sets a restraint for comparing the model to a set of EM images.