gem.solvers.simple_ed.SimpleED
- class gem.solvers.simple_ed.SimpleED(norb, use_Ntot=False, use_Sz=False, dtype=<class 'numpy.complex128'>, N_sector=None, Sz_sector=None, solver_params=None, comm=None, **kwargs)[source]
Simple exact diagonalization solver for a general embedding Hamiltonian.
Symmetry sectors are controlled by
use_Ntot/use_Sz(which symmetries to exploit) andN_sector/Sz_sector(which sector(s) to include):N_sector = <int>— solve only that particle-number sector.N_sector = None— solve all particle-number sectors.Sz_sector = <int>— solve only that Sz sector.Sz_sector = None— solve all Sz sectors.
The Hamiltonian is built and diagonalised independently in each sector. Expectation values (density matrix, energies) are obtained as thermal/degeneracy-weighted averages across all included sectors.
MPI. The sectors are distributed over the ranks of
comm(by defaultMPI.COMM_WORLDwhen mpi4py is installed, otherwise a serial stand-in). Each rank builds the basis and all operators only for the sectors it owns, diagonalises them, and the global ground-state energy, partition function and thermal expectation values are obtained by reduction over the ranks.self.my_sectorsholds the global indices owned by this rank; every per-sector list (basis_list,evals_list,bw_per_sector, …) is indexed by the local position inside it. Reduced quantities (gs_ene,Zpart,Tstates,deg,dm, the energies,gs_wf) are identical on every rank.build_Hemb,solve_Hemb,calc_density_matrix,compute_E1loc,compute_E2locandcalc_double_occare collective: every rank ofcommmust call them, in the same order. Calling one of them inside anif rank == 0:block deadlocks.h5write_gsis the exception, it writes from rank 0 and is a no-op elsewhere.Matrix-free. With
solver_params['matrix_free'] = Truenothing is stored per sector but the basis: the Hamiltonian is handed to ARPACK as aLinearOperatorand thec^dag_i c_joperators are applied on the fly, so the memory goes fromO(dim*norb^2)toO(dim)and the sector size stops being limited by memory. It costs a few times more per matvec, it needsnum_eigatT>0once a sector reachesdense_cutoff(the full-spectrum fallback cannot work without the matrix), and it does not support the spin penalties. Results are otherwise identical to the stored path, sign for sign.Methods
build_Hemb(D, eloc, Lambdac, V2E[, mu, ...])Build the embedding Hamiltonian in every sector owned by this rank.
Compute the one-body density matrix as a thermal/degeneracy average across all active sectors, reduced over the MPI ranks.
Thermal double occupancy on orbital (i, i+1), averaged over all sectors.
compute_E1loc(nimp)One-body local energy (impurity block) averaged across sectors.
Two-body local energy averaged across sectors.
Names of the mandatory methods that are still the gemSolver stubs, i.e. that this solver has not implemented.
solve_Hemb([num_eig, which, tol, ...])Diagonalise each sector and build the global (thermal) partition function.
build_S2_op
build_denmat_op
build_h1e
build_one_body
build_two_body
h5read_state
h5write_gs
Methods
|
Initialize the solver with the given number of orbitals and symmetry settings. |
|
Build the embedding Hamiltonian in every sector owned by this rank. |
|
|
|
|
|
|
Compute the one-body density matrix as a thermal/degeneracy average across all active sectors, reduced over the MPI ranks. |
|
Thermal double occupancy on orbital (i, i+1), averaged over all sectors. |
|
|
One-body local energy (impurity block) averaged across sectors. |
Two-body local energy averaged across sectors. |
|
|
|
|
|
Names of the mandatory methods that are still the gemSolver stubs, i.e. that this solver has not implemented. |
|
|
Diagonalise each sector and build the global (thermal) partition function. |
Attributes