From 492098fe01f77aa8ffdeafc9ba7e7f1db7545fcb Mon Sep 17 00:00:00 2001 From: robrobo Date: Sat, 9 Aug 2025 16:11:24 +0200 Subject: [PATCH] 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 --- src/mdevaluate/pbc.py | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/mdevaluate/pbc.py b/src/mdevaluate/pbc.py index b44f083..a22f117 100644 --- a/src/mdevaluate/pbc.py +++ b/src/mdevaluate/pbc.py @@ -149,32 +149,21 @@ def nojump(frame: CoordinateFrame, usecache: bool = True) -> CoordinateFrame: i0 = 0 delta = 0 - delta = ( - delta - + np.array( - np.vstack( - [m[i0 : abstep + 1].sum(axis=0) for m in reader.nojump_matrices] - ).T - ) - @ frame.box - ) + delta = (delta + + np.vstack( + [m[i0 : abstep + 1].sum(axis=0) for m in reader.nojump_matrices] + ).T) reader._nojump_cache[abstep] = delta while len(reader._nojump_cache) > NOJUMP_CACHESIZE: reader._nojump_cache.popitem(last=False) - delta = delta[selection, :] else: - delta = ( - np.array( - np.vstack( - [ - m[: frame.step + 1, selection].sum(axis=0) - for m in reader.nojump_matrices - ] + delta = np.vstack( + [m[: frame.step + 1, selection].sum(axis=0) for m in reader.nojump_matrices] ).T - ) - @ frame.box - ) + + delta = delta[selection, :] + delta = delta @ frame.box return frame - delta