API Reference
Core Data Structures
EDPara
Central parameter container for system configuration.
Constructor:
k_list::Matrix{Int64}: Momentum point represented by integersGk::Tuple{Int64, Int64}: Reciprocal lattice constant in integers; zero means no Umklapp Scatter (default (0,0))Nc_conserve::Int64: Number of conserved components (default 1)Nc_hopping::Int64: Number of hopping channels (default 1)V_int::Function: Two-body interaction functionH_onebody::Array{ComplexF64, 4}: One-body Hamiltonian terms, index [ch1, ch2, cc, k]
EDPara(; k_list, Gk, V_int, H_onebody=zeros(ComplexF64, 1, 1, 1, 1))Main Functions
System Setup
EDmbslist(para::EDPara, Nparticles)
Generate all many-body states for given particle number.
Arguments:
para::EDPara: System parametersN_particles: Number of particles (tuple for each-component)
Returns:
Vector{MBS64}: List of many-body states
EDmomentumblockdivision(para::EDPara, mbslist)
Divide Hilbert space into momentum blocks.
Arguments:
para::EDPara: System parametersmbs_list::Vector{MBS64}: List of many-body states
Returns:
- `blocks::Vector{Vector{MBS64}}: States in each momentum block
block_k1::Vector{Int64}: K1 momentum for each blockblock_k2::Vector{Int64}: K2 momentum for each blockk0number::Int64: Index of momentum=0 block
Hamiltonian Construction
EDsortedScatterListonebody(para::EDPara)
Generate sorted list of one-body Scatter terms.
Arguments:
para::EDPara: System parameters
Returns:
Vector{Scatter{1}}: Sorted one-body Scatter terms
EDsortedScatterListtwobody(para::EDPara)
Generate sorted list of two-body Scatter terms.
Arguments:
para::EDPara: System parameters
Returns:
Vector{Scatter{2}}: Sorted two-body Scatter terms
Diagonalization
EDsolve(block, scatlist1, scatlist2, Neigen; kwargs)
Solve eigenvalue problem for momentum block.
Arguments:
block::Vector{MBS64}: Many-body states in blockscat_list1::Vector{Scatter{1}}: One-body Scatter termsscat_list2::Vector{Scatter{2}}: Two-body Scatter termsNeigen::Int64: Number of eigenvalues to compute
Keyword Arguments:
showtime::Bool=false: Show timing informationconverge_warning::Bool=true: Show convergence warningswhich::Symbol=:SR: Which eigenvalues to compute (:SR,:LR,:LM)
Returns:
values::Vector{Float64}: Eigenvaluesvectors::Vector{Vector{ComplexF64}}: Eigenvectors
Analysis Functions
EDetgentropy(eigenvectors, block, partition_indices)
Calculate entanglement entropy for spatial partition.
Arguments:
eigenvectors::Vector{Vector{ComplexF64}}: Eigenvectorsblock::Vector{MBS64}: Many-body states in blockpartition_indices::Vector{Int64}: Orbital indices for partition A
Returns:
Vector{Float64}: Entanglement entropy for each eigenvector
EDconnectionintegral(para, eigenvectors, blocks, blockk1, blockk2)
Calculate many-body Berry connection.
Arguments:
para::EDPara: System parameterseigenvectors::Matrix{Vector{ComplexF64}}: All eigenvectorsblocks::Vector{Vector{MBS64}}: All momentum blocksblock_k1::Vector{Int64}: K1 momentablock_k2::Vector{Int64}: K2 momenta
Returns:
Matrix{ComplexF64}: Berry connection matrix
Utility Functions
EDoccupancytomomentum(occupancy, klist, Gk)
Convert occupancy array to momentum representation.
Arguments:
occupancy::Vector{Int64}: Occupation numbersk_list::Matrix{Int64}: Momentum point indicesGk::Tuple{Int64, Int64}: Grid dimensions
Returns:
Vector{ComplexF64}: Momentum space wavefunction
groupmomentumpairs(k_list, Gk)
Group momentum pairs for efficient Scatter calculations.
Arguments:
k_list::Matrix{Int64}: Momentum point indicesGk::Tuple{Int64, Int64}: Grid dimensions
Returns:
Vector{Tuple{Int64, Int64, Int64}}: Grouped momentum pairs
Multi-Component Systems
The package supports multi-component systems with separate conservation laws:
Component Indexing
- Global orbital index:
i_global = k + Nk * (ch - 1) + Nk * Nch * (cc - 1) k: momentum indexch: hopping channel indexcc: conserved component index
One-Body Terms
Accessed via para.H_onebody[ch1, ch2, cc, k] for hopping between channels.
Two-Body Terms
Handled by the interaction function para.V_int with proper component mapping.
Performance Tips
- Pre-computation: Generate Scatter lists once and reuse for all momentum blocks
- Memory Management: Use
showtime=trueto monitor memory usage - Parallel Processing: The package automatically uses multiple threads when available
- Sparse Methods: KrylovKit eigensolvers are memory-efficient for large systems
Error Handling
The package validates inputs and provides descriptive error messages for:
- Invalid momentum indices
- Inconsistent system parameters
- Memory allocation failures
- Convergence issues in eigensolvers