cQDyn is a Python package for simulating quantum dynamics using state coefficients and Hamiltonian matrices. The code allows the inclusion of an external field via the interaction Hamiltonian.
The wave function
where
with the Hamiltonian matrix
Hence, the time-independent Hamiltonian
To install the package, clone the repository and run the following command in the terminal in the root directory of the project:
pip install .After that, you can run the code from the command line as
cqdynor import it in your Python scripts.
The input is given in the JSON format in input.json with the following structure
{
"total_time" : 10,
"dt" : 0.001,
"print_time" : 0.5,
"coefficients": ["1+0j", "0+0j"],
"H_0" : [[2.0000, 0.2000], [0.2000, 1.0000]],
"V_int" : [[0.0000, 0.2000],[ 0.2000, 0.0000]],
"field" : "sin(t)"
}
where H_0 is the Hamiltonian without interaction, V_int is the interaction Hamiltonian and field is the interaction field. Note that field is a string with prescription of the time-dependent field where the time is denoted as 't'. coefficients hold the state coefficients at the beginning of the dynamics.
Python arrays in the binary format are saved in the cqdyn.npz file. The file contains the following arrays:
time: time points of the simulationcoefficients: complex coefficients of the wave function at each time pointenergy: energy at each time point Loading the file can be done in Python as
import numpy as np
data = np.load('cqdyn.npz')
time = data['time']
coefficients = data['coefficients']
energy = data['energy']Energies and coefficcients are also save in a human-readable text format in energy.txt and coefficients.txt files.
The cQDyn output from the terminal is saved to cqdyn.out.
@software{cqdyn,
title = {cQDyn: coefficient-based Quantum Dynamics},
author = {Janoš, Jiří},
url = {https://github.com/JanosJiri/cqdyn},
year = {2025},
}