BAFQMC can be developed beyond the two triangular-lattice models distributed here. This guide maps a new Hamiltonian onto the actual solver, ED, and measurement code. It covers changes to the lattice, hopping, pairing, flavors, and interactions. For a parameter scan of an already implemented model, use the calculation recipes. The observable reference defines the current measured operators and output normalizations that extensions can build on.
Start from the Hamiltonian the researcher requested and carry the extension through a working example and independent numerical checks. The worked anisotropic-lattice example below is an implementation blueprint; the current executable has no generic lattice or hopping-matrix input flag.
Distinguish unit cells, physical sites, flavor modes, and Nambu components.
For a crystal with
Here
Write a site/flavor index convention and an explicit bond list, including periodic image displacements. State whether each bond appears once with its Hermitian conjugate or as two directed entries. Small periodic clusters can have repeated image bonds and self-image bonds: summing their amplitudes and deduplicating their endpoints are different Hamiltonians. The current code sums the image contributions.
A useful general quadratic specification, using the paper's negative pairing convention, is
The physical Hamiltonian and its grand-canonical counterpart are
The combined indices
Specify the interaction in operators, including its linear and constant
terms. For example,
For an interaction written as a sum of Hermitian quadratic channels
For
For each independent field configuration, establish the applicable time-reversal symmetry (TRS), reflection positivity (RP), or conjugate-sector construction after decoupling. Write the symmetry operator or reflection, its action on sites/flavors/Nambu indices, and the conditions on each generated quadratic factor. For a TRS route, record the antiunitary square and all additional hypotheses of the sign-positivity criterion being used. For an RP route, specify the reflected partition and the required form and sign of cross-partition couplings. Symmetry of the original interaction alone does not check these configuration-level conditions.
The simplest existing construction gives an explicit example. For equal real
hopping of the two flavors,
The number-conserving code uses this relation directly. A model with different
flavor hoppings, flavor mixing, or a new HS channel needs its own matrix
representation and weight derivation whenever that relation changes. Taking
an absolute value of a new determinant is not a proof of its sign protection.
For complex hopping, this shortcut requires conjugate normal matrices,
If a requested model instead requires complex-weight sampling, implement that
estimator explicitly. The paired solver's local ratio-phase diagnostics are
not phase reweighting: its current measurements are ordinary averages. A
complex-weight calculation needs the full configuration phase
This entails phase-aware measurement and analysis, including the scalar and
branch contributions to
Sign protection and trace convergence are separate parts of the construction. Specify the parameter region in which the grand-canonical physical model has a finite thermal trace, and establish the domain required by the decoupled quadratic traces. A finite ED occupation cutoff defines a finite-dimensional reference; convergence toward an untruncated model is a further calculation.
For a quadratic model, positivity of the Hermitian bosonic energy matrix is a useful sufficient condition for a finite thermal trace. One sufficient bound for the quadratic form above is
Real Bogoliubov frequencies alone do not establish positivity of that energy
matrix. For the current
where
Keep the quadratic energy matrix distinct from the bosonic commutator matrix
that is exponentiated. In the full Nambu formulation the latter is generally
non-Hermitian even for a Hermitian physical Hamiltonian. The paired solver's
exp_general_matrix uses general-complex diagonalization. A new pairing
matrix must retain the correct particle/hole signs and conjugations; using a
Hermitian eigensolver on that commutator matrix changes the propagator.
The paired representation also has a scalar normal-ordering contribution.
For the current total-density HS field ratio_constant. Re-derive this factor for a different
quadratic generator or Nambu convention.
The local determinant factor currently uses
det_Pblock**(-0.5d0). The code records the phase and samples the magnitude;
it does not maintain an explicit branch-continuation state. Establish the
square-root branch associated with the physical trace for a new paired
model, anchored in a known convergent limit, and test the full ratio including
its scalar. If the model needs branch tracking, implement and verify that
state as part of the extension. Changing the determinant exponent alone does
not convert between a full and a reduced Nambu representation.
The following map points to active source files. Both components use similar names, with different matrix dimensions and update formulas.
| Responsibility | Files and symbols | Required coordination |
|---|---|---|
| Input and dimensions | src/<solver>/src/calc_basic.f90: read_input, Params_set |
Read and broadcast new parameters; separate cells, sites, flavors, and sectors; record them in run metadata. RT=1 is currently assigned here. |
| Crystal and graph | src/<solver>/src/lattice.f90: Lattice_make |
Update L_bonds, LT_bonds, site/sector index maps, real/reciprocal vectors, and Fourier phases. |
| Quadratic propagation | src/<solver>/src/non_interact.f90: def_hamT, opT_set; paired exp_general_matrix |
Build the new hopping/pairing matrix and its inverse-time factors, keeping the physical and commutator conventions distinct. |
| Fields and channel schedule | fields.f90: AuxConf_make; model.f90: Model_init; local_sweep.f90 |
Update field support, channel allocation, initial/restart I/O, and both sweep directions. The active schedule explicitly uses two channels. |
| HS factors | operator_Hubbard.f90: opU_set, opU_get_delta, opU_mmult_L/R |
Implement the derived operator, field measure, scalar, and local matrix change. In the paired code, coupling sign currently selects the channel type. |
| Ratios and Green updates | localU.f90: LocalU_metro; multiply.f90; stabilization.f90 |
Match update support and rank, derive the determinant ratio, and verify stabilized propagation against direct matrix products. |
| Measurements | obser_equal.f90: Obs_equal_calc; fourier_trans.f90 |
Change kinetic, interaction, pairing, and momentum estimators with the Hamiltonian; carry definitions into file output and analysis. |
| Campaigns and references | src/<solver>/run_paper.py, src/<solver>/benchmarks/campaign*.py, ED files below |
Generate consistent solver/ED inputs, validate the implemented model, and report every new parameter and reference cutoff. |
Consult the source directly through the number-conserving component and paired component. In particular:
-
A sublattice count is not a complete lattice definition. The current
Norb=1bond construction explicitly targets destination orbital 1. A kagome extension needs three physical sublattices, intracell positions, intercell bonds, and consistent orbital indices. Audit allocations and normalizations usingLq,Ndim,Nsite,Norb,Nsub, andNbond. Sublattice count, coordination number, and forward-bond storage count are distinct.Nbond=3and the spatial/time columns ofLT_bondsare currently fixed to the triangular graph. Check tensor extents in Fourier helpers such asm_write_k_3andm_write_reciprocal_3against their callers; orbital-correlation dimensions must follow the new orbital indexing. The pairedNsec=4labels$(b,c,b^+,c^+)$ ; it is not the sublattice count. -
Quadratic and interaction changes affect different update support.
New deterministic hopping or bond pairing may retain the existing onsite
density-HS support. A bond HS field, flavor-off-diagonal channel, or new
interaction changes it. The number-conserving
LocalU_metroapplies a rank-one diagonal-site update. The paired version selects four sectors of one site and uses only diagonal entries of its$4\times4$ Delta. Adding off-diagonal entries to that array alone does not implement the required Woodbury update. -
Channel signs encode operators. The paired
opU_setuses the positive$U_1$ channel for relative density and the nonpositive$U_2$ channel for total density. Opposite signs or additional operators require explicit channel definitions; renamingOp_U1or changing a JSON number does not change that dispatch. -
Measurements contain the old Hamiltonian explicitly. Kinetic energy
sums the scalar
RToverL_bonds; paired energy uses onsiteRDelta*pair_equal. Update these when propagation changes. The current paired implementation extracts the full four-sector contractions; it does not reconstruct its interacting paired$c$ sector by conjugating$b$ . -
Momentum and normalization follow the new crystal. Use
$e^{i\mathbf q\cdot(\mathbf r_{\mathbf R a}-\mathbf r_{\mathbf R'b})}$ , including sublattice positions, and state whether the result is a matrix in sublattice indices or a summed physical structure factor. Audit every$N_s^{-1}$ and$N_s^{-2}$ factor. The triangular K index is not a generic ordering momentum; current noncommensurate Fortran runs leave its output zero while paired ED omits it. That zero represents an unavailable K estimator. Define and implement the new model's actual momenta.
The existing paired time-dependent observable routine Obs_tau_calc is outside
the supported equal-time workflow. A research task involving imaginary-time
correlations must add an estimator together with its propagation checks.
The number-conserving ED driver
contains _hamiltonian_static, _hopping_two_species,
_translation_permutations, the two-species basis construction, and K-point
operators. Its public validator currently restricts interacting reference
calculations to src/number_conserving/benchmarks/campaign_analysis.py also contains the
triangular dispersion and needs the new spectrum.
For pairing, update
geometry_triangle.py,
the general driver's build_basis, build_hamiltonian, and observable
operators, and the tensor ED implementation.
The present basis has two flavors per physical site. Complex hopping/pairing
also requires complex coefficients and a suitable Hamiltonian dtype. Preserve
the distinction between physical site count and QuSpin's basis.Ns, which is
the many-body Hilbert-space dimension.
Add a model identifier and explicit parameter fields in the new input schema when several implementations coexist. Extend the readers and validators that consume those fields. A new manifest flag has an effect only after those readers and numerical kernels implement it. Keep generated tables self-describing: model, geometry, parameters, units, normalization, sampling, SEM, ED cutoffs, and energy convention. Use separate examples and campaign outputs so the original triangular cases and new model are both runnable. Update reference data intentionally when definitions or calculations change, and explain the change alongside the result.
Consider a requested extension with the same two flavors and onsite channels, but three independent real hopping amplitudes:
The displacement pairs are integer cell coordinates. Keep the physical triangular primitive vectors from the algorithm guide. The dispersion becomes
This change preserves the conjugate-flavor relation for equal real hoppings
and the original onsite HS channels. For
It follows from a lower bound on the hopping spectrum and need not be the
tight band minimum. As a concrete implementation test, use
An agent implementing this request should:
- Add and broadcast the three amplitudes in the input representation;
retain the isotropic values
$(1,1,1)$ as the original-model default. Connect eachL_bonds(:,nu)entry to its amplitude indef_hamT. - Make the kinetic estimator use the identical amplitudes and Hermitian conjugates. Keep onsite HS algebra and its local support unchanged after checking the conjugate-sector relation for the new quadratic factors.
- Update both ED hopping constructions and the analytic free dispersion. Choose a small finite-occupation reference or extend the current NC ED size interface as needed; record its basis definition.
- Compute free thermal density, energy, and momentum occupation independently
from the dispersion. For pairing, use
$\omega_{\mathbf k}=\sqrt{(\varepsilon_{\mathbf k}-\mu)^2-\Delta^2}$ in the stable Gaussian case. Check kinetic energy against derivatives with respect to each$t_\nu$ . - Verify a nonuniform fixed HS field by direct dense multiplication, then
run an interacting BAFQMC/ED comparison. Recover the original triangular
answers at
$(1,1,1)$ with the existing paper cases. - Add a small curated example, exact commands, resource measurements, and a model definition to the documentation. Keep larger generated scans in their own output directory.
Setting
Build a small dense reference directly from the new model definition. It should assemble site operators, hopping, pairing, and interaction terms independently of the production helpers. Compare Hamiltonian spectra and thermal observables in a common finite Fock basis; also check Hermiticity, pairing symmetry, energy decomposition, and relevant thermodynamic or gauge identities. The approach in test_ed_physics.py is a starting point.
For explicit nonuniform fields, form the ordered short-time matrices and their full products independently. Compare Green functions, the complete weight including scalars, and proposed-update ratios. Test several field configurations and stabilization intervals. Extend test_fixed_field_solver.py to the new geometry/channel; its current coverage checks interacting HS propagation but does not test a nonzero Metropolis proposal. A change to the update formula additionally needs old/new dense ratios and updated Green matrices for deterministic nonzero proposals.
Use analytic free or Bogoliubov limits as in test_gaussian_solvers.py, then perform an interacting run that actually exercises the new terms. Report means, SEM, and reference differences. Test the new model explicitly: passing the old triangular benchmarks only establishes that those cases remain consistent.
Run the existing checks alongside the added model tests:
make check
make physicsUse PYTHON_ED=/path/to/quspin/python when ED has a separate environment.
These checks have independent physical references; a new model should add
equally direct coverage. Full 22-point production remains available through
python3 reproduce.py when required by the requested validation scope.
Deliver a documented Hamiltonian and lattice, the HS/symmetry and trace derivation appropriate to its parameters, working solver and reference implementations, a runnable small example, independent tests, and measured computational cost. Record intentional changes to existing inputs or results as part of normal development. The researcher should be able to run both the original examples and the new physical model from this checkout.