10.18. mcscf
— Multiconfigurational selfconsistent field¶
The mcscf
implements orbital optimization for
MCSCF and CASSCF. 1step (combined orbital and wavefunction
optimization) and 2step algorithms (alternating orbital and wavefunction
optimization) are available. Different kinds of active space solvers can
be used with this module.
For example, a simple CASCI calculation can be run as:
import pyscf
mol = pyscf.M(
atom = 'O 0 0 0; O 0 0 1.2',
basis = 'ccpvdz',
spin = 2)
myhf = mol.RHF().run()
# 6 orbitals, 8 electrons
mycas = myhf.CASCI(6, 8).run()
and a simple CASSCF can be run as:
import pyscf
mol = pyscf.M(
atom = 'O 0 0 0; O 0 0 1.2',
basis = 'ccpvdz',
spin = 2)
myhf = mol.RHF().run()
# 6 orbitals, 8 electrons
mycas = myhf.CASSCF(6, 8).run()
The CASSCF orbital optimization is general and can be combined
with many different solvers, such as DMRG and selected CI solvers.
Optimized orbitals are stored in the attribute mycas.mo_coeff
.
10.18.1. Examples¶
Relevant examples
examples/mcscf/00simple_casci.py
examples/mcscf/00simple_casscf.py
examples/mcscf/01for_expensive_fci.py
examples/mcscf/03natural_orbital.py
examples/mcscf/04density_matrix.py
examples/mcscf/10define_cas_space.py
examples/mcscf/11casscf_with_uhf_uks.py
examples/mcscf/12c2_triplet_from_singlet_hf.py
examples/mcscf/13load_chkfile.py
examples/mcscf/13restart.py
examples/mcscf/14project_init_guess.py
examples/mcscf/15state_average.py
examples/mcscf/15state_specific.py
examples/mcscf/15transition_dm.py
examples/mcscf/16density_fitting.py
examples/mcscf/17approx_orbital_hessian.py
examples/mcscf/18o2_spatial_spin_symmetry.py
examples/mcscf/18spatial_spin_symmetry.py
examples/mcscf/19frozen_core.py
examples/mcscf/20change_symmetry.py
examples/mcscf/21active_space_symmetry.py
examples/mcscf/21nosymhf_then_symcasscf.py
examples/mcscf/22x2c.py
examples/mcscf/23local_spin.py
examples/mcscf/33make_init_guess
examples/mcscf/34init_guess_localization.py
examples/mcscf/40customizing_hamiltonian.py
examples/mcscf/41mcscf_custom_df_hamiltonian.py
examples/mcscf/41state_average.py
examples/mcscf/42compare_cas_space.py
examples/mcscf/43avas.py
examples/mcscf/43dmet_cas.py
examples/mcscf/44mcscf_active_space_hamiltonian.py
examples/mcscf/50casscf_then_dmrgscf.py
examples/mcscf/50casscf_with_selected_ci.py
examples/mcscf/50cornell_shci_casscf.py
examples/mcscf/50dmrgscf_with_block.py
examples/mcscf/51o2_triplet_by_various_fci.py
examples/mcscf/60uhf_based_ucasscf.py
examples/mcscf/61rcas_vs_ucas
examples/mcscf/70casscf_hot_tuning.py
examples/mcscf/70casscf_optimize_scheduler.py
CASCI and CASSCF
When using results of this code for publications, please cite the following paper: “A general second order complete active space selfconsistentfield solver for largescale systems”, Q. Sun, J. Yang, and G. K.L. Chan, Chem. Phys. Lett. 683, 291 (2017).
Simple usage:
>>> from pyscf import gto, scf, mcscf
>>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0)
>>> mf = scf.RHF(mol).run()
>>> mc = mcscf.CASCI(mf, 6, 6)
>>> mc.kernel()[0]
108.980200816243354
>>> mc = mcscf.CASSCF(mf, 6, 6)
>>> mc.kernel()[0]
109.044401882238134
>>> mc = mcscf.CASSCF(mf, 4, 4)
>>> cas_list = [5,6,8,9] # pick orbitals for CAS space, 1based indices
>>> mo = mcscf.sort_mo(mc, mf.mo_coeff, cas_list)
>>> mc.kernel(mo)[0]
109.007378939813691
mcscf.CASSCF()
or mcscf.CASCI()
returns a proper instance of CASSCF/CASCI class.
There are some parameters to control the CASSCF/CASCI method.
 verboseint
Print level. Default value equals to
Mole.verbose
. max_memoryfloat or int
Allowed memory in MB. Default value equals to
Mole.max_memory
. ncasint
Active space size.
 nelecastuple of int
Active (nelec_alpha, nelec_beta)
 ncoreint or tuple of int
Core electron number. In UHFCASSCF, it’s a tuple to indicate the different core eletron numbers.
 natorbbool
Whether to restore the natural orbital during CASSCF optimization. Default is not.
 canonicalizationbool
Whether to canonicalize orbitals. Default is True.
 fcisolveran instance of
FCISolver
The pyscf.fci module provides several FCISolver for different scenario. Generally, fci.direct_spin1.FCISolver can be used for all RHFCASSCF. However, a proper FCISolver can provide better performance and better numerical stability. One can either use
fci.solver()
function to pick the FCISolver by the program or manually assigen the FCISolver to this attribute, e.g.>>> from pyscf import fci >>> mc = mcscf.CASSCF(mf, 4, 4) >>> mc.fcisolver = fci.solver(mol, singlet=True) >>> mc.fcisolver = fci.direct_spin1.FCISolver(mol)You can control FCISolver by setting e.g.:
>>> mc.fcisolver.max_cycle = 30 >>> mc.fcisolver.conv_tol = 1e7For more details of the parameter for FCISolver, See
fci
.By replacing this fcisolver, you can easily use the CASCI/CASSCF solver with other FCI replacements, such as DMRG, QMC. See
dmrgscf
andfciqmcscf
.
The Following attributes are used for CASSCF
 conv_tolfloat
Converge threshold. Default is 1e7
 conv_tol_gradfloat
Converge threshold for CI gradients and orbital rotation gradients. Default is 1e4
 max_stepsizefloat
The step size for orbital rotation. Small step size is prefered. Default is 0.03. (NOTE although the default step size is small enough for many systems, it happens that the orbital optimizor crosses the barriar of local minimum and converge to the neighbour solution, e.g. the CAS(4,4) for C2H4 in the test files. In these systems, adjusting max_stepsize, max_ci_stepsize and max_cycle_micro, max_cycle_micro_inner and ah_start_tol may be helpful)
>>> mc = mcscf.CASSCF(mf, 6, 6) >>> mc.max_stepsize = .01 >>> mc.max_cycle_micro = 1 >>> mc.max_cycle_macro = 100 >>> mc.max_cycle_micro_inner = 1 >>> mc.ah_start_tol = 1e6 max_ci_stepsizefloat
The max size for approximate CI updates. The approximate updates are used in 1step algorithm, to estimate the change of CI wavefunction wrt the orbital rotation. Small step size is prefered. Default is 0.01.
 max_cycle_macroint
Max number of macro iterations. Default is 50.
 max_cycle_microint
Max number of micro iterations in each macro iteration. Depending on systems, increasing this value might reduce the total macro iterations. Generally, 2  3 steps should be enough. Default is 2.
 max_cycle_micro_innerint
Max number of steps for the orbital rotations allowed for the augmented hessian solver. It can affect the actual size of orbital rotation. Even with a small max_stepsize, a few max_cycle_micro_inner can accumulate the rotation and leads to a significant change of the CAS space. Depending on systems, increasing this value migh reduce the total number of macro iterations. The value between 2  8 is preferred. Default is 4.
 frozenint or list
If integer is given, the innermost orbitals are excluded from optimization. Given the orbital indices (0based) in a list, any doubly occupied core orbitals, active orbitals and external orbitals can be frozen.
 ah_level_shiftfloat, for AH solver.
Level shift for the Davidson diagonalization in AH solver. Default is 0.
 ah_conv_tolfloat, for AH solver.
converge threshold for Davidson diagonalization in AH solver. Default is 1e8.
 ah_max_cyclefloat, for AH solver.
Max number of iterations allowd in AH solver. Default is 20.
 ah_lindepfloat, for AH solver.
Linear dependence threshold for AH solver. Default is 1e16.
 ah_start_tolflat, for AH solver.
In AH solver, the orbital rotation is started without completely solving the AH problem. This value is to control the start point. Default is 1e4.
 ah_start_cycleint, for AH solver.
In AH solver, the orbital rotation is started without completely solving the AH problem. This value is to control the start point. Default is 3.
ah_conv_tol
,ah_max_cycle
,ah_lindep
,ah_start_tol
andah_start_cycle
can affect the accuracy and performance of CASSCF solver. Lowerah_conv_tol
andah_lindep
can improve the accuracy of CASSCF optimization, but slow down the performance.>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.UHF(mol) >>> mf.scf() >>> mc = mcscf.CASSCF(mf, 6, 6) >>> mc.conv_tol = 1e10 >>> mc.ah_conv_tol = 1e5 >>> mc.kernel() 109.044401898486001 >>> mc.ah_conv_tol = 1e10 >>> mc.kernel() 109.044401887945668 chkfilestr
Checkpoint file to save the intermediate orbitals during the CASSCF optimization. Default is the checkpoint file of mean field object.
Saved results
 e_totfloat
