Daniel Russel wrote: >> Are you suggesting that instead he should do: >> model.evaluate(scale_factors=[1.0] * 999 + [0.1]) > or model.set_weight(myrestraint_index, .5) or > model.set_weight(my_restraint_pointer, .5); > or restraintset.set_weight(r, .5);
I don't like the second because it requires the model to keep a second bunch of restraint pointers hanging around, and then you have to keep them synchronized with the 'real' list of restraints (what happens if you remove a restraint from a model, or you delete a restraint and then create a new one which happens to have the same address?) I _really_ don't like the first one because 1) it requires the list of restraints to remain ordered and 2) it wouldn't work with restraints that live inside other restraints.
If you like the third, why not compromise and say just that any RestraintSet can scale its children. People are likely to want to scale a whole RestraintSet at a time anyway, and can always stick a single Restraint into a RestraintSet if they really want to individually scale it. We can punt on model.set_weight for the time being, at least until you can convince me that it's a good idea. ;)
>> rather than passing the stdevs to the model. Of course, I am arguing >> that a scale factor and a stdev should be treated similarly here. > The stddev is an attribute of a particular type of Restraint. As I see > it, weight is a transformation applied to the output of any restraint.
Yes, I figured you'd say that. ;) On the other hand, adding a scale member to the Restraint base class adds a per-object overhead, and maybe it's better to only have that for RestraintSets. So we can agree not to put it in Restraint, but for different reasons...
>>> Plus, this way we can reuse a restraint with different weights in >>> different places if we should so desire. >> Surely the easiest way to do that is the put the restraint into two >> different restraint sets, each with its own weight. > Sure. But that requires copying the object and keeping them > synchronized. Not that I see any particular application of this :-)
Maybe I'm missing something here, but a RestraintSet (currently) just keeps a vector of pointers to Restraints. So there's no reason why the same Restraint object couldn't be in two sets.
Ben