From db2cc623373bc5aa67582a4ee2cbed69abd599b6 Mon Sep 17 00:00:00 2001 From: AndresOrtegaGuerrero Date: Tue, 29 Oct 2024 12:58:35 +0000 Subject: [PATCH] upgrade weas_widget version --- pyproject.toml | 2 +- .../utils/raman/result.py | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cf92895..dfde138 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ dependencies = [ "pre-commit", "euphonic", "kaleido", - "weas-widget==0.1.5", + "weas-widget==0.1.12", ] [tool.ruff.lint] diff --git a/src/aiidalab_qe_vibroscopy/utils/raman/result.py b/src/aiidalab_qe_vibroscopy/utils/raman/result.py index fd036e7..832de02 100644 --- a/src/aiidalab_qe_vibroscopy/utils/raman/result.py +++ b/src/aiidalab_qe_vibroscopy/utils/raman/result.py @@ -10,7 +10,6 @@ import json from weas_widget import WeasWidget -from weas_widget.utils import generate_phonon_trajectory from aiida_vibroscopy.utils.broadenings import multilorentz @@ -520,19 +519,26 @@ def _animation_widget(self): # Get the structure of the selected mode structure = self.structure_ase - trajectory = generate_phonon_trajectory( - atoms=structure, - eigenvectors=eigenvector, - amplitude=amplitude, - repeat=[ + self.weas = WeasWidget(guiConfig=self.guiConfig) + self.weas.from_ase(structure) + + phonon_setting = { + "eigenvectors": np.array( + [[[real_part, 0] for real_part in row] for row in eigenvector] + ), + "kpoint": [0, 0, 0], # optional + "amplitude": amplitude, + "nframes": 20, + "repeat": [ self._supercell[0].value, self._supercell[1].value, self._supercell[2].value, ], - ) - self.weas = WeasWidget(guiConfig=self.guiConfig) - self.weas.from_ase(trajectory) - self.weas.avr.vf.settings = [ - {"origins": "positions", "vectors": "movement", "radius": 0.1} - ] + "color": "black", + "radius": 0.1, + } + self.weas.avr.phonon_setting = phonon_setting + + self.weas.avr.model_style = 1 + self.weas.avr.color_type = "JMOL" self.weas.avr.vf.show = True