Total MCSCF energy (electronic energy plus nuclear repulsion)
 cindarray
CAS space FCI coefficients
 convergedbool, for CASSCF only
It indicates CASSCF optimization converged or not.
 mo_energy: ndarray,
Diagonal elements of general Fock matrix
 mo_coeffndarray, for CASSCF only
Optimized CASSCF orbitals coefficients Note the orbitals are NOT natural orbitals by default. There are two inbuilt methods to convert the mo_coeff to natural orbitals. 1. Set .natorb attribute. It can be used before calculation. 2. call .cas_natorb_ method after the calculation to inplace convert the orbitals
10.18.2. CASSCF active space solver¶
10.18.2.1. DMRG solver¶
10.18.2.2. FCIQMC solver¶
10.18.2.3. Stateaverage FCI solver¶
10.18.2.4. Stateaverage with mixed solver¶
10.18.3. Symmetry broken¶
10.18.4. Initial guess¶
10.18.5. Canonical orbitals¶
Orbital canonicalization are controlled by parameters mc.canonicalization
and mc.natorb
(assuming the MCSCF object is mc
). The order of
orbitals are affected by the parameter mc.sorting_mo_energy
.
canonicalization: This flag canonicalizes orbitals in core and external space using general Fock matrix.
natorb: Transforms active orbitals using 1particle density matrices.
sorting_mo_energy: Sort orbitals based on the diagonal elements of the general Fock matrix.
Enabling natorb or sorting_mo_energy may slightly change the total energy of DMRG solver or selected CI solver.
General Fock matrix is defined as
\(\gamma\) is the total density matrix which includes the doubly occupied core density matrix and correlated density matrix in active space.
If mc.canonicalization
is enabled, CASCI/CASSCF will call
the mc.canonicalize()
function to diagonalize orbitals in
core space and external space. Orbitals in active space are not changed if
merely setting mc.canonicalization
. In the attribute
mc.mo_energy
, eigenvalues of general Fock matrix for core and external
subspaces are stored in the corresponding subsectors. The sector of active
space in mc.mo_energy
stores the expectation value of general Fock
\(\langle \phiF\phi\rangle\).
By default, mc.canonicalization
is enabled because the canonicalized
MCSCF orbitals can simplify the implementations of MRPT (NEVPT2) methods.
mc.natorb
controls whether the CASCI/CASSCF active space orbitals are
transformed to natural orbitals w.r.t. the correlated density matrix. When this
parameter is enabled, the natural orbitals will be stored in the active part of
the attribute mc.mo_coeff
and the CI coefficients mc.ci
(if
applicable) will be transformed accordingly.
By default mc.natorb
is disabled because natural orbitals may not be
favored by total energy for an arbitrary CI solver. We make this default value
to ensure that a CASCI calculation followed by a CASSCF calculation (e.g.
DMRGCASSCF then DMRGCASCI) produces results same to the CASSCF results.
The CASCI calculation may produce different
The value of mc.natorb
does not affect (the default) FCI solver. But
this is not true for external large active space solvers such
as DMRG, selected CI methods. It is recommended to disable mc.natorb
in
these calculations.
Following presents what the mc.mo_coeff
would be like for different
combinations of mc.canonicalization
and mc.natorb
in a
CASCI calculation:
mc.canonicalization = False
andmc.natorb = False
:
The resultant orbitals mc.mo_coeff
are identical to the input orbitals.
If the CASCI was initialized with a RHF calculation, mc.mo_coeff
points
to RHF orbitals.
mc.canonicalization = True
andmc.natorb = False
:
Core part and external part of mc.mo_coeff
are canonicalized orbitals,
which diagonalize the core and external blocks of general Fock matrix. The
orbitals in active space are identical to the active orbitals in the input.
mc.canonicalization = False
andmc.natorb = True
Core and external part of mc.mo_coeff
are identical to the core and
external part of the input orbitals. Active space orbitals are transformed to
the natural orbitals of the correlated density matrix.
mc.canonicalization = True
andmc.natorb = True
mc.mo_coeff
are completely different to the input orbitals.
Please note that elements of mc.mo_energy
may not be sorted ascendantly.
Parameter mc.sorting_mo_energy
can affect the ordering of MCSCF orbitals
when :attr:`mc.canonicalization` or :attr:`mc.natorb` is enabled.
By default, canonical orbitals in the core and external space
are sorted by the orbital energies (from low to high) and the natural orbitals
in the active space are sorted by natural occupations (from large to small).
If point group symmetry is enabled in the calculation, canonical orbitals are
sorted within each symmetry sector only (rather than the entire core or external
space). Irreducible representation labels (can be accessed via
mc.mo_coeff.orbsym
) are assigned to orbitals in the initial
guess and they will not be changed in the MCSCF optimization and the subsequent
canonicalization procedure. Setting mc.sorting_mo_energy
(though not
recommended) can force the orbitals to be sorted against energy (or occupations
in active space) regardless whether the point group symmetry is used.
In certain scenario, you may want to enable both mc.natorb
and
mc.sorting_mo_energy
.
examples/dmrg/31cr2_scan/cr2scan.py
provides one example that needs both
parameters. In that example, the dissociation curve of Cr dimer
was scanned using heatbath selectedCI method in which the active space of
selectedCICASSCF was gradually enlarged in a series of CASSCF calculations.
Since the selectedCI algorithm depends on the initial single determinant, the
orbital ordering does matter to the final CASSCF results.
mc.natorb
and mc.sorting_mo_energy
have to be enabled to make
sure that the each selectedCI starts from the similar initial reference at
each point on the dissociation curve. Without these settings, the differences
in the orbital ordering can lead to discontinuous potential energy curve.
10.18.6. Program reference¶
10.18.6.1. CASCI¶

class
pyscf.mcscf.casci.
CASCI
(mf_or_mol, ncas, nelecas, ncore=None)[source]¶  Args:
 mf_or_molSCF object or Mole object
SCF or Mole to define the problem size.
 ncasint
Number of active orbitals.
 nelecasint or a pair of int
Number of electrons in active space.
 Kwargs:
 ncoreint
Number of doubly occupied core orbitals. If not presented, this parameter can be automatically determined.
 Attributes:
 verboseint
Print level. Default value equals to
Mole.verbose
. max_memoryfloat or int
Allowed memory in MB. Default value equals to
Mole.max_memory
. ncasint
Active space size.
 nelecastuple of int
Active (nelec_alpha, nelec_beta)
 ncoreint or tuple of int
Core electron number. In UHFCASSCF, it’s a tuple to indicate the different core eletron numbers.
 natorbbool
Whether to transform natural orbital in active space. Be cautious of this parameter when CASCI/CASSCF are combined with DMRG solver or selected CI solver because DMRG and selected CI are not invariant to the rotation in active space. False by default.
 canonicalizationbool
Whether to canonicalize orbitals. Note that canonicalization does not change the orbitals in active space by default. It only diagonalizes core and external space of the general Fock matirx. To get the natural orbitals in active space, attribute natorb need to be enabled. True by default.
 sorting_mo_energybool
Whether to sort the orbitals based on the diagonal elements of the general Fock matrix. Default is False.
 fcisolveran instance of
FCISolver
The pyscf.fci module provides several FCISolver for different scenario. Generally, fci.direct_spin1.FCISolver can be used for all RHFCASSCF. However, a proper FCISolver can provide better performance and better numerical stability. One can either use
fci.solver()
function to pick the FCISolver by the program or manually assigen the FCISolver to this attribute, e.g.>>> from pyscf import fci >>> mc = mcscf.CASSCF(mf, 4, 4) >>> mc.fcisolver = fci.solver(mol, singlet=True) >>> mc.fcisolver = fci.direct_spin1.FCISolver(mol)
You can control FCISolver by setting e.g.:
>>> mc.fcisolver.max_cycle = 30 >>> mc.fcisolver.conv_tol = 1e7
For more details of the parameter for FCISolver, See
fci
.
Saved results
 e_totfloat
Total MCSCF energy (electronic energy plus nuclear repulsion)
 e_casfloat
CAS space FCI energy
 cindarray
CAS space FCI coefficients
 mo_coeffndarray
When canonicalization is specified, the orbitals are canonical orbitals which make the general Fock matrix (Fock operator on top of MCSCF 1particle density matrix) diagonalized within each subspace (core, active, external). If natorb (natural orbitals in active space) is specified, the active segment of the mo_coeff is natural orbitls.
 mo_energyndarray
Diagonal elements of general Fock matrix (in mo_coeff representation).
 mo_occndarray
Occupation numbers of natural orbitals if natorb is specified.
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.RHF(mol) >>> mf.scf() >>> mc = mcscf.CASCI(mf, 6, 6) >>> mc.kernel()[0] 108.980200816243354

Gradients
(*args, **kwargs)¶ Nonrelativistic restricted HartreeFock gradients

