CASCI And CASSCF Reference#
Start with CASSCF to optimize the reference orbitals. Choose the active space
and states before changing optimizer controls. Use fixed-orbital casci for the
more specialized task of solving CI without optimizing those orbitals.
FCI is the default solver; omit its name when no alternative is intended.
Use the main input guide first and the
SCF guide for its required completed starting reference.
What Usually Changes#
Decision |
Necessary settings |
|---|---|
Reference space |
Positive |
Orbital optimization |
Choose the |
Target states |
Add |
Initial character |
Add AVAS labels and an optional projector basis when starting-MO ordering needs them. |
Approximation/resources |
Use DF first, including with native auxiliary selection; choose explicit worker bounds where necessary. Change convergence controls only for a stated need. |
The CASSCF reference CAS is not the later selected orbital window or
selected-determinant space. For example, a small optimized reference may supply
orbitals for a larger subsequent correlation window. Do not copy the later
selected-orbital count into active_orbitals automatically.
When Defaults Are Sufficient#
If the SCF MOs already provide the intended active ordering and a single root is wanted, omit AVAS, state averaging and spin penalties. Keep the default optimizer settings unless an accuracy requirement or observed failure justifies an override. YAML defaults owns the complete numerical reference; a stage review can legitimately require no additional solver fields.
Enable runtime orbital projections before the run. They are a deliberate diagnostic choice even when all optimizer defaults suffice. Monitor the target shells plus other plausibly important channels, not only the initial active space; see runtime projections.
An active stage requires both CAS counts. Labels, state averaging or a spin penalty without them are an incomplete request. Convergence, charge/spin, DF or solver fields alone do not define an active space.
DF And Stage-Local Changes#
DF is independent of FCI versus block2. Configure density_fit and, when needed,
auxbasis on the active stage as well as SCF. Neither setting is inherited
from SCF. A deliberately exact active stage removes the upstream DF wrapper.
The selected reference’s own provider determines later export; setting
mppt.integral_mode cannot convert it to another approximation.
Add charge or spin only when the active-stage system differs from the SCF
reference. The override rebuilds the molecule and a reference object without
running another SCF kernel. AVAS still uses the completed original SCF. Check
electron/CAS/multiplicity consistency explicitly rather than assuming the
override also reoptimizes that SCF reference.
Use the single PySCF thread budget, parallelism.threads, to
bound OpenMP and BLAS across active-space work. Optional phases.casscf and
phases.active_solver overrides distinguish orbital work from FCI/block2 calls.
Without parallelism, the existing all-detected-thread stage policy remains.
Each block2 solver receives a durable block2-thread-launcher beside its
settings.json. The launcher applies the active-solver OMP/BLAS environment for
every child invocation, including response and density calls; solver.threads
uses the same OpenMP count. Native block2 mkl_thrds also receives the BLAS count
because block2 rebuilds its own thread configuration after startup.
An inherited MKL_DOMAIN_NUM_THREADS is cleared for
that child so it cannot override the requested MKL limit. Settings record the
original executable, launcher and count-only environment; MPI stays disabled.
Child environment values are launch requests, not child-runtime readbacks.
Stage memory, DMRG workspace and a host hard RSS limit are different controls. The omitted gradient tolerance is derived from the configured energy tolerance; do not add an independent tolerance without a reason.
Small Complete Input#
Save this CASSCF reference example as lih.yaml. It uses a small LiH model with
DF at both stages and two equally weighted singlets. Native auxiliary selection
is left in place. Runtime projections follow Li core/valence, the additional
Li p channel and H character across all orbital spaces. One thread and 512 MB
are explicit small-example resource choices, not software defaults.
molecule:
atoms:
- [Li, 0.0, 0.0, 0.0]
- [H, 0.0, 0.0, 1.6]
max_memory: 512.0
basis:
Li: [library, sto-3g]
H: [library, sto-3g]
scf:
spin: 1
density_fit: true
omp_num_threads: 1
casscf:
active_orbitals: 4
n_active_electrons: 2
density_fit: true
omp_num_threads: 1
states_to_average: [[singlet, 2]]
runtime_projections:
labels: ["Li 1s", "Li 2s", "Li 2p", "H 1s"]
Stop at the active-space checkpoint, before integral export:
pyscf2mppt lih.yaml --output-dir runs/lih --stop-after casscf
This prepares DF-SCF followed by orbital-optimized DF-CASSCF. Inspect convergence, state character and the projection history in the actual run.
For a deliberate fixed-orbital comparison, rename casscf to casci. CASCI
disables final canonicalization to retain the supplied basis; requested AVAS
still prepares the initial ordering first. Changing the method requires a new
run directory, not a modified-input resume. The same stop flag applies to both
methods. Before continuing to export, configure the intended selected window
and explicit downstream vacuum; an omitted window means full-ERI export, not
automatic selection of this CAS.
Numerical Diagnostics And Completion#
Frontend density trace, Hermiticity, averaging, occupation and weight checks
emit [WARN] and preserve the returned density and checkpoint. Their diagnostic
tolerances do not change PySCF, FCI or block2 convergence controls. This also
applies with mppt.no_dump: true.
If SCF reports converged=False but returns the required orbital arrays, the
frontend warns and allows the active-space stage to proceed. CASSCF retains its
own convergence status after its macroiteration limit; completion does not imply
convergence. Native solver exceptions/nonzero exit codes, missing arrays and
incompatible dimensions still stop the calculation. Conflicting initial-density
orbital tags remain a structural error because DF exchange consumes those tags.
The saved-reference importer has a separate admission rule: both source SCF
and CASSCF/CASCI must be converged. Continuing active work after an unconverged
SCF does not make that checkpoint eligible for --reference-checkpoint.
AVAS Initial Guess#
Use avas_labels when a label-driven initial active ordering is needed. This
is the starting CASSCF/CASCI orbital guess, not the SCF starting density and
not determinant selection. Omission, null or empty labels retain SCF orbitals
for the initial ordering. Rotating the converged reference before export is
another operation: see orbital generation.
For a system with an explicitly chosen five-electron, five-orbital Fe 3d space, the stage fragment is:
casscf:
active_orbitals: 5
n_active_electrons: 5
avas_labels: ["Fe 3d"]
The molecule, charge, multiplicity and working basis must match that model.
Add avas_basis only when the working AOs do not define the intended projector:
casscf:
avas_basis:
Fe: [library, def2-svp]
The second fragment augments an already defined stage; it is not a complete
active-space request. The working orbital basis remains basis. Projector
bases are independent of DF auxiliary bases and
runtime projection diagnostics.
See the AO-label rules and
reference-basis loading rules.
How The Starting Orbitals Are Built#
Require available SCF coefficients, occupations and energies before active work. Check the SCF convergence flag: the warning-only frontend permits continuation with an unconverged SCF guess and preserves that flag.
Form the metric-correct projector onto the union of all matched reference AOs and diagonalize occupied and virtual MO blocks separately.
Partition/reorder the initial MOs and canonicalize inactive, active and remaining virtual blocks.
Pass that ordering with the explicitly requested CAS counts to CASCI/CASSCF.
The fixed internal AVAS settings are in the defaults reference. They are not extra YAML controls. Its open-shell mode does not guarantee retention of every singly occupied orbital; changing the reference basis can change the inferred space at the same threshold. The leading-MO AVAS exclusion is also not a global frozen-core setting.
A completed CASSCF does not change the earlier SCF convergence flag. The saved-reference importer separately requires both source stages to be converged; continuation after unconverged SCF does not authorize checkpoint import.
Requested Counts, Errors And Checkpoints#
AVAS reports inferred orbital/electron counts but does not replace the supplied
CAS counts. A mismatch warns and continues with the AVAS MOs as an ordered guess.
Review projector eigenvalues, CASSCF AVAS projection basis and AVAS guess built
before attributing a result to the intended active space. The eigenvalues are
initial-guess evidence, not final optimized-MO character.
Explicit nonempty avas_basis loading/label/AVAS errors propagate. In the working
basis mode an AVAS failure instead warns and falls back to SCF MOs. Neither a
warning nor a successful guess establishes the intended converged reference.
Inspect final orbital diagnostics separately.
AVAS labels/basis do not automatically configure final MPPT projector analysis. For a like-for-like final comparison, choose the corresponding final diagnostic labels/basis explicitly without enabling generation. Such a diagnostic group can evaluate all MOs, not only rows named by its occupied/virtual group name.
--stop-after casscf saves returned active-stage MOs, not an AVAS-only
intermediate. Completed-stage resume restores them without rerunning AVAS.
Changed labels/basis require a fresh scientific input/output directory; see
preview and restart rules.
Accepted Stage Aliases#
Use canonical fields in new inputs. Accepted aliases share their behavior:
Alias |
Canonical key |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Numerical Diagnostics And Completion#
Active-space macroiterations reuse the SCF reference’s cached physical AO hcore,
including through DF/undo_df views. A new charge/spin reference reuses it only
when its built one-electron operator matches; otherwise it builds a fresh entry.
MO rotations and changing active-space densities do not invalidate this cache.
Frontend density trace, Hermiticity, averaging, occupation and weight checks
emit [WARN] and preserve the returned density and checkpoint. Their diagnostic
tolerances do not change PySCF, FCI or block2 convergence controls. This also
applies with mppt.no_dump: true.
If SCF reports converged=False but returns the required orbital arrays, the
frontend warns and allows the active-space stage to proceed. CASSCF retains its
own convergence status after its macroiteration limit; completion does not imply
convergence. Native solver exceptions/nonzero exit codes, missing arrays and
incompatible dimensions still stop the calculation.
Runtime Orbital Projections#
Strongly recommended: enable runtime_projections for CASSCF. Track how
target character moves between inactive, active and external spaces during
optimization. Include extra shells that may matter for later occupation analysis;
collecting their history now is preferable to repeating a calculation to recover
missing iteration diagnostics. Include them even when they are not in the
initial CAS or AVAS target.
The setting is off in the software defaults and independent of AVAS orbital preparation. For a Ce model where these channels are relevant, use this fragment:
casscf:
active_orbitals: 17
n_active_electrons: 11
runtime_projections:
labels: ["Ce 4f", "Ce 5d", "Ce 6s", "Ce 6p"]
This is a stage fragment; keep your molecule, basis and solver settings.
labels follows the existing AO-label syntax. Each string creates one table;
a nested list creates one table for the union of its AO matches.
Choose labels represented by the working/projector basis. The same option is
useful for a deliberate CASCI run, but gives only its completed snapshot.
Projection weights describe orbital character, not electron occupations. Use them alongside the physical state/1-RDM population tables in PySCF reporting, not as a substitute for those populations.
The threshold is inclusive and applies before rounding. 0.01 means 1%.
Cells show percentages with two decimal places. A row is retained if its raw
weight meets the threshold at any displayed step. Subthreshold cells show —.
The MO numbers are one-based native orbital positions, not tracked identities.
Orbital projections: Ce 5d | c² (%)
MO space initial m1 m2
8 inactive — 1.23 2.45
113 active 24.00 23.10 22.00
The numbers above illustrate formatting. Long histories split into consecutive column blocks with repeated label, units, headers and identical MO rows/order.
Fixed Targets And Snapshot Boundaries#
Projector labels, overlaps and metric pseudoinverses are cached before the solve.
Weights are evaluated for all MOs without a full MO-by-MO projector matrix.
An optional runtime_projections.basis uses the same element/atom-label
[library, name] or [file, path] mapping as avas_basis, but is independent:
runtime_projections:
labels: ["O 2p"]
basis:
O: [library, sto-3g]
Omitting this basis uses the working AOs, including their radial-shell label conventions. A label alone does not certify a physical atomic shell. Managed runs capture and fingerprint explicit projector files with other input resources.
CASSCF reports the actual post-AVAS starting orbitals, then every completed
mc1step macroiteration using fresh callback orbitals. Microsteps are excluded;
ordinary progress throttling does not suppress projection snapshots. A changed
returned basis is labelled final/final_postcanonicalization, separately from
macroiterations. An identical final basis is not printed twice.
CASCI reports one completed casci snapshot. FCI and block2 use the same
diagnostic path. Diagnostics invoke no additional solver, Fock or AO2MO work.
They do compute overlap integrals once and small projector/active-space algebra.
Traces, Raw History And Resume#
Each snapshot reports unthresholded inactive/active/external traces, their changes from the previous snapshot and start, and the minimum squared principal overlap of the active space with both references. These are orbital weights, not electron populations. The raw file retains all principal overlaps; no MO reordering, clipping or population reconstruction is performed.
The log names a unique runtime_projections/<method>-<execution-id>.jsonl
under the execution workdir. The first record contains schema version, execution
ID, label/basis specifications, projector and starting-MO hashes, partition counts
and threshold. Subsequent records contain UTC timestamps, step/phase/macro,
MO hash, all raw weights, traces, trace changes and active principal overlaps.
Weights are label-major with native MO order; traces use inactive/active/external
order. Full MO matrices are not stored by diagnostics.
A fresh execution always starts a new file. Completed-stage resume leaves earlier histories untouched and emits the existing restored-result report without running a solver or inventing missing macroiterations. Preserve the entire workdir to retain these optional histories; they are not required checkpoint artifacts.
The supported callback boundary is restricted real-orbital PySCF mc1step,
including its DF and state-average wrappers. Other native optimization kernels
need their own boundary validation. Large-system runtime overhead is not benchmarked.
Enable block2#
Check the current MPPT environment first. block2 and its adapter may already be installed; do not reinstall a working environment merely to follow this page:
python -m pip show block2 pyscf-dmrgscf
command -v block2main
block2main -v
If the backend is absent and installation is authorized, use a separate working MPPT environment on Linux x86-64. The adapter checks used these pinned dependencies:
python -m pip install \
'block2==0.5.4' 'mkl==2024.2.2' 'mkl-include==2024.2.2' \
'intel-openmp==2024.2.1' 'tbb==2021.13.1' \
'pyscf-dmrgscf @ git+https://github.com/pyscf/dmrgscf.git@a03f7b6c67c61626f129e9c0c771016c14912400'
block2main -v
The adapter resolves block2main from PATH and configures dmrgscf without editing
site-packages. It uses single-node OpenMP, with no MPI launcher. The FCI route
does not load dmrgscf or require block2. Native loader errors remain errors.
Select the optional solver with this stage fragment. Omitted DMRG controls use the documented solver defaults, so do not copy their full list just to activate block2:
solver: block2
omp_num_threads controls the external solver as well as the parent stage.
memory_gb is block2’s workspace hint in GB; PySCF max_memory is in decimal MB.
Neither is a hard RSS cap. DMRG options with solver: fci are rejected.
Sweep Schedule#
With no explicit schedule, sweep zero uses min(250, M) and noise 1e-4.
Halfway through max_sweeps, the solver switches to full M, zero noise, and
Davidson tolerance energy_tolerance / 10. The initial Davidson tolerance is
max(1e-5, energy_tolerance). One-dot begins at floor(2*max_sweeps/3).
For an explicit schedule, add these settings under dmrg:
max_bond_dimension: 500
max_sweeps: 16
twodot_to_onedot: 10
schedule:
- {sweep: 0, bond_dimension: 250, davidson_tolerance: 1.0e-5, noise: 1.0e-4}
- {sweep: 4, bond_dimension: 500, davidson_tolerance: 1.0e-7, noise: 1.0e-5}
- {sweep: 8, bond_dimension: 500, davidson_tolerance: 1.0e-9, noise: 0.0}
Sweep numbers are zero-based and strictly increasing, start at zero, and remain
below max_sweeps. The final entry must use maximum M and zero noise. The
one-dot switching sweep must also precede max_sweeps; at least four sweeps are
required. These defaults and examples are starting controls, not convergence evidence.
State Averaging And Saved Results#
states_to_average: [[2, 12]] requests twelve equally weighted doublets. The
user-facing number is multiplicity; the adapter passes twice spin to block2.
Mixed multiplicities use independent solvers and unique directories.
An entry may be [spin, nroots] or a mapping with required spin/nroots and
optional spin_penalty_shift. Counts and multiplicities must be positive;
unknown mapping fields are rejected. All requested roots across all blocks
receive uniform weights, not equal weight per block. There is no separate
CASSCF root-weight input.
PySCF’s FCI solver.spin selects an Mₛ sector; a lower-spin sector can also
contain higher-total-spin roots. Set a positive finite spin_penalty_shift in
Eh to target total spin. Without state averaging, it applies to the single FCI
solver and uses the effective active-stage multiplicity:
casscf:
active_orbitals: 5
n_active_electrons: 4
spin_penalty_shift: 1.0
With state averaging, the stage value is the default for every solver block.
Mapping entries can override it or explicitly disable it with null:
casscf:
active_orbitals: 5
n_active_electrons: 4
spin_penalty_shift: 1.0
states_to_average:
# Inherits 1.0 Eh.
- [singlet, 50]
# Uses a smaller block-specific shift.
- {spin: triplet, nroots: 45, spin_penalty_shift: 0.5}
# Keeps the native quintet solver.
- {spin: quintet, nroots: 5, spin_penalty_shift: null}
An omitted block key inherits the stage default. A positive finite block value
replaces it, and explicit null disables it for that block. Two-item entries
remain valid and inherit the default. The setup report shows the default and
effective block values.
The setting uses PySCF’s fix_spin level shift. It is not exact spin projection:
verify each root’s S² and repeat with another shift when unwanted spin remains.
Omitting every setting keeps native FCI behavior. Global and block-level spin
penalties are both rejected with solver: block2.
Penalized singlet state-average blocks use direct_spin1 with a zero-total-spin
target, avoiding the direct_spin0 singlet-symmetry check that can reject a
spin-mixed CI guess. Unpenalized singlet blocks retain direct_spin0.
Files remain under <run-root>/dmrg/spin<2S>-<unique>/: effective settings.json,
native configuration, FCIDUMP, the latest native log, MPS and density files.
Completed-stage checkpoints store orbitals, energies, per-root 1-RDMs, weights,
spin values, and the method/solver labels. Preserve the whole run directory.
Internally both methods use the established casscf checkpoint stage and
casscf.npz filename. Use --stop-after casscf for either method. Resuming a
completed active-space stage rebuilds its Hamiltonian/DF context without loading
block2 or running a kernel. This is completed-stage resume, not an automatic
restart of an interrupted DMRG solve or additional CASSCF macroiterations.
Continue CASSCF Optimization#
Use --continue-casscf to run additional macroiterations from saved optimized
orbitals in a new run directory. A source that reached its macroiteration
limit is a valid starting guess; this does not mark it converged. The source SCF
must be converged. Preserve checkpoints/, input/ and the complete dmrg/
directory for block2.
Create continue.yaml with the number of additional macroiterations and any
resource overrides:
casscf:
max_cycle_macro: 20
omp_num_threads: 8
max_memory: 150000
dmrg:
memory_gb: 150
pyscf2mppt run continue.yaml --continue-casscf previous/checkpoints \
--output-dir continued
Omit dmrg for an FCI source. Geometry, basis, embedding, charge, spin, active
space, state-average roots and solver settings are inherited. Allowed overrides
are molecule.max_memory, SCF/CASSCF memory and OpenMP controls,
casscf.dmrg.memory_gb and the required casscf.max_cycle_macro. Do not copy the
whole original YAML into the continuation input. For relocated runs, pass
--reference-input-dir /path/to/previous to resolve captured input resources.
parallelism is also a resource override. Omit it to inherit the source policy,
or supply a complete replacement: old phase overrides are not merged into it.
Explicit parallelism: null removes the inherited policy and selects the legacy
thread behavior. For example, on a worker with at least eight available CPUs,
this replacement requests a BLAS-priority DF build while retaining the stage
OpenMP setting elsewhere:
parallelism:
threads: 8
phases:
df_build:
omp_num_threads: 1
blas_num_threads: 8
Select limits for the actual worker and BLAS backend as described under
thread budgets. A retained casscf.omp_num_threads: 8 also applies
to DF. With the admitted in-core Cholesky path, auto allows BLAS eight as well;
conservative routes leave BLAS at one under that budget. Resource changes do not
alter the old run or its saved input.
The run restores SCF arrays, skips AVAS and uses the saved CASSCF MO coefficients.
DF factors and optimizer history are rebuilt. FCI recomputes CI at those orbitals.
Block2 copies each spin sector’s MPS, metadata and orbital ordering into a fresh
solver directory; missing or ambiguous state fails instead of starting fresh.
The first block2 call follows dmrgscf’s native fullrestart: up to eight one-dot
sweeps, zero noise, configured maximum bond dimension and energy tolerance.
Subsequent calls follow the normal CASSCF solver path.
The solver directory retains continuation-first.conf and
continuation-first.out before later calls overwrite the native working files.
Continuation defaults to stopping after CASSCF and records source hashes in
input/casscf-continuation.json. Old results are read-only. Repeat the same
command with --resume only to recover this new run: a completed new CASSCF stage
is reused, not extended again. For more iterations create another continuation
from its checkpoint. This is not a restart from an interrupted macroiteration.
To prepare the new run before mounting RAM-backed scratch, add --stop-after scf
to its first command. This copies the saved SCF checkpoint without running SCF or
CASSCF. Then mount scratch at the existing <output-dir>/scratch and repeat the
command with --resume and no --stop-after scf. Keep input, checkpoints and
dmrg/ on persistent storage. The tmpfs capacity and all processes share the
container or host RAM budget; PySCF max_memory is not a hard total-memory limit.
Limits And Acceptance#
The supported domain is real, restricted spatial orbitals and C1. The pinned dmrgscf contracts 2-RDM to obtain 1-RDM; a one-active-electron block2 calculation is rejected. Use FCI for that inexpensive case. External-solver errors propagate; there is no automatic fallback to FCI.
PySCF’s CASSCF converged flag concerns orbital optimization. A successful
block2 process or completed CASCI is not a certificate of convergence with bond
dimension. Review native sweep energies/discarded weights and compare increasing M.
Tiny LiH acceptance compares FCI and block2 energies to native exact FCI within
1e-8 Eh, and 1-RDMs within 1e-6, on identical final orbitals. CASSCF additionally
requires a changed inactive projector. Different approximate CI-response paths
need not produce identical orbitals after one unconverged macroiteration.
MPPT consumes these orbitals, densities and the physical Hamiltonian, not MPS coefficients. It still needs its own model-space selection. NEVPT2, transition RDMs and MPS-to-determinant export are outside this adapter. See the external DMRG reference example for a separate manual route.