superstar54 / weas-widget

A widget to visualize and edit atomic structures in Jupyter Notebook
https://weas-widget.readthedocs.io/en/latest/index.html
MIT License
19 stars 3 forks source link

Support phonon visualization #15

Closed superstar54 closed 6 months ago

superstar54 commented 6 months ago

Suppose we have an eigenvector and amplitude.

One can create a trajectory for the mode.

trajectory = []
times = np.linspace(0, 2 * np.pi, 10)
for t in times:
    # arrow vector
    vectors = amplitude * eigenvector * np.sin(t)
    # new atoms
    new_atoms = atoms.copy()
    new_atoms.positions = atoms.positions + vectors
    new_atoms.set_array("moment", vectors)