Core functions

Environment parameters

The following environment parameters defines how FuzzifiED works, viz. whether it outputs logs, how many threads it uses and where it reads its libraries. In general, you can keep it at default.

Main.FuzzifiED.SilentStdConstant
SilentStd :: Bool = false

a flag to determine whether logs of the FuzzifiED functions should be turned off. False by default. If you want to evaluate without log, put FuzzifiED.SilentStd = true. This parameter can be defined for each process separately.

source
Main.FuzzifiED.NumThreadsConstant
NumThreads :: Int = Threads.nthreads()

an integer to define how many threads OpenMP uses. By default, it is the same as the number of threads in Julia. If you use Jupyter notebooks, which by default uses one core only, you may need to define this by hand, e.g., FuzzifiED.NumThreads = 8. This parameter can be defined for each process separately.

source
Main.FuzzifiED.LibpathConstant
Libpath :: String = FuzzifiED_jll.LibpathFuzzifiED

define where the Fortran library are compiled. You do not need to modify that by yourself. However, if you compile the Fortran codes by yourself, you need to point this to your compiled library.

source
Main.FuzzifiED.ElementTypeType
ElementType :: DataType = ComplexF64

set the default type of the operator elements, either ComplexF64 or Float64. ComplexF64 by default.

source

Quantum numbers

FuzzifiED implements diagonal and off-diagonal quantum numbers. They are defined as

Main.FuzzifiED.QNDiagType
mutable struct QNDiag

records the information of a diagonal $\mathrm{U}(1)$ or $ℤ_p$ quantum number in the form of a symmetry charge

\[Q=∑_{o=1}^{N_o}q_on_o\]

or

\[Q=∑_{o=1}^{N_o}q_on_o\ \mathrm{mod}\ p\]

where $i=1,…,N_U$ is the index of quantum number, $o$ is the index of orbital, $n_o=c^†_oc_o$, and $q_o$ is a set of coefficients that must be integer valued.

Fields

  • name :: String is the name of the diagonal quantum number
  • charge :: Vector{Int64} is the symmetry charge $q_o$ of each orbital
  • modul :: Vector{Int64} is the modulus $p$, set to 1 for $\mathrm{U}(1)$ QNDiags.

Initialisation

It can be initialised by the following method

QNDiag([name :: String, ]charge :: Vector{Int64}[, modul :: Int64]) :: QNDiag

The arguments name and modul is facultative. By default name is set to "QN" and modul is set to 1.

source
Main.FuzzifiED.QNOffdType
mutable struct QNOffd

records the information of an off-diagonal $ℤ_p$ quantum number in the form of a discrete transformation

\[𝒵:\ c_o↦ α_o^* c^{(p_o)}_{π_o},  c_o^†↦ α_o c^{(1-p_o)}_{π_o}\]

where we use a notation $c^{(1)}=c^†$ and $c^{0}=c$ for convenience, $π_o$ is a permutation of $1,…,N_o$, $α_o$ is a coefficient, and $p_o$ specified whether or not particle-hole transformation is performed for the orbital. Note that one must guarentee that all these transformations commute with each other and also commute with the diagonal QNs.

Arguments

  • perm :: Vector{Int64} is a length-$N_o$ vector that records the permutation $π_o$.
  • ph :: Vector{Int64} is a length-$N_o$ vector that records $p_o$ to determine whether or not to perform a particle-hole transformation
  • fac :: Vector{ComplexF64} is a length-$N_o$ vector that records the factor $α_o$ in the transformation.
  • cyc :: Int64 is the cycle $p$.

Initialisation

It can be initialised by the following method

QNOffd(perm :: Vector{Int64}[, ph :: Vector{Int64}][, fac :: Vector{ComplexF64}][, cyc :: Int64]) :: QNOffd
QNOffd(perm :: Vector{Int64}, ph_q :: Bool[, fac :: Vector{ComplexF64}]) :: QNOffd

The arguments ph, fac and cyc are facultative. By default ph is set all 0, fac is set to all 1 and cyc is set to 2. If ph_q is a bool and true, then ph is set to all 1.

source

The QNDiag can be added or multiplied by a number

Base.:+Method
function +(qnd1 :: QNDiag, qnd2 :: QNDiag) :: QNDiag 
function -(qnd1 :: QNDiag, qnd2 :: QNDiag) :: QNDiag

