この日本語ページは準備中です。 技術的な詳細は英語版が最新かつ正確です。 → English version
GANSU2 CLI Usage Guide
Quick Start
Install from PyPI. The wheel is small; the gansu2 command and the GPU shared library are fetched on first use and cached under ~/.cache/gansu2/<version>/.
pip install gansu2
# Run a calculation
gansu2 -x h2o.xyz -g sto-3g -m RHF
Preparing Input Files
XYZ File Format
XYZ files specify molecular geometry. Format: number of atoms, comment line, then atom coordinates in Angstrom.
H2 molecule (h2.xyz):
2
Hydrogen molecule
H 0.000 0.000 0.000
H 0.000 0.000 0.740
H2O molecule (h2o.xyz):
3
Water molecule
O 0.000 0.000 0.127
H 0.000 0.758 -0.509
H 0.000 -0.758 -0.509
NH3 molecule (nh3.xyz):
4
Ammonia
N 0.000 0.000 0.117
H 0.000 0.939 -0.273
H 0.813 -0.470 -0.273
H -0.813 -0.470 -0.273
CH4 molecule (ch4.xyz):
5
Methane
C 0.000 0.000 0.000
H 0.629 0.629 0.629
H -0.629 -0.629 0.629
H -0.629 0.629 -0.629
H 0.629 -0.629 -0.629
Benzene (benzene.xyz):
12
Benzene
C 0.000 1.387 0.000
C 1.201 0.693 0.000
C 1.201 -0.693 0.000
C 0.000 -1.387 0.000
C -1.201 -0.693 0.000
C -1.201 0.693 0.000
H 0.000 2.469 0.000
H 2.138 1.235 0.000
H 2.138 -1.235 0.000
H 0.000 -2.469 0.000
H -2.138 -1.235 0.000
H -2.138 1.235 0.000
Periodic Systems (PBC)
Give the geometry an ASE-style extended-XYZ header — a Lattice="..." tag on the comment line, nine numbers for rows a, b, c in Angstrom — and gansu2 automatically runs a Gamma-point periodic Hartree–Fock (PBC-RHF) instead of a molecular calculation. No extra flag is required.
Water in a cubic cell (h2o_pbc.xyz) — the Lattice= tag is what triggers the periodic path:
3
Lattice="12.0 0.0 0.0 0.0 12.0 0.0 0.0 0.0 12.0"
O 0.000 0.000 0.127
H 0.000 0.758 -0.509
H 0.000 -0.758 -0.509
gansu2 -x h2o_pbc.xyz -g sto-3g
With -m uhf / -m rohf the same input runs the Gamma-point PBC-UHF / PBC-ROHF, and with -m rks / -m uks --functional pbe (or hse06) the periodic restricted / unrestricted Kohn–Sham. For 3D cells add --pbc_jk_backend direct.
k-point Kohn–Sham DFT (KRKS) is provided by the separate gansu2_krks runner; run it with no arguments to see the lattice and k-mesh options.
Basis Sets
Basis sets are specified by name. GANSU2 automatically resolves the path.
| Name | Description | Typical use |
|---|---|---|
sto-3g | Minimal basis | Quick tests |
3-21g | Split-valence | Preliminary calculations |
6-31g | Split-valence | General use |
6-31g_st | With polarization (6-31G*) | Better accuracy |
cc-pvdz | Correlation-consistent DZ | Post-HF calculations |
cc-pvtz | Correlation-consistent TZ | High-accuracy post-HF |
cc-pvqz | Correlation-consistent QZ | Benchmark calculations |
By default GANSU2 uses Cartesian Gaussians (6 d-functions, 10 f, 15 g). To match the spherical-harmonic convention used by ORCA / PySCF / NWChem for cc-pVnZ and similar basis sets (5 d, 7 f, 9 g), add --use_spherical 1. See Example 2b.
Basic Usage
Syntax
gansu2 -x <xyz_file> -g <basis> [options]
Options
| Option | Description | Default |
|---|---|---|
-x | XYZ file path | (required) |
-g | Basis set name or path | (required) |
-m | Method: RHF, UHF, ROHF, RKS / UKS / ROKS (DFT) | RHF |
-r | Run type: energy, gradient, optimize, hessian | energy |
-c | Molecular charge | 0 |
--post_hf_method | Post-HF method (see below) | none |
--n_excited_states | Number of excited states | 5 |
--eri_method | ERI method: stored, RI, direct, direct_ri, hash | stored |
--functional | DFT functional: svwn5, pbe, blyp, scan, b3lyp, b3lyp5, pbe0 | svwn5 |
--grid_level | DFT grid level 0–9 (same level table as PySCF) | 1 |
--convergence_method | SCF convergence: DIIS, SOSCF, etc. | DIIS |
--initial_guess | Initial guess: core, gwh, sad, minao | core |
--optimizer | Geometry optimizer (see below) | bfgs |
--use_spherical | Spherical-harmonic basis (5D/7F/9G) instead of Cartesian (6D/10F/15G) | 0 |
--num_gpus | Number of GPUs for RI (RHF), Direct-SCF (also inside CASSCF), DLPNO and DMET (-1 = all visible) | -1 |
--cpu | Force CPU-only execution | (off) |
--list-basis | List available basis sets and exit | |
-p | Parameter recipe file | (none) |
-ag | Auxiliary basis file for RI | (def2-universal-jkfit) |
-ecp | ECP file | (none) |
-v | Verbose output | (off) |
DFT (Kohn-Sham)
gansu2 -x H2O.xyz -g cc-pvdz --method rks --functional pbe --grid_level 3
--functional は svwn5(LDA)、pbe・blyp(GGA)、scan(meta-GGA)、b3lyp・b3lyp5・pbe0(ハイブリッド)、--grid_level は 0–9 で PySCF と同じレベル表です。開殻には --method uks / --method roks を使います。詳細は DFT parameters。
Post-HF Methods
| Value | Method |
|---|---|
none | HF only |
mp2 | MP2 |
mp3 | MP3 |
mp4 | MP4 |
cc2 | CC2 |
ccsd | CCSD |
ccsd_t | CCSD(T) |
ccsd_density | CCSD + Lambda + 1-RDM |
dmet | DMET-CCSD (fragment-based correlation, multi-GPU, auto X-H bond fragmentation) |
dmet_ccsd_t | DMET-CCSD(T) — same fragment construction plus perturbative triples per fragment |
dlpno_ccsd | DLPNO-CCSD (local-correlation CCSD, requires RI; UHF / ROHF references for small molecules) |
dlpno_ccsd_t | DLPNO-CCSD(T) — perturbative triples on per-triple TNO bases |
fci | Full CI |
casscf | CASSCF(--casscf_active と一緒に。GPU のみ。--post_casscf_method で NEVPT2) |
cis | CIS excited states |
adc2 | ADC(2) excited states |
sos_adc2 | SOS-ADC(2) excited states |
lt_sos_adc2 | Laplace-transform SOS-ADC(2) (O(N⁴) with RI) |
adc2x | ADC(2)-x excited states |
eom_mp2 | EOM-MP2 excited states |
eom_cc2 | EOM-CC2 excited states |
eom_ccsd | EOM-CCSD excited states |
ip_eom_ccsd | IP-EOM-CCSD — (N−1)-electron ionized states (RHF) |
ea_eom_ccsd | EA-EOM-CCSD — (N+1)-electron attached states (RHF) |
steom_ccsd | STEOM-CCSD (auto-runs CIS-NTO + IP/EA-EOM; RHF) |
dlpno_steom_ccsd | DLPNO-STEOM-CCSD — local STEOM (RHF, requires RI) |
Optimizers
bfgs, dfp, sr1, gdiis, newton, cg-fr, cg-pr, cg-hs, cg-dy, sd
Examples
1. Basic HF Energy
cat > h2o.xyz << 'EOF'
3
Water
O 0.000 0.000 0.127
H 0.000 0.758 -0.509
H 0.000 -0.758 -0.509
EOF
gansu2 -x h2o.xyz -g sto-3g
2. Different Basis Sets
gansu2 -x h2o.xyz -g sto-3g # Minimal basis
gansu2 -x h2o.xyz -g cc-pvdz # Double-zeta
gansu2 -x h2o.xyz -g cc-pvtz # Triple-zeta
2b. Spherical-Harmonic Basis
By default GANSU2 uses Cartesian Gaussians (6D/10F/15G). Add --use_spherical 1 to use pure spherical harmonics (5D/7F/9G, Molden ordering), matching the ORCA / PySCF / NWChem convention for cc-pVnZ and similar basis sets.
# Cartesian (default) vs spherical RHF energy
gansu2 -x h2o.xyz -g cc-pvdz # Cartesian (25 basis functions)
gansu2 -x h2o.xyz -g cc-pvdz --use_spherical 1 # Spherical (24 basis functions)
# Works across stored / RI / multi-GPU and gradients + optimization
gansu2 -x benzene.xyz -g cc-pvdz --use_spherical 1
gansu2 -x h2o.xyz -g cc-pvdz --eri_method ri -ag cc-pvdz-rifit.gbs \
-r optimize --use_spherical 1 --num_gpus 4
Spherical basis is supported for RHF/UHF/ROHF energy (stored, RI, multi-GPU distributed RI), RI post-HF (MP2/CCSD/CIS/EOM/ADC(2)/DLPNO/STEOM), THC, all initial guesses (core/gwh/sad/minao for RHF; core/gwh/sad for UHF/ROHF), ECP, analytical gradient and geometry optimization, analytical Hessian and vibrational frequencies, and Molden export. Direct-SCF/Hash ERIs remain Cartesian-only and raise a clear error under --use_spherical 1.
3. Post-HF Correlation Energy
# MP2
gansu2 -x h2o.xyz -g cc-pvdz --post_hf_method mp2
# CCSD
gansu2 -x h2o.xyz -g cc-pvdz --post_hf_method ccsd
# CCSD(T)
gansu2 -x h2o.xyz -g cc-pvdz --post_hf_method ccsd_t
# Full CI (exact, small molecules only)
gansu2 -x h2o.xyz -g sto-3g --post_hf_method fci
Multi-node / multi-GPU Full-CI
The Full-CI vector grows factorially and quickly exceeds a single GPU’s memory (e.g. C₂/6-31g has ~3.4×10⁸ determinants and does not fit one GPU). A distributed solver shards the FCI vector across MPI ranks, one GPU per rank.
Multi-node Full-CI uses an MPI-enabled build, provided as a separate artifact — it is not part of the standard pip install gansu2 wheel. With that build available, launch it with mpirun through the script/gansu2_mpi.sh wrapper, which pins each rank to exactly one GPU (CUDA_VISIBLE_DEVICES=$LOCAL_RANK) so every rank sees its GPU as device 0:
# 2 ranks → 2 GPUs
mpirun -np 2 --bind-to none ../script/gansu2_mpi.sh \
gansu2 -x ../xyz/C2.xyz -g 6-31g --post_hf_method fci
The dispatch is automatic: with more than one rank the distributed solver runs; with -np 1 (or a non-MPI build) the single-GPU solver is used. Both give the same energy to machine precision.
[!NOTE]
script/gansu2_mpi.shresolves the node-local rank from Open MPI, MVAPICH2, Slurm (srun), or MPICH/Intel MPI environment variables, so the same wrapper works across launchers and scales to multiple nodes unchanged (one GPU per rank).
4. Excited State Calculations
# CIS — 10 excited states
gansu2 -x h2o.xyz -g cc-pvdz --post_hf_method cis --n_excited_states 10
# ADC(2) — accurate excited states
gansu2 -x h2o.xyz -g cc-pvdz --post_hf_method adc2
# EOM-CCSD — gold standard for excited states
gansu2 -x h2o.xyz -g cc-pvdz --post_hf_method eom_ccsd
# STEOM-CCSD — auto-runs CIS-NTO + IP-EOM + EA-EOM (RI recommended)
gansu2 -x h2o.xyz -g cc-pvdz --eri_method ri -ag cc-pvdz-rifit.gbs \
--post_hf_method steom_ccsd --n_excited_states 5
# Triplet states
gansu2 -x h2o.xyz -g cc-pvdz --post_hf_method adc2 --spin_type triplet
4b. DMET-CCSD (Fragment-Based Correlation)
DMET-CCSD partitions the molecule into atom-localized fragments, builds an embedding cluster (fragment AOs + Schmidt-decomposed bath orbitals) for each, and runs CCSD per cluster. Total correlation is reconstructed by democratic projection. Fragments can be distributed across several GPUs.
# Auto fragment detection (recommended): each heavy atom + nearest H atoms
# Benzene → 6 CH fragments, 2 unique by symmetry
gansu2 -x ../xyz/Benzene.xyz -g sto-3g --eri_method ri \
-ag ../auxiliary_basis/cc-pvdz-rifit.gbs \
--post_hf_method dmet --num_gpus 4
# DMET-CCSD(T) — perturbative triples added per fragment at converged μ_DMET
gansu2 -x ../xyz/Benzene.xyz -g sto-3g --eri_method ri \
-ag ../auxiliary_basis/cc-pvdz-rifit.gbs \
--post_hf_method dmet_ccsd_t --num_gpus 4
# Manual fragment specification (atom indices, 0-indexed)
gansu2 -x ../xyz/Benzene.xyz -g sto-3g --post_hf_method dmet \
--dmet_fragments "{0,6} {1,7} {2,8} {3,9} {4,10} {5,11}"
# Vayesta-compatible loose tolerance (faster bisection, ~1% N deviation)
gansu2 -x ../xyz/Benzene.xyz -g sto-3g --post_hf_method dmet \
--dmet_n_tol 4.2e-3
The output reports both T-amplitude democratic energy and the standard QC-DMET (Vayesta-convention) energy:
---- DMET-CCSD Summary ----
Chemical potential μ_DMET (CCSD-relaxed): -1.144e-03 Ha
Total DMET-CCSD correlation energy (T-amp democratic): -0.3043 Ha
Total DMET-CCSD correlation energy (DMET, Vayesta): -0.4938 Ha
HF energy: -227.8926 Ha
DMET-CCSD total energy (DMET): -228.3864 Ha
4c. DLPNO-CCSD / DLPNO-CCSD(T) (Local Correlation)
DLPNO-CCSD and DLPNO-CCSD(T) (Riplinger & Neese, 2013/2016) exploit four nested locality layers — occupied LMO localization (Pipek-Mezey), projected atomic orbitals + per-LMO atom domains, per-pair PNO truncation, and strong/weak-pair partitioning — to achieve near-canonical CCSD(T) accuracy at near-linear scaling. They run on an RHF reference, on one or several GPUs; the RI back-end is required. UHF and ROHF references are also accepted; there they are intended for small molecules, since memory and time are those of canonical UCCSD.
# DLPNO-CCSD on water hexamer (normal preset)
gansu2 -x ../xyz/large_molecular/water_hexamer.xyz -g cc-pvdz \
--eri_method ri -ag ../auxiliary_basis/cc-pvdz-rifit.gbs \
--post_hf_method dlpno_ccsd --dlpno_preset normal --num_gpus 8
# DLPNO-CCSD(T) — adds perturbative triples (TNO basis)
gansu2 -x ../xyz/large_molecular/water_hexamer.xyz -g cc-pvdz \
--eri_method ri -ag ../auxiliary_basis/cc-pvdz-rifit.gbs \
--post_hf_method dlpno_ccsd_t --dlpno_preset normal --num_gpus 8
# Tighter accuracy (closer to canonical, larger PNO/TNO basis)
gansu2 ... --post_hf_method dlpno_ccsd_t --dlpno_preset tight
ORCA-compatible truncation presets: loose / normal (default) / tight / very_tight. On very large systems where the singles terms would not fit in memory, the run falls back to DLPNO-CCD and prints a warning. See DLPNO parameters for the presets and Advanced parameters for the individual t_cut_* cutoffs.
4d. Exporting Localized Orbitals
Occupied orbitals can be localized (Pipek-Mezey) and written to a Molden file for visualization in Avogadro / Jmol / VMD / MOrbVis. Works for any SCF method (RHF / UHF / ROHF); no DLPNO calculation is run.
# Closed-shell: 1 localization, writes occupied LMOs + canonical virtuals
gansu2 -x ../xyz/Benzene.xyz -g cc-pvdz --export_lmo_molden 1
# → output_lmo.molden
# UHF: α and β occupied blocks localized independently
gansu2 -x ../xyz/radical.xyz -g cc-pvdz -m UHF --export_lmo_molden 1
For ROHF, doubly-occupied and singly-occupied subspaces are localized separately so closed-shell core and open-shell electrons do not mix. Pass --export_molden 1 --export_lmo_molden 1 together to emit both canonical (output.molden) and localized (output_lmo.molden) files in a single run.
4e. CASSCF
# RHF 参照の CAS(4e,4o)
gansu2 -x ../xyz/H2O.xyz -g cc-pvdz --post_hf_method casscf --casscf_active 4e,4o
# 活性軌道を番号(0 始まり)で: ベンゼンの π 軌道 6 つ
gansu2 -x ../xyz/Benzene.xyz -g cc-pvdz --post_hf_method casscf --casscf_active 16,19-22,29
# 3 根の状態平均
gansu2 -x ../xyz/H2O.xyz -g cc-pvdz --post_hf_method casscf --casscf_active 4e,4o \
--casscf_objective SA --casscf_roots 3 --casscf_weights uniform
# ROHF 参照・RI 積分
gansu2 -x ../xyz/OH.xyz -g cc-pvdz -m rohf --eri_method ri --post_hf_method casscf --casscf_active 3e,3o
# direct の積分、J と K を 4 GPU で
gansu2 -x ../xyz/Benzene.xyz -g cc-pvdz --eri_method direct --num_gpus 4 \
--post_hf_method casscf --casscf_active 16,19-22,29
# CASSCF に続けて NEVPT2(強縮約)
gansu2 -x ../xyz/H2O.xyz -g cc-pvdz --post_hf_method casscf --casscf_active 4e,4o \
--post_casscf_method nevpt2-sc
CASSCF は GPU が必要で、コマンドラインからだけ使えます。詳細は CASSCF parameters。
5. Energy Gradient
# Stored-ERI analytical gradient
gansu2 -x h2o.xyz -g cc-pvdz -r gradient
# RI analytical gradient, single- or multi-GPU
gansu2 -x h2o.xyz -g cc-pvdz --eri_method ri -ag cc-pvdz-rifit.gbs -r gradient
gansu2 -x h2o.xyz -g cc-pvdz --eri_method ri -ag cc-pvdz-rifit.gbs -r gradient --num_gpus 4
# Spherical-basis gradient
gansu2 -x h2o.xyz -g cc-pvdz --eri_method ri -ag cc-pvdz-rifit.gbs -r gradient --use_spherical 1
Analytical gradients are available for RHF/UHF (stored, Direct) and RHF (RI, single- and multi-GPU) and ROHF, in both Cartesian and spherical bases. Post-HF gradients (--eri_method stored, or ri (Cartesian or spherical basis) with the RI two-electron derivatives, consistent with the RI energy): MP2, SCS-MP2, SOS-MP2, CC2, CCSD, CCSD(T), CIS and ADC(2) for RHF, MP2, SCS-MP2, SOS-MP2, CCSD, CCSD(T), CIS and ADC(2) for UHF (UMP2 / UCCSD / UCCSD(T) / UCIS / ADC(2) with --eri_method stored; all but RHF-MP2 on GPU only), frozen core and ECPs included. For large molecules the RI MP2 / SCS-MP2 / SOS-MP2 and ADC(2) (singlet) gradients and the RI ADC(2) energies switch automatically to three-index forms (no nao⁴ arrays) when the four-index route does not fit the GPU; give an RI fitting set (-ag ...-rifit) for correlated gradients, as a JK fitting set amplifies rounding there. The CCSD(T) gradient keeps all triples amplitudes in memory and is intended for small molecules. For UHF, tighten the SCF (--convergence_energy_threshold 1e-12 or below): the relaxed-density gradient assumes converged orbitals. CIS excited states (RHF reference, singlet or triplet, GPU) ADC(2) excited states (RHF singlet or triplet, UHF; GPU) and SOS-ADC(2) (RHF singlet or triplet, RI; GPU) are --post_hf_method cis (or adc2, sos_adc2) -r gradient --grad_root n (state n, 1 = lowest); excited-state gradients are first order in the orbital error, so tighten the SCF further (e.g. --convergence_energy_threshold 1e-14). RKS / UKS gradients are described under DFT. Other post-HF methods stop with an error rather than returning the HF gradient.
gansu2 -x h2o.xyz -g cc-pvdz --post_hf_method ccsd -r gradient
6. Geometry Optimization
# Create a distorted H2
cat > h2_stretched.xyz << 'EOF'
2
Stretched H2
H 0.000 0.000 0.000
H 0.000 0.000 1.500
EOF
# Optimize with BFGS (default)
gansu2 -x h2_stretched.xyz -g cc-pvdz -r optimize
# Optimize with Newton-Raphson (uses analytical Hessian)
gansu2 -x h2_stretched.xyz -g cc-pvdz -r optimize --optimizer newton
7. Vibrational Frequencies (Hessian)
gansu2 -x h2o.xyz -g cc-pvdz -r hessian
8. UHF for Open-Shell Systems
# Hydrogen atom (1 electron)
cat > h_atom.xyz << 'EOF'
1
Hydrogen atom
H 0.000 0.000 0.000
EOF
gansu2 -x h_atom.xyz -g cc-pvdz -m UHF
9. Charged Molecules
# OH- anion
cat > oh.xyz << 'EOF'
2
Hydroxide
O 0.000 0.000 0.000
H 0.000 0.000 0.970
EOF
gansu2 -x oh.xyz -g cc-pvdz -c -1
10. RI Approximation for Large Molecules
# Explicit auxiliary basis
gansu2 -x benzene.xyz -g cc-pvdz --eri_method ri -ag ../auxiliary_basis/cc-pvdz-rifit.gbs
# No -ag: the bundled def2-universal-jkfit (generated from the primary basis for elements it lacks)
gansu2 -x benzene.xyz -g cc-pvdz --eri_method ri
11. CCSD Density Matrix (for DMET)
gansu2 -x h2o.xyz -g cc-pvdz --post_hf_method ccsd_density
12. CPU-Only Mode
gansu2 -x h2o.xyz -g sto-3g --cpu
gansu2 -x h2o.xyz -g cc-pvdz --post_hf_method ccsd --cpu
13. Using a Parameter Recipe File
cat > recipe.txt << 'EOF'
method = RHF
convergence_method = DIIS
initial_guess = sad
eri_method = stored
EOF
gansu2 -p recipe.txt -x h2o.xyz -g cc-pvdz --post_hf_method mp2
14. List Available Basis Sets
gansu2 --list-basis
Full Parameter Reference
See parameters.md for the commonly used parameters, and parameters_advanced.md for the tuning options.
Tips
- Basis set names are case-insensitive:
cc-pvdz,CC-PVDZ,cc-pVDZall work. - SAD initial guess (
--initial_guess sad) is recommended for faster SCF convergence on molecules larger than H2. - RI approximation (
--eri_method ri) dramatically reduces memory usage for larger molecules. Performance is comparable to stored ERI for small molecules. - GPU acceleration is automatic when an NVIDIA GPU is detected. Use
--cputo force CPU execution for benchmarking or debugging.