Simulating dynamics of simple systems with interacting spin-zero particles in an exact basis. The basis is specified via a set of single-particle states (e.g. tight-binding model of lattice orbitals and interorbital connections) and the considered number of bosons. The codes allow simulating both closed dynamics (bose_hubbard_ed_closed.py
) and open dynamics with sources and sinks for particles (bose_hubbard_ed_open.py
). Also, the mean-field, that is, classical apporoximation can be considered (bose_hubbard_classical.py
) where in the Heisenberg equation of motion, the creation and annihilation operators are replaced by their mean values, that is, a classical number.
The Hilbert space basis is handled using QuSpin.
The codes were used to produce the numerical simulations and visualisations of Pyykkönen et al. All-optical switching at the two-photon limit with interference-localized states, Phys. Rev. Research 5, 043259, (2023).
The given analyses are thus made for the paper.
- Install QuSpin following the instructions in https://quspin.github.io/QuSpin/Installation.html
- If h5py, the Python interface for hdf5, is not installed (you can check by running
python -c "import h5py"
on command line), install it e.g. via Anaconda by runningconda install h5py
. - If you installed QuSpin through Anaconda, initialize the environment with
conda init
(if not already initialized).
The full exact diagonalization codes are divided in two phases: 1) Generating data, 2) Analyzing data.
The generation occurs via the Python scripts bose_hubbard_ed_closed.py
,bose_hubbard_ed_open.py
, which runs simulation on a single parameter set and saves the results in an hdf5 file. The scripts can be run either with command line parameters (as defined in them), or one can change the parameters in the files and run without the command line parameters. Analysis occurs with scripts contained in the folder Analysis
, where template analyses are given. Presently, there are analyses for single simulations: analyze_single_closed.py
and analyze_single_open.py
, which are run e.g. python analyze_single_closed.py path_to_data_file.h5
. There are also two example scripts for analyzing sets of simulations, where specific parameters are varied: analyze_dataset_closed.py
and analyze_dataset_open.py
, which are run as e.g. python analyze_dataset_eg.py path_to_data_folder
.
At the moment, the mean-field simulation and the respective analysis are done in the same Python script bose_hubbard_classical.py
.
In the analysis, the dynamics of the systems are simulated from a given initial state until a final time. The structure of the simulations are:
- Define system parameters and simulations times
Nb
(closed),Nb_max
(open) = initial number of bosonsU
= on-site interaction strengthgammaL1
,gammaL2
,gammaR1
,gammaR2
=losses and gains at left and right edge sites of the system (open)start, stop, num
= start and stop times of the simulation and number of time points
- Define system Hamiltonian and the initial state. For each model one defines a lattice by entering an
if 'lattice_name' = model_name:
block that compiles the single-particle and interaction Hamiltonians and defines the initial states in internalif 'init_state' = state_name:
blocks. - System assembly and time-evolution from the initial state is perfomed via QuSpin.
- Results are saved into a hdf5 file named as specified in the code as
<name>_<closed/open>_<init_type>_Nb<Nb>_U<U>
, where<...>
represent instered string or value andname
is specified in the definition block of the model. The saved parameters are- For closed simulation: lattice name
lattice_name
, initial state typeinit_type
, interaction strengthU
, model specific parameters, Hamiltonian eigenvalues and real and imaginary parts of eigenvectorseigenvalues
,eigenvectors_r
,eigenvectors_i
, real and imaginary parts of overlaps between eigenvectors and initial stateoverlaps_r
andoverlaps_i
, number of sitesn_sites
, number of particlesNb
, considered time instancests
, real and imaginary parts of state vectors at each timepsi_t_r
andpsi_t_i
, particle number at each site at each timens_t
, basis state integer, index and label representationsstate_ints
,state_idxs
,state_labels
. - For open simulation: lattice name
lattice_name
, initial state typeinit_type
, interaction strengthU
, model specific parameters, stateoverlaps_r
andoverlaps_i
, number of sitesn_sites
, number of particlesNb
, considered time instancests
, real and imaginary parts of state vectors at each timepsi_t_r
andpsi_t_i
, particle number at each site at each timens_t
, basis state integer, index and label representationsstate_ints
,state_idxs
,state_labels
.
- For closed simulation: lattice name