IMP logo
IMP Reference Guide  2.7.0
The Integrative Modeling Platform
modeller/__init__.py
1 # This file was automatically generated by SWIG (http://www.swig.org).
2 # Version 3.0.10
3 #
4 # Do not make changes to this file unless you know what you are doing--modify
5 # the SWIG interface file instead.
6 
7 # This wrapper is part of IMP,
8 # Copyright 2007-2017 IMP Inventors. All rights reserved.
9 
10 from __future__ import print_function, division, absolute_import
11 
12 
13 
14 
15 from sys import version_info as _swig_python_version_info
16 if _swig_python_version_info >= (2, 7, 0):
17  def swig_import_helper():
18  import importlib
19  pkg = __name__.rpartition('.')[0]
20  mname = '.'.join((pkg, '_IMP_modeller')).lstrip('.')
21  try:
22  return importlib.import_module(mname)
23  except ImportError:
24  return importlib.import_module('_IMP_modeller')
25  _IMP_modeller = swig_import_helper()
26  del swig_import_helper
27 elif _swig_python_version_info >= (2, 6, 0):
28  def swig_import_helper():
29  from os.path import dirname
30  import imp
31  fp = None
32  try:
33  fp, pathname, description = imp.find_module('_IMP_modeller', [dirname(__file__)])
34  except ImportError:
35  import _IMP_modeller
36  return _IMP_modeller
37  if fp is not None:
38  try:
39  _mod = imp.load_module('_IMP_modeller', fp, pathname, description)
40  finally:
41  fp.close()
42  return _mod
43  _IMP_modeller = swig_import_helper()
44  del swig_import_helper
45 else:
46  import _IMP_modeller
47 del _swig_python_version_info
48 try:
49  _swig_property = property
50 except NameError:
51  pass # Python < 2.2 doesn't have 'property'.
52 
53 try:
54  import builtins as __builtin__
55 except ImportError:
56  import __builtin__
57 
58 def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
59  if (name == "thisown"):
60  return self.this.own(value)
61  if (name == "this"):
62  if type(value).__name__ == 'SwigPyObject':
63  self.__dict__[name] = value
64  return
65  method = class_type.__swig_setmethods__.get(name, None)
66  if method:
67  return method(self, value)
68  if (not static):
69  object.__setattr__(self, name, value)
70  else:
71  raise AttributeError("You cannot add attributes to %s" % self)
72 
73 
74 def _swig_setattr(self, class_type, name, value):
75  return _swig_setattr_nondynamic(self, class_type, name, value, 0)
76 
77 
78 def _swig_getattr(self, class_type, name):
79  if (name == "thisown"):
80  return self.this.own()
81  method = class_type.__swig_getmethods__.get(name, None)
82  if method:
83  return method(self)
84  raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
85 
86 
87 def _swig_repr(self):
88  try:
89  strthis = "proxy of " + self.this.__repr__()
90  except __builtin__.Exception:
91  strthis = ""
92  return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
93 
94 
95 def _swig_setattr_nondynamic_method(set):
96  def set_attr(self, name, value):
97  if (name == "thisown"):
98  return self.this.own(value)
99  if hasattr(self, name) or (name == "this"):
100  set(self, name, value)
101  else:
102  raise AttributeError("You cannot add attributes to %s" % self)
103  return set_attr
104 
105 
106 try:
107  import weakref
108  weakref_proxy = weakref.proxy
109 except __builtin__.Exception:
110  weakref_proxy = lambda x: x
111 
112 
113 class IMP_MODELLER_SwigPyIterator(object):
114  """Proxy of C++ swig::IMP_MODELLER_SwigPyIterator class."""
115 
116  thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
117 
118  def __init__(self, *args, **kwargs):
119  raise AttributeError("No constructor defined - class is abstract")
120  __repr__ = _swig_repr
121  __swig_destroy__ = _IMP_modeller.delete_IMP_MODELLER_SwigPyIterator
122  __del__ = lambda self: None
123 
124  def value(self):
125  """value(IMP_MODELLER_SwigPyIterator self) -> PyObject *"""
126  return _IMP_modeller.IMP_MODELLER_SwigPyIterator_value(self)
127 
128 
129  def incr(self, n=1):
130  """
131  incr(IMP_MODELLER_SwigPyIterator self, size_t n=1) -> IMP_MODELLER_SwigPyIterator
132  incr(IMP_MODELLER_SwigPyIterator self) -> IMP_MODELLER_SwigPyIterator
133  """
134  return _IMP_modeller.IMP_MODELLER_SwigPyIterator_incr(self, n)
135 
136 
137  def decr(self, n=1):
138  """
139  decr(IMP_MODELLER_SwigPyIterator self, size_t n=1) -> IMP_MODELLER_SwigPyIterator
140  decr(IMP_MODELLER_SwigPyIterator self) -> IMP_MODELLER_SwigPyIterator
141  """
142  return _IMP_modeller.IMP_MODELLER_SwigPyIterator_decr(self, n)
143 
144 
145  def distance(self, x):
146  """distance(IMP_MODELLER_SwigPyIterator self, IMP_MODELLER_SwigPyIterator x) -> ptrdiff_t"""
147  return _IMP_modeller.IMP_MODELLER_SwigPyIterator_distance(self, x)
148 
149 
150  def equal(self, x):
151  """equal(IMP_MODELLER_SwigPyIterator self, IMP_MODELLER_SwigPyIterator x) -> bool"""
152  return _IMP_modeller.IMP_MODELLER_SwigPyIterator_equal(self, x)
153 
154 
155  def copy(self):
156  """copy(IMP_MODELLER_SwigPyIterator self) -> IMP_MODELLER_SwigPyIterator"""
157  return _IMP_modeller.IMP_MODELLER_SwigPyIterator_copy(self)
158 
159 
160  def next(self):
161  """next(IMP_MODELLER_SwigPyIterator self) -> PyObject *"""
162  return _IMP_modeller.IMP_MODELLER_SwigPyIterator_next(self)
163 
164 
165  def __next__(self):
166  """__next__(IMP_MODELLER_SwigPyIterator self) -> PyObject *"""
167  return _IMP_modeller.IMP_MODELLER_SwigPyIterator___next__(self)
168 
169 
170  def previous(self):
171  """previous(IMP_MODELLER_SwigPyIterator self) -> PyObject *"""
172  return _IMP_modeller.IMP_MODELLER_SwigPyIterator_previous(self)
173 
174 
175  def advance(self, n):
176  """advance(IMP_MODELLER_SwigPyIterator self, ptrdiff_t n) -> IMP_MODELLER_SwigPyIterator"""
177  return _IMP_modeller.IMP_MODELLER_SwigPyIterator_advance(self, n)
178 
179 
180  def __eq__(self, x):
181  """__eq__(IMP_MODELLER_SwigPyIterator self, IMP_MODELLER_SwigPyIterator x) -> bool"""
182  return _IMP_modeller.IMP_MODELLER_SwigPyIterator___eq__(self, x)
183 
184 
185  def __ne__(self, x):
186  """__ne__(IMP_MODELLER_SwigPyIterator self, IMP_MODELLER_SwigPyIterator x) -> bool"""
187  return _IMP_modeller.IMP_MODELLER_SwigPyIterator___ne__(self, x)
188 
189 
190  def __iadd__(self, n):
191  """__iadd__(IMP_MODELLER_SwigPyIterator self, ptrdiff_t n) -> IMP_MODELLER_SwigPyIterator"""
192  return _IMP_modeller.IMP_MODELLER_SwigPyIterator___iadd__(self, n)
193 
194 
195  def __isub__(self, n):
196  """__isub__(IMP_MODELLER_SwigPyIterator self, ptrdiff_t n) -> IMP_MODELLER_SwigPyIterator"""
197  return _IMP_modeller.IMP_MODELLER_SwigPyIterator___isub__(self, n)
198 
199 
200  def __add__(self, n):
201  """__add__(IMP_MODELLER_SwigPyIterator self, ptrdiff_t n) -> IMP_MODELLER_SwigPyIterator"""
202  return _IMP_modeller.IMP_MODELLER_SwigPyIterator___add__(self, n)
203 
204 
205  def __sub__(self, *args):
206  """
207  __sub__(IMP_MODELLER_SwigPyIterator self, ptrdiff_t n) -> IMP_MODELLER_SwigPyIterator
208  __sub__(IMP_MODELLER_SwigPyIterator self, IMP_MODELLER_SwigPyIterator x) -> ptrdiff_t
209  """
210  return _IMP_modeller.IMP_MODELLER_SwigPyIterator___sub__(self, *args)
211 
212  def __iter__(self):
213  return self
214 IMP_MODELLER_SwigPyIterator_swigregister = _IMP_modeller.IMP_MODELLER_SwigPyIterator_swigregister
215 IMP_MODELLER_SwigPyIterator_swigregister(IMP_MODELLER_SwigPyIterator)
216 
217 
218 _value_types=[]
219 _object_types=[]
220 _raii_types=[]
221 _plural_types=[]
222 
223 IMP_DEBUG = _IMP_modeller.IMP_DEBUG
224 IMP_RELEASE = _IMP_modeller.IMP_RELEASE
225 IMP_SILENT = _IMP_modeller.IMP_SILENT
226 IMP_PROGRESS = _IMP_modeller.IMP_PROGRESS
227 IMP_TERSE = _IMP_modeller.IMP_TERSE
228 IMP_VERBOSE = _IMP_modeller.IMP_VERBOSE
229 IMP_MEMORY = _IMP_modeller.IMP_MEMORY
230 IMP_NONE = _IMP_modeller.IMP_NONE
231 IMP_USAGE = _IMP_modeller.IMP_USAGE
232 IMP_INTERNAL = _IMP_modeller.IMP_INTERNAL
233 IMP_KERNEL_HAS_LOG4CXX = _IMP_modeller.IMP_KERNEL_HAS_LOG4CXX
234 IMP_COMPILER_HAS_AUTO = _IMP_modeller.IMP_COMPILER_HAS_AUTO
235 IMP_COMPILER_HAS_DEBUG_VECTOR = _IMP_modeller.IMP_COMPILER_HAS_DEBUG_VECTOR
236 IMP_COMPILER_HAS_UNIQUE_PTR = _IMP_modeller.IMP_COMPILER_HAS_UNIQUE_PTR
237 IMP_KERNEL_HAS_BOOST_RANDOM = _IMP_modeller.IMP_KERNEL_HAS_BOOST_RANDOM
238 IMP_KERNEL_HAS_GPERFTOOLS = _IMP_modeller.IMP_KERNEL_HAS_GPERFTOOLS
239 IMP_KERNEL_HAS_TCMALLOC_HEAPCHECKER = _IMP_modeller.IMP_KERNEL_HAS_TCMALLOC_HEAPCHECKER
240 IMP_KERNEL_HAS_TCMALLOC_HEAPPROFILER = _IMP_modeller.IMP_KERNEL_HAS_TCMALLOC_HEAPPROFILER
241 IMPKERNEL_SHOW_WARNINGS = _IMP_modeller.IMPKERNEL_SHOW_WARNINGS
242 
243 import sys
244 class _DirectorObjects(object):
245  """@internal Simple class to keep references to director objects
246  to prevent premature deletion."""
247  def __init__(self):
248  self._objects = []
249  def register(self, obj):
250  """Take a reference to a director object; will only work for
251  refcounted C++ classes"""
252  if hasattr(obj, 'get_ref_count'):
253  self._objects.append(obj)
254  def cleanup(self):
255  """Only drop our reference and allow cleanup by Python if no other
256  Python references exist (we hold 3 references: one in self._objects,
257  one in x, and one in the argument list for getrefcount) *and* no
258  other C++ references exist (the Python object always holds one)"""
259  objs = [x for x in self._objects if sys.getrefcount(x) > 3 \
260  or x.get_ref_count() > 1]
261 # Do in two steps so the references are kept until the end of the
262 # function (deleting references may trigger a fresh call to this method)
263  self._objects = objs
264  def get_object_count(self):
265  """Get number of director objects (useful for testing only)"""
266  return len(self._objects)
267 _director_objects = _DirectorObjects()
268 
269 class _ostream(object):
270  """Proxy of C++ std::ostream class."""
271 
272  thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
273 
274  def __init__(self, *args, **kwargs):
275  raise AttributeError("No constructor defined")
276  __repr__ = _swig_repr
277 
278  def write(self, osa_buf):
279  """write(_ostream self, char const * osa_buf)"""
280  return _IMP_modeller._ostream_write(self, osa_buf)
281 
282 _ostream_swigregister = _IMP_modeller._ostream_swigregister
283 _ostream_swigregister(_ostream)
284 
285 IMP_COMPILER_HAS_OVERRIDE = _IMP_modeller.IMP_COMPILER_HAS_OVERRIDE
286 IMP_COMPILER_HAS_FINAL = _IMP_modeller.IMP_COMPILER_HAS_FINAL
287 IMP_HAS_NOEXCEPT = _IMP_modeller.IMP_HAS_NOEXCEPT
288 import IMP
289 IMP_CGAL_HAS_BOOST_FILESYSTEM = _IMP_modeller.IMP_CGAL_HAS_BOOST_FILESYSTEM
290 IMP_CGAL_HAS_BOOST_PROGRAMOPTIONS = _IMP_modeller.IMP_CGAL_HAS_BOOST_PROGRAMOPTIONS
291 IMP_CGAL_HAS_BOOST_RANDOM = _IMP_modeller.IMP_CGAL_HAS_BOOST_RANDOM
292 IMP_CGAL_HAS_BOOST_SYSTEM = _IMP_modeller.IMP_CGAL_HAS_BOOST_SYSTEM
293 IMPCGAL_SHOW_WARNINGS = _IMP_modeller.IMPCGAL_SHOW_WARNINGS
294 import IMP.cgal
295 IMP_ALGEBRA_HAS_IMP_CGAL = _IMP_modeller.IMP_ALGEBRA_HAS_IMP_CGAL
296 IMP_ALGEBRA_HAS_BOOST_FILESYSTEM = _IMP_modeller.IMP_ALGEBRA_HAS_BOOST_FILESYSTEM
297 IMP_ALGEBRA_HAS_BOOST_PROGRAMOPTIONS = _IMP_modeller.IMP_ALGEBRA_HAS_BOOST_PROGRAMOPTIONS
298 IMP_ALGEBRA_HAS_BOOST_RANDOM = _IMP_modeller.IMP_ALGEBRA_HAS_BOOST_RANDOM
299 IMP_ALGEBRA_HAS_BOOST_SYSTEM = _IMP_modeller.IMP_ALGEBRA_HAS_BOOST_SYSTEM
300 IMP_ALGEBRA_HAS_CGAL = _IMP_modeller.IMP_ALGEBRA_HAS_CGAL
301 IMP_ALGEBRA_HAS_ANN = _IMP_modeller.IMP_ALGEBRA_HAS_ANN
302 IMPALGEBRA_SHOW_WARNINGS = _IMP_modeller.IMPALGEBRA_SHOW_WARNINGS
303 import IMP.algebra
304 IMP_DISPLAY_HAS_IMP_CGAL = _IMP_modeller.IMP_DISPLAY_HAS_IMP_CGAL
305 IMP_DISPLAY_HAS_BOOST_FILESYSTEM = _IMP_modeller.IMP_DISPLAY_HAS_BOOST_FILESYSTEM
306 IMP_DISPLAY_HAS_BOOST_PROGRAMOPTIONS = _IMP_modeller.IMP_DISPLAY_HAS_BOOST_PROGRAMOPTIONS
307 IMP_DISPLAY_HAS_BOOST_RANDOM = _IMP_modeller.IMP_DISPLAY_HAS_BOOST_RANDOM
308 IMP_DISPLAY_HAS_BOOST_SYSTEM = _IMP_modeller.IMP_DISPLAY_HAS_BOOST_SYSTEM
309 IMP_DISPLAY_HAS_CGAL = _IMP_modeller.IMP_DISPLAY_HAS_CGAL
310 IMPDISPLAY_SHOW_WARNINGS = _IMP_modeller.IMPDISPLAY_SHOW_WARNINGS
311 import IMP.display
312 IMP_SCORE_FUNCTOR_HAS_IMP_CGAL = _IMP_modeller.IMP_SCORE_FUNCTOR_HAS_IMP_CGAL
313 IMP_SCORE_FUNCTOR_HAS_BOOST_FILESYSTEM = _IMP_modeller.IMP_SCORE_FUNCTOR_HAS_BOOST_FILESYSTEM
314 IMP_SCORE_FUNCTOR_HAS_BOOST_PROGRAMOPTIONS = _IMP_modeller.IMP_SCORE_FUNCTOR_HAS_BOOST_PROGRAMOPTIONS
315 IMP_SCORE_FUNCTOR_HAS_BOOST_RANDOM = _IMP_modeller.IMP_SCORE_FUNCTOR_HAS_BOOST_RANDOM
316 IMP_SCORE_FUNCTOR_HAS_BOOST_SYSTEM = _IMP_modeller.IMP_SCORE_FUNCTOR_HAS_BOOST_SYSTEM
317 IMP_SCORE_FUNCTOR_HAS_CGAL = _IMP_modeller.IMP_SCORE_FUNCTOR_HAS_CGAL
318 IMP_SCORE_FUNCTOR_HAS_HDF5 = _IMP_modeller.IMP_SCORE_FUNCTOR_HAS_HDF5
319 IMPSCOREFUNCTOR_SHOW_WARNINGS = _IMP_modeller.IMPSCOREFUNCTOR_SHOW_WARNINGS
320 import IMP.score_functor
321 IMP_CORE_HAS_IMP_CGAL = _IMP_modeller.IMP_CORE_HAS_IMP_CGAL
322 IMP_CORE_HAS_IMP_KERNEL = _IMP_modeller.IMP_CORE_HAS_IMP_KERNEL
323 IMP_CORE_HAS_BOOST_FILESYSTEM = _IMP_modeller.IMP_CORE_HAS_BOOST_FILESYSTEM
324 IMP_CORE_HAS_BOOST_PROGRAMOPTIONS = _IMP_modeller.IMP_CORE_HAS_BOOST_PROGRAMOPTIONS
325 IMP_CORE_HAS_BOOST_RANDOM = _IMP_modeller.IMP_CORE_HAS_BOOST_RANDOM
326 IMP_CORE_HAS_BOOST_SYSTEM = _IMP_modeller.IMP_CORE_HAS_BOOST_SYSTEM
327 IMP_CORE_HAS_CGAL = _IMP_modeller.IMP_CORE_HAS_CGAL
328 IMP_CORE_HAS_HDF5 = _IMP_modeller.IMP_CORE_HAS_HDF5
329 IMPCORE_SHOW_WARNINGS = _IMP_modeller.IMPCORE_SHOW_WARNINGS
330 import IMP.core
331 IMP_MODELLER_HAS_IMP_ALGEBRA = _IMP_modeller.IMP_MODELLER_HAS_IMP_ALGEBRA
332 IMP_MODELLER_HAS_IMP_CGAL = _IMP_modeller.IMP_MODELLER_HAS_IMP_CGAL
333 IMP_MODELLER_HAS_IMP_DISPLAY = _IMP_modeller.IMP_MODELLER_HAS_IMP_DISPLAY
334 IMP_MODELLER_HAS_IMP_KERNEL = _IMP_modeller.IMP_MODELLER_HAS_IMP_KERNEL
335 IMP_MODELLER_HAS_IMP_SCORE_FUNCTOR = _IMP_modeller.IMP_MODELLER_HAS_IMP_SCORE_FUNCTOR
336 IMP_MODELLER_HAS_BOOST_FILESYSTEM = _IMP_modeller.IMP_MODELLER_HAS_BOOST_FILESYSTEM
337 IMP_MODELLER_HAS_BOOST_PROGRAMOPTIONS = _IMP_modeller.IMP_MODELLER_HAS_BOOST_PROGRAMOPTIONS
338 IMP_MODELLER_HAS_BOOST_RANDOM = _IMP_modeller.IMP_MODELLER_HAS_BOOST_RANDOM
339 IMP_MODELLER_HAS_BOOST_SYSTEM = _IMP_modeller.IMP_MODELLER_HAS_BOOST_SYSTEM
340 IMP_MODELLER_HAS_CGAL = _IMP_modeller.IMP_MODELLER_HAS_CGAL
341 IMP_MODELLER_HAS_HDF5 = _IMP_modeller.IMP_MODELLER_HAS_HDF5
342 IMPMODELLER_SHOW_WARNINGS = _IMP_modeller.IMPMODELLER_SHOW_WARNINGS
343 
344 BinormalTermList=list
345 _plural_types.append("BinormalTermList")
346 _value_types.append("BinormalTerm")
347 
348 
349 _object_types.append("MultipleBinormalRestraint")
350 
351 
352 
353 import math
354 import imp
355 import os
356 import sys
357 import tempfile
358 import shutil
359 import IMP.atom
360 import IMP.container
361 import modeller.scripts
362 import modeller.optimizers
363 
364 class _TempDir(object):
365  """Make a temporary directory that is deleted when the object is."""
366 
367  def __init__(self):
368  self.tmpdir = tempfile.mkdtemp()
369 
370  def __del__(self):
371  shutil.rmtree(self.tmpdir, ignore_errors=True)
372 
373 
374 class IMPRestraints(modeller.terms.energy_term):
375  """A Modeller restraint which evaluates an IMP scoring function.
376  This can be used to incorporate IMP Restraints into an existing
377  comparative modeling pipeline, or to use Modeller optimizers or
378  protocols.
379  """
380 
381  _physical_type = modeller.physical.absposition
382 
383  def __init__(self, particles, scoring_function=None):
384  """Constructor.
385  @param particles A list of the IMP atoms (as Particle objects),
386  same order as the Modeller atoms.
387  @param scoring_function An IMP::ScoringFunction object that will
388  be incorporated into the Modeller score (molpdf).
389  @note since Modeller, unlike IMP, is sensitive to the ordering
390  of atoms, it usually makes sense to create the model in
391  Modeller and then use ModelLoader to load it into IMP,
392  since that will preserve the Modeller atom ordering in IMP.
393  """
394  modeller.terms.energy_term.__init__(self)
395  self._particles = particles
396  if scoring_function:
397  self._sf = scoring_function
398  else:
399  self._sf = particles[0].get_model()
400 
401  def eval(self, mdl, deriv, indats):
402  atoms = self.indices_to_atoms(mdl, indats)
403  _copy_modeller_coords_to_imp(atoms, self._particles)
404  if len(self._particles) == 0:
405  score = 0.
406  else:
407  score = self._sf.evaluate(deriv)
408  if deriv:
409  dvx = [0.] * len(indats)
410  dvy = [0.] * len(indats)
411  dvz = [0.] * len(indats)
412  _get_imp_derivs(self._particles, dvx, dvy, dvz)
413  return (score, dvx, dvy, dvz)
414  else:
415  return score
416 
417 
419  """An IMP restraint using all defined Modeller restraints.
420  This is useful if you want to use Modeller restraints with an IMP
421  optimizer, or in combination with IMP restraints.
422 
423  @note Currently only the coordinates of the atoms are translated
424  between Modeller and IMP; thus, a Modeller restraint which
425  uses any other attribute (e.g. charge) will not react if
426  this attribute is changed by IMP.
427  """
428 
429  def __init__(self, model, modeller_model, particles):
430  """Constructor.
431  @param model The IMP Model object.
432  @param modeller_model The Modeller model object.
433  @param particles A list of the IMP atoms (as Particle objects),
434  in the same order as the Modeller atoms.
435  @note since Modeller, unlike IMP, is sensitive to the ordering
436  of atoms, it usually makes sense to create the model in
437  Modeller and then use ModelLoader to load it into IMP,
438  since that will preserve the Modeller atom ordering in IMP.
439  """
440  def get_particle(x):
441  if hasattr(x, 'get_particle'):
442  return x.get_particle()
443  else:
444  return x
445  IMP.Restraint.__init__(self, model, "ModellerRestraints %1%")
446  self._modeller_model = modeller_model
447  self._particles = [get_particle(x) for x in particles]
448 
449  def unprotected_evaluate(self, accum):
450  atoms = self._modeller_model.atoms
451  sel = modeller.selection(self._modeller_model)
452  _copy_imp_coords_to_modeller(self._particles, atoms)
453  energies = sel.energy()
454  if accum:
455  _add_modeller_derivs_to_imp(atoms, self._particles, accum)
456 
457  return energies[0]
458 
459  def get_version_info(self):
460  return IMP.VersionInfo("IMP developers", "0.1")
461  def do_show(self, fh):
462  fh.write("ModellerRestraints")
463  def do_get_inputs(self):
464  return self._particles
465 
466 
467 def _copy_imp_coords_to_modeller(particles, atoms):
468  """Copy atom coordinates from IMP to Modeller"""
469  xkey = IMP.FloatKey("x")
470  ykey = IMP.FloatKey("y")
471  zkey = IMP.FloatKey("z")
472  for (num, at) in enumerate(atoms):
473  at.x = particles[num].get_value(xkey)
474  at.y = particles[num].get_value(ykey)
475  at.z = particles[num].get_value(zkey)
476 
477 
478 def _copy_modeller_coords_to_imp(atoms, particles):
479  """Copy atom coordinates from Modeller to IMP"""
480  xkey = IMP.FloatKey("x")
481  ykey = IMP.FloatKey("y")
482  zkey = IMP.FloatKey("z")
483  for (num, at) in enumerate(atoms):
484  particles[num].set_value(xkey, at.x)
485  particles[num].set_value(ykey, at.y)
486  particles[num].set_value(zkey, at.z)
487 
488 
489 def _add_modeller_derivs_to_imp(atoms, particles, accum):
490  """Add atom derivatives from Modeller to IMP"""
491  for (num, at) in enumerate(atoms):
492  xyz = IMP.core.XYZ(particles[num])
493  xyz.add_to_derivative(0, at.dvx, accum)
494  xyz.add_to_derivative(1, at.dvy, accum)
495  xyz.add_to_derivative(2, at.dvz, accum)
496 
497 
498 def _get_imp_derivs(particles, dvx, dvy, dvz):
499  """Move atom derivatives from IMP to Modeller"""
500  xkey = IMP.FloatKey("x")
501  ykey = IMP.FloatKey("y")
502  zkey = IMP.FloatKey("z")
503  for idx in range(0, len(dvx)):
504  dvx[idx] = particles[idx].get_derivative(xkey)
505  dvy[idx] = particles[idx].get_derivative(ykey)
506  dvz[idx] = particles[idx].get_derivative(zkey)
507 
508 
509 # Generators to create IMP UnaryFunction objects from Modeller parameters:
510 def _HarmonicLowerBoundGenerator(parameters, modalities):
511  (mean, stdev) = parameters
513  return IMP.core.HarmonicLowerBound(mean, k)
514 
515 def _HarmonicUpperBoundGenerator(parameters, modalities):
516  (mean, stdev) = parameters
518  return IMP.core.HarmonicUpperBound(mean, k)
519 
520 def _HarmonicGenerator(parameters, modalities):
521  (mean, stdev) = parameters
523  return IMP.core.Harmonic(mean, k)
524 
525 def _CosineGenerator(parameters, modalities):
526  (phase, force_constant) = parameters
527  (periodicity,) = modalities
528  return IMP.core.Cosine(force_constant, periodicity, phase)
529 
530 def _LinearGenerator(parameters, modalities):
531  (scale,) = parameters
532  return IMP.core.Linear(0, scale)
533 
534 def _SplineGenerator(parameters, modalities):
535  (open, low, high, delta, lowderiv, highderiv) = parameters[:6]
536  values = []
537  for v in parameters[6:]:
538  values.append(v)
539  if open < 0.0:
540  return IMP.core.ClosedCubicSpline(values, low, delta)
541  else:
542  return IMP.core.OpenCubicSpline(values, low, delta)
543 
544 #: Mapping from Modeller math form number to a unary function generator
545 _unary_func_generators = {
546  1: _HarmonicLowerBoundGenerator,
547  2: _HarmonicUpperBoundGenerator,
548  3: _HarmonicGenerator,
549  7: _CosineGenerator,
550  8: _LinearGenerator,
551  10: _SplineGenerator,
552 }
553 
554 # Generators to make IMP Restraint objects from Modeller features
555 def _DistanceRestraintGenerator(form, modalities, atoms, parameters):
556  unary_func_gen = _unary_func_generators[form]
557  return IMP.core.DistanceRestraint(atoms[0].get_model(),
558  unary_func_gen(parameters, modalities),
559  atoms[0], atoms[1])
560 
561 def _AngleRestraintGenerator(form, modalities, atoms, parameters):
562  unary_func_gen = _unary_func_generators[form]
563  return IMP.core.AngleRestraint(atoms[0].get_model(),
564  unary_func_gen(parameters, modalities),
565  atoms[0], atoms[1], atoms[2])
566 
567 def _MultiBinormalGenerator(form, modalities, atoms, parameters):
568  nterms = modalities[0]
569  if len(parameters) != nterms * 6:
570  raise ValueError("Incorrect number of parameters (%d) for multiple "
571  "binormal restraint - expecting %d (%d terms * 6)" \
572  % (len(parameters), nterms * 6, nterms))
573  r = IMP.core.MultipleBinormalRestraint(atoms[0].get_model(),
574  atoms[:4], atoms[4:8])
575  for i in range(nterms):
577  t.set_weight(parameters[i])
578  t.set_means((parameters[nterms + i * 2],
579  parameters[nterms + i * 2 + 1]))
580  t.set_standard_deviations((parameters[nterms * 3 + i * 2],
581  parameters[nterms * 3 + i * 2 + 1]))
582  t.set_correlation(parameters[nterms * 5 + i])
583  r.add_term(t)
584  return r
585 
586 def _DihedralRestraintGenerator(form, modalities, atoms, parameters):
587  if form == 9:
588  return _MultiBinormalGenerator(form, modalities, atoms, parameters)
589  unary_func_gen = _unary_func_generators[form]
590  return IMP.core.DihedralRestraint(atoms[0].get_model(),
591  unary_func_gen(parameters, modalities),
592  atoms[0], atoms[1], atoms[2], atoms[3])
593 
594 def _get_protein_atom_particles(protein):
595  """Given a protein particle, get the flattened list of all child atoms"""
596  atom_particles = []
597  for ichain in range(protein.get_number_of_children()):
598  chain = protein.get_child(ichain)
599  for ires in range(chain.get_number_of_children()):
600  residue = chain.get_child(ires)
601  for iatom in range(residue.get_number_of_children()):
602  atom = residue.get_child(iatom)
603  atom_particles.append(atom.get_particle())
604  return atom_particles
605 
606 def _load_restraints_line(line, atom_particles):
607  """Parse a single Modeller restraints file line and return the
608  corresponding IMP restraint."""
609  spl = line.split()
610  typ = spl.pop(0)
611  if typ == 'MODELLER5':
612  return
613  elif typ != 'R':
614  raise NotImplementedError("Only 'R' lines currently read from " + \
615  "Modeller restraints files")
616  form = int(spl.pop(0))
617  modalities = [int(spl.pop(0))]
618  features = [int(spl.pop(0))]
619 # Discard group
620  spl.pop(0)
621  natoms = [int(spl.pop(0))]
622  nparam = int(spl.pop(0))
623  nfeat = int(spl.pop(0))
624  for i in range(nfeat - 1):
625  modalities.append(int(spl.pop(0)))
626  features.append(int(spl.pop(0)))
627  natoms.append(int(spl.pop(0)))
628  atoms = [int(spl.pop(0)) for x in range(natoms[0])]
629  for i in range(len(atoms)):
630  atoms[i] = atom_particles[atoms[i] - 1]
631  parameters = [float(spl.pop(0)) for x in range(nparam)]
632  restraint_generators = {
633  1 : _DistanceRestraintGenerator,
634  2 : _AngleRestraintGenerator,
635  3 : _DihedralRestraintGenerator,
636  }
637  restraint_gen = restraint_generators[features[0]]
638  return restraint_gen(form, modalities, atoms, parameters)
639 
640 
641 def _load_entire_restraints_file(filename, protein):
642  """Yield a set of IMP restraints from a Modeller restraints file."""
643  atoms = _get_protein_atom_particles(protein)
644  fh = open(filename, 'r')
645  for line in fh:
646  try:
647  rsr = _load_restraints_line(line, atoms)
648  if rsr is not None:
649  yield rsr
650  except Exception as err:
651  print("Cannot read restraints file line:\n" + line)
652  raise
653 
654 
655 def _copy_residue(r, model):
656  """Copy residue information from modeller to imp"""
657 #print "residue "+str(r)
658  p=IMP.Particle(model)
660  r.index)
661  p.set_name(str("residue "+r.num));
662  return p
663 
664 
665 def _copy_atom(a, model):
666  """Copy atom information from modeller"""
667 #print "atom "+str(a)
668  p=IMP.Particle(model)
670  xyzd= IMP.core.XYZ.setup_particle(p, IMP.algebra.Vector3D(a.x, a.y, a.z))
671 # Alignment structures don't have charges or atom types; models do
672  if hasattr(a, 'charge'):
674  if hasattr(a, 'type'):
675  IMP.atom.CHARMMAtom.setup_particle(p, a.type.name)
676  ap.set_input_index(a.index)
677  return p
678 
679 def _copy_chain(c, model):
680  """Copy chain information from modeller"""
681 #print "atom "+str(a)
682  p=IMP.Particle(model)
683 #set the chain name
684  cp = IMP.atom.Chain.setup_particle(p,c.name)
685  return p
686 
687 def _get_forcefield(submodel):
688  if submodel == 3:
690  IMP.atom.get_data_path('top_heav.lib'),
691  IMP.atom.get_data_path('par.lib'))
692  else:
694  IMP.atom.get_data_path('top.lib'),
695  IMP.atom.get_data_path('par.lib'))
696  return ff
697 
698 def add_soft_sphere_radii(hierarchy, submodel, scale=1.0, filename=None):
699  """Add radii to the hierarchy using the Modeller radius library, radii.lib.
700  Each radius is scaled by the given scale (Modeller usually scales radii
701  by a factor of 0.82). submodel specifies the topology submodel, which is
702  the column in radii.lib to use."""
703  if filename is None:
704  filename = IMP.atom.get_data_path('radii.lib')
705  radii = {}
706  for line in open(filename):
707  if line.startswith('#'): continue
708  spl = line.split()
709  if len(spl) > 11:
710  radii[spl[0]] = float(spl[submodel])
711  atoms = IMP.atom.get_by_type(hierarchy, IMP.atom.ATOM_TYPE)
712  for a in atoms:
713  p = a.get_particle()
714  ct = IMP.atom.CHARMMAtom(p).get_charmm_type()
715  if ct in radii:
716  IMP.core.XYZR.setup_particle(p, radii[ct] * scale)
717 
718 
719 class ModelLoader(object):
720  """Read a Modeller model into IMP. After creating this object, the atoms
721  in the Modeller model can be loaded into IMP using the load_atoms()
722  method, then optionally any Modeller static restraints can be read in
723  with load_static_restraints() or load_static_restraints_file().
724 
725  This class can also be used to read Modeller alignment structures;
726  however, only load_atoms() will be useful in such a case (since
727  alignment structures don't have restraints or other information).
728 
729  """
730 
731  def __init__(self, modeller_model):
732  """Constructor.
733  @param modeller_model The Modeller model or alignment structure
734  object to read.
735  """
736  self._modeller_model = modeller_model
737 
738  def load_atoms(self, model):
739  """Construct an IMP::atom::Hierarchy that contains the same atoms as
740  the Modeller model or alignment structure.
741 
742  IMP atoms created from a Modeller model will be given charges and
743  CHARMM types, extracted from the model. Alignment structures don't
744  contain this information, so the IMP atoms won't either.
745 
746  @param model The IMP::Model object in which the hierarchy will be
747  created. The highest level hierarchy node is a PROTEIN.
748  @return the newly-created root IMP::atom::Hierarchy.
749  """
750  pp = IMP.Particle(model)
752  self._atoms = {}
753  for chain in self._modeller_model.chains:
754  cp = IMP.Particle(model)
755  hcp = IMP.atom.Chain.setup_particle(cp, chain.name)
756 # We don't really know the type yet
757  hpp.add_child(hcp)
758  for residue in chain.residues:
759  rp = _copy_residue(residue, model)
760  hrp = IMP.atom.Hierarchy(rp)
761  hcp.add_child(hrp)
762  for atom in residue.atoms:
763  ap = _copy_atom(atom, model)
764  hap = IMP.atom.Hierarchy(ap)
765  hrp.add_child(hap)
766  self._atoms[atom.index] = ap
767  lastres = hrp
768  self._modeller_hierarchy = hpp
769  return hpp
770 
771  def _get_nonbonded_list(self, atoms, pair_filter, edat, distance):
772  nbl = IMP.container.ClosePairContainer(atoms, distance,
773  edat.update_dynamic)
774 
775 # Exclude the same sets of atoms as Modeller
776  if pair_filter is None:
777  pair_filter = IMP.atom.StereochemistryPairFilter()
778  if edat.excl_local[0]:
779  pair_filter.set_bonds(list(self.load_bonds()))
780  if edat.excl_local[1]:
781  pair_filter.set_angles(list(self.load_angles()))
782  if edat.excl_local[2]:
783  pair_filter.set_dihedrals(list(self.load_dihedrals()))
784  nbl.add_pair_filter(pair_filter)
785  return nbl
786 
787  def load_bonds(self):
788  """Load the Modeller bond topology into the IMP model. Each bond is
789  represented in IMP as an IMP::atom::Bond, with no defined length
790  or stiffness. These bonds are primarily useful as input to
791  IMP::atom::StereochemistryPairFilter, to exclude bond interactions
792  from the nonbonded list. Typically the contribution to the scoring
793  function from the bonds is included in the Modeller static restraints
794  (use load_static_restraints() or load_static_restraints_file() to
795  load these). If you want to regenerate the stereochemistry in IMP,
796  do not use these functions (as then stereochemistry scoring terms
797  and exclusions would be double-counted) and instead use the
798  IMP::atom::CHARMMTopology class.
799 
800  You must call load_atoms() prior to using this function.
801  @see load_angles(), load_dihedrals(), load_impropers()
802  @return A generator listing all of the bonds.
803  """
804  if not hasattr(self, '_modeller_hierarchy'):
805  raise ValueError("Call load_atoms() first.")
806  for (maa, mab) in self._modeller_model.bonds:
807  pa = self._atoms[maa.index]
808  pb = self._atoms[mab.index]
810  ba= IMP.atom.Bonded(pa)
811  else:
814  bb= IMP.atom.Bonded(pb)
815  else:
817  yield IMP.atom.create_bond(ba, bb,
818  IMP.atom.Bond.SINGLE).get_particle()
819 
820  def load_angles(self):
821  """Load the Modeller angle topology into the IMP model.
822  See load_bonds() for more details."""
823  return self._internal_load_angles(self._modeller_model.angles,
825 
826  def load_dihedrals(self):
827  """Load the Modeller dihedral topology into the IMP model.
828  See load_bonds() for more details."""
829  return self._internal_load_angles(self._modeller_model.dihedrals,
831 
832  def load_impropers(self):
833  """Load the Modeller improper topology into the IMP model.
834  See load_bonds() for more details."""
835  return self._internal_load_angles(self._modeller_model.impropers,
837 
838  def _internal_load_angles(self, angles, angle_class):
839  if not hasattr(self, '_modeller_hierarchy'):
840  raise ValueError("Call load_atoms() first.")
841  for modeller_atoms in angles:
842  imp_particles = [self._atoms[x.index] for x in modeller_atoms]
843  p = IMP.Particle(imp_particles[0].get_model())
844  a = angle_class.setup_particle(p,
845  *[IMP.core.XYZ(x) for x in imp_particles])
846  yield a.get_particle()
847 
848  def load_static_restraints_file(self, filename):
849  """Convert a Modeller static restraints file into equivalent
850  IMP::Restraints. load_atoms() must have been called first to read
851  in the atoms that the restraints will act upon.
852  @param filename Name of the Modeller restraints file. The restraints
853  in this file are assumed to act upon the model read in by
854  load_atoms(); no checking is done to enforce this.
855  @return A Python generator of the newly-created IMP::Restraint
856  objects.
857  """
858  if not hasattr(self, '_modeller_hierarchy'):
859  raise ValueError("Call load_atoms() first.")
860  return _load_entire_restraints_file(filename, self._modeller_hierarchy)
861 
862 
864  """Convert the current set of Modeller static restraints into equivalent
865  IMP::Restraints. load_atoms() must have been called first to read
866  in the atoms that the restraints will act upon.
867  @return A Python generator of the newly-created IMP::Restraint
868  objects.
869  """
870  class _RestraintGenerator(object):
871  """Simple generator wrapper"""
872  def __init__(self, gen):
873  self._gen = gen
874  def __iter__(self, *args, **keys):
875  return self
876  def close(self, *args, **keys):
877  return self._gen.close(*args, **keys)
878  def next(self):
879  return next(self._gen)
880  __next__ = next
881  def send(self, *args, **keys):
882  return self._gen.send(*args, **keys)
883  def throw(self, *args, **keys):
884  return self._gen.throw(*args, **keys)
885 # Write current restraints into a temporary file
886  t = _TempDir()
887  rsrfile = os.path.join(t.tmpdir, 'restraints.rsr')
888  self._modeller_model.restraints.write(file=rsrfile)
889 # Read the file back in
890  gen = self.load_static_restraints_file(rsrfile)
891  wrap = _RestraintGenerator(gen)
892 # Ensure that tmpdir remains until we're done with the generator
893  wrap._tempdir = t
894  return wrap
895 
896  def load_dynamic_restraints(self, pair_filter=None):
897  """Convert Modeller dynamic restraints into IMP::Restraint objects.
898 
899  For each currently active Modeller dynamic restraint
900  (e.g. soft-sphere, electrostatics) an equivalent IMP::Restraint
901  is created.
902  load_atoms() must have been called first to read
903  in the atoms that the restraints will act upon.
904 
905  If pair_filter is given, it is an IMP::PairFilter object to exclude
906  pairs from the nonbonded lists used by the dynamic restraints.
907  Otherwise, an IMP::atom::StereochemistryPairFilter object is created
908  to exclude Modeller bonds, angles and dihedrals, as specified by
909  edat.excl_local. (Note that this calls load_bonds(), load_angles()
910  and load_dihedrals(), so will create duplicate lists of bonds if
911  those methods are called manually as well.)
912 
913  @note Currently only soft-sphere, electrostatic and Lennard-Jones
914  restraints are loaded.
915  @return A Python generator of the newly-created IMP::Restraint
916  objects.
917  """
918  if not hasattr(self, '_modeller_hierarchy'):
919  raise ValueError("Call load_atoms() first.")
920  edat = self._modeller_model.env.edat
921  libs = self._modeller_model.env.libs
922  atoms = IMP.atom.get_leaves(self._modeller_hierarchy)
923  m = atoms[0].get_model()
925 
926  if edat.dynamic_sphere:
927 # Note: cannot use Modeller's cutoff distance, as that is
928 # center-to-center; IMP's is sphere surface-surface
929  nbl = self._get_nonbonded_list(atoms, pair_filter, edat, 0.)
930 # No way to get Modeller radii, so we have to reassign them
931  add_soft_sphere_radii(self._modeller_hierarchy,
932  libs.topology.submodel, edat.radii_factor)
933  k = \
937  yield IMP.container.PairsRestraint(ps, nbl)
938 
939  if edat.dynamic_lennard or edat.dynamic_coulomb:
940 # 3.0 is roughly the max. atom diameter
941  d = max(edat.contact_shell - 3.0, 0.0)
942  nbl = self._get_nonbonded_list(atoms, pair_filter, edat, d)
943  ff = _get_forcefield(libs.topology.submodel)
944  ff.add_radii(self._modeller_hierarchy)
945 
946  if edat.dynamic_lennard:
947  ff.add_well_depths(self._modeller_hierarchy)
948  sf = IMP.atom.ForceSwitch(edat.lennard_jones_switch[0],
949  edat.lennard_jones_switch[1])
951  yield IMP.container.PairsRestraint(ps, nbl)
952 
953  if edat.dynamic_coulomb:
954  sf = IMP.atom.ForceSwitch(edat.coulomb_switch[0],
955  edat.coulomb_switch[1])
957  ps.set_relative_dielectric(edat.relative_dielectric)
958  yield IMP.container.PairsRestraint(ps, nbl)
959 
960 
962  """Proxy of C++ IMP::modeller::MultipleBinormalRestraint class."""
963 
964  thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
965 
966  def __init__(self, m, q1, q2):
967  """__init__(IMP::modeller::MultipleBinormalRestraint self, Model m, IMP::ParticleIndexQuad const & q1, IMP::ParticleIndexQuad const & q2) -> MultipleBinormalRestraint"""
968  this = _IMP_modeller.new_MultipleBinormalRestraint(m, q1, q2)
969  try:
970  self.this.append(this)
971  except __builtin__.Exception:
972  self.this = this
973 
974  def add_term(self, term):
975  """add_term(MultipleBinormalRestraint self, BinormalTerm term)"""
976  return _IMP_modeller.MultipleBinormalRestraint_add_term(self, term)
977 
978 
979  def do_get_inputs(self):
980  """do_get_inputs(MultipleBinormalRestraint self) -> IMP::ModelObjectsTemp"""
981  return _IMP_modeller.MultipleBinormalRestraint_do_get_inputs(self)
982 
983 
984  def get_version_info(self):
985  """get_version_info(MultipleBinormalRestraint self) -> VersionInfo"""
986  return _IMP_modeller.MultipleBinormalRestraint_get_version_info(self)
987 
988 
989  def __str__(self):
990  """__str__(MultipleBinormalRestraint self) -> std::string"""
991  return _IMP_modeller.MultipleBinormalRestraint___str__(self)
992 
993 
994  def __repr__(self):
995  """__repr__(MultipleBinormalRestraint self) -> std::string"""
996  return _IMP_modeller.MultipleBinormalRestraint___repr__(self)
997 
998 
999  @staticmethod
1000  def get_from(o):
1001  return _object_cast_to_MultipleBinormalRestraint(o)
1002 
1003 MultipleBinormalRestraint_swigregister = _IMP_modeller.MultipleBinormalRestraint_swigregister
1004 MultipleBinormalRestraint_swigregister(MultipleBinormalRestraint)
1005 
1006 class BinormalTerm(object):
1007  """Proxy of C++ IMP::modeller::BinormalTerm class."""
1008 
1009  thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
1010 
1011  def __init__(self):
1012  """__init__(IMP::modeller::BinormalTerm self) -> BinormalTerm"""
1013  this = _IMP_modeller.new_BinormalTerm()
1014  try:
1015  self.this.append(this)
1016  except __builtin__.Exception:
1017  self.this = this
1018 
1019  def set_correlation(self, correlation):
1020  """set_correlation(BinormalTerm self, double correlation)"""
1021  return _IMP_modeller.BinormalTerm_set_correlation(self, correlation)
1022 
1023 
1024  def set_weight(self, weight):
1025  """set_weight(BinormalTerm self, double weight)"""
1026  return _IMP_modeller.BinormalTerm_set_weight(self, weight)
1027 
1028 
1029  def set_means(self, means):
1030  """set_means(BinormalTerm self, IMP::FloatPair means)"""
1031  return _IMP_modeller.BinormalTerm_set_means(self, means)
1032 
1033 
1034  def set_standard_deviations(self, stdevs):
1035  """set_standard_deviations(BinormalTerm self, IMP::FloatPair stdevs)"""
1036  return _IMP_modeller.BinormalTerm_set_standard_deviations(self, stdevs)
1037 
1038 
1039  def show(self, *args):
1040  """
1041  show(BinormalTerm self, _ostream out)
1042  show(BinormalTerm self)
1043  """
1044  return _IMP_modeller.BinormalTerm_show(self, *args)
1045 
1046 
1047  def __str__(self):
1048  """__str__(BinormalTerm self) -> std::string"""
1049  return _IMP_modeller.BinormalTerm___str__(self)
1050 
1051 
1052  def __repr__(self):
1053  """__repr__(BinormalTerm self) -> std::string"""
1054  return _IMP_modeller.BinormalTerm___repr__(self)
1055 
1056  __swig_destroy__ = _IMP_modeller.delete_BinormalTerm
1057  __del__ = lambda self: None
1058 BinormalTerm_swigregister = _IMP_modeller.BinormalTerm_swigregister
1059 BinormalTerm_swigregister(BinormalTerm)
1060 
1061 
1062 def get_module_version():
1063  """get_module_version() -> std::string const"""
1064  return _IMP_modeller.get_module_version()
1065 
1066 def get_example_path(fname):
1067  """get_example_path(std::string fname) -> std::string"""
1068  return _IMP_modeller.get_example_path(fname)
1069 
1070 def get_data_path(fname):
1071  """get_data_path(std::string fname) -> std::string"""
1072  return _IMP_modeller.get_data_path(fname)
1073 
1074 from . import _version_check
1075 _version_check.check_version(get_module_version())
1076 __version__ = get_module_version()
1077 
1078 
1079 
static CHARMMAtom setup_particle(Model *m, ParticleIndex pi, String 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.
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
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:242
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.
Make CGAL functionality available to IMP.
Cosine function.
Definition: Cosine.h:22
std::string get_data_path(std::string file_name)
Return the full path to one of this module's data 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:157
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
Composable functors to implement scores via compile-time composition.
An IMP restraint using all defined Modeller restraints.
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:62
A single binormal term in a MultipleBinormalRestraint.
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)
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:28
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:19
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.
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
Modeller-style multiple binormal (phi/psi) restraint.
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
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:173
VectorD< 3 > Vector3D
Definition: VectorD.h:395
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:41
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).
Output IMP model data in various file formats.
Functionality for loading, creating, manipulating and scoring atomic structures.
static Chain setup_particle(Model *m, ParticleIndex pi, std::string id)
Definition: Chain.h:41
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:52
Harmonic function (symmetric about the mean)
Definition: core/Harmonic.h:24