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

Re: [IMP-dev] add_attribute vs. add_cache_attribute

Restraints are not allowed to add/remove/change attributes during restraint evaluation. The reason for this is that the order of evaluation of restraints is not defined and if restraints could change attributes, the score could depend on what order they were evaluated in. However, in certain cases it makes sense to cache computations in the particle so as to avoid having to recompute it next time (or in a different restraint). The (undocumented) method add_cache_attribute() provides a means to do that. The assumptions made are that
- any restraint that writes it should write an equivalent value
- it should get cleared if anything "significant" (a still vague concept) in the particle changes.

One usage of it currently is for the collision detection hierarchies used with rigid bodies. This hierarchy is computed on demand (for example when trying to evaluate a distance pair score on a pair of rigid bodies). Any time the rigid body is changed (eg the internal coordinates of a member are changed), the hierarchy gets cleared out and must be recomputed the next time.

On Fri, May 18, 2012 at 1:25 PM, Dina Schneidman <" target="_blank">> wrote:

What is the difference between the two functions for adding Particle attributes?

IMP-dev mailing list