1 """@namespace IMP.pmi.dof
2 Setup constraints and create movers for an IMP Hierarchy
5 from __future__
import print_function
15 """ given PMI Molecule/Residue or IMP objects, return hierarchies """
22 hs = [s.get_hierarchy()]
23 elif type(s)
is IMP.pmi.topology._Residue:
24 hs = [s.get_hierarchy()]
26 raise Exception(
"Cannot process type "+str(type(s)))
29 if hasattr(spec,
'__iter__'):
30 hhs = list(itertools.chain.from_iterable(get_h(item)
for item
in spec))
36 """ Just get the leaves from a list of hierarchies """
41 """A class to simplify create of constraints and movers for an IMP Hierarchy.
42 Call the various create() functions to get started."""
43 def __init__(self,mdl):
51 """Create rigid body constraint and mover
52 @param hspec Can be one of the following inputs:
53 IMP Selection, Hierarchy,
54 PMI Molecule, Residue, or a list/set
55 @param max_trans Maximum rigid body translation
56 @param max_rot Maximum rigid body rotation
60 self.movers.append(setup_rb)
67 chain_min_length=
None,
68 chain_max_length=
None):
69 """Create SUPER rigid body mover from one or more hierarchies. Can also create chain of SRBs.
70 @param hspec Can be one of the following inputs:
71 IMP Selection, Hierarchy,
72 PMI Molecule, Residue, or a list/set
73 @param max_trans Maximum super rigid body translation
74 @param max_rot Maximum super rigid body rotation
75 @param chain_min_length Create a CHAIN of super rigid bodies - must provide list
76 This parameter is the minimum chain length.
77 @param chain_max_length max chain length
80 setup_srb = SetupSuperRigidBody(hiers,max_trans,max_rot,chain_min_length,chain_max_length)
81 self.movers.append(setup_srb)
87 """Create a chain of flexible beads
88 @param hspec Can be one of the following inputs:
89 IMP Selection, Hierarchy,
90 PMI Molecule, Residue, or a list/set
91 @param max_trans Maximum flexible bead translation
94 setup_fb = SetupFlexibleBeads(hiers,max_trans)
95 self.movers.append(setup_fb)
102 def get_all_movers(self):
105 for m
in self.movers:
106 all_movers+=m.get_movers()
109 """Sets up and stores RigidBodyMover and BallMovers for NonRigidMembers"""
110 def __init__(self,hiers,max_trans,max_rot):
113 self.flexible_movers = []
115 def create_non_rigid_members(self,spec,max_trans=1.0):
118 idxs = set(self.rb.get_member_indexes())
121 if not p.get_index()
in idxs:
122 raise Exception(
"You tried to create nonrigid members from "
123 "particles that aren't in the RigidBody!")
125 self.rb.set_is_rigid_member(p.get_index(),
False)
127 p.set_is_optimized(fk,
True)
131 def get_movers(self):
132 return [self.rb_mover]+self.flexible_movers
134 def get_rigid_body(self):
140 class SetupSuperRigidBody(object):
141 def __init__(self,hiers,max_trans,max_rot,chain_min_length,chain_max_length):
143 if chain_min_length
is None and chain_max_length
is None:
144 self._setup_srb(hiers,max_trans,max_rot)
145 elif chain_min_length
is not None and chain_max_length
is not None:
147 self._setup_srb(hs,max_trans,max_rot)
149 raise Exception(
"DegreesOfFreedom: SetupSuperRigidBody: if you want chain, specify min AND max")
151 def _setup_srb(self,hiers,max_trans,max_rot):
155 srbm.add_rigid_body_particle(p)
157 srbm.add_xyz_particle(p)
158 self.movers.append(srbm)
160 def get_movers(self):
163 class SetupFlexibleBeads(object):
164 def __init__(self,hiers,max_trans):
168 raise Exception(
"Cannot create flexible beads from members of rigid body")
170 def get_movers(self):
A class to simplify create of constraints and movers for an IMP Hierarchy.
Set up of system representation from topology files.
def create_flexible_beads
Create a chain of flexible beads.
Modify the transformation of a rigid body.
Modify a set of continuous variables by perturbing them within a ball.
static bool get_is_setup(const IMP::ParticleAdaptor &p)
This class is constructed from within the State class.
def create_rigid_body
Create rigid body constraint and mover.
The standard decorator for manipulating molecular structures.
def create_super_rigid_body
Create SUPER rigid body mover from one or more hierarchies.
def get_all_leaves
Just get the leaves from a list of hierarchies.
def get_hierarchies
given PMI Molecule/Residue or IMP objects, return hierarchies
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
The general base class for IMP exceptions.
Sets up and stores RigidBodyMover and BallMovers for NonRigidMembers.
IMP::core::RigidBody create_rigid_body(Hierarchy h)
Python classes to represent, score, sample and analyze models.
Functionality for loading, creating, manipulating and scoring atomic structures.
Hierarchies get_leaves(const Selection &h)
Select hierarchy particles identified by the biological name.
static bool get_is_setup(const IMP::ParticleAdaptor &p)