From 7dd02f2eed5385f8ca99d046d8937e62ca7eb232 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Fri, 11 Oct 2024 11:50:34 +0100 Subject: [PATCH] Apply mass-weighting to modes for web JSON --- euphonic/qpoint_phonon_modes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/euphonic/qpoint_phonon_modes.py b/euphonic/qpoint_phonon_modes.py index 618f4f859..917f6d042 100644 --- a/euphonic/qpoint_phonon_modes.py +++ b/euphonic/qpoint_phonon_modes.py @@ -898,6 +898,9 @@ def _to_phonon_website_dict(self, x_tick_labels = [(int(key) + 1, str(value)) for key, value in x_tick_labels] x_tick_labels = self._combine_neighbouring_labels(x_tick_labels) + vectors = eigenvectors / np.sqrt(self.crystal.atom_mass)[None, None, :, None] + vectors = vectors.view(float).reshape(*eigenvectors.shape[:-1], 3, 2) + dat = PhononWebsiteData( name=name, **self._crystal_website_data(self.crystal), @@ -905,7 +908,7 @@ def _to_phonon_website_dict(self, distances=abscissa.magnitude.tolist(), qpoints=self.qpts.tolist(), eigenvalues=self.frequencies.to("1/cm").magnitude.tolist(), - vectors=eigenvectors.view(float).reshape(*eigenvectors.shape[:-1], 3, 2).tolist(), + vectors=vectors.tolist(), repetitions=repetitions, line_breaks=line_breaks )