ITensor extension

FuzzifiED also supports an ITensor extension, including convertion with the Site and OpSum objects from ITensor library and management of DMRG sweeping process. To use the extension, make sure the packages ITensors, ITensorMPS are properly installed, and include

using ITensors, ITensorMPS

at the heading of the Julia script.

During intialisation, the optimal configuration for parallelisation is already automatically set.

BLAS.set_num_threads(1);
NDTensors.Strided.disable_threads();
ITensors.enable_threaded_blocksparse();

Format conversion

FuzzyfiED defines a new SityType "FuzzyFermion" that can be initialised from QNDiags to avoid overwriting the original "Fermion" type.

ITensors.spaceMethod
ITensors.space( :: SiteType"FuzzyFermion" ; o :: Int, qnd :: Vector{QNDiag})

Define a new site type "FuzzyFermion" which inherits all the features of ITensor type "Fermion". It can be initialised by a set of QNDiag's and the site index $o$.

source

The Sites objects in ITensor can be converted to a QNDiags and Confs with the QNs extracted.

Base.VectorMethod
Vector{QNDiag}(sites :: Vector{<:Index})

Converts a Sites object in the ITensors package to a set of QNDiags.

Arguments

  • sites :: Vector{<:Index} is a Sites object. Only Fermion site type is supported, and the quantum numbers of the 0 state must be all zero. Note that this will subject to the limitation in ITensors that the number of conserved quantities must be less than 4.
source
FuzzifiED.ConfsMethod
Confs(sites :: Vector{<:Index}, sec_qn :: QN)
Confs(sites :: Vector{<:Index}, cf_ref :: Vector{Int64})

Converts a Sites object in the ITensors package to the Confs object

Arguments

  • sites :: Vector{<:Index} is a Sites object. Only Fermion site type is supported, and the quantum numbers of the 0 state must be all zero. Note that this will subject to the limitation in ITensors that the number of conserved quantities must be less than 4.
  • sec_qn :: QN is a QN object that specifies the the quantum number of the selected configuration. Alternatively, cf_ref :: Vector{Int64}) is a reference configuration composed of 0 and 1.
source

Conversely, the Sites objects in ITensors can also be generated from a set of diagonal quantum numbers

FuzzifiED.GetSitesMethod
GetSites(qnd :: Vector{QNDiag}) :: Vector{<:Index}

returns the ITensors Sites of type "FuzzyFermion" from a set of QNDiags.

source

If the number of quantum numbers are too many, it can be truncated by

FuzzifiED.TruncateQNDiagMethod
TruncateQNDiag(qnd :: Vector{QNDiag} ; trunc_lth :: Int64, trunc_wt :: Vector{Int64}) :: Vector{QNDiag}

truncates the list of $N_U$ QNDiags from to a number $N'_U$ acceptable by ITensors. The new quantum numbers are

