NormalViewer
Vibrational normal-mode viewer: pick a mode by frequency and watch it animate, with optional displacement arrows.
See the Normal Mode Visualization example for a walkthrough.
Constructor
NormalViewer(atoms, vibrations=None, mode_vectors=None, frequencies=None,
n_frames=30, theme=None, **settings)
| Parameter | Type | Description | Default |
|---|---|---|---|
atoms |
Atoms, dict |
Equilibrium structure | Required |
vibrations |
Vibrations, VibrationsData |
ASE vibrations object | None |
mode_vectors |
array-like (n_modes, n_atoms, 3) |
Displacement vectors | None |
frequencies |
array-like (n_modes,) |
Frequencies in cm⁻¹; complex values are imaginary modes | None |
n_frames |
int |
Animation frames per vibration period | 30 |
theme |
str |
Viewer theme; None uses get_theme() |
None |
**settings |
Viewer settings for this viewer |
Provide either vibrations, or mode_vectors together with frequencies.
Shapes, counts and finiteness are checked when the viewer is created.
Normal-mode settings:
| Setting | Description | Default |
|---|---|---|
mode_index |
Mode shown first | 0 |
amplitude |
Displacement scale | 0.75 |
show_mode_vector |
Arrows for the + and − displacement of each atom | False |
fps |
Animation speed in frames per second | 20 |
Styles, bonds, cell and view settings work as in MolecularViewer; see Viewer Settings.
Class methods
from_orca()
Modes from an ORCA .hess file. skip_imaginary=True drops translations and
rotations (|frequency| < 10 cm⁻¹).
from_vasp()
Modes from a VASP OUTCAR written with IBRION=5 or 6 (the "Eigenvectors
and eigenvalues of the dynamical matrix" section). With selective dynamics,
the free atoms are matched to the structure by position and fixed atoms get
zero displacement. Imaginary modes are reported with negative frequencies.
from_file()
ORCA .hess or VASP OUTCAR, detected from the file name (OUTCAR → VASP)
and then the content.
Methods
show(), get_html(), save_html(), save_png() and save_gif() work as in
MolecularViewer. A GIF covers one vibration
period of the current mode.
In the viewer
- Vibration section: mode list with frequencies (imaginary modes shown as
123.45i), amplitude slider, displacement arrows. - Player: play/pause and speed; the toolbar copies the current displaced structure or every frame of the period.
Examples
From ASE vibrations
from ase.vibrations import Vibrations
from aseview import NormalViewer
vib = Vibrations(atoms)
vib.run()
NormalViewer(atoms, vibrations=vib).show()
From ORCA or VASP
from ase.io import read
from aseview import NormalViewer
NormalViewer.from_orca(read("molecule.xyz"), "orca.hess").show()
NormalViewer.from_vasp(read("POSCAR"), "OUTCAR").show()
NormalViewer.from_file(read("molecule.xyz"), "orca.hess").show() # format detected
Arrows, amplitude and starting mode
NormalViewer.from_orca(
atoms,
"orca.hess",
show_mode_vector=True,
amplitude=1.0,
mode_index=6,
n_frames=60,
).show()
Supported Hessian formats
| Program | File |
|---|---|
| ORCA | .hess |
| VASP | OUTCAR (IBRION=5/6) |