returns the sum or substraction of two QNDiags, whose name is the samea as qnd1, charge is the same as qnd1 ± qnd2, and modulus is the GCD of qnd1 and qnd2. If qnd1 and qnd2 are both $ℤ_p$ quantum numbers and their modulus are coprime, a trivial QNDiag will be returned.

source
Base.:*Method
function *(fac :: Int64, qnd :: QNDiag) :: QNDiag 
function *(qnd :: QNDiag, fac :: Int64) :: QNDiag 
function ÷(qnd :: QNDiag, fac :: Int64) :: QNDiag 
function -(qnd :: QNDiag) :: QNDiag

returns the QNDiag multiplied or divided by an integer factor, where the charge is multiplied or integer-divided by the factor. For $ℤ_p$ quantum numbers, their modulus will be multiplied or integer-divided by the absolute value. If qnd.modul ÷ abs(fac) ≤ 1, a trivial QNDiag will be returned.

source

The QNOffd can be composed

Base.:*Method
function *(qnf1 :: QNOffd, qnf2 :: QNOffd) :: QNOffd

returns the composition of two QNOffd transformations. The cycle is set to be the LCM of two QNOffds

source

Configurations

Main.FuzzifiED.ConfsType
mutable struct Confs

This type stores all the configurations that respects the diagonal quantum numbers (QNDiag) and also a table to inversely look up the index from the configuration.

Fields

  • no :: Int64 is the number of orbital*flavour.
  • ncf :: Int64 is the number of configurations.
  • conf :: Vector{Int64} is an array of length ncf containing all the configurations. Each configuration is expressed in a binary number. If the o-1-th bit of conf[i] is 1, then the o-th orbital in the i-th configuration is occupied ; if the bit is 0, then the orbital is empty.
  • nor :: Int64, lid :: Vector{Int64} and rid :: Vector{Int64} contain the information of Lin table that is used to inversely look up the index i from the configuration.
source

It can be generated from the QNDiags.

Main.FuzzifiED.ConfsMethod
function Confs(no :: Int64, secd :: Vector{Int64}, qnd :: Vector{QNDiag} ; nor :: Int64 = div(no, 2), modul :: Vector{Int64}, num_th :: Int64, disp_std :: Bool) :: Confs

generates the configurations from the list of QNDiags.

Arguments

  • no :: Int64 is the number of orbital*flavour $N_o$.
  • secd :: Vector{Int64} is the set of $Q_i$ for the selected configurations in the sector.
  • qnd :: Vector{QNDiag} is the set of QNDiags.
  • nor :: Int64 is the number of less significant bits used to generate the Lin table. Facultative, $N_o/2$ by default.
  • num_th :: Int64, the number of threads. Facultative, NumThreads by default.
  • disp_std :: Bool, whether or not the log shall be displayed. Facultative, !SilentStd by default.

Output

  • cfs :: Confs is a Confs object.

Note

If your qnd has negative entries, QNDiags must contain the number of electrons.

source

The inverse look-back for a configuration can be done by

Main.FuzzifiED.GetConfIdMethod
GetConfId(cfs :: Confs, cf :: Int64) :: Int64

inversely look up the index from the configuration

Arguments

  • cfs :: Confs stores the configurations.
  • cf :: Int64 stores the configuration to be looked-up expressed in a binary number. If the o-1-th bit of conf[i] is 1, then the o-th orbital in the i-th configuration is occupied ; if the bit is 0, then the orbital is empty.

Output

  • id :: Int64 is the id of the configuration such that cfs.conf[id] == cf
source

Basis

Main.FuzzifiED.BasisType
mutable struct Basis

This type stores the information of the basis that respects both diagonal and off-diagonal quantum numbers. The states in the basis is in the form

\[|I⟩=λ_{i_{I1}}|i_{I1}⟩+λ_{i_{I2}}|i_{I2}⟩+⋯+λ_{i_{Im_I}}|i_{Im_I}⟩\]

where $|i⟩$ is a direct product state, i.e., the configurations $|i_{Ik}⟩$ are grouped into a state $|I⟩$.