\[\begin{aligned} &Q'_1=Q_1,\ Q'_2=Q_2,\ …,\ Q'_{N'_U-1}=Q_{N'_U-1}\\ &Q'_{N'_U}=λ_{N'_U}Q_{N'_U}+λ_{N'_U+1}Q_{N'_U+1}+…+λ_{N_U}Q_{N_U} \end{aligned}\]

Arguments

  • qnd :: Vector{QNDiag} stores the set of QNDiags.
  • trunc_lth :: Int64 stores the truncated numbers of QNDiags. Facultative, 3 by default.
  • trunc_wt :: Vecotr{Int64} stores the $N_U-N'_U+1$ coefficients $λ$. Facultative, $1,10,100,1000,…$ by default.
source

The OpSum objects in ITensor can be converted with the collection of Term's

FuzzifiED.TermsMethod
Terms(opsum :: OpSum)

Converts a OpSum object in ITensors to a series of terms. Note that the only operators supported are "C", "Cdag" "N" and "I".

source

Easy sweep

This tool kit facilitates the management of DMRG process. It automatically records the intermediate results and recover these results if a job is stopped and run again on HPC. It also manages the gradual increase of maximal bond dimensions and the determination of convergence by the criteria of energy. This extension required the packages HDF5. We also recommand using the package ITensorMPOConstruction for the generation of Hamiltonian MPO, which can be installed by

using Pkg ; Pkg.add(url="https://github.com/ITensor/ITensorMPOConstruction.jl.git")
FuzzifiED.EasySweepMethod
EasySweep(id :: String, hmt :: MPO, st00 :: MPS ; path :: String, dim_list :: Vector{Int64}, proj :: Vector{String}, e_tol1 :: Float64, e_tol :: Float64, cutoff :: Vector{Float64}, maxdim0 :: Vector{Float64}, noise0 :: Vector{Float64}, noise :: Vector{Int64}, nsweeps :: Int64, weight :: Float64, observer :: AbstractObserver) :: Tuple{Float64, MPS}

Function

This function automatically performs several rounds of DMRG sweeps with increasing bond dimensions. It first checks the file st_$(id).h5 in a specified repository. If the key st_fin exists, it reads the energy and MPS from the file and return the energy and MPS, otherwise it will perform the DMRG process. For each round, it will try to access the results from the key st_d$(dim_i) in st_$(id).h5, where dim_i is either 0 representing the initial round, or an element of array dim_list. If the key exist, it will read the result ; otherwise it will perform the sweeps using SweepOne. For the initial round, it will take the initial state from st00, the maximal bond dimensions from maxdim0, noise from noise0 and record the results in the key E_d0 and st_d0 in st_$(id).h5. For each of the following round, it will take the result from the previous round as the initial state and perform nsweeps sweeps with the bond dimension dim_list[i]. Each round will be stopped if the energy difference is less than e_tol1. The entire process will be stopped if the energy difference between two rounds is less than e_tol or the bond dimension of the result is less than 0.9 times the maximal bond dimension. The projected states will be accessed from the files specified by proj. It will try to access first the states with the same bond dimension as the projected states. If such states do not exist, it will then access the final state. The resulting energy will be written into the key E_fin in the file st_$(id).h5, and the MPS written into st_fin. The function returns a tuple of energy and the final MPS.

Arguments

  • id :: String is a string identifying the file to which the results will be accessed and written.
  • hmt :: MPO is an MPO specifying the Hamiltonian.
  • st00 :: MPS is an MPS specifying the initial state.
  • path :: String identifies the path where the results will be accessed and stored. Facultative, ./ by default.
  • dim_list :: Vector{Int64} :: Int64 is a list that specifies the maximal bond dimensions of each round of sweeps starting from the second round. Facultative, [1000,2000,3000,4000,5000,6000] by default
  • proj :: Vector{String} specifies the name of the states that will be projected. Facultative, empty by default.
  • e_tol1 :: Float64 specifies the energy tolerence as a criteria to end the round of sweeps for each round of sweeps. Facultative, 1E-6 by default.
  • e_tol :: Float64 specifies the energy tolerence as a criteria to end the entire process. Facultative, 1E-7 by default.
  • cutoff :: Vector{Float64} is the cutoff that will be sent into DMRG. Facultative, [1.E-9] by default.
  • maxdim0 :: Vector{Int64} specifies the maximal bond dimensions of the first round of sweeps. Facultative, [10,20,50,100,200,500] by default.
  • noise0 :: Vector{Float64} specifies the noise of each sweep in the initial round and will be sent into DMRG. Facultative, [1E-4,3E-5,1E-5,3E-6,1E-6,3E-7] by default.
  • noise :: Vector{Float64} specifies the noise of each sweep from the second round and will be sent into DMRG. Facultative, [1E-6,1E-7,0] by default.
  • nsweeps :: Int64 specifies the number of sweeps in each round from the second rounds. Facultative, 10 by default.
  • weight :: Float64 specifies the weight of projected states and will be sent into DMRG. Facultative, 100.0 by default.
  • observer :: AbstractObserver specifies the measurement and cutoff condition for each sweep starting from the second round. Facultative, by default the observer will print the energy and cutoff once the energy difference is less than e_tol at each sweep.
  • dmrg_options :: Dict specifies other options to be sent into DMRG. E.g., to specify write_when_maxdim_exceeds = 1000 and write_path = "./tmp/", one can put dmrg_options = Dict(:write_when_maxdim_exceeds => 1000, :write_path => "./tmp/").
  • clear_previous :: Bool. If set true, the file st_$(id).h5 will be removed and the calculation will start from scratch. Facultative, false by default.
source
FuzzifiED.SweepOneMethod
SweepOne(id :: String, hmt :: MPO, st0 :: MPS, dim1 :: Int64 ; path :: String, cutoff :: Vector{Float64}, maxdim :: Vector{Int64}, nsweeps :: Int64, noise :: Vector{Float64}, proj :: Vector{String}, e_tol :: Float64, weight :: Float64, observer :: AbstractObserver, dmrg_options :: Dict, dmrg_options :: Dict) :: Tuple{Float64, MPS}

Function

This function performs one round of nsweeps sweeps. It first checks the file st_$(id).h5 in a specified repository. If the key st_d$(dim1) exists, it reads the energy and MPS from the file and return the energy and MPS, otherwise it will perform the DMRG process with the maximal bond dimension specified by maxdim if it exists, or dim1. The projected states will be read from the key st_d$(dim1) if it exists or st_fin in the file st_$(fi).h5 in the same repository for each string fi in the array proj. The sweeps will be ended if the energy difference is less than etol or whatever criteria is given in observer. The resulting energy will be written into the key E_d$(dim1) in the file st_$(id).h5, and the MPS written into st_d$(dim1). The function returns a tuple of energy and the final MPS.

Arguments

  • id :: String is a string identifying the file to which the results will be accessed and written.
  • hmt :: MPO is an MPO specifying the Hamiltonian.
  • st0 :: MPS is an MPS specifying the initial state.
  • dim1 :: Int64 is a bond dimension that will be used to identify the result.
  • path :: String identifies the path where the results will be accessed and stored. Facultative, ./ by default.
  • cutoff :: Vector{Float64} is the cutoff that will be sent into DMRG. Facultative, [1.E-9] by default.
  • maxdim :: Vector{Int64} specifies the maximal bond dimension of each sweep. Facultative, [dim1] by default.
  • nsweeps :: Int64 specifies the number of sweeps in the round. Facultative, 10 by default.
  • noise :: Vector{Float64} specifies the noise of each sweep and will be sent into DMRG. Facultative, [1E-6,1E-7,0] by default.
  • proj :: Vector{String} specifies the name of the states that will be projected. Facultative, empty by default.
  • e_tol :: Float64 specifies the energy tolerence as a criteria to end the sweeps. Facultative, 1E-6 by default.
  • weight :: Float64 specifies the weight of projected states and will be sent into DMRG. Facultative, 100.0 by default.
  • observer :: AbstractObserver specifies the measurement and cutoff condition for each sweep. Facultative, by default the observer will print the energy and cutoff once the energy difference is less than e_tol at each sweep.
  • dmrg_options :: Dict specifies other options to be sent into DMRG. E.g., to specify write_when_maxdim_exceeds = 1000 and write_path = "./tmp/", one can put dmrg_options = Dict(:write_when_maxdim_exceeds => 1000, :write_path => "./tmp/").
source
FuzzifiED.GetMPOSitesMethod
GetMPOSites(id :: String, tms, qnd :: Vector{QNDiag} ; path :: String, qnu_o :: Vector{Vector{Int64}}, qnu_name :: Vector{String}, modul :: Vector{Int64}, mpo_method :: Function) :: Tuple{MPO, Vector{<:Index}}

Function

This function returns the MPO and sites for a given operator and a Hilbert space with given quantum numbers. It first checks the file op_$(id).h5 in a specified repository. If the file exists, it will try to read the fields mpo and sites and return the MPO and Sites. Otherwise it will first generates the sites with the quantum numbers given in qnu_o, qnu_name and modul (these objects are often results of a function named Get*Qnu). Then it will generate the MPO with the terms of the operator given in tms. The MPO and sites will be written into the file op_$(id).h5 in the fields mpo and sites.

Arguments

  • id :: String is a string identifying the file to which the results will be accessed and written.
  • tms :: Terms or tms :: OpSum is either an array of terms or a OpSum objects that specifies the expression of the operator.
  • qnd :: Vector{QNDiag} is a list of diagonal quantum numbers.
  • path :: String identifies the path where the results will be accessed and stored. Facultative, ./ by default.
  • mpo_method :: Function is a function mpo_method(os :: OpSum, sites :: Sites) :: MPO that generates the MPO from OpSum and Sites. Facultative, MPO by default. We suggest using MPO_new in ITensorMPOConstruction package. See example_ising_dmrg_easysweep.jl for example. N.b., MPO_new only applies to the cases that the operator do not carry charge under any of the quantum numbers.
  • clear_previous :: Bool. If set true, the file op_$(id).h5 will be removed and the calculation will start from scratch. Facultative, false by default.
source
FuzzifiED.GetMPOMethod
GetMPO(id :: String, tms :: Union{Terms, OpSum}, sites :: Vector{<:Index} ; path :: String, mpo_method :: Function) :: MPO

Function

This function returns the MPO for a given operator and a given set of sites. It first checks the file op_$(id).h5 in a specified repository. If the file exists, it will try to read the fields mpo and return the MPO it has read. Otherwise it will generate the MPO with the terms of the operator given in tms. The MPO and Sites will be written into the file op_$(id).h5 in the fields mpo.

Arguments

  • id :: String is a string identifying the file to which the results will be accessed and written.
  • tms :: Terms or tms :: OpSum is either an array of terms or a OpSum objects that specifies the expression of the operator.
  • sites :: Vector{<:Index} specifies the sites that the operator is acting on.
  • path :: String identifies the path where the results will be accessed and stored. Facultative, ./ by default.
  • mpo_method :: Function is a function mpo_method(os :: OpSum, sites :: Sites) :: MPO that generates the MPO from OpSum and Sites. Facultative, MPO by default. We suggest using MPO_new in ITensorMPOConstruction package. See example_ising_dmrg_easysweep.jl for example. N.b., MPO_new only applies to the cases that the operator do not carry charge under any of the quantum numbers.
  • clear_previous :: Bool. If set true, the file op_$(id).h5 will be removed and the calculation will start from scratch. Facultative, false by default.
source

Modified version of ITensor

We have forked ITensors and made some modifications to better suit our need. To install the modified packages, please use

using Pkg 
Pkg.add(url="https://github.com/FuzzifiED/ITensors.jl.git")
Pkg.add(url="https://github.com/FuzzifiED/ITensorMPS.jl.git")
Pkg.add(url="https://github.com/FuzzifiED/ITensorMPOConstruction.jl.git")

The modifications made include

  • Modify ITensors to allow up to 10 quantum numbers ;
  • Modify ITensorMPS to allow write_when_maxdim_exceeds in DMRG in the presence of projection matrices ;
  • Modify ITensorMPOConstruction to allow building MPOs that has symmetry flux ;
  • Modify ITensorMPOConstruction to allow compatibility with the newest version of ITensors.

Please be warned that the robustness and the backward compatibility of these modifications are not warranted.