as_scanner
()¶ Generating a scanner for CASCI PES.
The returned solver is a function. This function requires one argument “mol” as input and returns total CASCI energy.
The solver will automatically use the results of last calculation as the initial guess of the new calculation. All parameters of MCSCF object are automatically applied in the solver.
Note scanner has side effects. It may change many underlying objects (_scf, with_df, with_x2c, …) during calculation.
Examples:
>>> from pyscf import gto, scf, mcscf >>> mf = scf.RHF(gto.Mole().set(verbose=0)) >>> mc_scanner = mcscf.CASCI(mf, 4, 4).as_scanner() >>> mc_scanner(gto.M(atom='N 0 0 0; N 0 0 1.1')) >>> mc_scanner(gto.M(atom='N 0 0 0; N 0 0 1.5'))

canonicalize
(mo_coeff=None, ci=None, eris=None, sort=False, cas_natorb=False, casdm1=None, verbose=3, with_meta_lowdin=True)¶ Canonicalized CASCI/CASSCF orbitals of effecitive Fock matrix and update CI coefficients accordingly.
Effective Fock matrix is built with oneparticle density matrix (see also
mcscf.casci.get_fock()
). For stateaverage CASCI/CASSCF object, the canonicalized orbitals are based on the stateaverage density matrix. To obtain canonicalized orbitals for an individual state, you need to pass “casdm1” of the specific state to this function. Args:
mc: a CASSCF/CASCI object or RHF object
 Kwargs:
 mo_coeff (ndarray): orbitals that span the core, active and external
space.
 ci (ndarray): CI coefficients (or objects to represent the CI
wavefunctions in DMRG/QMCMCSCF calculations).
 eris: Integrals for the MCSCF object. Input this object to reduce the
overhead of computing integrals. It can be generated by
mc.ao2mo()
method. sort (bool): Whether the canonicalized orbitals are sorted based on
the orbital energy (diagonal part of the effective Fock matrix) within each subspace (core, active, external). If point group symmetry is not available in the system, orbitals are always sorted. When point group symmetry is available, sort=False will preserve the symmetry label of input orbitals and only sort the orbitals in each symmetry sector. sort=True will reorder all orbitals over all symmetry sectors in each subspace and the symmetry labels may be changed.
 cas_natorb (bool): Whether to transform active orbitals to natual
orbitals. If enabled, the output orbitals in active space are transformed to natural orbitals and CI coefficients are updated accordingly.
 casdm1 (ndarray): 1particle density matrix in active space. This
density matrix is used to build effective fock matrix. Without input casdm1, the density matrix is computed with the input ci coefficients/object. If neither ci nor casdm1 were given, density matrix is computed by
mc.fcisolver.make_rdm1()
method. For stateaverage CASCI/CASCF calculation, this results in a set of canonicalized orbitals of stateaverage effective Fock matrix. To canonicalize the orbitals for one particular state, you can assign the density matrix of that state to the kwarg casdm1.
 Returns:
A tuple, (natural orbitals, CI coefficients, orbital energies) The orbital energies are the diagonal terms of effective Fock matrix.

canonicalize_
(mo_coeff=None, ci=None, eris=None, sort=False, cas_natorb=False, casdm1=None, verbose=None, with_meta_lowdin=True)[source]¶ Canonicalized CASCI/CASSCF orbitals of effecitive Fock matrix and update CI coefficients accordingly.
Effective Fock matrix is built with oneparticle density matrix (see also
mcscf.casci.get_fock()
). For stateaverage CASCI/CASSCF object, the canonicalized orbitals are based on the stateaverage density matrix. To obtain canonicalized orbitals for an individual state, you need to pass “casdm1” of the specific state to this function. Args:
mc: a CASSCF/CASCI object or RHF object
 Kwargs:
 mo_coeff (ndarray): orbitals that span the core, active and external
space.
 ci (ndarray): CI coefficients (or objects to represent the CI
wavefunctions in DMRG/QMCMCSCF calculations).
 eris: Integrals for the MCSCF object. Input this object to reduce the
overhead of computing integrals. It can be generated by
mc.ao2mo()
method. sort (bool): Whether the canonicalized orbitals are sorted based on
the orbital energy (diagonal part of the effective Fock matrix) within each subspace (core, active, external). If point group symmetry is not available in the system, orbitals are always sorted. When point group symmetry is available, sort=False will preserve the symmetry label of input orbitals and only sort the orbitals in each symmetry sector. sort=True will reorder all orbitals over all symmetry sectors in each subspace and the symmetry labels may be changed.
 cas_natorb (bool): Whether to transform active orbitals to natual
orbitals. If enabled, the output orbitals in active space are transformed to natural orbitals and CI coefficients are updated accordingly.
 casdm1 (ndarray): 1particle density matrix in active space. This
density matrix is used to build effective fock matrix. Without input casdm1, the density matrix is computed with the input ci coefficients/object. If neither ci nor casdm1 were given, density matrix is computed by
mc.fcisolver.make_rdm1()
method. For stateaverage CASCI/CASCF calculation, this results in a set of canonicalized orbitals of stateaverage effective Fock matrix. To canonicalize the orbitals for one particular state, you can assign the density matrix of that state to the kwarg casdm1.
 Returns:
A tuple, (natural orbitals, CI coefficients, orbital energies) The orbital energies are the diagonal terms of effective Fock matrix.

cas_natorb
(mo_coeff=None, ci=None, eris=None, sort=False, casdm1=None, verbose=None, with_meta_lowdin=True)[source]¶ Transform active orbitals to natrual orbitals, and update the CI wfn accordingly
 Args:
mc : a CASSCF/CASCI object or RHF object
 Kwargs:
 sortbool
Sort natural orbitals wrt the occupancy.
 Returns:
A tuple, the first item is natural orbitals, the second is updated CI coefficients, the third is the natural occupancy associated to the natural orbitals.

cas_natorb_
(mo_coeff=None, ci=None, eris=None, sort=False, casdm1=None, verbose=None, with_meta_lowdin=True)[source]¶ Transform active orbitals to natrual orbitals, and update the CI wfn accordingly
 Args:
mc : a CASSCF/CASCI object or RHF object
 Kwargs:
 sortbool
Sort natural orbitals wrt the occupancy.
 Returns:
A tuple, the first item is natural orbitals, the second is updated CI coefficients, the third is the natural occupancy associated to the natural orbitals.

fix_spin
(shift=0.2, ss=None)¶ Use level shift to control FCI solver spin.
\[(H + shift*S^2) \Psi\rangle = E \Psi\rangle\] Kwargs:
 shiftfloat
Energy penalty for states which have wrong spin
 ssnumber
S^2 expection value == s*(s+1)

fix_spin_
(shift=0.2, ss=None)[source]¶ Use level shift to control FCI solver spin.
\[(H + shift*S^2) \Psi\rangle = E \Psi\rangle\] Kwargs:
 shiftfloat
Energy penalty for states which have wrong spin
 ssnumber
S^2 expection value == s*(s+1)

get_h1cas
(mo_coeff=None, ncas=None, ncore=None)¶ CAS sapce oneelectron hamiltonian
 Args:
casci : a CASSCF/CASCI object or RHF object
 Returns:
A tuple, the first is the effective oneelectron hamiltonian defined in CAS space, the second is the electronic energy from core.

get_h1eff
(mo_coeff=None, ncas=None, ncore=None)[source]¶ CAS sapce oneelectron hamiltonian
 Args:
casci : a CASSCF/CASCI object or RHF object
 Returns:
A tuple, the first is the effective oneelectron hamiltonian defined in CAS space, the second is the electronic energy from core.

get_h2cas
(mo_coeff=None)[source]¶ Compute the active space twoparticle Hamiltonian.
Note It is different to get_h2eff when df.approx_hessian is applied, in which get_h2eff function returns the DF integrals while get_h2cas returns the regular 2electron integrals.

get_h2eff
(mo_coeff=None)[source]¶ Compute the active space twoparticle Hamiltonian.
Note It is different to get_h2cas when df.approx_hessian is applied. in which get_h2eff function returns the DF integrals while get_h2cas returns the regular 2electron integrals.

get_jk
(mol, dm, hermi=1, with_j=True, with_k=True, omega=None)[source]¶ Compute J, K matrices for all input density matrices
 Args:
mol : an instance of
Mole
 dmndarray or list of ndarrays
A density matrix or a list of density matrices
 Kwargs:
 hermiint
Whether J, K matrix is hermitian
0 : not hermitian and not symmetric1 : hermitian or symmetric2 : antihermitian vhfopt :
A class which holds precomputed quantities to optimize the computation of J, K matrices
 with_jboolean
Whether to compute J matrices
 with_kboolean
Whether to compute K matrices
 omegafloat
Parameter of rangeseperated Coulomb operator: erf( omega * r12 ) / r12. If specified, integration are evaluated based on the longrange part of the rangeseperated Coulomb operator.
 Returns:
Depending on the given dm, the function returns one J and one K matrix, or a list of J matrices and a list of K matrices, corresponding to the input density matrices.
Examples:
>>> from pyscf import gto, scf >>> from pyscf.scf import _vhf >>> mol = gto.M(atom='H 0 0 0; H 0 0 1.1') >>> dms = numpy.random.random((3,mol.nao_nr(),mol.nao_nr())) >>> j, k = scf.hf.get_jk(mol, dms, hermi=0) >>> print(j.shape) (3, 2, 2)

