First H₂ calculation
Run a fixed-geometry Hartree–Fock calculation on neutral H₂ in STO-3G.
Use the executable from installation. The commands assume
rustiq is on your terminal’s command search path (PATH).
Create the input files
Open a terminal in a directory where you can create files and enter these commands one line at a time. The first creates a folder for the calculation. The second makes it your working directory.
mkdir rustiq-h2
cd rustiq-h2
In a plain-text editor, save the following as h2.xyz in that folder.
The first line is the atom count, the second is a comment, and each remaining
line gives an element and three coordinates in Angstrom.
2
Hydrogen molecule
H 0.0 0.0 -0.37
H 0.0 0.0 0.37
rustiq init h2.xyz -o calculation.toml
init reads the geometry and writes calculation.toml beside it. Open that
file to find the geometry path and the STO-3G basis name. For this input,
the default charge is zero, init determines a singlet from the even
electron count, and automatic HF selection resolves to RHF. This step
creates the configuration without calculating energies or downloading a basis.
Obtain STO-3G and run
With an online build and an internet connection, download STO-3G into RustiQ’s local basis store. The second command reads the configuration and prints the calculation report in your terminal.
rustiq basis download sto-3g
rustiq run calculation.toml
If STO-3G is already installed, you can go directly to run. For offline
use, import a previously obtained Basis Set Exchange JSON file with
rustiq basis import /path/to/sto-3g.json before running the calculation.
To print the same result as JSON, run:
rustiq run calculation.toml --format json
Verify the calculation
Find these lines in the terminal report:
SCF converged after 2 iterations.
Total Energy (including nuclear repulsion): -1.116759 Hartree
The H₂ calculation uses two electrons and two STO-3G basis functions. The full-precision total HF energy is approximately −1.116759307506 Hartree, with an absolute smoke-test tolerance of 1e-9 Hartree.
The run met the SCF stopping criteria and reported the total HF energy in Hartree. The default core-Hamiltonian guess makes this example deterministic. Continue with interpreting the report to see what you can conclude from the convergence and energy values. If the run stops early, see what to check when a calculation fails.
Optional checks for contributors
From the repository root, import the checked-in basis fixture and run the checked-in configuration to reproduce the example from source.
cargo run --locked -- basis import tests/data/sto-3g.json
cargo run --locked -- run samples/h2/sto-3g/calculation.toml
The following verification commands are for users working from a source checkout; they are optional when using only the release binary. The existing CLI regression test checks this input, RHF resolution, units, two SCF iterations, and these selected output lines. Its reproducible command is below; the test source is linked for readers who want to inspect its assertions.
Run that verification with:
cargo test --locked --test cli_samples test_cli_h2_sample_converges_and_prints_reference_energy
For independent numerical verification, the h2-sto-3g-rhf case compares full
precision JSON energies against PySCF with a 2e-10 Hartree energy tolerance.
The rounded terminal value above is not that tolerance. See the book’s
scientific scope and reference comparisons
for the coverage boundary. The comparison implementation and full reference
instructions are linked below.
Reference test instructions on GitHub
Reproducing this comparison requires the cloned repository and its Nix
development environment (or the documented uv/PySCF setup); the binary
archive alone does not include the reference harness.
nix run .#pyscf-check -- -k 'h2-sto-3g-rhf and not mp2'