QSCISolver¶
- class QSCISolver(*, backend, optimizer, ansatz=None, max_iterations=10, qsci_options=None, **vqe_kwargs)[source]¶
Bases:
objectPySCF CASCI/CASSCF active-space solver backed by
QSCI.Assign an instance to the
fcisolverof a PySCFmcscf.CASCIormcscf.CASSCFobject. Eachkernel()call runs aQSCIensemble on the active-space Hamiltonian whose sampling program is aVQE, trained afresh each call. The VQE’s samples with the active space’s alpha and beta electron counts seed the subspace, which QSCI then grows and diagonalises with anS^2 - S(S+1)penalty toward the lowest spin those counts allow,S = |n_alpha - n_beta| / 2. The finalQSCIStatetakes the place of PySCF’s CI vector, somc.ciis that state. Requires thechemextra.- Variables:
backend – Backend the QSCI ensembles run on.
optimizer – Optimizer configuration; each VQE trains with its own copy.
ansatz – Ansatz of every VQE, or None for
VQE’s default.max_iterations – Optimisation iterations of each VQE.
qsci_options – Further
QSCIarguments.vqe_kwargs – Further
VQEarguments.nroots (
int) – States solved for; only 1 is supported.converged – Whether the last VQE run’s optimizer reported success.
Configure the QSCI run of every
kernel()call.- Parameters:
backend (
CircuitRunner) – Backend the QSCI ensembles run on.optimizer (
Optimizer) – Optimizer configuration; each VQE trains with its own copy.ansatz (
Ansatz|None) – Ansatz of every VQE. Defaults toVQE’s default.max_iterations (
int) – Optimisation iterations of each VQE.qsci_options (
Mapping[str,Any] |None) – FurtherQSCIarguments, e.g.n_expansionsorlambda_penalty.
- Raises:
ValueError – If
qsci_optionssetsconfig_filterorpenalty, which the solver derives from the active space’s electron counts.
Attributes Summary
Methods Summary
approx_kernel(h1e, eri, norb, nelec[, ci0, ...])The last
kernel()result, for CASSCF's approximate CI steps.kernel(h1e, eri, norb, nelec[, ci0, ecore])Run QSCI on the active space, seeded by a VQE's samples.
make_rdm1(ci, norb, nelec)Spin-summed 1-RDM of
ci.make_rdm12(ci, norb, nelec)Spin-summed 1- and 2-RDMs of
ci.make_rdm12s(ci, norb, nelec)Spin RDMs of
ci, in PySCF'smake_rdm12slayout.make_rdm1s(ci, norb, nelec)Alpha and beta 1-RDMs of
ci.spin_square(ci, norb, nelec)<S^2>and the multiplicity2S + 1ofci.Attributes Documentation
Methods Documentation
- approx_kernel(h1e, eri, norb, nelec, ci0=None, ecore=0.0, **kwargs)[source]¶
The last
kernel()result, for CASSCF’s approximate CI steps.Runs
kernel()when there is no last result.
- kernel(h1e, eri, norb, nelec, ci0=None, ecore=0.0, **kwargs)[source]¶
Run QSCI on the active space, seeded by a VQE’s samples.
- Parameters:
h1e (
ArrayLike) – One-body integrals,(norb, norb).eri (
ArrayLike) – Two-body integrals in chemist order, in any PySCF packing.norb (
int) – Active orbitals.nelec (
int|tuple[int,int]) – Active electrons, as a total or(n_alpha, n_beta).ci0 (
Any) – Unused.ecore (
float) – Core energy.**kwargs (
Any) – Further PySCF solver options, unused.
- Return type:
- Returns:
<H>of the final state withecoreincluded, a variational upper bound, and theQSCIState.- Raises:
NotImplementedError – If
nrootsis not 1, or the integrals are unrestricted.ValueError – If no sample has the active space’s electron counts.