[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IMP-dev] problem evaluating restraints



hi,

I think something is wrong now with calling to restraint evaluation.
After adding the restraint to the model, I am keep getting the message:



ERROR:
----------------------------------------------------------------------
Traceback (most recent call last):
  File "simple_test.py", line 49, in test_ev
    print r.evaluate(None)
File "/viola1/home/kerenl/bioinformatics/projects/imp/build/lib/IMP/ __init__.py", line 1193, in evaluate def evaluate(self, *args): return _IMP.Restraint_evaluate(self, *args) ValueError: Restraint::evaluate() cannot be called during model evaluatio

I think the attached test case should work and I am not sure why it does not .....
import unittest
import IMP
import IMP.test
import IMP.core
import IMP.atom
import IMP.helper
import math

class SimpleExclusionVolumeTests(IMP.test.TestCase):
    """Tests for simple exclusion volume"""
    def test_ev(self):
        """Testing excluded volume restraint"""
        m= IMP.Model()
        print "read"
        sel = IMP.atom.CAlphaSelector()
        p0= IMP.atom.read_pdb(self.get_input_file_name("input.pdb"), m, sel)
        p1= IMP.atom.read_pdb(self.get_input_file_name("input.pdb"), m, sel)
        print 'create'
        mhs = IMP.atom.Hierarchies()
        mhs.append(p0)
        mhs.append(p1)
        ps = IMP.helper.set_rigid_bodies(mhs)

        print "radius"
        for p in IMP.core.get_leaves(p0)+IMP.core.get_leaves(p1):
            d= IMP.core.XYZR.setup_particle(p.get_particle())
            d.set_radius(1)
        print "add ss"
        sc= IMP.core.ListSingletonContainer()
        fps=IMP.core.XYZRs()
        for i in range(0,10):
            p= IMP.Particle(m)
            d= IMP.core.XYZR.setup_particle(p)
            d.set_radius(10)
            sc.add_particle(p)
            fps.append(d)
            d.set_coordinates_are_optimized(True)
        for p in ps:
            d= IMP.core.XYZ(p)
            d.set_coordinates(IMP.algebra.random_vector_in_box(
                              IMP.algebra.Vector3D(0,0,0),
                              IMP.algebra.Vector3D(20,20,20)))

        rbs = IMP.core.RigidBodies(ps)
        sev = IMP.helper.create_simple_excluded_volume_on_rigid_bodies(rbs)

        r = sev.restraint()

        print r.evaluate(None)

if __name__ == '__main__':
    unittest.main()



thanks,
Keren.