apply selection and scaling with current box after delta in jumps has been cached or calculated directly. this should fix using nojump on NPT simulations
#6
Analysing NPT simulations with .nojump lead to wrong coordinates. The issue was that caching was the default and that the cached values were already multiplied by the box matrix for the requested frame. Since box sizes change during NPT, using the cached result lead to accumulating displacements.
The new version simply does the multiplication afterwards and the cache only saves the delta in raw jumps.
Code to test this is with the old version before this fix:
import mdevaluate as md
traj = md.open('/data/robin/sim/fst_tip4p2005/T170_tb_q-14_P-850_NPT', trajectory='out/traj.xtc')
nojump = traj.nojump
last0 = nojump[-1] # result for no cache yet
[nojump[i] for i in range(0,len(nojump), 10)] # fill cache and accumulate mistakes
last1 = nojump[-1] # wrong result
del nojump.frames._nojump_cache # reset cache
last2 = nojump[-1] # again result for no cache
print((last0 == last2).all()) # should be True
print((last1 == last2).all()) # should be False in the old version and True in the new one
Analysing NPT simulations with .nojump lead to wrong coordinates. The issue was that caching was the default and that the cached values were already multiplied by the box matrix for the requested frame. Since box sizes change during NPT, using the cached result lead to accumulating displacements.
The new version simply does the multiplication afterwards and the cache only saves the delta in raw jumps.
Code to test this is with the old version before this fix:
import mdevaluate as md
traj = md.open('/data/robin/sim/fst_tip4p2005/T170_tb_q-14_P-850_NPT', trajectory='out/traj.xtc')
nojump = traj.nojump
last0 = nojump[-1] # result for no cache yet
[nojump[i] for i in range(0,len(nojump), 10)] # fill cache and accumulate mistakes
last1 = nojump[-1] # wrong result
del nojump.frames._nojump_cache # reset cache
last2 = nojump[-1] # again result for no cache
print((last0 == last2).all()) # should be True
print((last1 == last2).all()) # should be False in the old version and True in the new one
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Analysing NPT simulations with .nojump lead to wrong coordinates. The issue was that caching was the default and that the cached values were already multiplied by the box matrix for the requested frame. Since box sizes change during NPT, using the cached result lead to accumulating displacements.
The new version simply does the multiplication afterwards and the cache only saves the delta in raw jumps.
Code to test this is with the old version before this fix:
import mdevaluate as md
traj = md.open('/data/robin/sim/fst_tip4p2005/T170_tb_q-14_P-850_NPT', trajectory='out/traj.xtc')
nojump = traj.nojump
last0 = nojump[-1] # result for no cache yet
[nojump[i] for i in range(0,len(nojump), 10)] # fill cache and accumulate mistakes
last1 = nojump[-1] # wrong result
del nojump.frames._nojump_cache # reset cache
last2 = nojump[-1] # again result for no cache
print((last0 == last2).all()) # should be True
print((last1 == last2).all()) # should be False in the old version and True in the new one