runSNVS A1 - build and run guide
Prepared 21 October 2026 for the 10 October A1 retained source release

1. DEPENDENCIES AND BUILD

Required: GNU Fortran with Fortran 2008/OpenMP support, a C compiler, make,
bash, BLAS/LAPACK and libcint 6.1.3. For the supplied libcint build helper,
also install git and CMake. Linux uses OpenBLAS/LAPACK; macOS uses Accelerate.
The Makefile also includes Windows/MSYS2 targets, which were not tested in
the present packaging check. Executables and compiled dependencies are not
included. Build in a new working copy if you wish to preserve the file hashes.

From this source directory:

  PREFIX="$PWD/../libcint-6.1.3" bash scripts/build_libcint.sh
  make -j 2 LIBCINT="$PWD/../libcint-6.1.3"
  ./runSNVS --help
  ./runSNVS --full-help

The helper downloads libcint v6.1.3 pinned to commit
c72d30662ba08048940c9000cc352a220c867712. It builds outside this source tree
and installs a static library by default. The libcint C integer interface
must use the default int, not I8INT. If an installation already exists, skip
the helper and specify its prefix as LIBCINT. Use LIBCINT_LINK=shared only
when deliberately linking a shared libcint installation. FC=/path/to/gfortran
selects a different Fortran compiler. The default build uses -O3,
-march=native and OpenMP. The CPU, compiler, BLAS and dependency builds can
change the new executable and floating-point results. Do not assign a
historical BUILD_DATE to a newly compiled executable.

There is no make test target. The retained docs/MANUAL_runSNVS.md covers
additional command-line modes and includes historical development entries.
Use the commands below for the native correlation workflow.

2. PREPARE A REFERENCE WAVEFUNCTION

The ORCA JSON route requires a complete occupied and virtual orbital space,
AO basis, occupations, one-electron matrices and consistent SCF metadata.
Use the canonical RHF/UHF reference and the matching output; a matching
geometry and basis label alone do not identify the same SCF solution.

With Python 3, a built runSNVS and licensed ORCA 6.1.x (orca and orca_2json),
the supplied standard-library preparation driver can create source.json.
Replace /path/to/... placeholders with real paths and select a new output
directory. Set the basis label to the actual parent basis.

  python3 scripts/snvs_autonomous.py --help
  python3 scripts/snvs_autonomous.py \
    --gbw /path/to/ref.gbw --scf-out /path/to/ref.out \
    --out /path/to/new_package --method none --ri none --layers all \
    --basis-label ano-pVQZ --fock-route reconstruct --gates strict \
    --threads 1 --nprocs 1 --maxcore 4000 \
    --orca-dir /path/to/orca611 --runsnvs /path/to/runSNVS

The driver refuses to overwrite an existing package. This command prepares
the hierarchy and source.json; it does not run native CCSD. It inherits the
atomic ANO order of this A1 executable. For a UHF source, preserve the core
count recorded in PREPARE.json. The optional --run runs generated external
ORCA layer inputs and is unnecessary for the native command below.
ORCA_JSON_EXPORT.txt documents the underlying export configuration.

3. NATIVE CCSD / CCSD(T) EXAMPLE

This parameterized example is not a bundled molecular test. It needs the
source.json prepared above. In a new working directory, set the executable,
input, frozen-core count and memory allocation for your actual calculation:

  RUNSNVS=/path/to/built/runSNVS
  SOURCE_JSON=/path/to/package/source.json
  NCORE=1
  MEM_GB=8
  mkdir native_example
  cd native_example
  "$RUNSNVS" -i "$SOURCE_JSON" -n 1 \
    --construction ano-snao --ano-order atomic \
    --export-json snvo --snvo-layers all --snvo-fock reconstruct \
    --snvo-frozen "$NCORE" --snvo-rimp2 --ri-aux 'auto:tau=1e-14' \
    --mem "$MEM_GB" --gates strict \
    --snvo-ccsd 'ints=exact,conv=1e-9,triples=0,classes=shared,start=prev,quartets=8' \
    --out-dir .

