IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
modeller/__init__.py
1 import os
2 import tempfile
3 import shutil
4 import IMP.atom
5 import IMP.container
6 import modeller.scripts
7 import modeller.optimizers
8 
9 
10 # Use Modeller 10 class names
11 if not hasattr(modeller.terms, 'EnergyTerm'):
12  modeller.terms.EnergyTerm = modeller.terms.energy_term
13  modeller.Selection = modeller.selection
14 
15 
16 class _TempDir:
17  """Make a temporary directory that is deleted when the object is."""
18 
19  def __init__(self):
20  self.tmpdir = tempfile.mkdtemp()
21 
22  def __del__(self):
23  shutil.rmtree(self.tmpdir, ignore_errors=True)
24 
25 
26 class IMPRestraints(modeller.terms.EnergyTerm):
27  """A Modeller restraint which evaluates an IMP scoring function.
28  This can be used to incorporate IMP Restraints into an existing
29  comparative modeling pipeline, or to use Modeller optimizers or
30  protocols.
31  """
32 
33  _physical_type = modeller.physical.absposition
34 
35  def __init__(self, particles, scoring_function=None):
36  """Constructor.
37  @param particles A list of the IMP atoms (as Particle objects),
38  same order as the Modeller atoms.
39  @param scoring_function An IMP::ScoringFunction object that will
40  be incorporated into the Modeller score (molpdf).
41  @note since Modeller, unlike IMP, is sensitive to the ordering
42  of atoms, it usually makes sense to create the model in
43  Modeller and then use ModelLoader to load it into IMP,
44  since that will preserve the Modeller atom ordering in IMP.
45  """
46  modeller.terms.EnergyTerm.__init__(self)
47  self._particles = particles
48  if scoring_function:
49  self._sf = scoring_function
50  else:
51  self._sf = particles[0].get_model()
52 
53  def eval(self, mdl, deriv, indats):
54  atoms = self.indices_to_atoms(mdl, indats)
55  _copy_modeller_coords_to_imp(atoms, self._particles)
56  if len(self._particles) == 0:
57  score = 0.
58  else:
59  score = self._sf.evaluate(deriv)
60  if deriv:
61  dvx = [0.] * len(indats)
62  dvy = [0.] * len(indats)
63  dvz = [0.] * len(indats)
64  _get_imp_derivs(self._particles, dvx, dvy, dvz)
65  return (score, dvx, dvy, dvz)
66  else:
67  return score
68 
69 
71  """An IMP restraint using all defined Modeller restraints.
72  This is useful if you want to use Modeller restraints with an IMP
73  optimizer, or in combination with IMP restraints.
74 
75  @note Currently only the coordinates of the atoms are translated
76  between Modeller and IMP; thus, a Modeller restraint which
77  uses any other attribute (e.g. charge) will not react if
78  this attribute is changed by IMP.
79  """
80 
81  def __init__(self, model, modeller_model, particles):
82  """Constructor.
83  @param model The IMP Model object.
84  @param modeller_model The Modeller model object.
85  @param particles A list of the IMP atoms (as Particle objects),
86  in the same order as the Modeller atoms.
87  @note since Modeller, unlike IMP, is sensitive to the ordering
88  of atoms, it usually makes sense to create the model in
89  Modeller and then use ModelLoader to load it into IMP,
90  since that will preserve the Modeller atom ordering in IMP.
91  """
92  def get_particle(x):
93  if hasattr(x, 'get_particle'):
94  return x.get_particle()
95  else:
96  return x
97  IMP.Restraint.__init__(self, model, "ModellerRestraints %1%")
98  self._modeller_model = modeller_model
99  self._particles = [get_particle(x) for x in particles]
100 
101  def unprotected_evaluate(self, accum):
102  atoms = self._modeller_model.atoms
103  sel = modeller.Selection(self._modeller_model)
104  _copy_imp_coords_to_modeller(self._particles, atoms)
105  energies = sel.energy()
106  if accum:
107  _add_modeller_derivs_to_imp(atoms, self._particles, accum)
108 
109  return energies[0]
110 
111  def get_version_info(self):
112  return IMP.VersionInfo("IMP developers", "0.1")
113  def do_show(self, fh):
114  fh.write("ModellerRestraints")
115  def do_get_inputs(self):
116  return self._particles
117 
118 
119 def _copy_imp_coords_to_modeller(particles, atoms):
120  """Copy atom coordinates from IMP to Modeller"""
121  xkey = IMP.FloatKey("x")
122  ykey = IMP.FloatKey("y")
123  zkey = IMP.FloatKey("z")
124  for (num, at) in enumerate(atoms):
125  at.x = particles[num].get_value(xkey)
126  at.y = particles[num].get_value(ykey)
127  at.z = particles[num].get_value(zkey)
128 
129 
130 def _copy_modeller_coords_to_imp(atoms, particles):
131  """Copy atom coordinates from Modeller to IMP"""
132  xkey = IMP.FloatKey("x")
133  ykey = IMP.FloatKey("y")
134  zkey = IMP.FloatKey("z")
135  for (num, at) in enumerate(atoms):
136  particles[num].set_value(xkey, at.x)
137  particles[num].set_value(ykey, at.y)
138  particles[num].set_value(zkey, at.z)
139 
140 
141 def _add_modeller_derivs_to_imp(atoms, particles, accum):
142  """Add atom derivatives from Modeller to IMP"""
143  for (num, at) in enumerate(atoms):
144  xyz = IMP.core.XYZ(particles[num])
145  xyz.add_to_derivative(0, at.dvx, accum)
146  xyz.add_to_derivative(1, at.dvy, accum)
147  xyz.add_to_derivative(2, at.dvz, accum)
148 
149 
150 def _get_imp_derivs(particles, dvx, dvy, dvz):
151  """Move atom derivatives from IMP to Modeller"""
152  xkey = IMP.FloatKey("x")
153  ykey = IMP.FloatKey("y")
154  zkey = IMP.FloatKey("z")
155  for idx in range(0, len(dvx)):
156  dvx[idx] = particles[idx].get_derivative(xkey)
157  dvy[idx] = particles[idx].get_derivative(ykey)
158  dvz[idx] = particles[idx].get_derivative(zkey)
159 
160 
161 # Generators to create IMP UnaryFunction objects from Modeller parameters:
162 def _HarmonicLowerBoundGenerator(parameters, modalities):
163  (mean, stdev) = parameters
165  return IMP.core.HarmonicLowerBound(mean, k)
166 
167 def _HarmonicUpperBoundGenerator(parameters, modalities):
168  (mean, stdev) = parameters
170  return IMP.core.HarmonicUpperBound(mean, k)
171 
172 def _HarmonicGenerator(parameters, modalities):
173  (mean, stdev) = parameters
175  return IMP.core.Harmonic(mean, k)
176 
177 def _CosineGenerator(parameters, modalities):
178  (phase, force_constant) = parameters
179  (periodicity,) = modalities
180  return IMP.core.Cosine(force_constant, periodicity, phase)
181 
182 def _LinearGenerator(parameters, modalities):
183  (scale,) = parameters
184  return IMP.core.Linear(0, scale)
185 
186 def _SplineGenerator(parameters, modalities):
187  (open, low, high, delta, lowderiv, highderiv) = parameters[:6]
188  values = []
189  for v in parameters[6:]:
190  values.append(v)
191  if open < 0.0:
192  return IMP.core.ClosedCubicSpline(values, low, delta)
193  else:
194  return IMP.core.OpenCubicSpline(values, low, delta)
195 
196 #: Mapping from Modeller math form number to a unary function generator
197 _unary_func_generators = {
198  1: _HarmonicLowerBoundGenerator,
199  2: _HarmonicUpperBoundGenerator,
200  3: _HarmonicGenerator,
201  7: _CosineGenerator,
202  8: _LinearGenerator,
203  10: _SplineGenerator,
204 }
205 
206 # Generators to make IMP Restraint objects from Modeller features
207 def _DistanceRestraintGenerator(form, modalities, atoms, parameters):
208  unary_func_gen = _unary_func_generators[form]
209  return IMP.core.DistanceRestraint(atoms[0].get_model(),
210  unary_func_gen(parameters, modalities),
211  atoms[0], atoms[1])
212 
213 def _AngleRestraintGenerator(form, modalities, atoms, parameters):
214  unary_func_gen = _unary_func_generators[form]
215  return IMP.core.AngleRestraint(atoms[0].get_model(),
216  unary_func_gen(parameters, modalities),
217  atoms[0], atoms[1], atoms[2])
218 
219 def _MultiBinormalGenerator(form, modalities, atoms, parameters):
220  nterms = modalities[0]
221  if len(parameters) != nterms * 6:
222  raise ValueError("Incorrect number of parameters (%d) for multiple "
223  "binormal restraint - expecting %d (%d terms * 6)" \
224  % (len(parameters), nterms * 6, nterms))
225  r = IMP.core.MultipleBinormalRestraint(atoms[0].get_model(),
226  atoms[:4], atoms[4:8])
227  for i in range(nterms):
229  t.set_weight(parameters[i])
230  t.set_means((parameters[nterms + i * 2],
231  parameters[nterms + i * 2 + 1]))
232  t.set_standard_deviations((parameters[nterms * 3 + i * 2],
233  parameters[nterms * 3 + i * 2 + 1]))
234  t.set_correlation(parameters[nterms * 5 + i])
235  r.add_term(t)
236  return r
237 
238 def _DihedralRestraintGenerator(form, modalities, atoms, parameters):
239  if form == 9:
240  return _MultiBinormalGenerator(form, modalities, atoms, parameters)
241  unary_func_gen = _unary_func_generators[form]
242  return IMP.core.DihedralRestraint(atoms[0].get_model(),
243  unary_func_gen(parameters, modalities),
244  atoms[0], atoms[1], atoms[2], atoms[3])
245 
246 def _get_protein_atom_particles(protein):
247  """Given a protein particle, get the flattened list of all child atoms"""
248  atom_particles = []
249  for ichain in range(protein.get_number_of_children()):
250  chain = protein.get_child(ichain)
251  for ires in range(chain.get_number_of_children()):
252  residue = chain.get_child(ires)
253  for iatom in range(residue.get_number_of_children()):
254  atom = residue.get_child(iatom)
255  atom_particles.append(atom.get_particle())
256  return atom_particles
257 
258 def _load_restraints_line(line, atom_particles):
259  """Parse a single Modeller restraints file line and return the
260  corresponding IMP restraint."""
261  spl = line.split()
262  typ = spl.pop(0)
263  if typ == 'MODELLER5':
264  return
265  elif typ != 'R':
266  raise NotImplementedError("Only 'R' lines currently read from " + \
267  "Modeller restraints files")
268  form = int(spl.pop(0))
269  modalities = [int(spl.pop(0))]
270  features = [int(spl.pop(0))]
271  # Discard group
272  spl.pop(0)
273  natoms = [int(spl.pop(0))]
274  nparam = int(spl.pop(0))
275  nfeat = int(spl.pop(0))
276  for i in range(nfeat - 1):
277  modalities.append(int(spl.pop(0)))
278  features.append(int(spl.pop(0)))
279  natoms.append(int(spl.pop(0)))
280  atoms = [int(spl.pop(0)) for x in range(natoms[0])]
281  for i in range(len(atoms)):
282  atoms[i] = atom_particles[atoms[i] - 1]
283  parameters = [float(spl.pop(0)) for x in range(nparam)]
284  restraint_generators = {
285  1 : _DistanceRestraintGenerator,
286  2 : _AngleRestraintGenerator,
287  3 : _DihedralRestraintGenerator,
288  4 : _DihedralRestraintGenerator,
289  }
290  restraint_gen = restraint_generators[features[0]]
291  return restraint_gen(form, modalities, atoms, parameters)
292 
293 
294 def _load_entire_restraints_file(filename, protein):
295  """Yield a set of IMP restraints from a Modeller restraints file."""
296  atoms = _get_protein_atom_particles(protein)
297  with open(filename, 'r') as fh:
298  for line in fh:
299  try:
300  rsr = _load_restraints_line(line, atoms)
301  if rsr is not None:
302  yield rsr
303  except Exception as err:
304  print("Cannot read restraints file line:\n" + line)
305  raise
306 
307 
308 def _copy_residue(r, model):
309  """Copy residue information from modeller to imp"""
310  #print "residue "+str(r)
311  p=IMP.Particle(model)
313  r.index)
314  p.set_name(str("residue "+r.num));
315  return p
316 
317 
318 def _copy_atom(a, model):
319  """Copy atom information from modeller"""
320  #print "atom "+str(a)
321  p=IMP.Particle(model)
323  xyzd= IMP.core.XYZ.setup_particle(p, IMP.algebra.Vector3D(a.x, a.y, a.z))
324  # Alignment structures don't have charges or atom types; models do
325  if hasattr(a, 'charge'):
327  if hasattr(a, 'type'):
328  IMP.atom.CHARMMAtom.setup_particle(p, a.type.name)
329  ap.set_input_index(a.index)
330  return p
331 
332 def _copy_chain(c, model):
333  """Copy chain information from modeller"""
334  #print "atom "+str(a)
335  p=IMP.Particle(model)
336  #set the chain name
337  cp = IMP.atom.Chain.setup_particle(p,c.name)
338  return p
339 
340 def _get_forcefield(submodel):
341  if submodel == 3:
343  IMP.atom.get_data_path('top_heav.lib'),
344  IMP.atom.get_data_path('par.lib'))
345  else:
347  IMP.atom.get_data_path('top.lib'),
348  IMP.atom.get_data_path('par.lib'))
349  return ff
350 
351 def add_soft_sphere_radii(hierarchy, submodel, scale=1.0, filename=None):
352  """Add radii to the hierarchy using the Modeller radius library, radii.lib.
353  Each radius is scaled by the given scale (Modeller usually scales radii
354  by a factor of 0.82). submodel specifies the topology submodel, which is
355  the column in radii.lib to use."""
356  if filename is None:
357  filename = IMP.atom.get_data_path('radii.lib')
358  radii = {}
359  with open(filename) as fh:
360  for line in fh:
361  if line.startswith('#'): continue
362  spl = line.split()
363  if len(spl) > 11:
364  radii[spl[0]] = float(spl[submodel])
365  atoms = IMP.atom.get_by_type(hierarchy, IMP.atom.ATOM_TYPE)
366  for a in atoms:
367  p = a.get_particle()
368  ct = IMP.atom.CHARMMAtom(p).get_charmm_type()
369  if ct in radii:
370  radius = radii[ct] * scale
372  IMP.core.XYZR(p).set_radius(radius)
373  else:
375 
376 
378  """Read a Modeller model into IMP. After creating this object, the atoms
379  in the Modeller model can be loaded into IMP using the load_atoms()
380  method, then optionally any Modeller static restraints can be read in
381  with load_static_restraints() or load_static_restraints_file().
382 
383  This class can also be used to read Modeller alignment structures;
384  however, only load_atoms() will be useful in such a case (since
385  alignment structures don't have restraints or other information).
386 
387  """
388 
389  def __init__(self, modeller_model):
390  """Constructor.
391  @param modeller_model The Modeller model or alignment structure
392  object to read.
393  """
394  self._modeller_model = modeller_model
395 
396  def load_atoms(self, model):
397  """Construct an IMP::atom::Hierarchy that contains the same atoms as
398  the Modeller model or alignment structure.
399 
400  IMP atoms created from a Modeller model will be given charges and
401  CHARMM types, extracted from the model. Alignment structures don't
402  contain this information, so the IMP atoms won't either.
403 
404  @param model The IMP::Model object in which the hierarchy will be
405  created. The highest level hierarchy node is a PROTEIN.
406  @return the newly-created root IMP::atom::Hierarchy.
407  """
408  pp = IMP.Particle(model)
410  self._atoms = {}
411  for chain in self._modeller_model.chains:
412  cp = IMP.Particle(model)
413  hcp = IMP.atom.Chain.setup_particle(cp, chain.name)
414  # We don't really know the type yet
415  hpp.add_child(hcp)
416  for residue in chain.residues:
417  rp = _copy_residue(residue, model)
418  hrp = IMP.atom.Hierarchy(rp)
419  hcp.add_child(hrp)
420  for atom in residue.atoms:
421  ap = _copy_atom(atom, model)
422  hap = IMP.atom.Hierarchy(ap)
423  hrp.add_child(hap)
424  self._atoms[atom.index] = ap
425  lastres = hrp
426  self._modeller_hierarchy = hpp
427  return hpp
428 
429  def _get_nonbonded_list(self, atoms, pair_filter, edat, distance):
430  nbl = IMP.container.ClosePairContainer(atoms, distance,
431  edat.update_dynamic)
432 
433  # Exclude the same sets of atoms as Modeller
434  if pair_filter is None:
435  pair_filter = IMP.atom.StereochemistryPairFilter()
436  if edat.excl_local[0]:
437  pair_filter.set_bonds(list(self.load_bonds()))
438  if edat.excl_local[1]:
439  pair_filter.set_angles(list(self.load_angles()))
440  if edat.excl_local[2]:
441  pair_filter.set_dihedrals(list(self.load_dihedrals()))
442  nbl.add_pair_filter(pair_filter)
443  return nbl
444 
445  def load_bonds(self):
446  """Load the Modeller bond topology into the IMP model. Each bond is
447  represented in IMP as an IMP::atom::Bond, with no defined length
448  or stiffness. These bonds are primarily useful as input to
449  IMP::atom::StereochemistryPairFilter, to exclude bond interactions
450  from the nonbonded list. Typically the contribution to the scoring
451  function from the bonds is included in the Modeller static restraints
452  (use load_static_restraints() or load_static_restraints_file() to
453  load these). If you want to regenerate the stereochemistry in IMP,
454  do not use these functions (as then stereochemistry scoring terms
455  and exclusions would be double-counted) and instead use the
456  IMP::atom::CHARMMTopology class.
457 
458  You must call load_atoms() prior to using this function.
459  @see load_angles(), load_dihedrals(), load_impropers()
460  @return A generator listing all of the bonds.
461  """
462  if not hasattr(self, '_modeller_hierarchy'):
463  raise ValueError("Call load_atoms() first.")
464  for (maa, mab) in self._modeller_model.bonds:
465  pa = self._atoms[maa.index]
466  pb = self._atoms[mab.index]
468  ba= IMP.atom.Bonded(pa)
469  else:
472  bb= IMP.atom.Bonded(pb)
473  else:
475  yield IMP.atom.create_bond(ba, bb,
476  IMP.atom.Bond.SINGLE).get_particle()
477 
478  def load_angles(self):
479  """Load the Modeller angle topology into the IMP model.
480  See load_bonds() for more details."""
481  return self._internal_load_angles(self._modeller_model.angles,
483 
484  def load_dihedrals(self):
485  """Load the Modeller dihedral topology into the IMP model.
486  See load_bonds() for more details."""
487  return self._internal_load_angles(self._modeller_model.dihedrals,
489 
490  def load_impropers(self):
491  """Load the Modeller improper topology into the IMP model.
492  See load_bonds() for more details."""
493  return self._internal_load_angles(self._modeller_model.impropers,
495 
496  def _internal_load_angles(self, angles, angle_class):
497  if not hasattr(self, '_modeller_hierarchy'):
498  raise ValueError("Call load_atoms() first.")
499  for modeller_atoms in angles:
500  imp_particles = [self._atoms[x.index] for x in modeller_atoms]
501  p = IMP.Particle(imp_particles[0].get_model())
502  a = angle_class.setup_particle(p,
503  *[IMP.core.XYZ(x) for x in imp_particles])
504  yield a.get_particle()
505 
506  def load_static_restraints_file(self, filename):
507  """Convert a Modeller static restraints file into equivalent
508  IMP::Restraints. load_atoms() must have been called first to read
509  in the atoms that the restraints will act upon.
510  @param filename Name of the Modeller restraints file. The restraints
511  in this file are assumed to act upon the model read in by
512  load_atoms(); no checking is done to enforce this.
513  @return A Python generator of the newly-created IMP::Restraint
514  objects.
515  """
516  if not hasattr(self, '_modeller_hierarchy'):
517  raise ValueError("Call load_atoms() first.")
518  return _load_entire_restraints_file(filename, self._modeller_hierarchy)
519 
520 
522  """Convert the current set of Modeller static restraints into equivalent
523  IMP::Restraints. load_atoms() must have been called first to read
524  in the atoms that the restraints will act upon.
525  @return A Python generator of the newly-created IMP::Restraint
526  objects.
527  """
528  class _RestraintGenerator:
529  """Simple generator wrapper"""
530  def __init__(self, gen):
531  self._gen = gen
532  def __iter__(self, *args, **keys):
533  return self
534  def close(self, *args, **keys):
535  return self._gen.close(*args, **keys)
536  def next(self):
537  return next(self._gen)
538  __next__ = next
539  def send(self, *args, **keys):
540  return self._gen.send(*args, **keys)
541  def throw(self, *args, **keys):
542  return self._gen.throw(*args, **keys)
543  # Write current restraints into a temporary file
544  t = _TempDir()
545  rsrfile = os.path.join(t.tmpdir, 'restraints.rsr')
546  self._modeller_model.restraints.write(file=rsrfile)
547  # Read the file back in
548  gen = self.load_static_restraints_file(rsrfile)
549  wrap = _RestraintGenerator(gen)
550  # Ensure that tmpdir remains until we're done with the generator
551  wrap._tempdir = t
552  return wrap
553 
554  def load_dynamic_restraints(self, pair_filter=None):
555  """Convert Modeller dynamic restraints into IMP::Restraint objects.
556 
557  For each currently active Modeller dynamic restraint
558  (e.g. soft-sphere, electrostatics) an equivalent IMP::Restraint
559  is created.
560  load_atoms() must have been called first to read
561  in the atoms that the restraints will act upon.
562 
563  If pair_filter is given, it is an IMP::PairFilter object to exclude
564  pairs from the nonbonded lists used by the dynamic restraints.
565  Otherwise, an IMP::atom::StereochemistryPairFilter object is created
566  to exclude Modeller bonds, angles and dihedrals, as specified by
567  edat.excl_local. (Note that this calls load_bonds(), load_angles()
568  and load_dihedrals(), so will create duplicate lists of bonds if
569  those methods are called manually as well.)
570 
571  @note Currently only soft-sphere, electrostatic and Lennard-Jones
572  restraints are loaded.
573  @return A Python generator of the newly-created IMP::Restraint
574  objects.
575  """
576  if not hasattr(self, '_modeller_hierarchy'):
577  raise ValueError("Call load_atoms() first.")
578  edat = self._modeller_model.env.edat
579  libs = self._modeller_model.env.libs
580  atoms = IMP.atom.get_leaves(self._modeller_hierarchy)
581  m = atoms[0].get_model()
583 
584  if edat.dynamic_sphere:
585  # Note: cannot use Modeller's cutoff distance, as that is
586  # center-to-center; IMP's is sphere surface-surface
587  nbl = self._get_nonbonded_list(atoms, pair_filter, edat, 0.)
588  # No way to get Modeller radii, so we have to reassign them
589  add_soft_sphere_radii(self._modeller_hierarchy,
590  libs.topology.submodel, edat.radii_factor)
591  k = \
595  yield IMP.container.PairsRestraint(ps, nbl)
596 
597  if edat.dynamic_lennard or edat.dynamic_coulomb:
598  # 3.0 is roughly the max. atom diameter
599  d = max(edat.contact_shell - 3.0, 0.0)
600  nbl = self._get_nonbonded_list(atoms, pair_filter, edat, d)
601  ff = _get_forcefield(libs.topology.submodel)
602  ff.add_radii(self._modeller_hierarchy)
603 
604  if edat.dynamic_lennard:
605  ff.add_well_depths(self._modeller_hierarchy)
606  sf = IMP.atom.ForceSwitch(edat.lennard_jones_switch[0],
607  edat.lennard_jones_switch[1])
609  yield IMP.container.PairsRestraint(ps, nbl)
610 
611  if edat.dynamic_coulomb:
612  sf = IMP.atom.ForceSwitch(edat.coulomb_switch[0],
613  edat.coulomb_switch[1])
615  ps.set_relative_dielectric(edat.relative_dielectric)
616  yield IMP.container.PairsRestraint(ps, nbl)
617 
618 
619 __version__ = "2.22.0"
620 
622  '''Return the version of this module, as a string'''
623  return "2.22.0"
624 
625 def get_module_name():
626  '''Return the fully-qualified name of this module'''
627  return "IMP::modeller"
628 
629 def get_data_path(fname):
630  '''Return the full path to one of this module's data files'''
631  import IMP
632  return IMP._get_module_data_path("modeller", fname)
633 
634 def get_example_path(fname):
635  '''Return the full path to one of this module's example files'''
636  import IMP
637  return IMP._get_module_example_path("modeller", fname)
static CHARMMAtom setup_particle(Model *m, ParticleIndex pi, String charmm_type)
Create a decorator with the passed CHARMM type.
Definition: CHARMMAtom.h:37
static Charged setup_particle(Model *m, ParticleIndex pi, Float charge)
Definition: Charged.h:46
Lower bound harmonic function (non-zero when feature < mean)
def load_static_restraints
Convert the current set of Modeller static restraints into equivalent IMP::Restraints.
def get_module_version
Return the version of this module, as a string.
def load_bonds
Load the Modeller bond topology into the IMP model.
A Modeller restraint which evaluates an IMP scoring function.
Coulomb (electrostatic) score between a pair of particles.
static Atom setup_particle(Model *m, ParticleIndex pi, Atom other)
Definition: atom/Atom.h:246
Various classes to hold sets of particles.
Upper bound harmonic function (non-zero when feature > mean)
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition: XYZR.h:48
A decorator for a particle which has bonds.
def load_impropers
Load the Modeller improper topology into the IMP model.
Cosine function.
Definition: Cosine.h:25
virtual double unprotected_evaluate(DerivativeAccumulator *da) const
Return the unweighted score for the restraint.
def get_example_path
Return the full path to one of this module's example files.
Dihedral restraint between four particles.
def load_static_restraints_file
Convert a Modeller static restraints file into equivalent IMP::Restraints.
The type of an atom.
A score on the distance between the surfaces of two spheres.
Return all close unordered pairs of particles taken from the SingletonContainer.
static Residue setup_particle(Model *m, ParticleIndex pi, ResidueType t, int index, int insertion_code)
Definition: Residue.h:160
A single binormal term in a MultipleBinormalRestraint.
def load_dynamic_restraints
Convert Modeller dynamic restraints into IMP::Restraint objects.
Distance restraint between two particles.
static XYZ setup_particle(Model *m, ParticleIndex pi)
Definition: XYZ.h:51
An IMP restraint using all defined Modeller restraints.
static bool get_is_setup(const IMP::ParticleAdaptor &p)
Definition: XYZR.h:47
CHARMM force field parameters.
Bond create_bond(Bonded a, Bonded b, Bond o)
Connect the two wrapped particles by a custom bond.
def load_dihedrals
Load the Modeller dihedral topology into the IMP model.
static Float get_k_from_standard_deviation(Float sd, Float t=297.15)
Return the k to use for a given Gaussian standard deviation.
Definition: core/Harmonic.h:67
def get_data_path
Return the full path to one of this module's data files.
Angle restraint between three particles.
static Hierarchy setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor children=ParticleIndexesAdaptor())
Create a Hierarchy of level t by adding the needed attributes.
ParticleIndexPairs get_indexes(const ParticlePairsTemp &ps)
Get the indexes from a list of particle pairs.
Lennard-Jones score between a pair of particles.
A particle that describes an angle between three particles.
The standard decorator for manipulating molecular structures.
Store a list of ParticleIndexes.
static Bonded setup_particle(Model *m, ParticleIndex pi)
The type for a residue.
def load_atoms
Construct an IMP::atom::Hierarchy that contains the same atoms as the Modeller model or alignment str...
Version and module information for Objects.
Definition: VersionInfo.h:29
A decorator for a particle with x,y,z coordinates.
Definition: XYZ.h:30
Modeller-style multiple binormal (phi/psi) restraint.
Linear function
Definition: Linear.h:22
def add_soft_sphere_radii
Add radii to the hierarchy using the Modeller radius library, radii.lib.
A particle that describes a dihedral angle between four particles.
def load_angles
Load the Modeller angle topology into the IMP model.
def get_module_name
Return the fully-qualified name of this module.
static bool get_is_setup(const IMP::ParticleAdaptor &p)
virtual VersionInfo get_version_info() const
Get information about the module and version of the object.
Definition: Object.h:206
VectorD< 3 > Vector3D
Definition: VectorD.h:408
A filter that excludes bonds, angles and dihedrals.
Read a Modeller model into IMP.
Class to handle individual particles of a Model object.
Definition: Particle.h:43
std::string get_data_path(std::string file_name)
Return the full path to one of this module's data files.
Smooth interaction scores by switching the derivatives (force switch).
Functionality for loading, creating, manipulating and scoring atomic structures.
static Chain setup_particle(Model *m, ParticleIndex pi, std::string id)
Definition: Chain.h:84
Hierarchies get_leaves(const Selection &h)
Applies a PairScore to each Pair in a list.
virtual ModelObjectsTemp do_get_inputs() const =0
Closed cubic spline function.
A decorator for an atom that has a defined CHARMM type.
Definition: CHARMMAtom.h:24
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:56
Harmonic function (symmetric about the mean)
Definition: core/Harmonic.h:27
A decorator for a particle with x,y,z coordinates and a radius.
Definition: XYZR.h:27