IMP logo
IMP Reference Guide  2.16.0
The Integrative Modeling Platform
pmi/dof/__init__.py
1 """@namespace IMP.pmi.dof
2  Create movers and set up constraints for PMI objects.
3  See the documentation of the DegreesOfFreedom class for more information.
4 """
5 
6 from __future__ import print_function
7 import IMP
8 import IMP.atom
9 import IMP.algebra
10 import IMP.pmi
11 import IMP.pmi.topology
12 import IMP.pmi.samplers
13 import IMP.pmi.tools
14 import IMP.pmi.samplers
15 import warnings
16 
17 
18 def create_rigid_body_movers(dof, maxtrans, maxrot):
19  mvs = []
20  for rb in dof.rigid_bodies:
21  mvs.append(IMP.core.RigidBodyMover(rb.get_model(), rb,
22  maxtrans, maxrot))
23  return mvs
24 
25 
26 class DegreesOfFreedom(object):
27  """Simplify creation of constraints and movers for an IMP Hierarchy.
28 
29  * The various "create X" functions make movers for system components
30  as well as set up necessary constraints. For each of these functions,
31  you can generally pass PMI objects like
32  [Molecule](@ref IMP::pmi::topology::Molecule) or slices thereof.
33  * DegreesOfFreedom.create_rigid_body() lets you rigidify a molecule
34  (but allows you to also pass "nonrigid" components which move with
35  the body and also independently).
36  * DegreesOfFreedom.create_super_rigid_body() sets up a special
37  "Super Rigid Body" which moves rigidly but is not always constrained
38  to be rigid (so you can later move the parts separately). This is
39  good for speeding up sampling.
40  * DegreesOfFreedom.create_flexible_beads() sets up particles to move
41  individually.
42  * DegreesOfFreedom.setup_md() sets up particles to move with molecular
43  dynamics. Note that this is not (yet) compatible with rigid bodies,
44  and only works with some restraints.
45  * DegreesOfFreedom.constrain_symmetry() makes a symmetry constraint so
46  that clones automatically move with their references. If instead you
47  want a softer restraint, check out the
48  [SymmetryRestraint](@ref IMP::pmi::restraints::stereochemistry::SymmetryRestraint).
49  * When you are done you can access all movers with
50  DegreesOfFreedom.get_movers(). If you have set up rigid, super rigid,
51  or flexible beads, pass the movers to the `monte_carlo_sample_objects`
52  argument of
53  [ReplicaExchange0](@ref IMP::pmi::macros::ReplicaExchange0).
54  * If you are running MD, you have to separately pass the particles
55  (also returned from DegreesOfFreedom.setup_md()) to the
56  `molecular_dynamics_sample_objects` argument of
57  [ReplicaExchange0](@ref IMP::pmi::macros::ReplicaExchange0). Check
58  out an [MD example here](pmi_2atomistic_8py-example.html).
59  """ # noqa: E501
60  def __init__(self, model):
61  self.model = model
62  self.movers = []
63  self.fb_movers = [] # stores movers corresponding to floppy parts
64  self.rigid_bodies = [] # stores rigid body objects
65  # stores all beads including nonrigid members of rigid bodies
66  self.flexible_beads = []
67  self.nuisances = []
68  # Keys are the RigidBody objects, values are list of movers
69  self._rb2mov = {}
70  # the following is needed to keep track of disabled movers
71  self.movers_particles_map = IMP.pmi.tools.OrderedDict()
72  self.movers_rb_map = {}
73  self.movers_xyz_map = {}
74  self.disabled_movers = []
75 
76  def _get_nonrigid_hiers(self, nonrigid_parts, rigid_hiers, resolution):
77  """Get Hierarchy objects for nonrigid parts. Make sure that they are
78  a subset of the rigid body Hierarchies."""
79  if not nonrigid_parts:
80  return
81  nr_hiers = IMP.pmi.tools.input_adaptor(nonrigid_parts, resolution,
82  flatten=True)
83  if nr_hiers:
84  rb_idxs = set(h.get_particle_index() for h in rigid_hiers)
85  for h in nr_hiers:
86  p = h.get_particle()
87  if p.get_index() not in rb_idxs:
88  raise ValueError(
89  "You tried to create nonrigid members from "
90  "particles that aren't in the RigidBody!")
91  return nr_hiers
92 
93  def create_rigid_body(self, rigid_parts, nonrigid_parts=None,
94  max_trans=4.0, max_rot=0.5, nonrigid_max_trans=4.0,
95  resolution='all', name=None):
96  """Create rigid body constraint and mover
97  @param rigid_parts Can be one of the following inputs:
98  IMP Hierarchy, PMI System/State/Molecule/TempResidue, a list/set
99  (of list/set) of them or a RigidBody object.
100  Must be uniform input, however. No mixing object types.
101  @param nonrigid_parts Same input format as rigid_parts.
102  Must be a subset of rigid_parts particles.
103  @param max_trans Maximum rigid body translation
104  @param max_rot Maximum rigid body rotation
105  @param nonrigid_max_trans Maximum step for the nonrigid (bead)
106  particles
107  @param resolution Only used if you pass PMI objects. Probably you
108  want 'all'.
109  @param name Rigid body name (if None, use IMP default)
110  @return (rb_movers,rb_object)
111  @note If you want all resolutions, pass PMI objects because this
112  function will get them all. Alternatively you can do your
113  selection elsewhere and just pass hierarchies.
114  """
115 
116  rb_movers = []
117 
118  # ADD CHECK: these particles are not already part of some RB or SRB
119 
120  # First, is this already a rigid body?
121  if type(rigid_parts) is IMP.core.RigidBody:
122  warnings.warn("Rigid Body Already Setup", IMP.pmi.ParameterWarning)
123  rb = rigid_parts
124  model = rb.get_model()
125  if name is None:
126  name = rb.get_name()
128  model.get_particle(i)))[0]
129  for i in rb.get_member_particle_indexes()]
130  else:
131  # Otherwise, setup RB
132  hiers = IMP.pmi.tools.input_adaptor(rigid_parts,
133  resolution,
134  flatten=True)
135 
136  if not hiers:
137  warnings.warn(
138  "No hierarchies were passed to create_rigid_body()",
140  return []
141 
142  # Need to do this before rigid body is set up so that we leave the
143  # system in a consistent state if a sanity check fails
144  nr_hiers = self._get_nonrigid_hiers(nonrigid_parts, hiers, resolution)
145 
146  if type(rigid_parts) is not IMP.core.RigidBody:
147  model = hiers[0].get_model()
148 
149  # we need to use the following constructor because the
150  # IMP.core.create_rigid_body seems to construct an arbitrary
151  # reference frame, which will be different for all copies.
152  # therefore, symmetry won't work all the time
153 
155  hiers)
156  comcoor = IMP.core.XYZ(com).get_coordinates()
157 
158  # Don't needlessly update the COM of this particle for the
159  # entire sampling run; we are done with both the ScoreState
160  # and the Particle.
162  model.remove_particle(com)
163 
167  rbp = IMP.Particle(model)
169  for h in hiers:
170  rb.add_member(h.get_particle())
171 
172  self.rigid_bodies.append(rb)
173  rb.set_coordinates_are_optimized(True)
174  rb_mover = IMP.core.RigidBodyMover(rb.get_model(), rb, max_trans,
175  max_rot)
176  if name is not None:
177  rb.set_name(name)
178  rb_mover.set_name(name)
179  rb_movers.append(rb_mover)
180  self.movers_particles_map[rb_mover] = []
181  self.movers_rb_map[rb_mover] = [rb]
182  rb_mover.set_was_used(True)
183  for h in hiers:
184  self.movers_particles_map[rb_mover] += IMP.atom.get_leaves(h)
185  # setup nonrigid parts
186  if nr_hiers:
188  for h in nr_hiers:
189  self.flexible_beads.append(h)
190  p = h.get_particle()
191  rb.set_is_rigid_member(p.get_index(), False)
192  for fk in floatkeys:
193  p.set_is_optimized(fk, True)
194  fbmv = IMP.core.BallMover(p.get_model(), p,
195  IMP.FloatKeys(floatkeys),
196  nonrigid_max_trans)
197  self.fb_movers.append(fbmv)
198  self.movers_particles_map[fbmv] = IMP.atom.get_leaves(h)
199  self.movers_xyz_map[fbmv] = IMP.atom.get_leaves(h)
200  fbmv.set_was_used(True)
201  rb_movers.append(fbmv)
202 
203  self.movers += rb_movers # probably need to store more info
204  self._rb2mov[rb] = rb_movers # dictionary relating rb to movers
205 
206  return rb_movers, rb
207 
208  def create_main_chain_mover(self, molecule, resolution=10,
209  lengths=[5, 10]):
210  """Create crankshaft moves from a set of SUPER rigid body mover
211  from one molecule.
212  See http://scfbm.biomedcentral.com/articles/10.1186/1751-0473-3-12
213  """
214  hiers = IMP.pmi.tools.input_adaptor(molecule, resolution, flatten=True)
215 
216  for length in lengths:
217  for n in range(len(hiers)-length):
218  hs = hiers[n+1:n+length]
220  hs, max_trans=0.0, max_rot=0.05,
221  axis=(hiers[n].get_particle(),
222  hiers[n+length].get_particle()))
223 
224  def create_super_rigid_body(self, srb_parts, max_trans=1.0, max_rot=0.1,
225  chain_min_length=None, chain_max_length=None,
226  resolution='all', name=None, axis=None):
227  """Create SUPER rigid body mover from one or more hierarchies.
228 
229  Can also create chain of SRBs. If you don't pass chain min/max,
230  it'll treat everything you pass as ONE rigid body.
231  If you DO pass chain min/max, it'll expect srb_parts is a list
232  and break it into bits.
233  @param srb_parts Can be one of the following inputs:
234  IMP Hierarchy, PMI System/State/Molecule/TempResidue,
235  or a list/set (of list/set) of them.
236  Must be uniform input, however. No mixing object types.
237  @param max_trans Maximum super rigid body translation
238  @param max_rot Maximum super rigid body rotation
239  @param chain_min_length Create a CHAIN of super rigid bodies -
240  must provide list; this parameter is the minimum
241  chain length.
242  @param chain_max_length Maximum chain length
243  @param resolution Only used if you pass PMI objects. Probably you
244  want 'all'.
245  @param name The name of the SRB (hard to assign a good one
246  automatically)
247  @param axis A tuple containing two particles which are used to
248  compute the rotation axis of the SRB. The default is None,
249  meaning that the rotation axis is random.
250 
251  @note If you set the chain parameters, will NOT create an SRB from
252  all of them together, but rather in groups made from the
253  outermost list.
254  """
255 
256  srb_movers = []
257 
258  # organize hierarchies based on chains
259  if chain_min_length is None and chain_max_length is None:
260  # the "chain" is just everything together
261  h = IMP.pmi.tools.input_adaptor(srb_parts, resolution,
262  flatten=True)
263  if len(h) == 0:
264  warnings.warn(
265  'No hierarchies were passed to create_super_rigid_body()',
267  return srb_movers
268  srb_groups = [h]
269  else:
270  if not hasattr(srb_parts, '__iter__'):
271  raise Exception("You tried to make a chain without a list!")
272  srb_groups = [IMP.pmi.tools.input_adaptor(
273  h, resolution, flatten=True, warn_about_slices=False)
274  for h in srb_parts]
275 
276  # create SRBs either from all hierarchies or chain
277  if chain_min_length is None and chain_max_length is None:
278  mv = self._setup_srb(srb_groups, max_trans, max_rot, axis)
279  if mv:
280  mv.set_was_used(True)
281  srb_movers.append(mv)
282  elif chain_min_length is not None and chain_max_length is not None:
284  srb_groups, chain_min_length, chain_max_length):
285  mv = self._setup_srb(hs, max_trans, max_rot, axis)
286  if mv:
287  mv.set_was_used(True)
288  srb_movers.append(mv)
289  else:
290  raise Exception(
291  "DegreesOfFreedom: SetupSuperRigidBody: if you want "
292  "chain, specify min AND max")
293  self.movers += srb_movers
294  if name is not None:
295  if len(srb_movers) > 1:
296  for n, mv in enumerate(srb_movers):
297  mv.set_name(name + '_' + str(n))
298  else:
299  srb_movers[0].set_name(name)
300  return srb_movers
301 
302  def _setup_srb(self, hiers, max_trans, max_rot, axis):
303  if axis is None:
304  srbm = IMP.pmi.TransformMover(
305  hiers[0][0].get_model(), max_trans, max_rot)
306  else:
307  srbm = IMP.pmi.TransformMover(
308  hiers[0][0].get_model(), axis[0], axis[1], max_trans, max_rot)
309  srbm.set_name("Super rigid body transform mover")
310  srbm.set_was_used(True)
311  super_rigid_rbs, super_rigid_xyzs \
313  ct = 0
314  self.movers_particles_map[srbm] = []
315  for h in hiers:
316  self.movers_particles_map[srbm] += IMP.atom.get_leaves(h)
317  for xyz in super_rigid_xyzs:
318  srbm.add_xyz_particle(xyz)
319  ct += 1
320  for rb in super_rigid_rbs:
321  srbm.add_rigid_body_particle(rb)
322  ct += 1
323  if ct > 1:
324  return srbm
325  else:
326  return 0
327 
328  def create_flexible_beads(self, flex_parts, max_trans=3.0,
329  resolution='all'):
330  """Create a chain of flexible beads
331 
332  @param flex_parts Can be one of the following inputs:
333  IMP Hierarchy, PMI System/State/Molecule/TempResidue,
334  or a list/set (of list/set) of them.
335  Must be uniform input, however. No mixing object types.
336  @param max_trans Maximum flexible bead translation
337  @param resolution Only used if you pass PMI objects. Probably
338  you want 'all'.
339  """
340 
341  fb_movers = []
342  hiers = IMP.pmi.tools.input_adaptor(flex_parts,
343  resolution,
344  flatten=True)
345  if not hiers or len(hiers) == 0:
346  warnings.warn(
347  'No hierarchies were passed to create_flexible_beads()',
349  return fb_movers
350  for h in hiers:
351  p = h.get_particle()
352  IMP.core.XYZ(p).set_coordinates_are_optimized(True)
355  raise Exception(
356  "Cannot create flexible beads from members of rigid body")
357  self.flexible_beads.append(h)
358  fbmv = IMP.core.BallMover(p.get_model(), p, max_trans)
359  fb_movers.append(fbmv)
360  fbmv.set_was_used(True)
361  self.fb_movers.append(fbmv)
362  self.movers_particles_map[fbmv] = IMP.atom.get_leaves(h)
363  self.movers_xyz_map[fbmv] = IMP.atom.get_leaves(h)
364  self.movers += fb_movers
365  return fb_movers
366 
367  def create_nuisance_mover(self, nuisance_p, step_size, name=None):
368  """Create MC normal mover for nuisance particles.
369  We will add an easier interface to add all of them from a PMI restraint
370  @param nuisance_p The Nuisance particle (an ISD::Scale)
371  @param step_size The maximum step size for Monte Carlo
372  @param name The name of the mover, useful for better output reading.
373  """
374  mv = IMP.core.NormalMover([nuisance_p],
375  IMP.FloatKeys([IMP.FloatKey("nuisance")]),
376  step_size)
377  if name is not None:
378  mv.set_name(name)
379  mv.set_was_used(True)
380  self.nuisances.append(nuisance_p)
381  self.movers.append(mv)
382  return [mv]
383 
384  def setup_md(self, hspec):
385  """Setup particles for MD simulation. Returns all particles, just
386  pass this to molecular_dynamics_sample_objects in ReplicaExchange0.
387  @param hspec Can be one of the following inputs:
388  IMP Hierarchy, PMI System/State/Molecule/TempResidue,
389  or a list/set (of list/set) of them.
390  Must be uniform input, however. No mixing object types.
391  """
392  hiers = IMP.pmi.tools.input_adaptor(hspec, flatten=True)
393  model = hiers[0].get_model()
394  all_ps = []
395  for hl in hiers:
396  for h in IMP.core.get_leaves(hl):
397  p = h.get_particle()
398  pxyz = IMP.core.XYZ(model, p.get_index())
399  pxyz.set_coordinates_are_optimized(True)
400  IMP.atom.LinearVelocity.setup_particle(p, [0., 0., 0.])
401  all_ps.append(p)
402  return all_ps
403 
404  def constrain_symmetry(self, references, clones, transform,
405  resolution='all', type="AXIAL"):
406  """Create a symmetry constraint. Checks:
407  same number of particles
408  disable ANY movers involving symmetry copies
409  (later may support moving them WITH references,
410  but requires code to propagate constraint)
411  @param references Can be one of the following inputs:
412  IMP Hierarchy, PMI System/State/Molecule/TempResidue,
413  or a list/set (of list/set) of them
414  @param clones Same format as references
415  @param transform The transform that moves a clone onto a reference
416  IMP.algebra.Transformation3D
417  @param resolution Only used if you pass PMI objects.
418  If you have a multires system, assuming each are rigid
419  bodies you probably only need one resolution.
420  @param type of symmetry. Implemented = AXIAL, RIGID_BODY
421  """
422 
423  # get all RBs and particles
424  href = IMP.pmi.tools.input_adaptor(references, resolution,
425  flatten=True)
426  hclones = IMP.pmi.tools.input_adaptor(clones, resolution, flatten=True)
427 
428  ref_rbs, ref_beads = IMP.pmi.tools.get_rbs_and_beads(href)
429  clones_rbs, clones_beads = IMP.pmi.tools.get_rbs_and_beads(hclones)
430 
431  for ref, clone in zip(ref_rbs, clones_rbs):
433 
434  for ref, clone in zip(ref_beads, clones_beads):
436 
437  # removing movers involved in clones
438  self.disable_movers(hclones)
439 
440  if type == "AXIAL":
441  sm = IMP.core.TransformationSymmetry(transform)
442 
443  if type == "RIGID_BODY":
444  p = IMP.Particle(self.model)
445  p.set_name("RigidBody_Symmetry")
447  p, IMP.algebra.ReferenceFrame3D(transform))
448  for cp in [(10, 0, 0), (0, 10, 0), (0, 0, 10)]:
449  p = IMP.Particle(self.model)
451  rb.add_member(p)
452  sm = IMP.core.TransformationSymmetry(rb.get_particle_index())
453  self.rigid_bodies.append(rb)
454  rb.set_coordinates_are_optimized(True)
455  rb_mover_tr = IMP.core.RigidBodyMover(
456  rb.get_model(), rb.get_particle_index(), 0.0, 1.0)
457  rb_mover_rt = IMP.core.RigidBodyMover(
458  rb.get_model(), rb.get_particle_index(), 10.0, 0.0)
459 
460  rb_mover_tr.set_name("RigidBody_Symmetry_Mover_Translate")
461  rb_mover_rt.set_name("RigidBody_Symmetry_Mover_Rotate")
462  print('Created rigid body symmetry restraint')
463  self.movers_particles_map[rb_mover_tr] = []
464  self.movers_particles_map[rb_mover_rt] = []
465  self.movers_rb_map[rb_mover_tr] = [rb]
466  self.movers_rb_map[rb_mover_rt] = [rb]
467  for h in hclones:
468  self.movers_particles_map[rb_mover_tr] \
469  += IMP.atom.get_leaves(h)
470  self.movers_particles_map[rb_mover_rt] \
471  += IMP.atom.get_leaves(h)
472  self.movers.append(rb_mover_tr) # probably need to store more info
473  self.movers.append(rb_mover_rt) # probably need to store more info
474  # dictionary relating rb to movers
475  self._rb2mov[rb] = [rb_mover_tr, rb_mover_rt]
476 
478  self.model,
479  [bead.get_particle().get_index()
480  for bead in clones_rbs+clones_beads])
481  c = IMP.container.SingletonsConstraint(sm, None, lsc)
482  self.model.add_score_state(c)
483  print('Created symmetry restraint for', len(ref_rbs),
484  'rigid bodies and', len(ref_beads), 'flexible beads')
485  self.model.update()
486 
487  def __repr__(self):
488  # would like something fancy like this:
489  # - super-rigid "SRB1"
490  # - rigid "Mol1" (8 rigid, 3 nonrigid)
491  # - rigid "Mol2" (8 rigid, 3 nonrigid)
492  # - rigid "Mol3" (8 rigid, 3 nonrigid)
493  return 'DegreesOfFreedom: ' + \
494  "\n".join(repr(m) for m in self.movers)
495 
496  def optimize_flexible_beads(self, nsteps, temperature=1.0):
497  '''Set up MC run with just flexible beads.
498  Optimization works much better when restraints
499  are already set up.'''
500  pts = IMP.pmi.tools.ParticleToSampleList()
501  for n, fb in enumerate(self.get_flexible_beads()):
502  pts.add_particle(fb, "Floppy_Bodies", 1.0,
503  "Flexible_Bead_" + str(n))
504  if len(pts.get_particles_to_sample()) > 0:
505  mc = IMP.pmi.samplers.MonteCarlo(self.model, [pts], temperature)
506  print("optimize_flexible_beads: optimizing %i flexible beads"
507  % len(self.get_flexible_beads()))
508  mc.optimize(nsteps)
509  else:
510  print("optimize_flexible_beads: no particle to optimize")
511 
512  def get_movers(self):
513  """Returns Enabled movers"""
514  if self.disabled_movers:
515  filtered_mover_list = []
516  for mv in self.movers:
517  if mv not in self.disabled_movers:
518  filtered_mover_list.append(mv)
519  return filtered_mover_list
520  else:
521  return self.movers
522 
524  """Return all movers corresponding to individual beads"""
525  return self.fb_movers
526 
527  def get_rigid_bodies(self):
528  """Return list of rigid body objects"""
529  return self.rigid_bodies
530 
532  "Return all flexible beads, including nonrigid members of rigid bodies"
533  return self.flexible_beads
534 
535  def disable_movers(self, objects, mover_types=None):
536  """Fix the position of the particles by disabling the corresponding
537  movers.
538  @param objects Can be one of the following inputs:
539  IMP Hierarchy, PMI System/State/Molecule/TempResidue, or a
540  list/set (of list/set) of them.
541  Must be uniform input, however. No mixing object types.
542  @param mover_types further filter the mover type that will be
543  disabled; it can be a list of IMP.core.RigidBodyMover,
544  IMP.core.BallMover etc etc if one wants to fix the corresponding
545  rigid body, or the floppy bodies.
546  An empty mover_types list is interpreted as all possible movers.
547  It returns the list of fixed xyz particles (ie, floppy bodies/beads)
548  and rigid bodies whose movers were disabled
549  """
550  hierarchies = IMP.pmi.tools.input_adaptor(objects,
551  pmi_resolution='all',
552  flatten=True)
553  tmp_set = set()
554  fixed_rb = set()
555  fixed_xyz = set()
556  if mover_types is None:
557  mover_types = []
558 
559  inv_map = {}
560  for mv, ps in self.movers_particles_map.items():
561  for p in ps:
562  if p in inv_map:
563  inv_map[p].append(mv)
564  else:
565  inv_map[p] = [mv]
566 
567  for h in hierarchies:
568  if h in inv_map:
569  for mv in inv_map[h]:
570  if (type(mv) in mover_types or not mover_types):
571  tmp_set.add(mv)
572  if mv in self.movers_rb_map:
573  fixed_rb |= set(self.movers_rb_map[mv])
574  if mv in self.movers_xyz_map:
575  fixed_xyz |= set(self.movers_xyz_map[mv])
576  print("Fixing %s movers" % (str(len(list(tmp_set)))))
577  self.disabled_movers += list(tmp_set)
578  return list(fixed_xyz), list(fixed_rb)
579 
580  def enable_all_movers(self):
581  """Reenable all movers: previously fixed particles will be released"""
582  self.disabled_movers = []
583 
585  """Extract the nuisances from get_particles_to_sample()"""
586  try:
587  pslist = r.get_particles_to_sample()
588  except AttributeError:
589  raise Exception(
590  "dof.get_nuisances_from_restraint(): the passed object "
591  "does not have a get_particles_to_sample() function")
592  for name in pslist:
593  is_sampled = True
594  if len(pslist[name]) == 3:
595  ps, maxtrans, is_sampled = pslist[name]
596  else:
597  ps, maxtrans = pslist[name]
598  if is_sampled:
599  self.create_nuisance_mover(ps[0], maxtrans, name)
def optimize_flexible_beads
Set up MC run with just flexible beads.
def get_rigid_bodies
Return list of rigid body objects.
Simple 3D transformation class.
static CenterOfMass setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor members)
Definition: CenterOfMass.h:81
Apply a SingletonFunction to a SingletonContainer to maintain an invariant.
Set the coordinates of a particle to be a transformed version of a reference.
Definition: core/symmetry.h:76
Set of Python classes to create a multi-state, multi-resolution IMP hierarchy.
def create_flexible_beads
Create a chain of flexible beads.
def enable_all_movers
Reenable all movers: previously fixed particles will be released.
Miscellaneous utilities.
Definition: tools.py:1
def get_nuisances_from_restraint
Extract the nuisances from get_particles_to_sample()
Modify the transformation of a rigid body.
def create_nuisance_mover
Create MC normal mover for nuisance particles.
def get_movers
Returns Enabled movers.
def get_floppy_body_movers
Return all movers corresponding to individual beads.
Move continuous particle variables by perturbing them within a ball.
static bool get_is_setup(const IMP::ParticleAdaptor &p)
Definition: rigid_bodies.h:731
GenericHierarchies get_leaves(Hierarchy mhd)
Get all the leaves of the bit of hierarchy.
static FloatKeys get_internal_coordinate_keys()
Definition: rigid_bodies.h:709
static XYZ setup_particle(Model *m, ParticleIndex pi)
Definition: XYZ.h:51
def setup_md
Setup particles for MD simulation.
A reference frame in 3D.
def create_main_chain_mover
Create crankshaft moves from a set of SUPER rigid body mover from one molecule.
def input_adaptor
Adapt things for PMI (degrees of freedom, restraints, ...) Returns list of list of hierarchies...
Definition: tools.py:948
def create_rigid_body
Create rigid body constraint and mover.
The standard decorator for manipulating molecular structures.
Ints get_index(const ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
def create_super_rigid_body
Create SUPER rigid body mover from one or more hierarchies.
Store a list of ParticleIndexes.
A decorator for a particle with x,y,z coordinates.
Definition: XYZ.h:30
Modify the transformation of a rigid body.
Modify a set of continuous variables using a normal distribution.
Definition: NormalMover.h:20
Sampling of the system.
Definition: samplers.py:1
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
Sample using Monte Carlo.
Definition: samplers.py:47
The general base class for IMP exceptions.
Definition: exception.h:49
static Reference setup_particle(Model *m, ParticleIndex pi, ParticleIndexAdaptor reference)
Definition: core/symmetry.h:32
Rotation3D get_identity_rotation_3d()
Return a rotation that does not do anything.
Definition: Rotation3D.h:356
Class to handle individual particles of a Model object.
Definition: Particle.h:41
def constrain_symmetry
Create a symmetry constraint.
static void teardown_particle(CenterOfMass com)
Make the particle no longer a center of mass.
Python classes to represent, score, sample and analyze models.
A decorator for a rigid body.
Definition: rigid_bodies.h:82
Functionality for loading, creating, manipulating and scoring atomic structures.
def get_rbs_and_beads
Returns unique objects in original order.
Definition: tools.py:1211
Hierarchies get_leaves(const Selection &h)
def get_flexible_beads
Return all flexible beads, including nonrigid members of rigid bodies.
def disable_movers
Fix the position of the particles by disabling the corresponding movers.
static RigidBody setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor ps)
Definition: rigid_bodies.h:174
static bool get_is_setup(const IMP::ParticleAdaptor &p)
Definition: rigid_bodies.h:752
Warning for probably incorrect input parameters.
def sublist_iterator
Yield all sublists of length >= lmin and <= lmax.
Definition: tools.py:644