Skip to content

Fulqrum Hamiltonian backend

Fulqrum builds the projected Hamiltonian for general-algebra solvers on CPU. Select it with hamiltonian_backend="fulqrum"; it changes the builder while retaining the chosen eigensolver and result interface. PySCF Davidson does not support it. TPB, GDB and spinless bases accept real or complex Hermitian integrals.

Installation

Fulqrum is an optional extra compiled locally from source.

On Linux:

uv sync --extra fulqrum

On macOS, use the compiler wrapper to link against PyTorch's OpenMP runtime:

CXX="$PWD/scripts/energy_solvers/clang_omp.sh" uv sync --extra fulqrum

Apple's Command Line Tools are required. If reinstalling a build made without the wrapper, add --reinstall-package fulqrum --no-cache.

Usage

from sci_solvers.energy_solvers.factory import create_solver
from sci_solvers.hamiltonian import HamiltonianData

ham = HamiltonianData.from_fcidump("FCIDUMP")
solver = create_solver(
    "arpack",
    symmetrize_spin=False,
    hamiltonian=ham,
    hamiltonian_backend="fulqrum",
    fulqrum_mode="csr",
    mode="tpb",
    device="cpu",
)
results = solver.compute_energy(ci_strs_batches=[(strs_a, strs_b)])

The input string arrays define the chosen TPB or GDB basis. Fulqrum has no GPU backend. A non-CPU device falls back to CPU with a warning; device_fallback="raise" rejects it instead.

Operator storage

fulqrum_mode Storage and work
"csr" (default) Assembles CSR with a counting pass to limit peak memory.
"csr_fast" Faster assembly with a larger intermediate allocation.
"matrix_free" Regenerates elements for each product, avoiding matrix storage.

matrix_free cannot be combined with use_operator=False or SLEPc's storage="aij". Builds and products use OpenMP; OMP_NUM_THREADS sets the thread count.

Measured full LOBPCG solves on 16 CPU threads, molecule 176, with the same energy in each mode:

Determinants CSR time / memory Fast CSR time / memory Matrix-free time / memory
3.7M 101 s / 8.4 GB 70 s / 19.5 GB 394 s / 1.4 GB
13.7M 480 s / 82 GB 333 s / 163 GB 2519 s / 3.6 GB

RAMPS subspace expansion

ramps_expand adds determinants connected to a core set whose estimated second-order energy contribution exceeds tol. The output contains the core followed by the selected additions, preserving particle counts.

from sci_solvers.energy_solvers.factory import create_solver
from sci_solvers.fulqrum_ramps import ramps_expand

strs_a, strs_b = ramps_expand(hcore, eri, core_a, core_b, energy, tol=1e-6, max_recursion=1)
solver = create_solver("arpack", mode="gdb", hamiltonian_backend="fulqrum", symmetrize_spin=False)
results = solver.sci_solver_callable([(strs_a, strs_b)], hcore, eri, norb, nelec)

Here core_a and core_b are parallel determinant arrays and energy is the core's ground-state energy. For flat spinless determinants, use ramps_expand_spinless from the same module. See the RAMPS API for signatures and types.