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