From 465d6b16504cf5d48f97b45471b72ffa9820bc3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Jan=C3=9Fen?= Date: Sat, 9 Dec 2023 00:14:08 +0100 Subject: [PATCH] Implement interactive_velocities_getter() --- pylammpsmpi/wrapper/ase.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pylammpsmpi/wrapper/ase.py b/pylammpsmpi/wrapper/ase.py index 960ea74..4bfa68b 100644 --- a/pylammpsmpi/wrapper/ase.py +++ b/pylammpsmpi/wrapper/ase.py @@ -342,6 +342,15 @@ def interactive_stress_getter(self, enable_stress_computation=True): ss = np.einsum("nij,kj->nik", ss, self._prism.R) return ss + def interactive_velocities_getter(self): + velocity = np.reshape( + np.array(self._interactive_library.gather_atoms("v", 1, 3)), + (len(self._structure), 3), + ) + if _check_ortho_prism(prism=self._prism): + velocity = np.matmul(velocity, self._prism.R.T) + return velocity + def close(self): if self._interactive_library is not None: self._interactive_library.close()