This is a simplest demo of Matrix product state (MPS) based density matrix renormalization group (DMRG) with detailed comments, particularly suitable for new-learners to quickly get the idea of how MPS works at code level. For sophisticated and production-ready MPS packages, I recommend pytenet and quimb.
Density matrix renormalization group (DMRG) is a powerful method to simulate one-dimensional strongly correlated quantum systems. During recent years, combining DMRG with matrix product state (MPS) has allowed further understanding of the DMRG method. SimpleMPS
aims to provide a demo for MPS based DMRG to solve the Heisenberg model. The ground state of the Heisenberg model could be obtained iteratively (see the image below,
The phase transition of transverse field Ising (TFI) model is also provided as a further example (see the image below, 20 sites. Analytical result is based on periodic boundary condition).
The implementation is largely inspired by The density-matrix renormalization group in the age of matrix product states. Understanding the first 6 parts of the article is crucial to understanding the code.
A Julia alternative to the project can be found here.
./SimpleMPS/mps.py
Implements the MPS based DMRG method./SimpleMPS/paulimat.py
Defines the Pauli matrices used in Heiserberg and Ising model./SimpleMPS/heisenberg.py
Defines the hamiltonian and matrix product operator of the Heisenberg model then searches for the ground state./SimpleMPS/ising.py
Defines the hamiltonian and matrix product operator of the transverse field Ising model and then studies the phase diagram and phase transition../SimpleMPS/test_heisenberg.py
Contains a simple test for the programs based on Heisenberg model../Notebook/analyze_ising.ipynb
Analyzes the result calculated by./SimpleMPS/ising.py
-
python heisenberg.py
to see the energy of the system during each iteration. There are 3 parameters hard-coded inheisenberg.py
:-
SITE_NUM
which is the number of sites in the model. -
MAX_BOND_DIMENSION
which is the maximum dimension of the bond degree in matrix product state. The higher bond dimension, the higher accuracy and computational cost. -
ERROR_THRESHOLD
which is the threshold for error when compressing matrix product state by SVD. The lower the threshold, the higher accuracy and computational cost. - One and only one of
MAX_BOND_DIMENSION
orERROR_THRESHOLD
should be provided.
-
-
python ising.py
to see the relation between$M_x$ and$h$ when$J$ is fixed to 1 and$h$ varies from 0 to 2. The parameters inising.py
is the same as those inheisenberg.py
. If you want to calculate the phase diagram, callcalc_phase_diagram
in the file, which typically takes hours. - Modify the codes to explore DMRG and MPS!