get_veff
(mol=None, dm=None, hermi=1)[source]¶ HartreeFock potential matrix for the given density matrix
 Args:
mol : an instance of
Mole
 dmndarray or list of ndarrays
A density matrix or a list of density matrices
 Kwargs:
 dm_lastndarray or a list of ndarrays or 0
The density matrix baseline. If not 0, this function computes the increment of HF potential w.r.t. the reference HF potential matrix.
 vhf_lastndarray or a list of ndarrays or 0
The reference HF potential matrix.
 hermiint
Whether J, K matrix is hermitian
0 : no hermitian or symmetric1 : hermitian2 : antihermitian vhfopt :
A class which holds precomputed quantities to optimize the computation of J, K matrices
 Returns:
matrix Vhf = 2*J  K. Vhf can be a list matrices, corresponding to the input density matrices.
Examples:
>>> import numpy >>> from pyscf import gto, scf >>> from pyscf.scf import _vhf >>> mol = gto.M(atom='H 0 0 0; H 0 0 1.1') >>> dm0 = numpy.random.random((mol.nao_nr(),mol.nao_nr())) >>> vhf0 = scf.hf.get_veff(mol, dm0, hermi=0) >>> dm1 = numpy.random.random((mol.nao_nr(),mol.nao_nr())) >>> vhf1 = scf.hf.get_veff(mol, dm1, hermi=0) >>> vhf2 = scf.hf.get_veff(mol, dm1, dm_last=dm0, vhf_last=vhf0, hermi=0) >>> numpy.allclose(vhf1, vhf2) True

h1e_for_cas
(mo_coeff=None, ncas=None, ncore=None)¶ CAS sapce oneelectron hamiltonian
 Args:
casci : a CASSCF/CASCI object or RHF object
 Returns:
A tuple, the first is the effective oneelectron hamiltonian defined in CAS space, the second is the electronic energy from core.

kernel
(mo_coeff=None, ci0=None, verbose=None)[source]¶  Returns:
Five elements, they are total energy, active space CI energy, the active space FCI wavefunction coefficients or DMRG wavefunction ID, the MCSCF canonical orbital coefficients, the MCSCF canonical orbital coefficients.
They are attributes of mcscf object, which can be accessed by .e_tot, .e_cas, .ci, .mo_coeff, .mo_energy

make_rdm1
(mo_coeff=None, ci=None, ncas=None, nelecas=None, ncore=None, **kwargs)[source]¶ Oneparticle density matrix in AO representation

make_rdm1s
(mo_coeff=None, ci=None, ncas=None, nelecas=None, ncore=None, **kwargs)[source]¶ Oneparticle density matrices for alpha and beta spin on AO basis

sort_mo
(caslst, mo_coeff=None, base=1)[source]¶ Pick orbitals for CAS space
 Args:
casscf : an
CASSCF
orCASCI
object mo_coeffndarray or a list of ndarray
Orbitals for CASSCF initial guess. In the UHFCASSCF, it’s a list of two orbitals, for alpha and beta spin.
 caslstlist of int or nested list of int
A list of orbital indices to represent the CAS space. In the UHFCASSCF, it’s consist of two lists, for alpha and beta spin.
 Kwargs:
 baseint
0based (Cstyle) or 1based (Fortranstyle) caslst
 Returns:
An reoreded mo_coeff, which put the orbitals given by caslst in the CAS space
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.RHF(mol) >>> mf.scf() >>> mc = mcscf.CASSCF(mf, 4, 4) >>> cas_list = [5,6,8,9] # pi orbitals >>> mo = mc.sort_mo(cas_list) >>> mc.kernel(mo)[0] 109.007378939813691

state_average
(weights=(0.5, 0.5))[source]¶ State average over the energy. The energy funcitonal is E = w1<psi1Hpsi1> + w2<psi2Hpsi2> + …
Note we may need change the FCI solver to
mc.fcisolver = fci.solver(mol, False)
before calling state_average_(mc), to mix the singlet and triplet states
MRH, 04/08/2019: Instead of turning casscf._finalize into an instance attribute that points to the previous casscf object, I’m going to make a whole new child class. This will have the added benefit of making state_average and state_average_ actually behave differently for the first time (until now they both modified the casscf object inplace). I’m also going to assign the weights argument as a member of the mc child class because an accurate secondorder CASSCF algorithm for stateaveraged calculations requires that the gradient and Hessian be computed for CI vectors of each root individually and then multiplied by that root’s weight. The second derivatives computed by newton_casscf.py need to be extended to stateaveraged calculations in order to be used as intermediates for calculations of the gradient of a single root in the context of the SACASSCF method; see: Mol. Phys. 99, 103 (2001).

state_average_
(weights=(0.5, 0.5))[source]¶ State average over the energy. The energy funcitonal is E = w1<psi1Hpsi1> + w2<psi2Hpsi2> + …
Note we may need change the FCI solver to
mc.fcisolver = fci.solver(mol, False)
before calling state_average_(mc), to mix the singlet and triplet states
MRH, 04/08/2019: Instead of turning casscf._finalize into an instance attribute that points to the previous casscf object, I’m going to make a whole new child class. This will have the added benefit of making state_average and state_average_ actually behave differently for the first time (until now they both modified the casscf object inplace). I’m also going to assign the weights argument as a member of the mc child class because an accurate secondorder CASSCF algorithm for stateaveraged calculations requires that the gradient and Hessian be computed for CI vectors of each root individually and then multiplied by that root’s weight. The second derivatives computed by newton_casscf.py need to be extended to stateaveraged calculations in order to be used as intermediates for calculations of the gradient of a single root in the context of the SACASSCF method; see: Mol. Phys. 99, 103 (2001).

pyscf.mcscf.casci.
as_scanner
(mc)[source]¶ Generating a scanner for CASCI PES.
The returned solver is a function. This function requires one argument “mol” as input and returns total CASCI energy.
The solver will automatically use the results of last calculation as the initial guess of the new calculation. All parameters of MCSCF object are automatically applied in the solver.
Note scanner has side effects. It may change many underlying objects (_scf, with_df, with_x2c, …) during calculation.
Examples:
>>> from pyscf import gto, scf, mcscf >>> mf = scf.RHF(gto.Mole().set(verbose=0)) >>> mc_scanner = mcscf.CASCI(mf, 4, 4).as_scanner() >>> mc_scanner(gto.M(atom='N 0 0 0; N 0 0 1.1')) >>> mc_scanner(gto.M(atom='N 0 0 0; N 0 0 1.5'))

pyscf.mcscf.casci.
canonicalize
(mc, mo_coeff=None, ci=None, eris=None, sort=False, cas_natorb=False, casdm1=None, verbose=3, with_meta_lowdin=True)[source]¶ Canonicalized CASCI/CASSCF orbitals of effecitive Fock matrix and update CI coefficients accordingly.
Effective Fock matrix is built with oneparticle density matrix (see also
mcscf.casci.get_fock()
). For stateaverage CASCI/CASSCF object, the canonicalized orbitals are based on the stateaverage density matrix. To obtain canonicalized orbitals for an individual state, you need to pass “casdm1” of the specific state to this function. Args:
mc: a CASSCF/CASCI object or RHF object
 Kwargs:
 mo_coeff (ndarray): orbitals that span the core, active and external
space.
 ci (ndarray): CI coefficients (or objects to represent the CI
wavefunctions in DMRG/QMCMCSCF calculations).
 eris: Integrals for the MCSCF object. Input this object to reduce the
overhead of computing integrals. It can be generated by
mc.ao2mo()
method. sort (bool): Whether the canonicalized orbitals are sorted based on
the orbital energy (diagonal part of the effective Fock matrix) within each subspace (core, active, external). If point group symmetry is not available in the system, orbitals are always sorted. When point group symmetry is available, sort=False will preserve the symmetry label of input orbitals and only sort the orbitals in each symmetry sector. sort=True will reorder all orbitals over all symmetry sectors in each subspace and the symmetry labels may be changed.
 cas_natorb (bool): Whether to transform active orbitals to natual
orbitals. If enabled, the output orbitals in active space are transformed to natural orbitals and CI coefficients are updated accordingly.
 casdm1 (ndarray): 1particle density matrix in active space. This
density matrix is used to build effective fock matrix. Without input casdm1, the density matrix is computed with the input ci coefficients/object. If neither ci nor casdm1 were given, density matrix is computed by
mc.fcisolver.make_rdm1()
method. For stateaverage CASCI/CASCF calculation, this results in a set of canonicalized orbitals of stateaverage effective Fock matrix. To canonicalize the orbitals for one particular state, you can assign the density matrix of that state to the kwarg casdm1.
 Returns:
A tuple, (natural orbitals, CI coefficients, orbital energies) The orbital energies are the diagonal terms of effective Fock matrix.

pyscf.mcscf.casci.
cas_natorb
(mc, mo_coeff=None, ci=None, eris=None, sort=False, casdm1=None, verbose=None, with_meta_lowdin=True)[source]¶ Transform active orbitals to natrual orbitals, and update the CI wfn accordingly
 Args:
mc : a CASSCF/CASCI object or RHF object
 Kwargs:
 sortbool
Sort natural orbitals wrt the occupancy.
 Returns:
A tuple, the first item is natural orbitals, the second is updated CI coefficients, the third is the natural occupancy associated to the natural orbitals.

