Normal Modes
NormalViewer animates vibrational modes. Pick a mode
from the list (imaginary frequencies read 123.45i), adjust the amplitude, and
toggle displacement arrows.
From a frequency calculation
NormalViewer.from_file() detects ORCA or VASP by itself. Start options:
NormalViewer.from_file(
atoms,
"orca.hess",
mode_index=6, # mode shown first
amplitude=1.0, # largest displacement in Å
show_mode_vector=True, # arrows
)
Custom mode vectors
Any displacement pattern can be animated by passing mode_vectors with
frequencies. The two demos below use hand-made phonon-like modes.
import numpy as np
from ase.build import nanotube
cnt = nanotube(5, 0, length=2, vacuum=5.0)
axis = cnt.positions.mean(axis=0)[:2]
radial = cnt.positions[:, :2] - axis
radial /= np.linalg.norm(radial, axis=1, keepdims=True)
breathing = np.column_stack([0.4 * radial, np.zeros(len(cnt))])
NormalViewer(
cnt,
mode_vectors=[breathing],
frequencies=[280.0],
show_mode_vector=True,
style="neon",
background_color="#000000",
).show()
Export
The toolbar copies the displaced structure or every frame of one period.
save_html() writes the page; save_gif() records one vibration period.