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

Re: Shared state




1. Classes can register callbacks/actions with ModelData::set_float, or this could trigger a State::set_float method, to be notified whenever the model is changed.
The main problem is that given "the float at index 10 is being set to 13.5", you have to lookup somewhat what is at index 10 and whether you care about it. Doing this every time anything is changed, for each of several State objects seems likely to be slow.

Well, for nonbonded lists you don't care what the index is, only what the old and new values are.
You do need to know that it is a coordinate as opposed to some other float.

But anyway, this won't work, because we can't tell for sure if we need to do an update based purely on, say, the x coordinate changing, since we need the 3D distance.
I would have thought that the sqrt(3)*l_infinity norm would be a good enough bound, but what do I know :-) Do you really care about l_2 vs l_inf?

Keep State as it is, with the exception that ModelData has a dirty bit controlled by Model which Model uses to check if the States should be updated.

How/when would this dirty bit be got/set?
If anything changed, it gets set. The Model unsets it when it calls update on the states.

2. we want 8 individual moves of 1A to be treated the same as one move of 8A. So going down this route would require the nonbonded list to keep a copy of the coordinates for comparison purposes - and a method to allow optimizers or other 'model state transforms' to do a more efficient batch update of the variables (e.g. so that we don't have to do our nonbond list check three times when we move a particle, for the individual changes in x,y,z, but just once).
Good point about the 8x move.

So the big question is whether moving a small number of particles is a common enough occurrence to structure things around it. Someone else has to answer that.