pyscf.mcscf.casci.
get_fock
(mc, mo_coeff=None, ci=None, eris=None, casdm1=None, verbose=None)[source]¶ Effective oneelectron Fock matrix in AO representation f = sum_{pq} E_{pq} F_{pq} F_{pq} = h_{pq} + sum_{rs} [(pqrs)(psrq)] DM_{sr}
Ref. Theor. Chim. Acta., 91, 31 Chem. Phys. 48, 157
For stateaverage CASCI/CASSCF object, the effective fock matrix is based on the stateaverage density matrix. To obtain Fock matrix of a specific state in the stateaverage calculations, you can pass “casdm1” of the specific state to this function.
 Args:
mc: a CASSCF/CASCI object or RHF object
 Kwargs:
 mo_coeff (ndarray): orbitals that span the core, active and external
space.
 ci (ndarray): CI coefficients (or objects to represent the CI
wavefunctions in DMRG/QMCMCSCF calculations).
 eris: Integrals for the MCSCF object. Input this object to reduce the
overhead of computing integrals. It can be generated by
mc.ao2mo()
method. casdm1 (ndarray): 1particle density matrix in active space. Without
input casdm1, the density matrix is computed with the input ci coefficients/object. If neither ci nor casdm1 were given, density matrix is computed by
mc.fcisolver.make_rdm1()
method. For stateaverage CASCI/CASCF calculation, this results in the effective Fock matrix based on the stateaverage density matrix. To obtain the effective Fock matrix for one particular state, you can assign the density matrix of that state to the kwarg casdm1.
 Returns:
Fock matrix

pyscf.mcscf.casci.
h1e_for_cas
(casci, mo_coeff=None, ncas=None, ncore=None)[source]¶ CAS sapce oneelectron hamiltonian
 Args:
casci : a CASSCF/CASCI object or RHF object
 Returns:
A tuple, the first is the effective oneelectron hamiltonian defined in CAS space, the second is the electronic energy from core.

pyscf.mcscf.casci_symm.
CASCI
¶

class
pyscf.mcscf.casci_symm.
SymAdaptedCASCI
(mf_or_mol, ncas, nelecas, ncore=None)[source]¶ 
kernel
(mo_coeff=None, ci0=None, verbose=None)[source]¶  Returns:
Five elements, they are total energy, active space CI energy, the active space FCI wavefunction coefficients or DMRG wavefunction ID, the MCSCF canonical orbital coefficients, the MCSCF canonical orbital coefficients.
They are attributes of mcscf object, which can be accessed by .e_tot, .e_cas, .ci, .mo_coeff, .mo_energy

sort_mo_by_irrep
(cas_irrep_nocc, cas_irrep_ncore=None, mo_coeff=None, s=None)[source]¶ Select active space based on symmetry information. See also
pyscf.mcscf.addons.sort_mo_by_irrep()

UCASCI (CASCI with nondegenerated alpha and beta orbitals, typically UHF orbitals)

pyscf.mcscf.ucasci.
CASCI
¶ alias of
pyscf.mcscf.ucasci.UCASCI

class
pyscf.mcscf.ucasci.
UCASCI
(mf_or_mol, ncas, nelecas, ncore=None)[source]¶ 

cas_natorb
(mo_coeff=None, ci0=None)[source]¶ Transform active orbitals to natrual orbitals, and update the CI wfn accordingly
 Args:
mc : a CASSCF/CASCI object or RHF object
 Kwargs:
 sortbool
Sort natural orbitals wrt the occupancy.
 Returns:
A tuple, the first item is natural orbitals, the second is updated CI coefficients, the third is the natural occupancy associated to the natural orbitals.

cas_natorb_
(mo_coeff=None, ci0=None)[source]¶ Transform active orbitals to natrual orbitals, and update the CI wfn accordingly
 Args:
mc : a CASSCF/CASCI object or RHF object
 Kwargs:
 sortbool
Sort natural orbitals wrt the occupancy.
 Returns:
A tuple, the first item is natural orbitals, the second is updated CI coefficients, the third is the natural occupancy associated to the natural orbitals.

get_h1cas
(mo_coeff=None, ncas=None, ncore=None)¶ CAS sapce oneelectron hamiltonian for UHFCASCI or UHFCASSCF
 Args:
casci : a UCASSCF/UCASCI object or UHF object

get_h1eff
(mo_coeff=None, ncas=None, ncore=None)[source]¶ CAS sapce oneelectron hamiltonian for UHFCASCI or UHFCASSCF
 Args:
casci : a UCASSCF/UCASCI object or UHF object

get_h2cas
(mo_coeff=None)[source]¶ Compute the active space twoparticle Hamiltonian.
Note It is different to get_h2eff when df.approx_hessian is applied, in which get_h2eff function returns the DF integrals while get_h2cas returns the regular 2electron integrals.

get_h2eff
(mo_coeff=None)[source]¶ Compute the active space twoparticle Hamiltonian.
Note It is different to get_h2cas when df.approx_hessian is applied. in which get_h2eff function returns the DF integrals while get_h2cas returns the regular 2electron integrals.

get_veff
(mol=None, dm=None, hermi=1)[source]¶ HartreeFock potential matrix for the given density matrix
 Args:
mol : an instance of
Mole
 dmndarray or list of ndarrays
A density matrix or a list of density matrices
 Kwargs:
 dm_lastndarray or a list of ndarrays or 0
The density matrix baseline. If not 0, this function computes the increment of HF potential w.r.t. the reference HF potential matrix.
 vhf_lastndarray or a list of ndarrays or 0
The reference HF potential matrix.
 hermiint
Whether J, K matrix is hermitian
0 : no hermitian or symmetric1 : hermitian2 : antihermitian vhfopt :
A class which holds precomputed quantities to optimize the computation of J, K matrices
 Returns:
matrix Vhf = 2*J  K. Vhf can be a list matrices, corresponding to the input density matrices.
Examples:
>>> import numpy >>> from pyscf import gto, scf >>> from pyscf.scf import _vhf >>> mol = gto.M(atom='H 0 0 0; H 0 0 1.1') >>> dm0 = numpy.random.random((mol.nao_nr(),mol.nao_nr())) >>> vhf0 = scf.hf.get_veff(mol, dm0, hermi=0) >>> dm1 = numpy.random.random((mol.nao_nr(),mol.nao_nr())) >>> vhf1 = scf.hf.get_veff(mol, dm1, hermi=0) >>> vhf2 = scf.hf.get_veff(mol, dm1, dm_last=dm0, vhf_last=vhf0, hermi=0) >>> numpy.allclose(vhf1, vhf2) True

h1e_for_cas
(mo_coeff=None, ncas=None, ncore=None)¶ CAS sapce oneelectron hamiltonian for UHFCASCI or UHFCASSCF
 Args:
casci : a UCASSCF/UCASCI object or UHF object

kernel
(mo_coeff=None, ci0=None)[source]¶  Returns:
Five elements, they are total energy, active space CI energy, the active space FCI wavefunction coefficients or DMRG wavefunction ID, the MCSCF canonical orbital coefficients, the MCSCF canonical orbital coefficients.
They are attributes of mcscf object, which can be accessed by .e_tot, .e_cas, .ci, .mo_coeff, .mo_energy

make_rdm1
(mo_coeff=None, ci=None, ncas=None, nelecas=None, ncore=None, **kwargs)[source]¶ Oneparticle density matrix in AO representation

make_rdm1s
(mo_coeff=None, ci=None, ncas=None, nelecas=None, ncore=None, **kwargs)[source]¶ Oneparticle density matrices for alpha and beta spin on AO basis

sort_mo
(caslst, mo_coeff=None, base=1)[source]¶ Pick orbitals for CAS space
 Args:
casscf : an
CASSCF
orCASCI
object mo_coeffndarray or a list of ndarray
Orbitals for CASSCF initial guess. In the UHFCASSCF, it’s a list of two orbitals, for alpha and beta spin.
 caslstlist of int or nested list of int
A list of orbital indices to represent the CAS space. In the UHFCASSCF, it’s consist of two lists, for alpha and beta spin.
 Kwargs:
 baseint
0based (Cstyle) or 1based (Fortranstyle) caslst
 Returns:
An reoreded mo_coeff, which put the orbitals given by caslst in the CAS space
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.RHF(mol) >>> mf.scf() >>> mc = mcscf.CASSCF(mf, 4, 4) >>> cas_list = [5,6,8,9] # pi orbitals >>> mo = mc.sort_mo(cas_list) >>> mc.kernel(mo)[0] 109.007378939813691

10.18.6.2. CASSCF¶

class
pyscf.mcscf.mc1step.
CASSCF
(mf_or_mol, ncas, nelecas, ncore=None, frozen=None)[source]¶  Args:
 mf_or_molSCF object or Mole object
SCF or Mole to define the problem size.
 ncasint
Number of active orbitals.
 nelecasint or a pair of int
Number of electrons in active space.
 Kwargs:
 ncoreint
Number of doubly occupied core orbitals. If not presented, this parameter can be automatically determined.
 Attributes:
 verboseint
Print level. Default value equals to
Mole.verbose
. max_memoryfloat or int
Allowed memory in MB. Default value equals to
Mole.max_memory
. ncasint
Active space size.
 nelecastuple of int
