QuantumSpectra is a computational quantum chemistry and molecular vibrational normal mode analysis library written in Julia. It diagonalizes mass-weighted Hessian tensors, projects out infinitesimal translations and rotations via Eckart-Sayvetz conditions, computes harmonic vibrational frequencies in
For an
Where the mass matrix
To isolate the
The idempotent Eckart projection operator
Projecting the mass-weighted Hessian:
Eigen-decomposition of the projected mass-weighted Hessian yields eigenvalues
The vibrational wavenumber
Zero-Point Vibrational Energy (ZPE):
Vibrational partition function
Internal energy
flowchart TD
subgraph Geometry ["Molecular Specification"]
ATOMS[Atomic Coordinates & Masses] --> COM[Center of Mass Translation]
COM --> INERTIA[Inertia Tensor & Linearity Test]
end
subgraph Projector ["Eckart Projection Engine"]
COM --> TRANS[3 Translations Tx, Ty, Tz]
COM --> ROT[3 Rotations Rx, Ry, Rz]
TRANS & ROT --> GS[Gram-Schmidt Orthonormalization]
GS --> P_MAT[Projector Matrix P = I - UU^T]
end
subgraph Dynamics ["Hessian & Normal Mode Diagonalization"]
H_CART[Cartesian Hessian SI] --> H_MW[Mass-Weighted Hessian H_mw = M^-1/2 H M^-1/2]
H_MW & P_MAT --> H_PROJ[Projected Hessian H_proj = P H_mw P]
H_PROJ --> EIGEN[Eigen-decomposition L, Lambda]
EIGEN --> FREQ[Frequencies in cm^-1]
EIGEN --> DISP[Cartesian Displacements]
end
subgraph Output ["Spectroscopy & Thermodynamics"]
FREQ --> ZPE[Zero-Point Energy ZPE]
FREQ --> THERMO[Q_vib, U_vib, Cv, S_vib]
FREQ --> IR[Lorentzian/Gaussian Convoluted IR Spectrum]
end
src/
├── QuantumSpectra.jl # Main module re-exports
├── constants.jl # Physical constants (h, c, N_A, k_B, amu to kg)
├── molecule.jl # Atom and Molecule types, COM, moment of inertia
├── projection.jl # Eckart translational and rotational projection operator
├── normal_modes.jl # Mass-weighted Hessian transformation and diagonalization
├── thermodynamics.jl # ZPE, partition function, enthalpy, entropy, heat capacity
└── spectrum.jl # Lorentzian and Gaussian line-broadened IR spectrum synthesis
test/
└── runtests.jl # Verification against analytical diatomic oscillator and water
using Pkg
Pkg.activate(".")
Pkg.instantiate()
using QuantumSpectra
# Define Water Molecule (H2O)
h2o = Molecule([
Atom("O", 15.9994, [0.0, 0.0, 0.0]),
Atom("H", 1.00784, [0.0, 0.757, 0.586]),
Atom("H", 1.00784, [0.0, -0.757, 0.586]),
])
# Compute normal modes and thermodynamics
# analysis = calculate_normal_modes(h2o, H_cart)
# thermo = calculate_vibrational_thermodynamics(analysis, 298.15)Run test suite:
julia --project=. test/runtests.jlThis project is licensed under the MIT License.