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

Merged
markusro merged 2 commits from fix/nojump_and_npt_caching into main 2025-08-19 12:55:44 +00:00

View File

@@ -149,32 +149,21 @@ def nojump(frame: CoordinateFrame, usecache: bool = True) -> CoordinateFrame:
i0 = 0 i0 = 0
delta = 0 delta = 0
delta = ( delta = (delta
delta + np.vstack(
+ np.array(
np.vstack(
[m[i0 : abstep + 1].sum(axis=0) for m in reader.nojump_matrices] [m[i0 : abstep + 1].sum(axis=0) for m in reader.nojump_matrices]
).T ).T)
)
@ frame.box
)
reader._nojump_cache[abstep] = delta reader._nojump_cache[abstep] = delta
while len(reader._nojump_cache) > NOJUMP_CACHESIZE: while len(reader._nojump_cache) > NOJUMP_CACHESIZE:
reader._nojump_cache.popitem(last=False) reader._nojump_cache.popitem(last=False)
delta = delta[selection, :]
else: else:
delta = ( delta = np.vstack(
np.array( [m[: frame.step + 1, selection].sum(axis=0) for m in reader.nojump_matrices]
np.vstack(
[
m[: frame.step + 1, selection].sum(axis=0)
for m in reader.nojump_matrices
]
).T ).T
)
@ frame.box delta = delta[selection, :]
) delta = np.array(delta @ frame.box)
return frame - delta return frame - delta