Python package for constructing molecular rovibrational kinetic and potential energy operators using Taylor-mode automatic differentiation.
Vibrojet enables the computation of the rovibrational kinetic energy
Expansion coefficients can be exported to files and used with variational rovibrational codes, such as TROVE, for computing matrix elements, energy levels, and spectra.
Vibrojet builds on jax.experimental.jet to perform Taylor-mode automatic differentiation and extends it with additional functions for building multivariate Taylor polynomials of rovibrational kinetic energy operators.
pip install --upgrade git+https://github.com/robochimps/vibrojet.gitTaylor-series expansion of the rovibrational kinetic energy
where
import itertools
import jax
import jax.numpy as jnp
from vibrojet.eckart import eckart
from vibrojet.keo import Gmat
from vibrojet.taylor import deriv_list
jax.config.update("jax_enable_x64", True)
# Masses of O, H, H atoms
masses = [15.9994, 1.00782505, 1.00782505]
# Equilibrium values of valence coordinates
r1, r2, alpha = 0.958, 0.958, 1.824
q0 = [r1, r2, alpha]
# Valence-to-Cartesian coordinate transformation
# input: array of three valence coordinates
# output: array of shape (number of atoms, 3)
# containing Cartesian coordinates of atoms
@eckart(q0, masses)
def valence_to_cartesian(q):
r1, r2, a = q
return jnp.array(
[
[0.0, 0.0, 0.0],
[r1 * jnp.sin(a / 2), 0.0, r1 * jnp.cos(a / 2)],
[-r2 * jnp.sin(a / 2), 0.0, r2 * jnp.cos(a / 2)],
]
)
# Generate list of multi-indices specifying the integer exponents
# for each coordinate in the Taylor series expansion
max_order = 4 # max total expansion order
deriv_ind = [
elem
for elem in itertools.product(*[range(0, max_order + 1) for _ in range(len(q0))])
if sum(elem) <= max_order
]
print("max expansion order:", max_order)
print("number of expansion terms:", len(deriv_ind))
# Function for computing kinetic G-matrix for given masses of atoms
# and internal coordinates
func = lambda x: Gmat(x, masses, valence_to_cartesian)
# Compute Taylor series expansion coefficients
Gmat_coefs = deriv_list(func, deriv_ind, q0, if_taylor=True)The array Gmat_coefs contains Taylor-series expansion coefficients deriv_ind.
More examples and user contributions for various molecules can be found in the examples folder.
If you use this code in your research, please cite:
A. Yachmenev, E. Vogt, A. F. Corral, Y. Saleh, "Taylor-mode automatic differentiation for constructing molecular rovibrational Hamiltonian operators", J. Chem. Phys. 163, 072501 (2025) DOI:10.1063/5.0287347, arXiv:2506.20129 [physics]
@article{Yachmenev_JCP163_2025,
author = {A. Yachmenev, E. Vogt, A. F. Corral, Y. Saleh},
title = {Taylor-mode automatic differentiation for constructing molecular rovibrational Hamiltonian operators},
year = {2025},
journal = {J. Chem. Phys.},
volume = {163},
pages = {072501},
url = {https://doi.org/10.1063/5.0287347},
DOI = {10.1063/5.0287347},
archiveprefix = {arXiv},
eprint = {2506.20129},
primaryclass = {physics},
url = {https://doi.org/10.48550/arXiv.2506.20129},
}For questions or feedback, feel free to open an issue or reach out to the authors directly via andrey.yachmenev@robochimps.com