Fields

  • cfs :: Confs stores the configurations that respect the QNDiags ;
  • dim :: Int64 is the dimension of the basis ;
  • szz :: Int64 records the maximum size $\max m_g$ of groups;
  • cfgr :: Vector{Int64} is a vector of length cfs.ncf and records which group $|I⟩$ each configuration $|i⟩$ belong to ;
  • cffac :: Vector{ComplexF64} is a vector of length cfs.ncf and records the coefficients $λ_i$ of each configuration ;
  • grel :: Matrix{Int64} is a szz*dim matrix that records the configurations in each group $|i_{Ik}⟩ (k = 1,…,m_I)$
  • grsz :: Vector{Int64} is a vector of length dim that records the size $m_I$ of each group.
source

It can be generated by the following methods.

Main.FuzzifiED.BasisMethod
function Basis(cfs :: Confs, secf :: Vector{ComplexF64}, qnf :: Vector{QNOffd} ; num_th :: Int64, disp_std :: Bool) :: Basis

generates the basis that respects the off-diagonal $ℤ_p$ quantum numbers (QNOffd)

Arguments

  • cfs :: Confs is the diagonal QN–preserving configurations ;
  • secf :: Vector{ComplexF64} is a vector of length the same as the number of discrete symmetries that records the eigenvalue of each transformation in the sector ;
  • qnf :: Vector{QNOffd} is a vector of off-diagonal quantum numbers.
  • num_th :: Int64, the number of threads. Facultative, NumThreads by default.
  • disp_std :: Bool, whether or not the log shall be displayed. Facultative, !SilentStd by default.

Output

  • bs :: Basis is the resulting Basis object
source
Main.FuzzifiED.BasisMethod
function Basis(cfs :: Confs) :: Basis

Generate a basis from the configurations without off-diagonal $ℤ_n$ symmetries.

Arguments

  • cfs :: Confs is the diagonal QN–preserving configurations ;

Output

  • bs :: Basis is the resulting Basis object
source

The look-back of the weight of a configuration in a state can be done by

Main.FuzzifiED.GetConfWeightMethod
GetConfWeight(bs :: Basis, st :: Vector{<:Number}, cf :: Int64) :: ComplexF64

looks up a the weight of a configuration in a state.

Arguments

  • bs :: Basis is the basis of the state ;
  • st :: Vector{ComplexF64} or st :: Vector{Float64} is a vector of length bs.dim that stores the state ;
  • cf :: Int64 stores the configuration to be looked-up expressed in a binary number. If the o-1-th bit of conf[i] is 1, then the o-th orbital in the i-th configuration is occupied ; if the bit is 0, then the orbital is empty.

Output

  • The weight of the configuration in the state
source

Term

Main.FuzzifiED.TermType
mutable struct Term

A Term object records a term that looks like $Uc^{(p_1)}_{o_1}c^{(p_2)}_{o_2}… c^{(p_l)}_{o_l}$ in an operator

Fields

  • coeff :: ComplexF64 records the coefficient $U$
  • cstr :: Vector{Int64} is a length-$2l$ vector $(p_1,o_1,p_2,o_2,… p_l,o_l)$ recording the operator string

Method

It can be generated by the function

function Term(coeff :: ComplexF64, cstr :: Vector{Int64}) :: ComplexF64
source

The product of terms with a number, the sum and product of terms, adjoint and particle-hole transformation are defined

Base.:*Method
function *(fac :: Number, tms :: Vector{Term}) :: Vector{Term}
function -(tms :: Vector{Term}) :: Vector{Term}
function *(tms :: Vector{Term}, fac :: Number) :: Vector{Term}
function /(tms :: Vector{Term}, fac :: Number) :: Vector{Term}

Return the product of a collection of terms with a number.

source
Base.:+Method
function +(tms1 :: Vector{Term}, tms2 :: Vector{Term}) :: Vector{Term}
function -(tms1 :: Vector{Term}, tms2 :: Vector{Term}) :: Vector{Term}

Return the naive sum of two series of terms by taking their union.

source
Base.:*Method
function *(tms1 :: Vector{Term}, tms2 :: Vector{Term}) :: Vector{Term}
function ^(tms :: Vector{Term}, pow :: Int64) :: Vector{Term}