Active (nelec_alpha, nelec_beta)
 ncoreint or tuple of int
Core electron number. In UHFCASSCF, it’s a tuple to indicate the different core eletron numbers.
 natorbbool
Whether to transform natural orbital in active space. Be cautious of this parameter when CASCI/CASSCF are combined with DMRG solver or selected CI solver because DMRG and selected CI are not invariant to the rotation in active space. False by default.
 canonicalizationbool
Whether to canonicalize orbitals. Note that canonicalization does not change the orbitals in active space by default. It only diagonalizes core and external space of the general Fock matirx. To get the natural orbitals in active space, attribute natorb need to be enabled. True by default.
 sorting_mo_energybool
Whether to sort the orbitals based on the diagonal elements of the general Fock matrix. Default is False.
 fcisolveran instance of
FCISolver
The pyscf.fci module provides several FCISolver for different scenario. Generally, fci.direct_spin1.FCISolver can be used for all RHFCASSCF. However, a proper FCISolver can provide better performance and better numerical stability. One can either use
fci.solver()
function to pick the FCISolver by the program or manually assigen the FCISolver to this attribute, e.g.>>> from pyscf import fci >>> mc = mcscf.CASSCF(mf, 4, 4) >>> mc.fcisolver = fci.solver(mol, singlet=True) >>> mc.fcisolver = fci.direct_spin1.FCISolver(mol)
You can control FCISolver by setting e.g.:
>>> mc.fcisolver.max_cycle = 30 >>> mc.fcisolver.conv_tol = 1e7
For more details of the parameter for FCISolver, See
fci
.
Saved results
 e_totfloat
Total MCSCF energy (electronic energy plus nuclear repulsion)
 e_casfloat
CAS space FCI energy
 cindarray
CAS space FCI coefficients
 mo_coeffndarray
When canonicalization is specified, the orbitals are canonical orbitals which make the general Fock matrix (Fock operator on top of MCSCF 1particle density matrix) diagonalized within each subspace (core, active, external). If natorb (natural orbitals in active space) is specified, the active segment of the mo_coeff is natural orbitls.
 mo_energyndarray
Diagonal elements of general Fock matrix (in mo_coeff representation).
 mo_occndarray
Occupation numbers of natural orbitals if natorb is specified.
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.RHF(mol) >>> mf.scf() >>> mc = mcscf.CASCI(mf, 6, 6) >>> mc.kernel()[0] 108.980200816243354 CASSCF
Extra attributes for CASSCF:
 conv_tolfloat
Converge threshold. Default is 1e7
 conv_tol_gradfloat
Converge threshold for CI gradients and orbital rotation gradients. Default is 1e4
 max_stepsizefloat
The step size for orbital rotation. Small step (0.005  0.05) is prefered. Default is 0.03.
 max_cycle_macroint
Max number of macro iterations. Default is 50.
 max_cycle_microint
Max number of micro iterations in each macro iteration. Depending on systems, increasing this value might reduce the total macro iterations. Generally, 2  5 steps should be enough. Default is 3.
 ah_level_shiftfloat, for AH solver.
Level shift for the Davidson diagonalization in AH solver. Default is 1e8.
 ah_conv_tolfloat, for AH solver.
converge threshold for AH solver. Default is 1e12.
 ah_max_cyclefloat, for AH solver.
Max number of iterations allowd in AH solver. Default is 30.
 ah_lindepfloat, for AH solver.
Linear dependence threshold for AH solver. Default is 1e14.
 ah_start_tolflat, for AH solver.
In AH solver, the orbital rotation is started without completely solving the AH problem. This value is to control the start point. Default is 0.2.
 ah_start_cycleint, for AH solver.
In AH solver, the orbital rotation is started without completely solving the AH problem. This value is to control the start point. Default is 2.
ah_conv_tol
,ah_max_cycle
,ah_lindep
,ah_start_tol
andah_start_cycle
can affect the accuracy and performance of CASSCF solver. Lowerah_conv_tol
andah_lindep
might improve the accuracy of CASSCF optimization, but decrease the performance.>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.UHF(mol) >>> mf.scf() >>> mc = mcscf.CASSCF(mf, 6, 6) >>> mc.conv_tol = 1e10 >>> mc.ah_conv_tol = 1e5 >>> mc.kernel()[0] 109.044401898486001 >>> mc.ah_conv_tol = 1e10 >>> mc.kernel()[0] 109.044401887945668
 chkfilestr
Checkpoint file to save the intermediate orbitals during the CASSCF optimization. Default is the checkpoint file of mean field object.
 ci_response_spaceint
subspace size to solve the CI vector response. Default is 3.
 callbackfunction(envs_dict) => None
callback function takes one dict as the argument which is generated by the builtin function
locals()
, so that the callback function can access all local variables in the current envrionment. scale_restorationfloat
When a step of orbital rotation moves out of trust region, the orbital optimization will be restored to previous state and the step size of the orbital rotation needs to be reduced. scale_restoration controls how much to scale down the step size.
Saved results
 e_totfloat
Total MCSCF energy (electronic energy plus nuclear repulsion)
 e_casfloat
CAS space FCI energy
 cindarray
CAS space FCI coefficients
 mo_coeffndarray
Optimized CASSCF orbitals coefficients. When canonicalization is specified, the returned orbitals make the general Fock matrix (Fock operator on top of MCSCF 1particle density matrix) diagonalized within each subspace (core, active, external). If natorb (natural orbitals in active space) is specified, the active segment of the mo_coeff is natural orbitls.
 mo_energyndarray
Diagonal elements of general Fock matrix (in mo_coeff representation).
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.RHF(mol) >>> mf.scf() >>> mc = mcscf.CASSCF(mf, 6, 6) >>> mc.kernel()[0] 109.044401882238134

Gradients
(*args, **kwargs)¶ Nonrelativistic restricted HartreeFock gradients

as_scanner
()¶ Generating a scanner for CASSCF PES.
The returned solver is a function. This function requires one argument “mol” as input and returns total CASSCF energy.
The solver will automatically use the results of last calculation as the initial guess of the new calculation. All parameters of MCSCF object (conv_tol, max_memory etc) are automatically applied in the solver.
Note scanner has side effects. It may change many underlying objects (_scf, with_df, with_x2c, …) during calculation.
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1.2', verbose=0) >>> mc_scanner = mcscf.CASSCF(scf.RHF(mol), 4, 4).as_scanner() >>> e = mc_scanner(gto.M(atom='N 0 0 0; N 0 0 1.1')) >>> e = mc_scanner(gto.M(atom='N 0 0 0; N 0 0 1.5'))

get_h2cas
(mo_coeff=None)[source]¶ Computing active space twoparticle Hamiltonian.
Note It is different to get_h2eff when df.approx_hessian is applied, in which get_h2eff function returns the DF integrals while get_h2cas returns the regular 2electron integrals.

get_h2eff
(mo_coeff=None)[source]¶ Computing active space twoparticle Hamiltonian.
Note It is different to get_h2cas when df.approx_hessian is applied, in which get_h2eff function returns the DF integrals while get_h2cas returns the regular 2electron integrals.

kernel
(mo_coeff=None, ci0=None, callback=None, _kern=<function kernel>)[source]¶  Returns:
Five elements, they are total energy, active space CI energy, the active space FCI wavefunction coefficients or DMRG wavefunction ID, the MCSCF canonical orbital coefficients, the MCSCF canonical orbital coefficients.
They are attributes of mcscf object, which can be accessed by .e_tot, .e_cas, .ci, .mo_coeff, .mo_energy

pyscf.mcscf.mc1step.
as_scanner
(mc)[source]¶ Generating a scanner for CASSCF PES.
The returned solver is a function. This function requires one argument “mol” as input and returns total CASSCF energy.
The solver will automatically use the results of last calculation as the initial guess of the new calculation. All parameters of MCSCF object (conv_tol, max_memory etc) are automatically applied in the solver.
Note scanner has side effects. It may change many underlying objects (_scf, with_df, with_x2c, …) during calculation.
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1.2', verbose=0) >>> mc_scanner = mcscf.CASSCF(scf.RHF(mol), 4, 4).as_scanner() >>> e = mc_scanner(gto.M(atom='N 0 0 0; N 0 0 1.1')) >>> e = mc_scanner(gto.M(atom='N 0 0 0; N 0 0 1.5'))

pyscf.mcscf.mc1step.
kernel
(casscf, mo_coeff, tol=1e07, conv_tol_grad=None, ci0=None, callback=None, verbose=3, dump_chk=True)[source]¶ quasinewton CASSCF optimization driver

pyscf.mcscf.mc1step_symm.
CASSCF
¶

class
pyscf.mcscf.mc1step_symm.
SymAdaptedCASSCF
(mf_or_mol, ncas, nelecas, ncore=None, frozen=None)[source]¶  Args:
 mf_or_molSCF object or Mole object
SCF or Mole to define the problem size.
 ncasint
Number of active orbitals.
 nelecasint or a pair of int
Number of electrons in active space.
 Kwargs:
 ncoreint
Number of doubly occupied core orbitals. If not presented, this parameter can be automatically determined.
 Attributes:
 verboseint
