\(\newcommand{\AA}{\text{Å}}\)
lmodea_k.NormalModes#
- class NormalModes(H: NDArray[floating], masses: NDArray[floating], wavevector: NDArray[floating] | None = None, coords_frac: NDArray[floating] | None = None, convert_phase: bool = False, asr: bool = False, rot_axis: str | None = None, generalized: bool = True, ignore_negative: bool = False, matrix_type: str = 'dynamical', eigval_min: float | None = None)#
Solve normal modes from a dynamical matrix or Hessian.
By default this class reproduces the generalized eigenproblem workflow used by the command-line entry point:
convert a dynamical matrix to a Cartesian Hessian when required;
optionally apply the acoustic sum rule at the Gamma point;
solve
H L = M L Kusingeigh(H, M);apply phase conversion to eigenvectors for non-Gamma wavevectors;
optionally raise on negative eigenvalues away from Gamma.
The legacy mass-weighted diagonalisation path is still available through the
generalized=Falseoption.- __init__(H: NDArray[floating], masses: NDArray[floating], wavevector: NDArray[floating] | None = None, coords_frac: NDArray[floating] | None = None, convert_phase: bool = False, asr: bool = False, rot_axis: str | None = None, generalized: bool = True, ignore_negative: bool = False, matrix_type: str = 'dynamical', eigval_min: float | None = None)#
- Parameters:
H ((3N, 3N) array) – Input matrix. If
matrix_type='dynamical'this is treated as a dynamical matrix and converted to a Cartesian Hessian before solving. Ifmatrix_type='hessian'it is used directly as the Hessian.masses ((N,) array) – Atomic masses (amu).
wavevector ((3,) array, optional) – Reduced wavevector for phase conversion.
coords_frac ((N, 3) array, optional) – Fractional coordinates for phase conversion.
convert_phase (bool, default False) – Whether to phase-shift eigenvectors for non-Γ wavevectors.
asr (bool, default False) – Apply the acoustic sum rule before diagonalisation at Gamma.
rot_axis ({"x","y","z",None}, optional) – Rotation axis for ASR rotational mode removal.
generalized (bool, default True) – If True, solve the generalized eigenproblem
H L = M L K. If False, diagonalise the dynamical matrix (mass-weighted Hessian).ignore_negative (bool, default False) – If True, permit negative eigenvalues at non-Gamma wavevectors. Otherwise raise a
ValueError.matrix_type ({"dynamical", "hessian"}, default "dynamical") – Whether the input matrix is a dynamical matrix or a Hessian.
eigval_min (float, optional) – Minimum eigenvalue threshold used to prevent singularities in downstream analyses. When provided, eigenvalues are clamped to this minimum value and methods like
get_hessian()andeigenvalues_clamped()return modified results.
Methods
__init__(H, masses[, wavevector, ...])- param H:
Input matrix. If
matrix_type='dynamical'this is treated as a
get_hessian([eigval_min])Get the Cartesian Hessian, optionally with eigenvalue clamping applied.
summary([n])Print the first n frequencies for inspection.
Attributes
dynmat_eigenvaluesEigenvalues from the dynamical-matrix diagonalisation, shape (3N,).
dynmat_eigenvectorsEigenvectors from the dynamical-matrix diagonalisation, shape (3N, 3N).
eigenvaluesEigenvalues from the generalized eigenproblem
H L = M L K, shape (3N,).eigenvalues_clampedEigenvalues with
eigval_minapplied if set, shape (3N,).eigenvectorsEigenvectors from the generalized eigenproblem
H L = M L K, shape (3N, 3N).frequenciesFrequencies in cm⁻¹ (negative for imaginary modes), shape (3N,).
hessianCartesian Hessian used in the solve, shape (3N, 3N).