How sebwouters/pydmet works
Project type and purpose
• PyDMET is a domain‐specific, scientific computing library and CLI tool written in Python.
• Its purpose is to implement density matrix embedding theory (DMET) workflows: setting up model Hamiltonians, performing embedding, solving correlated sub‐problems (via CheMPS2), and computing observables such as local density of states (LDOS) or density–density response (LDDR).
File structure
• Top‐level scripts:
• start.py, LDOS1D.py, LDOS2D.py, LDDR2D.py – user‐facing entry points for different calculations.
• preloadmkl.sh – environment setup for Intel MKL.
• “src” directory: core library modules:
• Hamiltonian builders (HamFull.py, HamInterface.py, HubbardDMET.py)
• DMET algorithm drivers (DMETham.py, DMETorbitals.py, InsulatingPMguess.py)
• Numerical tools (DIIS.py, LinalgWrappers.py, MinimizeCostFunction.py)
• Correlated‐solver interface (SolveCorrelated.py)
• Configuration/metadata: .gitignore, LICENSE, README.md.
Insights from README
• Dependencies: Python, SciPy, libchemps2 (PyCheMPS2).
• Execution flow: “Start from start.py; LDOS2D.py; LDOS1D.py; LDDR2D.py and adjust these files to start using PyDMET.”
a. Main components
1. User Interface Layer (entry‐point scripts)
2. Core DMET Engine (the “src” modules)
3. External Numerical Libraries
– Python interpreter + SciPy stack (BLAS/LAPACK, MKL)
– libchemps2 (external C++ library)
4. Data / File I/O (input parameter files, result files)
b. Relationships and interactions
• Entry‐point scripts call high‐level DMET routines in src/ (e.g., instantiate HubbardDMET, build Hamiltonian, call SolveCorrelated).
• DMET Engine modules orchestrate:
– Hamiltonian construction → HamFull/HamInterface
– Orbital selection and embedding → DMETham, DMETorbitals, InsulatingPMguess
– Iterative solver accelerators → DIIS, MinimizeCostFunction
– Correlated sub‐problem via SolveCorrelated → bridges to libchemps2
• Core numerical routines delegate to LinalgWrappers (SciPy/MKL).
• Results (LDOS, LDDR) produced and written by scripts.
c. Architectural patterns and design principles
– Modular layering: UI layer separated from core algorithm modules.
– Plugin‐style solver interface: external C++ solver (CheMPS2) is abstracted behind SolveCorrelated.py.
– Iterative‐algorithm pattern: DIIS for convergence acceleration.
d. Key technologies/frameworks
– Python 3.x, SciPy, NumPy
– Intel MKL (optional, via preloadmkl.sh)
– C++ CheMPS2 library (exposed through PyCheMPS2)
– Git for version control
Detail
• Major data flows: “1-electron integrals”, “embedding potentials”, “correlated wavefunction”, “LDOS output.”