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.SilentStd
— ConstantSilentStd :: 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.
Main.FuzzifiED.NumThreads
— ConstantNumThreads :: 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.
Main.FuzzifiED.Libpath
— ConstantLibpath :: 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.
Main.FuzzifiED.ElementType
— TypeElementType :: DataType = ComplexF64
set the default type of the operator elements, either ComplexF64
or Float64
. ComplexF64
by default.
Main.FuzzifiED.OpenHelp!
— Methodfunction OpenHelp!()
A shortcut to open the link for documentation http://docs.fuzzified.world in the system browser.
Quantum numbers
FuzzifiED implements diagonal and off-diagonal quantum numbers. They are defined as
Main.FuzzifiED.QNDiag
— Typemutable 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 numbercharge :: Vector{Int64}
is the symmetry charge $q_o$ of each orbitalmodul :: 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.
Main.FuzzifiED.QNOffd
— Typemutable 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 transformationfac :: 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.
The QNDiag can be added or multiplied by a number
Base.:+
— Methodfunction +(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.
Base.:*
— Methodfunction *(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.
The QNOffd can be composed
Base.:*
— Methodfunction *(qnf1 :: QNOffd, qnf2 :: QNOffd) :: QNOffd
returns the composition of two QNOffd transformations. The cycle is set to be the LCM of two QNOffds
Configurations
Main.FuzzifiED.Confs
— Typemutable 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 lengthncf
containing all the configurations. Each configuration is expressed in a binary number. If theo-1
-th bit ofconf[i]
is 1, then theo
-th orbital in thei
-th configuration is occupied ; if the bit is 0, then the orbital is empty.nor :: Int64
,lid :: Vector{Int64}
andrid :: Vector{Int64}
contain the information of Lin table that is used to inversely look up the indexi
from the configuration.
It can be generated from the QNDiags.
Main.FuzzifiED.Confs
— Methodfunction 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.
The inverse look-back for a configuration can be done by
Main.FuzzifiED.GetConfId
— MethodGetConfId(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 theo-1
-th bit ofconf[i]
is 1, then theo
-th orbital in thei
-th configuration is occupied ; if the bit is 0, then the orbital is empty.
Output
id :: Int64
is the id of the configuration such thatcfs.conf[id] == cf
Basis
Main.FuzzifiED.Basis
— Typemutable 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 lengthcfs.ncf
and records which group $|I⟩$ each configuration $|i⟩$ belong to ;cffac :: Vector{ComplexF64}
is a vector of lengthcfs.ncf
and records the coefficients $λ_i$ of each configuration ;grel :: Matrix{Int64}
is aszz
*dim
matrix that records the configurations in each group $|i_{Ik}⟩ (k = 1,…,m_I)$grsz :: Vector{Int64}
is a vector of lengthdim
that records the size $m_I$ of each group.
It can be generated by the following methods.
Main.FuzzifiED.Basis
— Methodfunction 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
Main.FuzzifiED.Basis
— Methodfunction 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 resultingBasis
object
The look-back of the weight of a configuration in a state can be done by
Main.FuzzifiED.GetConfWeight
— MethodGetConfWeight(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}
orst :: Vector{Float64}
is a vector of lengthbs.dim
that stores the state ;cf :: Int64
stores the configuration to be looked-up expressed in a binary number. If theo-1
-th bit ofconf[i]
is 1, then theo
-th orbital in thei
-th configuration is occupied ; if the bit is 0, then the orbital is empty.
Output
- The weight of the configuration in the state
Term
Main.FuzzifiED.Term
— Typemutable 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
The product of terms with a number, the sum and product of terms, adjoint and particle-hole transformation are defined
Base.:*
— Methodfunction *(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.
Base.:+
— Methodfunction +(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.
Base.:*
— Methodfunction *(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}…$
Base.adjoint
— Methodfunction 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}$
Main.FuzzifiED.ParticleHole
— Methodfunction 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}$
The terms can be simplified by
Main.FuzzifiED.NormalOrder
— Methodfunction 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.
Main.FuzzifiED.SimplifyTerms
— Methodfunction 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.
Operator
Main.FuzzifiED.Operator
— Typemutable 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 : ifbsd
andbsf
have exactly the same set of quantum numbers, and the operator fully respects the symmetries, and all the elements inbsd.cffac
andbsf.cffac
has the same absolute value, thenred_q = 1
; otherwisered_q = 0
;sym_q :: Int64
records the symmetry of the operator : if the matrix is Hermitian, thensym_q = 1
; if it is symmetric, thensym_q = 2
; otherwisesym_q = 0
;ntm :: Int64
is the number of terms ;nc :: Int64
is the maximum number of operators in an operator stringcstrs :: 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.
It can be generated by the following methods.
Main.FuzzifiED.Operator
— Methodfunction 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 asbsd
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 : ifbsd
andbsf
have exactly the same set of quantum numbers, and the operator fully respects the symmetries, and all the elements inbsd.cffac
andbsf.cffac
has the same absolute value, thenred_q = 1
; otherwisered_q = 0
; Facultative, ifbsf
is not given, 1 by default, otherwise 0 by default.sym_q :: Int64
records the symmetry of the operator : if the matrix is Hermitian, thensym_q = 1
; if it is symmetric, thensym_q = 2
; otherwisesym_q = 0
. Facultative, ifbsf
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.
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.:*
— Methodfunction *(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.
Base.:*
— Methodfunction *(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.
Sparse matrix
Main.FuzzifiED.OpMat
— Typemutable 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
anddimf :: 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}
andelval :: Vector{ComplexF64}
records the elements of the sparse matrix as in theSparseMatrixCSC
elements of Julia.
It can be generated by the following methods.
Main.FuzzifiED.OpMat
— Methodfunction 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 beComplexF64
orFloat64
. Facultative, the same asElementType
by defaultnum_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.
The lowest eigenstates of the sparse matrix can be calculated by
Main.FuzzifiED.GetEigensystem
— Methodfunction 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}
ormat :: 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 is1E-8
;ncv :: Int64
is an auxiliary parameter needed in the Arpack process. The default value ismax(2 * nst, nst + 10)
initvec :: Vector{ComplexF64}
orinitvec :: 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 asmat
recording the eigenvalues, and - A
dimd
*nst
matrix that has the same type asmat
where every column records an eigenstate.
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.:*
— Methodfunction *(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.
Base.:*
— Methodfunction *(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.
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.SparseMatrixCSCFromOpMat
— MethodSparseMatrixCSCFromOpMat(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.
Main.FuzzifiED.MatrixFromOpMat
— MethodMatrixFromOpMat(mat :: OpMat{ComplexF64}) :: Matrix{ComplexF64}
MatrixFromOpMat(mat :: OpMat{Float64}) :: Matrix{Int64,Float64}
converts the OpMat
objects to a full matrix.
Main.FuzzifiED.OpMat
— MethodOpMat(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.
Entanglement
Main.FuzzifiED.StateDecompMat
— Methodfunction 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 lengthno
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 lengthno
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}^†$
Main.FuzzifiED.GetEntSpec
— Methodfunction 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
andqnf_b
are facultative and the same asqnd_a
andqnf_a
by default.amp_oa :: Vector{ComplexF64}
andamp_ob :: Vector{ComplexF64}
are complex lists of lengthno
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.
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})