ExcludedVolumeRestraint : meaning of the score
Hi list,
I was wondering about the exact meaning of the ExcludedVolumeRestraint score, and how this score was computed. So I took my virtual shovel and had a few hours digging in IMP code, but I still have questions.
For what I understood, the score is computed as the sum of harmonic functions over a set of pairs of intersecting spheres (this score being 0.0 for non interacting spheres), but the way these pairs are built is still a little fuzzy for me.
Here is the sample python code I wrote using that restraint :
rigidChains = {} for chain in IMP.atom.Chains(IMP.atom.get_by_type(mh, IMP.atom.CHAIN_TYPE)) : rigidChains[chain.get_id()] = IMP.atom.setup_as_rigid_body(chain)
...
lsc = IMP.container.ListSingletonContainer() for rb in rigidChains.values() : lsc.add_particle(rb.get_particle()) m.add_restraint( IMP.core.ExcludedVolumeRestraint( lsc, IMP.core.LeavesRefiner(refChains.values()[0].get_traits()) ) )
I intuitively expected IMP to consider all pairs of intersecting atom-spheres between any two different chains, but reading the code I could not convince me this is actually what is computed. I could not decide for instance if pairs of atoms in a same chain were considered or not, and in fact I could not even see where exactly atoms were extracted out of my rigid body hierarchies…
Could you explain me in a few words if my sample code does what I expect from it, and if not, how to change it to obtain the desired behavior.
Thanks a lot
Dr. Benjamin SCHWARZ Biocomputing group Email : schwarz@igbmc.fr Voice : +33 (0)3 68 85 47 30 FAX : +33 (0)3 68 85 47 18
Structural Biology & Genomics Dept. - IGBMC 1 rue Laurent Fries BP 10142 F - 67404 Illkirch CEDEX
The ExcludedVolume scoring function is a sum over all pairs of refined particles. Pairs where both members are in the same rigid body are dropped as they can never change during optimization. The rigidbodyclosepairsfinder is responsible for enumerating all such pairs which are then put in a ClosePairContainer, which is in turn fed to a PairsRestraint. See the constructor implementation in svn (I think I simplified the implementation since 1.0, but maybe the simplification preceded 1.0).
The reason it is not documented in detail is that the plan has been to replace it with an alternate mechanism which better handles high resolution rigid bodies. But the improved implementation is not finished and tested yet.
Your sample code below won't do much of interest since there are only internal pairs. Add all the rigid bodies to one container and set up a ExcludedVolumeRestraint on that will do better. lsc=IMP.container.ListSingetonContainer(rigidChains.values) m.add_restraint(IMP.core.ExcludedVolumeRestraint(lsc, IMP.core.LeavesRefiner(...))
I'll add a warning if only one particle is passed and a reminder to get better rigid body handling.
On Aug 2, 2010, at 2:33 AM, Benjamin SCHWARZ wrote:
> Hi list, > > I was wondering about the exact meaning of the ExcludedVolumeRestraint score, and how this score was computed. So I took my virtual shovel and had a few hours digging in IMP code, but I still have questions. > > For what I understood, the score is computed as the sum of harmonic functions over a set of pairs of intersecting spheres (this score being 0.0 for non interacting spheres), but the way these pairs are built is still a little fuzzy for me. > > Here is the sample python code I wrote using that restraint : > > rigidChains = {} > for chain in IMP.atom.Chains(IMP.atom.get_by_type(mh, IMP.atom.CHAIN_TYPE)) : > rigidChains[chain.get_id()] = IMP.atom.setup_as_rigid_body(chain) > > ... > > lsc = IMP.container.ListSingletonContainer() > for rb in rigidChains.values() : > lsc.add_particle(rb.get_particle()) > m.add_restraint( > IMP.core.ExcludedVolumeRestraint( > lsc, > IMP.core.LeavesRefiner(refChains.values()[0].get_traits()) > ) > ) > > I intuitively expected IMP to consider all pairs of intersecting atom-spheres between any two different chains, but reading the code I could not convince me this is actually what is computed. > I could not decide for instance if pairs of atoms in a same chain were considered or not, and in fact I could not even see where exactly atoms were extracted out of my rigid body hierarchies… > > Could you explain me in a few words if my sample code does what I expect from it, and if not, how to change it to obtain the desired behavior. > > Thanks a lot > > > > > Dr. Benjamin SCHWARZ > Biocomputing group > Email : schwarz@igbmc.fr > Voice : +33 (0)3 68 85 47 30 > FAX : +33 (0)3 68 85 47 18 > > <logo-uds-signature.gif> > > > Structural Biology & Genomics Dept. - IGBMC > 1 rue Laurent Fries > BP 10142 > F - 67404 Illkirch CEDEX > > _______________________________________________ > IMP-users mailing list > IMP-users@salilab.org > https://salilab.org/mailman/listinfo/imp-users
Hi Daniel,
I am sorry, but your answer remains a bit cryptic to me.
first, I don't understand this statement : > Your sample code below won't do much of interest since there are only internal pairs. I have 4 rigid bodies, one for each chain in my pdb structure, thus I should have all atom pairs between distinct chains, should I not ?
second : > Add all the rigid bodies to one container and set up a ExcludedVolumeRestraint on that will do better. I thought I was doing exactly this with for rb in rigidChains.values() : lsc.add_particle(rb.get_particle())
Moreover > lsc=IMP.container.ListSingetonContainer(rigidChains.values) Does not seem to work, since rigidChains contains RigidBody Decorators (which are not particles), and ListSingletonContainer can only be initialized with Particles...
>> rigidChains = {} >> for chain in IMP.atom.Chains(IMP.atom.get_by_type(mh, IMP.atom.CHAIN_TYPE)) : >> rigidChains[chain.get_id()] = IMP.atom.setup_as_rigid_body(chain) >> [..] >> lsc = IMP.container.ListSingletonContainer() >> for rb in rigidChains.values() : >> lsc.add_particle(rb.get_particle()) >> m.add_restraint( >> IMP.core.ExcludedVolumeRestraint( >> lsc, >> IMP.core.LeavesRefiner(refChains.values()[0].get_traits()) >> ) >> )
Sorry, it looks like I had gotten confused about your code. The code below looks correct.
BTW, lists of decorators and particles are automatically inter-converted, so you can just to IMP.container.ListSingletonContainer(rigidChains.values())
On Aug 9, 2010, at 7:43 AM, Benjamin SCHWARZ wrote:
> Hi Daniel, > > I am sorry, but your answer remains a bit cryptic to me. > > first, I don't understand this statement : >> Your sample code below won't do much of interest since there are only internal pairs. > I have 4 rigid bodies, one for each chain in my pdb structure, thus I should have all atom pairs between distinct chains, should I not ? > > second : >> Add all the rigid bodies to one container and set up a ExcludedVolumeRestraint on that will do better. > I thought I was doing exactly this with > for rb in rigidChains.values() : > lsc.add_particle(rb.get_particle()) > > Moreover >> lsc=IMP.container.ListSingetonContainer(rigidChains.values) > Does not seem to work, since rigidChains contains RigidBody Decorators (which are not particles), and ListSingletonContainer can only be initialized with Particles... > >>> rigidChains = {} >>> for chain in IMP.atom.Chains(IMP.atom.get_by_type(mh, IMP.atom.CHAIN_TYPE)) : >>> rigidChains[chain.get_id()] = IMP.atom.setup_as_rigid_body(chain) >>> [..] >>> lsc = IMP.container.ListSingletonContainer() >>> for rb in rigidChains.values() : >>> lsc.add_particle(rb.get_particle()) >>> m.add_restraint( >>> IMP.core.ExcludedVolumeRestraint( >>> lsc, >>> IMP.core.LeavesRefiner(refChains.values()[0].get_traits()) >>> ) >>> ) > > _______________________________________________ > IMP-users mailing list > IMP-users@salilab.org > https://salilab.org/mailman/listinfo/imp-users
Thank you for the confirmation Daniel
> BTW, lists of decorators and particles are automatically inter-converted, so you can just to > IMP.container.ListSingletonContainer(rigidChains.values())
Are you sure this works with Version 1.0 ? I tried it, but it would not run, neither than replacing lsc.add_particle(rb.get_particle()) by lsc.add_particle(rb)
both result in the following error message :
Traceback (most recent call last): File "/Users/schwarz/Dev/IMPstuff/src/tests/fit_with_restraints_test/fitWithRestraints.py", line 117, in <module> lsc = IMP.container.ListSingletonContainer(rigidChains.values()) File "/usr/local/lib/python2.6/site-packages/IMP/container/__init__.py", line 425, in __init__ this = _IMP_container.new_ListSingletonContainer(*args) NotImplementedError: Wrong number of arguments for overloaded function 'new_ListSingletonContainer'. Possible C/C++ prototypes are: IMP::container::ListSingletonContainer(IMP::Particles const &,std::string) IMP::container::ListSingletonContainer(IMP::Particles const &) IMP::container::ListSingletonContainer(std::string) IMP::container::ListSingletonContainer() IMP::container::ListSingletonContainer(char const *)
In fact, I intuitively expected the behavior you describe since in the few implementations of the Decorator design pattern I have seen to this date, the Decorator always inherited from the "decorated". According to the doc, in IMP this seems not to be the case : unless I missed the point; a XYZ or a RigidBody is not a Particle.
--Ben
It looks like I was wrong about native python list support being in 1.0.
On Aug 9, 2010, at 8:37 AM, Benjamin SCHWARZ wrote:
> Thank you for the confirmation Daniel > > >> BTW, lists of decorators and particles are automatically inter-converted, so you can just to >> IMP.container.ListSingletonContainer(rigidChains.values()) > > > Are you sure this works with Version 1.0 ? I tried it, but it would not run, neither than replacing > lsc.add_particle(rb.get_particle()) > by > lsc.add_particle(rb) > > both result in the following error message : > > Traceback (most recent call last): > File "/Users/schwarz/Dev/IMPstuff/src/tests/fit_with_restraints_test/fitWithRestraints.py", line 117, in <module> > lsc = IMP.container.ListSingletonContainer(rigidChains.values()) > File "/usr/local/lib/python2.6/site-packages/IMP/container/__init__.py", line 425, in __init__ > this = _IMP_container.new_ListSingletonContainer(*args) > NotImplementedError: Wrong number of arguments for overloaded function 'new_ListSingletonContainer'. > Possible C/C++ prototypes are: > IMP::container::ListSingletonContainer(IMP::Particles const &,std::string) > IMP::container::ListSingletonContainer(IMP::Particles const &) > IMP::container::ListSingletonContainer(std::string) > IMP::container::ListSingletonContainer() > IMP::container::ListSingletonContainer(char const *) > > In fact, I intuitively expected the behavior you describe since in the few implementations of the Decorator design pattern I have seen to this date, the Decorator always inherited from the "decorated". According to the doc, in IMP this seems not to be the case : unless I missed the point; a XYZ or a RigidBody is not a Particle. > > --Ben > _______________________________________________ > IMP-users mailing list > IMP-users@salilab.org > https://salilab.org/mailman/listinfo/imp-users
participants (2)
-
Benjamin SCHWARZ
-
Daniel Russel