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
@@ -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 = np.array(delta @ frame.box)
|
||||
return frame - delta
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user