We present qdmag, a computational utility for calculating the magnetization of magnetic molecules in a time-varying external magnetic field by solving a generalized Lindblad quantum master equation with spin-phonon coupling treated as a dissipation te
We present qdmag, a computational utility for calculating the magnetization of magnetic molecules in a time-varying external magnetic field by solving a generalized Lindblad quantum master equation with spin-phonon coupling treated as a dissipation term. The package relies on the spin Hamiltonian formalism, which includes both the magnetic exchange interactions and the zero-field splitting (ZFS) interaction. Different types of magnetic exchange interaction and ZFS terms up to 12th order, which are written in terms of the extended Stevens operators, are supported. qdmag enables long-time evolution of magnetization for up to a few milliseconds, which is achieved through a staircase approximation of the magnetic field as a function of time. For high-dimensional spin Hamiltonians, a lower-dimensional effective Hamiltonian is constructed to make the calculations computationally feasible. Three case studies of one-spin, two-spin, and three-spin systems are presented to demonstrate the usage of qdmag. Our work offers a computational tool to bridge the gap between theoretical development and numerical calculations of spin dynamics in the presence of spin-phonon coupling.