Print level. Default value equals to
Mole.verbose
. max_memoryfloat or int
Allowed memory in MB. Default value equals to
Mole.max_memory
. ncasint
Active space size.
 nelecastuple of int
Active (nelec_alpha, nelec_beta)
 ncoreint or tuple of int
Core electron number. In UHFCASSCF, it’s a tuple to indicate the different core eletron numbers.
 natorbbool
Whether to transform natural orbital in active space. Be cautious of this parameter when CASCI/CASSCF are combined with DMRG solver or selected CI solver because DMRG and selected CI are not invariant to the rotation in active space. False by default.
 canonicalizationbool
Whether to canonicalize orbitals. Note that canonicalization does not change the orbitals in active space by default. It only diagonalizes core and external space of the general Fock matirx. To get the natural orbitals in active space, attribute natorb need to be enabled. True by default.
 sorting_mo_energybool
Whether to sort the orbitals based on the diagonal elements of the general Fock matrix. Default is False.
 fcisolveran instance of
FCISolver
The pyscf.fci module provides several FCISolver for different scenario. Generally, fci.direct_spin1.FCISolver can be used for all RHFCASSCF. However, a proper FCISolver can provide better performance and better numerical stability. One can either use
fci.solver()
function to pick the FCISolver by the program or manually assigen the FCISolver to this attribute, e.g.>>> from pyscf import fci >>> mc = mcscf.CASSCF(mf, 4, 4) >>> mc.fcisolver = fci.solver(mol, singlet=True) >>> mc.fcisolver = fci.direct_spin1.FCISolver(mol)
You can control FCISolver by setting e.g.:
>>> mc.fcisolver.max_cycle = 30 >>> mc.fcisolver.conv_tol = 1e7
For more details of the parameter for FCISolver, See
fci
.
Saved results
 e_totfloat
Total MCSCF energy (electronic energy plus nuclear repulsion)
 e_casfloat
CAS space FCI energy
 cindarray
CAS space FCI coefficients
 mo_coeffndarray
When canonicalization is specified, the orbitals are canonical orbitals which make the general Fock matrix (Fock operator on top of MCSCF 1particle density matrix) diagonalized within each subspace (core, active, external). If natorb (natural orbitals in active space) is specified, the active segment of the mo_coeff is natural orbitls.
 mo_energyndarray
Diagonal elements of general Fock matrix (in mo_coeff representation).
 mo_occndarray
Occupation numbers of natural orbitals if natorb is specified.
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.RHF(mol) >>> mf.scf() >>> mc = mcscf.CASCI(mf, 6, 6) >>> mc.kernel()[0] 108.980200816243354 CASSCF
Extra attributes for CASSCF:
 conv_tolfloat
Converge threshold. Default is 1e7
 conv_tol_gradfloat
Converge threshold for CI gradients and orbital rotation gradients. Default is 1e4
 max_stepsizefloat
The step size for orbital rotation. Small step (0.005  0.05) is prefered. Default is 0.03.
 max_cycle_macroint
Max number of macro iterations. Default is 50.
 max_cycle_microint
Max number of micro iterations in each macro iteration. Depending on systems, increasing this value might reduce the total macro iterations. Generally, 2  5 steps should be enough. Default is 3.
 ah_level_shiftfloat, for AH solver.
Level shift for the Davidson diagonalization in AH solver. Default is 1e8.
 ah_conv_tolfloat, for AH solver.
converge threshold for AH solver. Default is 1e12.
 ah_max_cyclefloat, for AH solver.
Max number of iterations allowd in AH solver. Default is 30.
 ah_lindepfloat, for AH solver.
Linear dependence threshold for AH solver. Default is 1e14.
 ah_start_tolflat, for AH solver.
In AH solver, the orbital rotation is started without completely solving the AH problem. This value is to control the start point. Default is 0.2.
 ah_start_cycleint, for AH solver.
In AH solver, the orbital rotation is started without completely solving the AH problem. This value is to control the start point. Default is 2.
ah_conv_tol
,ah_max_cycle
,ah_lindep
,ah_start_tol
andah_start_cycle
can affect the accuracy and performance of CASSCF solver. Lowerah_conv_tol
andah_lindep
might improve the accuracy of CASSCF optimization, but decrease the performance.>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.UHF(mol) >>> mf.scf() >>> mc = mcscf.CASSCF(mf, 6, 6) >>> mc.conv_tol = 1e10 >>> mc.ah_conv_tol = 1e5 >>> mc.kernel()[0] 109.044401898486001 >>> mc.ah_conv_tol = 1e10 >>> mc.kernel()[0] 109.044401887945668
 chkfilestr
Checkpoint file to save the intermediate orbitals during the CASSCF optimization. Default is the checkpoint file of mean field object.
 ci_response_spaceint
subspace size to solve the CI vector response. Default is 3.
 callbackfunction(envs_dict) => None
callback function takes one dict as the argument which is generated by the builtin function
locals()
, so that the callback function can access all local variables in the current envrionment. scale_restorationfloat
When a step of orbital rotation moves out of trust region, the orbital optimization will be restored to previous state and the step size of the orbital rotation needs to be reduced. scale_restoration controls how much to scale down the step size.
Saved results
 e_totfloat
Total MCSCF energy (electronic energy plus nuclear repulsion)
 e_casfloat
CAS space FCI energy
 cindarray
CAS space FCI coefficients
 mo_coeffndarray
Optimized CASSCF orbitals coefficients. When canonicalization is specified, the returned orbitals make the general Fock matrix (Fock operator on top of MCSCF 1particle density matrix) diagonalized within each subspace (core, active, external). If natorb (natural orbitals in active space) is specified, the active segment of the mo_coeff is natural orbitls.
 mo_energyndarray
Diagonal elements of general Fock matrix (in mo_coeff representation).
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.RHF(mol) >>> mf.scf() >>> mc = mcscf.CASSCF(mf, 6, 6) >>> mc.kernel()[0] 109.044401882238134

kernel
(mo_coeff=None, ci0=None, callback=None, _kern=None)[source]¶  Returns:
Five elements, they are total energy, active space CI energy, the active space FCI wavefunction coefficients or DMRG wavefunction ID, the MCSCF canonical orbital coefficients, the MCSCF canonical orbital coefficients.
They are attributes of mcscf object, which can be accessed by .e_tot, .e_cas, .ci, .mo_coeff, .mo_energy

sort_mo_by_irrep
(cas_irrep_nocc, cas_irrep_ncore=None, mo_coeff=None, s=None)[source]¶ Select active space based on symmetry information. See also
pyscf.mcscf.addons.sort_mo_by_irrep()
UCASSCF (CASSCF without spindegeneracy between alpha and beta orbitals) 1step optimization algorithm

pyscf.mcscf.umc1step.
CASSCF
¶ alias of
pyscf.mcscf.umc1step.UCASSCF

class
pyscf.mcscf.umc1step.
UCASSCF
(mf_or_mol, ncas, nelecas, ncore=None, frozen=None)[source]¶ 

get_h2cas
(mo_coeff=None)[source]¶ Compute the active space twoparticle Hamiltonian.
Note It is different to get_h2eff when df.approx_hessian is applied, in which get_h2eff function returns the DF integrals while get_h2cas returns the regular 2electron integrals.

kernel
(mo_coeff=None, ci0=None, callback=None, _kern=<function kernel>)[source]¶  Returns:
Five elements, they are total energy, active space CI energy, the active space FCI wavefunction coefficients or DMRG wavefunction ID, the MCSCF canonical orbital coefficients, the MCSCF canonical orbital coefficients.
They are attributes of mcscf object, which can be accessed by .e_tot, .e_cas, .ci, .mo_coeff, .mo_energy

MO integrals for UCASSCF methods
10.18.6.3. addons¶

pyscf.mcscf.addons.
cas_natorb
(casscf, mo_coeff=None, ci=None, sort=False)[source]¶ Natrual orbitals in CAS space

pyscf.mcscf.addons.
caslst_by_irrep
(casscf, mo_coeff, cas_irrep_nocc, cas_irrep_ncore=None, s=None, base=1)[source]¶ Given number of active orbitals for each irrep, return the orbital indices of active space
 Args:
casscf : an
CASSCF
orCASCI
object cas_irrep_nocclist or dict
Number of active orbitals for each irrep. It can be a dict, eg {‘A1’: 2, ‘B2’: 4} to indicate the active space size based on irrep names, or {0: 2, 3: 4} for irrep Id, or a list [2, 0, 0, 4] (identical to {0: 2, 3: 4}) in which the list index is served as the irrep Id.
 Kwargs:
 cas_irrep_ncorelist or dict
Number of closed shells for each irrep. It can be a dict, eg {‘A1’: 6, ‘B2’: 4} to indicate the closed shells based on irrep names, or {0: 6, 3: 4} for irrep Id, or a list [6, 0, 0, 4] (identical to {0: 6, 3: 4}) in which the list index is served as the irrep Id. If cas_irrep_ncore is not given, the program will generate a guess based on the lowest
CASCI.ncore
orbitals. sndarray
overlap matrix
 baseint
0based (Clike) or 1based (Fortranlike) caslst
 Returns:
