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