Examples

PyTC 0.3.0 ships ten numbered examples in the pytc/examples directory. They are small, executable demonstrations rather than production benchmarks.

Get and run the examples

Clone the matching release and install it in editable mode:

git clone --branch v0.3.0 https://github.com/nickirk/pytc.git
cd pytc
python -m pip install -e .

Run an example from the repository root, for example:

python pytc/examples/03_dense_xtc_ccsd.py
python pytc/examples/06_rank_m_x_factor_direct_ccsd.py
JAX_ENABLE_X64=1 python pytc/examples/08_adaptive_low_rank_bug_ccsd.py

Each script is runnable on its own unless the table notes a dependency. Examples 01 to 06 print a small expected-value or structural self-check and fail if that check does not pass. Examples 07 to 10 print the PyTC energy next to the PySCF reference.

Transcorrelated methods

Script

What it demonstrates

Dependency

01_vmc_optimize_jastrow.py

Two-phase reference-variance VMC optimization of a Jastrow factor

Writes h2o_phase_b_hist.h5

02_load_and_average_jastrow_params.py

Polyak–Ruppert averaging of the phase-B trajectory

Reads the file written by 01

03_dense_xtc_ccsd.py

Exact dense, non-ISDF xTC-CCSD

Standalone

04_isdf_xtc_ccsd.py

ISDF xTC-CCSD compared with the dense reference

Standalone

05_make_fno_xtc_ccsd.py

FNO virtual-space truncation scan through ISDF

Standalone

06_rank_m_x_factor_direct_ccsd.py

Rank-\(M\) orbital X and direct T2-U-Z factorized ISDF xTC-CCSD

Standalone; PyTC 0.2.1+

Adaptive low-rank methods

These examples run on water in cc-pVDZ with a density-fitted RHF reference and need JAX in double precision (JAX_ENABLE_X64=1). They are new in PyTC 0.3.0.

Script

What it demonstrates

Reference

07_adaptive_low_rank_bug_rpa.py

BUG direct RPA at three truncation thresholds

PySCF direct RPA

08_adaptive_low_rank_bug_ccsd.py

BUG-CCSD at a loose and a tight truncation threshold, with a per-iteration callback

PySCF DF-CCSD

09_adaptive_low_rank_bug_mp2.py

BUG-MP2 at three truncation thresholds

PySCF DF-MP2

10_adaptive_low_rank_bug_ccsd_t.py

BUG-CCSD followed by the projected (T) correction

PySCF DF-CCSD(T)

See Adaptive Low-Rank Methods for the interface.

Two separate transcorrelated workflows

Examples 01 and 02 show how to optimize and average a flexible CompositeJastrow([NuclearCusp, BoysHandy]). Examples 03–05 instead use a fixed, inexpensive REXP correlator so that the dense reference remains practical on a small machine. They do not consume the optimized parameters from 01/02.

Example 06 is a separate H4/STO-3G API demonstration. It confirms that the rank-\(M\) build contains X_tucker = {U, Z} instead of dense X and then runs the dedicated factor-direct solver. See ISDF Efficiency Paths before using that approximation for a new production system.

Choosing a starting point

  • Start with 03 when validating integral conventions on a small molecule.

  • Compare 03 and 04 before relying on an ISDF rank for a new system.

  • Use 05 to study the additional FNO truncation error.

  • Use 06 only after the full-X ISDF calculation is understood and validated; rank-\(M\) X is an explicit approximation, not the default.

  • Start with 09 or 07 for the adaptive low-rank solvers, then 08 and 10 for CCSD and CCSD(T).