NCORE=1 and MEM_GB=8 are illustrative values. Use the actual frozen-core
count and a sufficient memory allocation. For a UHF reference, replace
--snvo-frozen with --snvo-core and use the recorded per-spin core count.
For CCSD(T), change triples=0 to triples=1. The generated *.ccsd.json files
report the CCSD correlation and perturbative-triples energies separately.

The correlation lane needs --snvo-rimp2 and --ri-aux even when CCSD uses
ints=exact. The *.rimp2.json files contain RI-MP2 energies; the exact-integral
MP2 doubles energy is available from the exact CCSD first iteration. These
are different quantities. --snvo-method ccsd selects generated replay inputs;
it does not enable the native CCSD solver. Similarly, --method ccsd or
ccsd(t) in snvs_autonomous.py selects external replay inputs.

The 200-state recomputation used reconstruct + strict, atomic
ANO order, exact CCSD integrals, conv=1e-9, triples=1, classes=shared,
start=prev and quartets=8, with 16 threads and a 150 GB allocation (including
recorded memory-limit retries). The smaller example above is not a timing
reproduction. Follow the article and SI for exact case and timing protocols.
An exact-Fock route (--snvo-fock exact) is also implemented, but substituting
it for reconstruct changes the above protocol.

4. OPTIONAL PYTHON TOOLS AND HISTORICAL TESTS

The native executable does not require Python, NumPy, SciPy or PySCF.
snvs_autonomous.py uses Python 3 standard-library modules. Optional scripts
have additional dependencies: replay_spin_orca.py needs NumPy;
prepare_spin_input.py, solve_spin.py and orca_json_metric.py need NumPy and
PySCF; audit_projectors.py additionally needs SciPy. Their package versions
are not frozen by this retained source snapshot.

scripts/run_regression.sh expects a separate runSNVO_tests fixture tree
(or RUNSNVS_TESTS override), which is not included. Some retained validation
scripts contain historical paths and launch external ORCA jobs. Inspect and
adapt them before use. They are not an offline full regression suite.

5. SMALL ANALYTIC PROJECTOR CHECK

The original tests/spin_projector_driver.f90 can be built without libcint.
The supplied checks/projector/rhf.in and uhf.in contain tiny analytic matrices,
not molecular wavefunctions. From this source directory, on macOS:

  SRC_ROOT="$PWD"
  mkdir projector_check_work
  cd projector_check_work
  gfortran -O0 -cpp -D__APPLE__ -fopenmp -ffree-line-length-none \
    -J . -I . "$SRC_ROOT/src/snvo_precision.f90" \
    "$SRC_ROOT/src/snvo_linalg.f90" "$SRC_ROOT/src/snvo_spin_spaces.f90" \
    "$SRC_ROOT/tests/spin_projector_driver.f90" \
    -framework Accelerate -o spin_projector_test
  ./spin_projector_test "$SRC_ROOT/checks/projector/rhf.in" > rhf.out
  ./spin_projector_test "$SRC_ROOT/checks/projector/uhf.in" > uhf.out

On Linux omit -D__APPLE__ and replace -framework Accelerate with
-lopenblas -llapack -lpthread. This Linux variant was not run in packaging.
The first output line must be PASS 2 2 1 1 for RHF and PASS 1 2 2 2 for UHF.
The next two 4-by-4 matrices are the alpha and beta virtual projectors.
Expected RHF matrices: diag(0,1,1,0) for both spins. Expected UHF matrices:
diag(0,0,1,0) for alpha and diag(0,1,1,0) for beta. Compare numerically,
for example with maximum absolute matrix difference <=1e-12, rather than
requiring byte-identical output formatting across compilers.

During the 21 October packaging check, all original production compilation
units compiled with GNU Fortran 16.1.0 on Apple Silicon macOS; the final
link stopped because libcint was not installed locally. The small projector
driver was separately built against Accelerate and passed the two cases
with maximum matrix difference 0.0. This does not revalidate molecular MP2,
CCSD, triples energies or timing measurements. Historical executable hashes
are identifiers; a new build is not expected to have the same binary hash.
