Fixed parse jumps for triclinic box case
This commit is contained in:
parent
3e8fd04726
commit
77771738ab
@ -187,19 +187,33 @@ def nojump_save_filename(reader: BaseReader):
|
||||
|
||||
def parse_jumps(trajectory: Coordinates):
|
||||
prev = trajectory[0].whole
|
||||
box = prev.box.diagonal()
|
||||
box = prev.box
|
||||
SparseData = namedtuple("SparseData", ["data", "row", "col"])
|
||||
jump_data = (
|
||||
SparseData(data=array("b"), row=array("l"), col=array("l")),
|
||||
SparseData(data=array("b"), row=array("l"), col=array("l")),
|
||||
SparseData(data=array("b"), row=array("l"), col=array("l")),
|
||||
)
|
||||
|
||||
for i, curr in enumerate(trajectory):
|
||||
if i % 500 == 0:
|
||||
logger.debug("Parse jumps Step: %d", i)
|
||||
delta = ((curr - prev) / box).round().astype(np.int8)
|
||||
r3 = np.subtract(curr, prev)
|
||||
delta_z = np.array(np.rint(np.divide(r3[:, 2], box[2][2])), dtype=np.int8)
|
||||
r2 = np.subtract(
|
||||
r3,
|
||||
(np.rint(np.divide(r3[:, 2], box[2][2])))[:, np.newaxis]
|
||||
* box[2][np.newaxis, :],
|
||||
)
|
||||
delta_y = np.array(np.rint(np.divide(r2[:, 1], box[1][1])), dtype=np.int8)
|
||||
r1 = np.subtract(
|
||||
r2,
|
||||
(np.rint(np.divide(r2[:, 1], box[1][1])))[:, np.newaxis]
|
||||
* box[1][np.newaxis, :],
|
||||
)
|
||||
delta_x = np.array(np.rint(np.divide(r1[:, 0], box[0][0])), dtype=np.int8)
|
||||
delta = np.array([delta_x, delta_y, delta_z]).T
|
||||
prev = curr
|
||||
box = prev.box
|
||||
for d in range(3):
|
||||
(col,) = np.where(delta[:, d] != 0)
|
||||
jump_data[d].col.extend(col)
|
||||
|
Loading…
Reference in New Issue
Block a user