A list of orbital indices
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvtz', symmetry=True, verbose=0) >>> mf = scf.RHF(mol) >>> mf.kernel() >>> mc = mcscf.CASSCF(mf, 12, 4) >>> mcscf.caslst_by_irrep(mc, mf.mo_coeff, {'E1gx':4, 'E1gy':4, 'E1ux':2, 'E1uy':2}) [5, 7, 8, 10, 11, 14, 15, 20, 25, 26, 31, 32]

pyscf.mcscf.addons.
get_fock
(casscf, mo_coeff=None, ci=None)[source]¶ Generalized Fock matrix in AO representation

pyscf.mcscf.addons.
make_rdm1
(casscf, mo_coeff=None, ci=None, **kwargs)[source]¶ Oneparticle densit matrix in AO representation
 Args:
casscf : an
CASSCF
orCASCI
object Kwargs:
 cindarray
CAS space FCI coefficients. If not given, take casscf.ci.
 mo_coeffndarray
Orbital coefficients. If not given, take casscf.mo_coeff.
Examples:
>>> import scipy.linalg >>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='sto3g', verbose=0) >>> mf = scf.RHF(mol) >>> res = mf.scf() >>> mc = mcscf.CASSCF(mf, 6, 6) >>> res = mc.kernel() >>> natocc = numpy.linalg.eigh(mcscf.make_rdm1(mc), mf.get_ovlp(), type=2)[0] >>> print(natocc) [ 0.0121563 0.0494735 0.0494735 1.95040395 1.95040395 1.98808879 2. 2. 2. 2. ]

pyscf.mcscf.addons.
make_rdm1s
(casscf, mo_coeff=None, ci=None, **kwargs)[source]¶ Alpha and beta oneparticle densit matrices in AO representation

pyscf.mcscf.addons.
map2hf
(casscf, mf_mo=None, base=1, tol=0.4)[source]¶ The overlap between the CASSCF optimized orbitals and the canonical HF orbitals.

pyscf.mcscf.addons.
project_init_guess
(casscf, init_mo, prev_mol=None)[source]¶ Project the given initial guess to the current CASSCF problem. The projected initial guess has two parts. The core orbitals are directly taken from the HartreeFock orbitals, and the active orbitals are projected from the given initial guess.
 Args:
casscf : an
CASSCF
orCASCI
object init_mondarray or list of ndarray
Initial guess orbitals which are not orthnormal for the current molecule. When the casscf is UHFCASSCF, the init_mo needs to be a list of two ndarrays, for alpha and beta orbitals
 Kwargs:
 prev_molan instance of
Mole
If given, the inital guess orbitals are associated to the geometry and basis of prev_mol. Otherwise, the orbitals are based of the geometry and basis of casscf.mol
 prev_molan instance of
 Returns:
New orthogonal initial guess orbitals with the core taken from HartreeFock orbitals and projected active space from original initial guess orbitals
Examples:
import numpy from pyscf import gto, scf, mcscf mol = gto.Mole() mol.build(atom='H 0 0 0; F 0 0 0.8', basis='ccpvdz', verbose=0) mf = scf.RHF(mol) mf.scf() mc = mcscf.CASSCF(mf, 6, 6) mo = mcscf.sort_mo(mc, mf.mo_coeff, [3,4,5,6,8,9]) print('E(0.8) = %.12f' % mc.kernel(mo)[0]) init_mo = mc.mo_coeff for b in numpy.arange(1.0, 3., .2): mol.atom = [['H', (0, 0, 0)], ['F', (0, 0, b)]] mol.build(0, 0) mf = scf.RHF(mol) mf.scf() mc = mcscf.CASSCF(mf, 6, 6) mo = mcscf.project_init_guess(mc, init_mo) print('E(%2.1f) = %.12f' % (b, mc.kernel(mo)[0])) init_mo = mc.mo_coeff

pyscf.mcscf.addons.
sort_mo
(casscf, mo_coeff, caslst, base=1)[source]¶ Pick orbitals for CAS space
 Args:
casscf : an
CASSCF
orCASCI
object mo_coeffndarray or a list of ndarray
Orbitals for CASSCF initial guess. In the UHFCASSCF, it’s a list of two orbitals, for alpha and beta spin.
 caslstlist of int or nested list of int
A list of orbital indices to represent the CAS space. In the UHFCASSCF, it’s consist of two lists, for alpha and beta spin.
 Kwargs:
 baseint
0based (Cstyle) or 1based (Fortranstyle) caslst
 Returns:
An reoreded mo_coeff, which put the orbitals given by caslst in the CAS space
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvdz', verbose=0) >>> mf = scf.RHF(mol) >>> mf.scf() >>> mc = mcscf.CASSCF(mf, 4, 4) >>> cas_list = [5,6,8,9] # pi orbitals >>> mo = mc.sort_mo(cas_list) >>> mc.kernel(mo)[0] 109.007378939813691

pyscf.mcscf.addons.
sort_mo_by_irrep
(casscf, mo_coeff, cas_irrep_nocc, cas_irrep_ncore=None, s=None)[source]¶ Given number of active orbitals for each irrep, construct the mo initial guess for CASSCF
 Args:
casscf : an
CASSCF
orCASCI
object cas_irrep_nocclist or dict
Number of active orbitals for each irrep. It can be a dict, eg {‘A1’: 2, ‘B2’: 4} to indicate the active space size based on irrep names, or {0: 2, 3: 4} for irrep Id, or a list [2, 0, 0, 4] (identical to {0: 2, 3: 4}) in which the list index is served as the irrep Id.
 Kwargs:
 cas_irrep_ncorelist or dict
Number of closed shells for each irrep. It can be a dict, eg {‘A1’: 6, ‘B2’: 4} to indicate the closed shells based on irrep names, or {0: 6, 3: 4} for irrep Id, or a list [6, 0, 0, 4] (identical to {0: 6, 3: 4}) in which the list index is served as the irrep Id. If cas_irrep_ncore is not given, the program will generate a guess based on the lowest
CASCI.ncore
orbitals. sndarray
overlap matrix
 Returns:
sorted orbitals, ordered as [c,..,c,a,..,a,v,..,v]
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='ccpvtz', symmetry=True, verbose=0) >>> mf = scf.RHF(mol) >>> mf.kernel() >>> mc = mcscf.CASSCF(mf, 12, 4) >>> mo = mc.sort_mo_by_irrep({'E1gx':4, 'E1gy':4, 'E1ux':2, 'E1uy':2}) >>> # Same to mo = sort_mo_by_irrep(mc, mf.mo_coeff, {2: 4, 3: 4, 6: 2, 7: 2}) >>> # Same to mo = sort_mo_by_irrep(mc, mf.mo_coeff, [0, 0, 4, 4, 0, 0, 2, 2]) >>> mc.kernel(mo)[0] 108.162863845084

pyscf.mcscf.addons.
spin_square
(casscf, mo_coeff=None, ci=None, ovlp=None)[source]¶ Spin square of the UHFCASSCF wavefunction
 Returns:
A list of two floats. The first is the expectation value of S^2. The second is the corresponding 2S+1
Examples:
>>> from pyscf import gto, scf, mcscf >>> mol = gto.M(atom='O 0 0 0; O 0 0 1', basis='sto3g', spin=2, verbose=0) >>> mf = scf.UHF(mol) >>> res = mf.scf() >>> mc = mcscf.CASSCF(mf, 4, 6) >>> res = mc.kernel() >>> print('S^2 = %.7f, 2S+1 = %.7f' % mcscf.spin_square(mc)) S^2 = 3.9831589, 2S+1 = 4.1149284

pyscf.mcscf.addons.
state_average
(casscf, weights=(0.5, 0.5), wfnsym=None)[source]¶ State average over the energy. The energy funcitonal is E = w1<psi1Hpsi1> + w2<psi2Hpsi2> + …
Note we may need change the FCI solver to
mc.fcisolver = fci.solver(mol, False)
before calling state_average_(mc), to mix the singlet and triplet states
MRH, 04/08/2019: Instead of turning casscf._finalize into an instance attribute that points to the previous casscf object, I’m going to make a whole new child class. This will have the added benefit of making state_average and state_average_ actually behave differently for the first time (until now they both modified the casscf object inplace). I’m also going to assign the weights argument as a member of the mc child class because an accurate secondorder CASSCF algorithm for stateaveraged calculations requires that the gradient and Hessian be computed for CI vectors of each root individually and then multiplied by that root’s weight. The second derivatives computed by newton_casscf.py need to be extended to stateaveraged calculations in order to be used as intermediates for calculations of the gradient of a single root in the context of the SACASSCF method; see: Mol. Phys. 99, 103 (2001).

pyscf.mcscf.addons.
state_average_
(casscf, weights=(0.5, 0.5))[source]¶ Inplace version of state_average

pyscf.mcscf.addons.
state_average_mix
(casscf, fcisolvers, weights=(0.5, 0.5))[source]¶ Stateaverage CASSCF over multiple FCI solvers.

pyscf.mcscf.addons.
state_average_mix_
(casscf, fcisolvers, weights=(0.5, 0.5))[source]¶ Inplace version of state_average

pyscf.mcscf.addons.
state_specific
(casscf, state=1, wfnsym=None)¶ For excited state
 Kwargs:
state : int 0 for ground state; 1 for first excited state.