Reference
DiagHamInterface.DiagHamInterface — Module
Interface to the DiagHam library.
DiagHamInterface.execute_diagham_script — Method
execute_diagham_script(execute; kwargs...)Run a DiagHam executable. Kwargs are converted to CLI flags (_ → -). Single-char keys use -k, multi-char use --key. Boolean true adds flag, false omits.
The kwargs of Cmd() are supported.
DiagHamInterface.fix_fileending — Method
fix_fileending(filename, ending)Return filename ensuring it ends with ending.
If ending does not start with a dot, a dot is prepended. If ending is empty, the original filename is returned. The function is safe to call with full paths; it only checks the final characters of filename.
DiagHamInterface.format_with_precision — Method
format_with_precision(x; atol=eps(float(T)), mode=:auto, maxdigits=20)Format number x as a string with absolute precision atol. Mode :auto uses %f for [1e-3, 1e6), else %e. Use :f or :e to force format.
DiagHamInterface.get_diagham_path — Method
get_diagham_path()Get the current path to the DiagHam build directory.
DiagHamInterface.install_diagham — Method
install_diagham(; source_dir, build_dir=nothing, run_dir=nothing, configure_options=["--enable-fqhe","--enable-fti","--with-blas-libs=-lopenblas","--with-lapack-libs=","--enable-lapack"])Checkout and build DiagHam from source. Returns the path to the build directory.
Parameters are keyword-only and intended to be easily overridden from tests or user code.
DiagHamInterface.read_matrix_from_txt — Method
read_matrix_from_txt(filename; sparsity=0.1)Read Hamiltonian from DiagHam-format text file. Auto-detects real/complex. Returns dense matrix if non-zero fraction > sparsity, else sparse.
DiagHamInterface.set_diagham_path — Method
set_diagham_path(path)Set the path to the DiagHam build directory.
DiagHamInterface.write_matrix_elements — Method
write_matrix_elements(label, indices, coeffs, file_name; dropband=false, full_single_particle=false)Write matrix elements to DiagHam-format file with header and data rows. dropband=true removes band index for single-band data. full_single_particle=true keeps both band indices for one-body terms.
DiagHamInterface.write_to_txt — Method
Optimized write_to_txt for SparseMatrixCSC. Converts to CSR internally.
DiagHamInterface.write_to_txt — Method
write_to_txt(Ham, filename; atol)Write Hamiltonian matrix to DiagHam-format text file (sparse coordinate format, 0-based indexing). Elements with abs(val) ≤ atol are omitted. Existing files are backed up.