phonons module¶
- torch_tdscha.phonons.displace_along_mode(mod, eigv, eta)¶
- Build a Cartesian displacement vector corresponding to a single normal mode. - Parameters:
- Returns:
- disp – Mass-weighted Cartesian displacement vector. 
- Return type:
- (3N,) ndarray 
 - Notes - Converts η from Å to Bohr·√amu using 1 Å = 1.889725988 Bohr and 1 amu = 911.444175 m_e. 
 
- torch_tdscha.phonons.get_AB(fom, feigv, T)¶
- Build Gaussian covariance matrices A and B for a harmonic system at temperature T. - Parameters:
- fom ((3N,) ndarray) – Phonon frequencies (a.u.). 
- feigv ((3N, 3N) ndarray) – Normal-mode eigenvectors (columns). 
- T (float) – Temperature in kelvin. 
 
- Returns:
- A ((3N, 3N) ndarray) – Coordinate covariance matrix ⟨u_i u_j⟩. 
- B ((3N, 3N) ndarray) – Momentum covariance matrix ⟨p_i p_j⟩. 
 
 - Notes - Converts T to Rydberg atomic units (K_to_Ry = 6.336857×10⁻⁶). 
- Acoustic modes (ω<1e-6) are removed before computing A and B. 
 
- torch_tdscha.phonons.get_alpha(om, eigv, T)¶
- Compute α matrix = 2 ω tanh(ω / 2T) projected to Cartesian coordinates. - Parameters:
- om ((3N,) ndarray) – Phonon frequencies (a.u.). 
- eigv ((3N, 3N) ndarray) – Normal-mode eigenvectors. 
- T (float) – Temperature in kelvin. 
 
- Returns:
- alpha – Dynamical matrix α in Cartesian coordinates. 
- Return type:
- (3N, 3N) ndarray 
 
- torch_tdscha.phonons.get_phonons(phi)¶
- Diagonalize a harmonic force-constant matrix and return phonon frequencies in internal atomic-unit scale (√Ry/Bohr). - Parameters:
- phi ((3N, 3N) ndarray) – Harmonic force-constant matrix. 
- Returns:
- om ((3N,) ndarray) – Square-root eigenvalues of phi (frequencies in a.u.). 
- eigv ((3N, 3N) ndarray) – Eigenvectors (columns). 
 
 
- torch_tdscha.phonons.get_phonons_THz(phi)¶
- Diagonalize a harmonic force-constant matrix and return phonon frequencies in THz. - Parameters:
- phi ((3N, 3N) ndarray) – Harmonic force-constant matrix in atomic units (Ry/Bohr²). 
- Returns:
- om ((3N,) ndarray) – Phonon frequencies in terahertz (THz). 
- eigv ((3N, 3N) ndarray) – Normal-mode eigenvectors (columns). 
 
 
- torch_tdscha.phonons.get_phonons_r(phi)¶
- Diagonalize the force-constant matrix using scipy.linalg.eigh and return positive phonon frequencies (absolute value). - Parameters:
- phi ((3N, 3N) ndarray) – Harmonic force-constant matrix. 
- Returns:
- om ((3N,) ndarray) – Positive phonon frequencies (a.u.). 
- eigv ((3N, 3N) ndarray) – Eigenvectors (columns). 
 
 
- torch_tdscha.phonons.inv_Phi(fom, feigv)¶
- Construct the inverse of the harmonic force-constant matrix using normal-mode decomposition. - Parameters:
- fom ((3N,) ndarray) – Phonon frequencies (a.u.). 
- feigv ((3N, 3N) ndarray) – Corresponding eigenvectors. 
 
- Returns:
- inv_phi – Matrix sum_k |e_k⟩⟨e_k| / ω_k^2 excluding acoustic modes. 
- Return type:
- (3N, 3N) ndarray 
 
- torch_tdscha.phonons.print_phonons(om)¶
- Print phonon frequencies to standard output in THz. - Parameters:
- om ((3N,) ndarray) – Frequencies in internal units (a.u.); converted to THz before printing. 
 
- torch_tdscha.phonons.print_phonons_mat(phi)¶
- Diagonalize a force-constant matrix and print phonon frequencies both in THz and cm⁻¹ units. - Parameters:
- phi ((3N, 3N) ndarray) – Harmonic force-constant matrix. 
 
- torch_tdscha.phonons.regularize(phi)¶
- Replace negative eigenvalues of a force-constant matrix by their absolute values to enforce positive definiteness. - Parameters:
- phi ((3N, 3N) ndarray) – Harmonic force-constant matrix (possibly with small negative modes). 
- Returns:
- phi_reg – Regularized force-constant matrix with all positive eigenvalues. 
- Return type:
- (3N, 3N) ndarray 
 
- torch_tdscha.phonons.remove_translations(om, eigv, thr=1e-06)¶
- Remove translational acoustic modes (ω≈0) from a phonon spectrum. - Parameters:
- om ((3N,) ndarray) – Phonon frequencies (a.u.). 
- eigv ((3N, 3N) ndarray) – Corresponding eigenvectors (columns). 
- thr (float, optional) – Threshold below which a mode is considered acoustic. Default 1e-6. 
 
- Returns:
- nom ((3N-3,) ndarray) – Non-acoustic frequencies. 
- neigv ((3N, 3N-3) ndarray) – Eigenvectors of optical modes. 
 
 
- torch_tdscha.phonons.remove_translations_from_mat(phi, thr=1e-06)¶
- Remove translational acoustic modes directly from a force-constant matrix. - Parameters:
- phi ((3N, 3N) ndarray) – Harmonic force-constant matrix. 
- thr (float, optional) – Threshold below which eigenmodes are treated as acoustic. Default 1e-6. 
 
- Returns:
- nom ((3N-3,) ndarray) – Non-acoustic frequencies. 
- neigv ((3N, 3N-3) ndarray) – Corresponding eigenvectors.