Return the naive product of two series of terms or the power of one terms. The number of terms equals the product of the number of terms in tms1 and tms2. For each term in tms1 $Uc^{(p_1)}_{o_1}…$ and tms2 $U'c^{(p'_1)}_{o'_1}…$, a new term is formed by taking $UU'c^{(p_1)}_{o_1}… c^{(p'_1)}_{o'_1}…$

source
Base.adjointMethod
function adjoint(tm :: Term) :: Term
function adjoint(tms :: Vector{Term}) :: Vector{Term}

Return the Hermitian conjugate of a series of terms. For each term $Uc^{(p_1)}_{o_1}c^{(p_2)}_{o_2}… c^{(p_l)}_{o_l}$, the adjoint is $\bar{U}c^{(1-p_l)}_{o_l}… c^{(1-p_2)}_{o_2}c^{(1-p_1)}_{o_1}$

source
Main.FuzzifiED.ParticleHoleMethod
function ParticleHole(tm :: Term) :: Term
function ParticleHole(tms :: Vector{Term}) :: Vector{Term}

Return the particle-hole transformation of a series of terms. For each term $Uc^{(p_1)}_{o_1}c^{(p_2)}_{o_2}… c^{(p_l)}_{o_l}$, the transformation results in $Uc^{(1-p_1)}_{o_1}c^{(1-p_2)}_{o_2}…c^{(1-p_l)}_{o_l}$

source

The terms can be simplified by

Main.FuzzifiED.NormalOrderMethod
function NormalOrder(tm :: Term) :: Vector{Term}

rearrange a term such that

  • the creation operators must be commuted in front of the annihilation operator
  • the orbital index of the creation operators are in ascending order and the annihilation operators in descending order.

return a list of terms whose result is equal to the original term.

source
Main.FuzzifiED.SimplifyTermsMethod
function SimplifyTerms(tms :: Vector{Term} ; cutoff :: Float64 = eps(Float64)) :: Vector{Term}

simplifies the sum of terms such that

  • each term is normal ordered,
  • like terms are combined, and terms with zero coefficients are removed.

Argument

  • cutoff :: Float64 is the cutoff such that terms with smaller absolute value of coefficients will be neglected. Facultative, eps(Float64) by default.
source

Operator

Main.FuzzifiED.OperatorType
mutable struct Operator

An Operator object records the sum of terms together with information about its symmetry and the basis of the state it acts on and the basis of the resulting state.

Fields

  • bsd :: Basis is the basis of the initial state ;
  • bsf :: Basis is the basis of the final state ;
  • red_q :: Int64 is a flag that records whether or not the conversion to a sparse martrix can be simplified : if bsd and bsf have exactly the same set of quantum numbers, and the operator fully respects the symmetries, and all the elements in bsd.cffac and bsf.cffac has the same absolute value, then red_q = 1 ; otherwise red_q = 0 ;
  • sym_q :: Int64 records the symmetry of the operator : if the matrix is Hermitian, then sym_q = 1 ; if it is symmetric, then sym_q = 2 ; otherwise sym_q = 0 ;
  • ntm :: Int64 is the number of terms ;
  • nc :: Int64 is the maximum number of operators in an operator string
  • cstrs :: Matrix{Int64} is a matrix recording the operator string of each term. Each column corresponds to a term and is padded to the maximum length with -1's.
  • coeffs :: Vector{ComplexF64} corresponds to the coefficients in each term.
source

It can be generated by the following methods.

Main.FuzzifiED.OperatorMethod
function Operator(bsd :: Basis[, bsf :: Basis], terms :: Vector{Term} ; red_q :: Int64, sym_q :: Int64, num_th :: Int64, disp_std :: Bool) :: Operator

generates an operator object from a series of terms.

Arguments

  • bsd :: Basis is the basis of the initial state ;
  • bsf :: Basis is the basis of the final state. Facultative, the same as bsd by default.
  • terms :: Vector{Term} records the terms ;
  • red_q :: Int64 is a flag that records whether or not the conversion to a sparse martrix can be simplified : if bsd and bsf have exactly the same set of quantum numbers, and the operator fully respects the symmetries, and all the elements in bsd.cffac and bsf.cffac has the same absolute value, then red_q = 1 ; otherwise red_q = 0 ; Facultative, if bsf is not given, 1 by default, otherwise 0 by default.
  • sym_q :: Int64 records the symmetry of the operator : if the matrix is Hermitian, then sym_q = 1 ; if it is symmetric, then sym_q = 2 ; otherwise sym_q = 0. Facultative, if bsf is not given, 1 by default, otherwise 0 by default.
  • num_th :: Int64, the number of threads. Facultative, NumThreads by default.
  • disp_std :: Bool, whether or not the log shall be displayed. Facultative, !SilentStd by default.
source

The product of an operator on a state and the inner product of a final state, an operator and an initial state can be calculated by

Base.:*Method
function *(op :: Operator, st_d :: Vector{ComplexF64} ; num_th :: Int64, disp_std :: Bool) :: Vector{ComplexF64}
function *(op :: Operator, st_d :: Vector{Float64} ; num_th :: Int64, disp_std :: Bool) :: Vector{Float64}

Measure the action of an operator on a state. st_d must be of length op.bsd.dim. Returns a vector of length op.bsf.dim that represents the final state.

Facultative arguments

  • num_th :: Int64, the number of threads. Facultative, NumThreads by default.
  • disp_std :: Bool, whether or not the log shall be displayed. Facultative, !SilentStd by default.
source
Base.:*Method
function *(st_fp :: LinearAlgebra.Adjoint{ComplexF64, Vector{ComplexF64}}, op :: Operator, st_d :: Vector{ComplexF64} ; num_th :: Int64, disp_std :: Bool) :: ComplexF64
function *(st_fp :: LinearAlgebra.Adjoint{Float64, Vector{Float64}}, op :: Operator, st_d :: Vector{Float64} ; num_th :: Int64, disp_std :: Bool) :: Float64

Measuring the inner product between two states and an operator. st_d must be of length op.bsd.dim and st_fp must be of length op.bsf.dim, and st_fp must be an adjoint.

Facultative arguments

  • num_th :: Int64, the number of threads. Facultative, NumThreads by default.
  • disp_std :: Bool, whether or not the log shall be displayed. Facultative, !SilentStd by default.
source

Sparse matrix

Main.FuzzifiED.OpMatType
mutable struct OpMat{ComplexF64}
mutable struct OpMat{Float64}

This type stores a sparse matrix in the same form as SparseMatrixCSC in SparseArrays. If the matrix is Hermitian or symmetric, only the lower triangle is stored.

Fields

  • dimd :: Int64 and dimf :: Int64 are the number of columns and rows of the matrix ;
  • symq :: Int64 records whether or not the matrix is Hermitian or symmetric ;
  • nel :: Int64 records the number of elements ;
  • colptr :: Vector{Int64}, rowid :: Vector{Int64} and elval :: Vector{ComplexF64} records the elements of the sparse matrix as in the SparseMatrixCSC elements of Julia.
source

It can be generated by the following methods.

Main.FuzzifiED.OpMatMethod
function OpMat[{type}](op :: Operator ; num_th :: Int64, disp_std :: Bool) :: OpMat{type}

Generates the sparse matrix from the operator. The parameter type is either Float64 or ComplexF64 ; it is facultative, given by ElementType by default.

Arguments

  • op :: Operator is the operator ;
  • type :: DataType specifies the type of the matrix. It can either be ComplexF64 or Float64. Facultative, the same as ElementType by default
  • num_th :: Int64, the number of threads. Facultative, NumThreads by default.
  • disp_std :: Bool, whether or not the log shall be displayed. Facultative, !SilentStd by default.
source

The lowest eigenstates of the sparse matrix can be calculated by

Main.FuzzifiED.GetEigensystemMethod
function GetEigensystem(mat :: OpMat{ComplexF64}, nst :: Int64 ; tol :: Float64, ncv :: Int64, initvec :: Vector{ComplexF64}, num_th :: Int64, disp_std :: Bool) :: Tuple{Vector{ComplexF64}, Matrix{ComplexF64}}
function GetEigensystem(mat :: OpMat{Float64}, nst :: Int64 ; tol :: Float64, ncv :: Int64, initvec :: Vector{Float64}, num_th :: Int64, disp_std :: Bool) :: Tuple{Vector{Float64}, Matrix{Float64}}

calls the Arpack package to calculate the lowest eigenstates of sparse matrix.

Arguments

  • mat :: OpMat{ComplexF64} or mat :: OpMat{Float64} is the matrix ;
  • nst :: Int64 is the number of eigenstates to be calculated ;
  • tol :: Float64 is the tolerence for the Arpack process. The default value is 1E-8 ;
  • ncv :: Int64 is an auxiliary parameter needed in the Arpack process. The default value is max(2 * nst, nst + 10)
  • initvec :: Vector{ComplexF64} or initvec :: Vector{Float64} is the initial vector. If empty, a random initialisation shall be used. Facultative, empty by default.
  • num_th :: Int64, the number of threads. Facultative, NumThreads by default.
  • disp_std :: Bool, whether or not the log shall be displayed. Facultative, !SilentStd by default.

Output

  • A length-nst array that has the same type as mat recording the eigenvalues, and
  • A dimd*nst matrix that has the same type as mat where every column records an eigenstate.
source

The product of an operator on a state and the inner product of a final state, an operator and an initial state can be calculated by

Base.:*Method
function *(mat :: OpMat{ComplexF64}, st_d :: Vector{ComplexF64} ; num_th :: Int64) :: Vector{ComplexF64}
function *(mat :: OpMat{Float64}, st_d :: Vector{Float64} ; num_th :: Int64) :: Vector{Float64}

Measure the action of a sparse matrix on a state. st_d must be of length mat.dimd. Returns a vector of length mat.dimf that represents the final state.

Facultative argument

  • num_th :: Int64, the number of threads. Facultative, NumThreads by default.
source
Base.:*Method
function *(st_fp :: LinearAlgebra.Adjoint{ComplexF64, Vector{ComplexF64}}, mat :: OpMat{ComplexF64}, st_d :: Vector{ComplexF64} ; num_th :: Int64) :: ComplexF64
function *(st_fp :: LinearAlgebra.Adjoint{Float64, Vector{Float64}}, mat :: OpMat{Float64}, st_d :: Vector{Float64} ; num_th :: Int64) :: Float64

Measuring the inner product between two states and a sparse matrix. st_d must be of length mat.dimd and st_fp must be of length mat.dimf, and st_fp must be an adjoint.

Facultative argument

  • num_th :: Int64, the number of threads. Facultative, NumThreads by default.
source

Note that sometimes it is needed to transform a state from one basis to another. This can be done by constructing an identity operator.

stf = Operator(bsd, bsf, [Term(1., [-1, -1])]) * std

The OpMat object can be converted into a full matrix or converted with the SparseMatrixCSC object in the SparseArrays package. This will allow, e.g., full diagonalisation using the linear algebra package of julia.

Main.FuzzifiED.SparseMatrixCSCFromOpMatMethod
SparseMatrixCSCFromOpMat(mat :: OpMat{ComplexF64}) :: SparseMatrixCSC{Int64,ComplexF64}
SparseMatrixCSCFromOpMat(mat :: OpMat{Float64}) :: SparseMatrixCSC{Int64,Float64}

converts the OpMat objects to a SparseMatrixCSC object in the SparseArrays package.

source
Main.FuzzifiED.MatrixFromOpMatMethod
MatrixFromOpMat(mat :: OpMat{ComplexF64}) :: Matrix{ComplexF64}
MatrixFromOpMat(mat :: OpMat{Float64}) :: Matrix{Int64,Float64}

converts the OpMat objects to a full matrix.

source
Main.FuzzifiED.OpMatMethod
OpMat(matcsc :: SparseMatrixCSC{Int64,ComplexF64}) :: OpMat{ComplexF64}
OpMat(matcsc :: SparseMatrixCSC{Int64,Float64}) :: OpMat{Float64}

converts the SparseMatrixCSC object in the SparseArrays package to an OpMat objects.

source

Entanglement

Main.FuzzifiED.StateDecompMatMethod
function StateDecompMat(st :: Vector{<:Number}, bs0 :: Basis, bsa :: Basis, bsb :: Basis, amp_oa :: Vector{ComplexF64}, amp_ob :: Vector{ComplexF64}) :: Matrix{ComplexF64}

Decompose a state $|ψ⟩=v_I|I⟩$ into a direct-product basis of two subsystems $|ψ⟩=M_{JI}|I_A⟩|J_B⟩$

Arguments

  • st :: Vector{<:Number} is the state to be decomposed into direct-product basis of two subsystems.
  • bs0 :: Basis is the total basis.
  • bsa :: Basis is the basis for the subsystem A.
  • bsb :: Basis is the basis for the subsystem B.
  • amp_oa :: Vector{ComplexF64} is a complex list of length no that specifies the amplitute of each orbital in the subsystem A. For a non-local basis, we decompose each electron into creation operators in two subsystems $c^†_o=a_{o,A}c^†_{o,A}+a_{o,B}c^†_{o,B}$ and this list specifies $a_{o,A}$. This is equivalent to $√{ℱ_{m,A}}$ in PRB 85, 125308 (2012) with an extra phase factor.
  • amp_ob :: Vector{ComplexF64} is a complex list of length no that specifies the amplitute of each orbital in the subsystem B.

Output

A complex matrix of dimension bsb.dim * bsa.dim that corresponds to the state in the decomposed basis $|ψ⟩=M_{JI}|I_A⟩|J_B⟩$. This is equivalent to $R_{μν}^A/√p$ in PRB 85, 125308 (2012). After calculating all the sectors, the reduced density matrix will be $ρ_B=⊕\mathbf{M}\mathbf{M}^†$

source
Main.FuzzifiED.GetEntSpecMethod
function GetEntSpec(st :: Vector{<:Number}, bs0 :: Basis, secd_lst :: Vector{Vector{Vector{Int64}}}, secf_lst :: Vector{Vector{Vector{<:Number}}} ; qnd_a :: Vector{QNDiag}, qnd_b :: Vector{QNDiag} = qnd_a, qnf_a :: Vector{QNOffd}, qnf_b :: Vector{QNOffd} = qnf_a, amp_oa :: Vector{<:Number}, amp_ob :: Vector{<:Number} = sqrt.(1 .- abs.(amp_oa .^ 2))) :: Dict{@NamedTuple{secd_a, secf_a, secd_b, secf_b}, Vector{Float64}}

Arguments

  • st :: Vector{<:Number} is the state to be decomposed into direct-product basis of two subsystems.
  • bs0 :: Basis is the total basis.
  • secd_lst :: Vector{Vector{Vector{Int64}}} gives the list of QNDiag sectors of subsystems to be calculated. Each of its elements is a two element vector ; the first specifies the sector for subsystem A, and the second specifies the sector for subsystem B.
  • secf_lst :: Vector{Vector{Vector{ComplexF64}}} gives the list of QNOffd sectors of subsystems to be calculated. Each of its elements is a two element vector ; the first specifies the sector for subsystem A, and the second specifies the sector for subsystem B.
  • qnd_a :: Vector{QNDiag}, qnd_b :: Vector{QNDiag} = qnd_a, qnf_a :: Vector{QNOffd}, qnf_b :: Vector{QNOffd} specifies the diagonal and off-diagonal quantum numbers of the subsystems A and B. qnd_b and qnf_b are facultative and the same as qnd_a and qnf_a by default.
  • amp_oa :: Vector{ComplexF64} and amp_ob :: Vector{ComplexF64} are complex lists of length no that specify the amplitute of each orbital in the subsystems A and B. For a non-local basis, we decompose each electron into creation operators in two subsystems $c^†_o=a_{o,A}c^†_{o,A}+a_{o,B}c^†_{o,B}$ and this list specifies $a_{o,A}$. This is equivalent to $√{ℱ_{m,A}}$ in PRB 85, 125308 (2012) with an extra phase factor.

Output

A dictionary whose keys are named tuples that specify the sector containing entries secd_a, secf_a, secd_b, secf_b and values are lists of eigenvalues of the density matrix in those sectors.

source

File operations

FuzzifiED supports writing the types Confs, Basis, Vector{Term}, Operator, OpMat{ComplexF64} and OpMat{Float64} into and reading them from groups and subgroups in HDF5 format.

using HDF5 
open(file_name, "cw")
# include the file name as a string 
# Modes : "cw" for write and "r" for read
...
close(f)

To write, include in the middle

write(f, group_name :: String, cfs :: Confs)
write(f, group_name :: String, bs  :: Basis)
write(f, group_name :: String, tms :: Vector{Term})
write(f, group_name :: String, op  :: Operator)
write(f, group_name :: String, mat :: OpMat{ComplexF64})
write(f, group_name :: String, mat :: OpMat{Float64})

To read, include in the middle

cfs = read(f, group_name :: String, Confs)
bs  = read(f, group_name :: String, Basis)
tms = read(f, group_name :: String, Vector{Term})
op  = read(f, group_name :: String, Operator)
mat = read(f, group_name :: String, OpMat{ComplexF64})
mat = read(f, group_name :: String, OpMat{Float64})