forte2._forte2#

Submodules#

Package Contents#

class forte2._forte2.DeterminantVector#
class forte2._forte2.DeterminantVector(arg: DeterminantVector)
class forte2._forte2.DeterminantVector(arg: collections.abc.Iterable[Determinant], /)
clear() None#

Remove all items from list.

append(arg: Determinant, /) None#

Append arg to the end of the list.

insert(arg0: int, arg1: Determinant, /) None#

Insert object arg1 before index arg0.

pop(index: int = -1) Determinant#

Remove and return item at index (default last).

extend(arg: DeterminantVector, /) None#

Extend self by appending elements from arg.

count(arg: Determinant, /) int#

Return number of occurrences of arg.

remove(arg: Determinant, /) None#

Remove first occurrence of arg.

class forte2._forte2.CIStrings(na: int, nb: int, symmetry: int, orbital_symmetry: collections.abc.Sequence[collections.abc.Sequence[int]], gas_min: collections.abc.Sequence[int], gas_max: collections.abc.Sequence[int])#
property alpha_address: std::__1::shared_ptr<forte2::StringAddress>#
property na: int#
property nb: int#
property symmetry: int#
property nas: int#
property nbs: int#
property ndet: int#
property ngas_spaces: int#
property gas_size: list[int]#
property gas_alpha_occupations: list[list[int]]#
property gas_beta_occupations: list[list[int]]#
property gas_occupations: list[tuple[int, int]]#
determinant(address: int) Determinant#
determinant_index(d: Determinant) int#
make_determinants() DeterminantVector#
class forte2._forte2.CISigmaBuilder(lists: CIStrings, E: float, H: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)], V: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)], log_level: int = 3)#
set_algorithm(algorithm: str) None#

Set the sigma build algorithm (options = kh, hz)

get_algorithm() str#

Get the current sigma build algorithm

set_memory(memory: int) None#

Set the memory limit for the builder (in MB)

form_Hdiag_csf(dets: DeterminantVector, spin_adapter: CISpinAdapter, spin_adapt_full_preconditioner: bool = False) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]#
energy_csf(dets: DeterminantVector, spin_adapter: CISpinAdapter, I: int) float#

Compute the energy of a CSF

form_H_csf(dets: DeterminantVector, spin_adapter: CISpinAdapter) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Form the full Hamiltonian matrix in the CSF basis

slater_rules_csf(dets: DeterminantVector, spin_adapter: CISpinAdapter, I: int, J: int) float#
Hamiltonian(basis: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], sigma: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) None#
make_sparse_state(C: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], threshold: float = 1e-12) SparseState#

Convert a CI vector to a sparse state

sf_1rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the spin-free one-electron reduced density matrix

sf_2rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the spin-free two-electron reduced density matrix

sf_3rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None)]#

Compute the spin-free three-electron reduced density matrix

sf_2cumulant(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the spin-free two-electron cumulant

sf_3cumulant(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None)]#

Compute the spin-free three-electron cumulant

a_1rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the alpha one-electron reduced density matrix

b_1rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the beta one-electron reduced density matrix

aa_2rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the alpha-alpha two-electron reduced density matrix

bb_2rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the beta-beta two-electron reduced density matrix

ab_2rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the alpha-beta two-electron reduced density matrix

aaa_3rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the alpha-alpha-alpha three-electron reduced density matrix

aab_3rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the alpha-alpha-beta three-electron reduced density matrix

abb_3rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the alpha-beta-beta three-electron reduced density matrix

bbb_3rdm(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the beta-beta-beta three-electron reduced density matrix

a_1trdm(sigmabuilder_right: CISigmaBuilder, C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the alpha one-electron transition reduced density matrix

b_1trdm(sigmabuilder_right: CISigmaBuilder, C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the beta one-electron transition reduced density matrix

sf_1trdm(sigmabuilder_right: CISigmaBuilder, C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the spin-free one-electron transition reduced density matrix

avg_build_time() list[float]#
set_log_level(level: int) None#

Set the logging level for the class

a_1rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], alpha: bool) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#
aa_2rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], alpha: bool) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the two-electron same-spin reduced density matrix for debugging purposes

ab_2rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the two-electron mixed-spin reduced density matrix for debugging purposes

aaa_3rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], alpha: bool) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the three-electron same-spin reduced density matrix for debugging purposes

aab_3rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the aab mixed-spin three-electron reduced density matrix for debugging purposes

abb_3rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the abb mixed-spin three-electron reduced density matrix for debugging purposes

aaaa_4rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], alpha: bool) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the four-electron same-spin reduced density matrix for debugging purposes

aaab_4rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the aaab mixed-spin four-electron reduced density matrix for debugging purposes

aabb_4rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the aabb mixed-spin four-electron reduced density matrix for debugging purposes

abbb_4rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the abbb mixed-spin four-electron reduced density matrix for debugging purposes

sf_1rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the spin-free one-electron reduced density matrix for debugging purposes

sf_2rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the spin-free two-electron reduced density matrix for debugging purposes

sf_3rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None)]#

Compute the spin-free three-electron reduced density matrix for debugging purposes

sf_2cumulant_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the spin-free two-electron cumulant for debugging purposes

sf_3cumulant_debug(C_left: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None)]#

Compute the spin-free three-electron cumulant for debugging purposes

class forte2._forte2.SelectedCIHelper(norb: int, dets: collections.abc.Sequence[Determinant], c: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)], E: float, H: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)], V: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)], log_level: int = 3)#
set_Hamiltonian(E: float, H: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)], V: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]) None#

Set the Hamiltonian integrals

Hamiltonian(basis: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], sigma: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) None#

Apply the Hamiltonian to the basis and store the result in sigma

Hdiag() Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]#

Return the diagonal of the Hamiltonian matrix

set_c(c: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]) None#

Set the CI coefficients

set_num_threads(n: int) None#

Set the number of threads to use in parallel sections

set_num_batches_per_thread(n: int) None#

Set the number of batches each thread will process in parallel sections

set_energies(e: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) None#

Set the energies of the roots

set_frozen_creation(frozen_creation: collections.abc.Sequence[int]) None#

Set orbitals excluded from creation in selection

set_frozen_annihilation(frozen_annihilation: collections.abc.Sequence[int]) None#

Set orbitals excluded from annihilation in selection

set_screening_criterion(criterion: str) None#

Set the screening criterion for selection (‘hbci’ or ‘ehbci’)

set_energy_correction(correction: str) None#

Set the energy correction method for selection (‘variational’ or ‘pt2’)

set_pt2_regularizer(regularizer: str, strength: float = 0.5) None#

Set the PT2 regularization method (‘none’, ‘shift’, ‘dsrg’) and its strength

select_hbci_ref(var_threshold: float, pt2_threshold: float) None#

Perform HBCI selection with the given threshold

select_hbci(var_threshold: float, pt2_threshold: float) None#

Perform HBCI selection with the given thresholds

compute_spin2() list[float]#

Compute the expectation value of S^2 for each root and return as a list

a_1rdm(left_root: int, right_root: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the alpha-spin 1-RDM between two roots

b_1rdm(left_root: int, right_root: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the beta-spin 1-RDM between two roots

sf_1rdm(left_root: int, right_root: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the spin-free 1-RDM between two roots

aa_2rdm(left_root: int, right_root: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the alpha-alpha 2-RDM between two roots

bb_2rdm(left_root: int, right_root: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the beta-beta 2-RDM between two roots

ab_2rdm(left_root: int, right_root: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the alpha-beta 2-RDM between two roots

sf_2rdm(left_root: int, right_root: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the spin-free 2-RDM between two roots

a_1trdm(right_helper: SelectedCIHelper, left_root: int, right_root: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the alpha-spin 1-transition RDM between two roots in different helpers

b_1trdm(right_helper: SelectedCIHelper, left_root: int, right_root: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the beta-spin 1-transition RDM between two roots in different helpers

sf_1trdm(right_helper: SelectedCIHelper, left_root: int, right_root: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the spin-free 1-transition RDM between two roots in different helpers

dets() list[Determinant]#

Return the determinants in the variational space

ndets() int#

Return the number of determinants in the variational space

energies() list[float]#

Return the energies of the roots

ept2_var() list[float]#

Return the variational part of the Epstein-Nesbet second-order energy correction

ept2_pt() list[float]#

Return the perturbative part of the Epstein-Nesbet second-order energy correction

num_new_dets_var() int#

Return the number of new variational determinants added in the last selection

num_new_dets_pt2() int#

Return the number of new perturbative determinants added in the last selection

selection_time() float#

Return the total selection time

class forte2._forte2.RelCISigmaBuilder(lists: CIStrings, E: float, H: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None)], V: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None, None, None)], log_level: int = 3, use_asym_ints: bool = False)#
set_algorithm(algorithm: str) None#

Set the sigma build algorithm (options = kh, hz)

get_algorithm() str#

Get the current sigma build algorithm

set_memory(memory: int) None#

Set the memory limit for the builder (in MB)

form_Hdiag(dets: DeterminantVector) Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)]#
slater_rules(dets: DeterminantVector, I: int, J: int) complex#
Hamiltonian(basis: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)], sigma: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)]) None#
so_1rdm(C_left: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None)]#

Compute the spin-orbital one-electron reduced density matrix

so_2rdm(C_left: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None, None, None)]#

Compute the spin-orbital two-electron reduced density matrix

so_2cumulant(C_left: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None, None, None)]#

Compute the spin-orbital two-electron cumulant

so_3rdm(C_left: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None, None, None, None, None)]#

Compute the spin-orbital three-electron reduced density matrix

so_3cumulant(C_left: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None, None, None, None, None)]#

Compute the spin-orbital three-electron cumulant

so_1rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None)]#
so_2rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None, None, None)]#
so_3rdm_debug(C_left: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)], C_right: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None)]) Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None, None, None, None, None)]#
class forte2._forte2.CISpinAdapter(twoS: int, twoMs: int, norb: int)#
prepare_couplings(dets: DeterminantVector) None#
csf_C_to_det_C(csf_C: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], det_C: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) None#
det_C_to_csf_C(det_C: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)], csf_C: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]) None#
property nconf: int#
property ncsf: int#
set_log_level(level: int) None#

Set the logging level for the class

class forte2._forte2.Determinant(arg: Determinant)#
class forte2._forte2.Determinant(str: Determinant.__init__.str)
static zero() Determinant#

Create a zero determinant with no electrons

maxnorb: int = Ellipsis#

The maximum number of orbitals supported by the Determinant class

set_na(n: int, value: bool) None#

Set the occupation of an alpha orbital

set_nb(n: int, value: bool) None#

Set the occupation of a beta orbital

na(n: int) bool#

Is orbital n occupied by an alpha electron?

nb(n: int) bool#

Is orbital n occupied by a beta electron?

count_alpha() int#

Count the number of alpha electrons

count_beta() int#

Count the number of beta electrons

count() int#

Count the total number of electrons

create_alpha(n: int) float#

Apply an alpha creation operator to the determinant at the specified orbital index and return the sign

create_beta(n: int) float#

Apply a beta creation operator to the determinant at the specified orbital index and return the sign

destroy_alpha(n: int) float#

Apply an alpha destruction operator to the determinant at the specified orbital index and return the sign

destroy_beta(n: int) float#

Apply a beta destruction operator to the determinant at the specified orbital index and return the sign

excitation_connection(arg: Determinant, /) tuple[list[int], list[int], list[int], list[int]]#

Describe the excitation connection of a determinant d, relative to this one.The excitation connection is defined as the creation and annihilation operators that need to be applied to this determinant to obtain d. The excitation connection is a vector of 4 vectors:[[alfa annihilation], [alfa creation],[beta annihilation], [beta creation]]

spin_flip() Determinant#

Spin flip the determinant, i.e., swap alpha and beta orbitals

str(n: int = 64) str#

Get the string representation of the Slater determinant

forte2._forte2.hilbert_space(nmo: int, na: int, nb: int, nirrep: int = 1, mo_symmetry: collections.abc.Sequence[int] = [], symmetry: int = 0) list[Determinant]#
forte2._forte2.hilbert_space(nmo: int, na: int, nb: int, ref: Determinant, truncation: int, nirrep: int = 1, mo_symmetry: collections.abc.Sequence[int] = [], symmetry: int = 0) list[Determinant]

Generate the Hilbert space for a given number of electrons, orbitals, and the truncation level.If information about the symmetry of the MOs is not provided, it assumes that all MOs have symmetry 0.A reference determinant must be provided to establish the excitation rank.

forte2._forte2.spin2(arg0: Determinant, arg1: Determinant, /) float#
forte2._forte2.spin2(arg0: SparseState, arg1: SparseState, /) complex

Calculate the <left_state|S^2|right_state> expectation value

class forte2._forte2.Configuration#
class forte2._forte2.Configuration(arg: Determinant, /)
str(n: int = 64) str#

Get the string representation of the Slater determinant

is_empty(n: int) bool#

Is orbital n empty?

is_docc(n: int) bool#

Is orbital n doubly occupied?

is_socc(n: int) bool#

Is orbital n singly occupied?

set_occ(n: int, value: int) None#

Set the occupation value of an orbital

count_docc() int#

Count the number of doubly occupied orbitals

count_socc() int#

Count the number of singly occupied orbitals

get_docc_vec() list[int]#

Get a list of the doubly occupied orbitals

get_socc_vec() list[int]#

Get a list of the singly occupied orbitals

forte2._forte2.set_log_level(arg: int, /) None#

Set the logging verbosity level (0=NONE, 1=ERROR, 2=WARNING, 3=INFO, 4=DEBUG)

forte2._forte2.get_log_level() int#

Get the current logging verbosity level

class forte2._forte2.SlaterRules(norb: int, scalar_energy: float, one_electron_integrals: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)], two_electron_integrals: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)])#
energy(arg: Determinant, /) float#
energies(dets: DeterminantVector) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]#

Compute the energies of a vector of determinants

slater_rules(lhs: Determinant, rhs: Determinant) float#
class forte2._forte2.RelSlaterRules(nspinor: int, scalar_energy: float, one_electron_integrals: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None)], two_electron_integrals: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None, None, None)], tei_is_asym: bool = False)#
energy(arg: Determinant, /) float#
energies(dets: DeterminantVector) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None)]#

Compute the energies of a vector of determinants

slater_rules(lhs: Determinant, rhs: Determinant) complex#
class forte2._forte2.SparseState#
class forte2._forte2.SparseState(arg: SparseState)
class forte2._forte2.SparseState(arg: collections.abc.Mapping[Determinant, complex], /)
class forte2._forte2.SparseState(det: Determinant, val: complex = 1)

A class to represent a vector of determinants

items() collections.abc.Iterator[tuple[Determinant, complex]]#
str(arg: int, /) str#
size() int#
norm(p: int = 2) float#

Calculate the p-norm of the SparseState (default p = 2, p = -1 for infinity norm)

add(arg0: Determinant, arg1: complex, /) None#
map() ankerl::unordered_dense::v4_8_1::detail::table<forte2::DeterminantImpl<128ul>, std::__1::complex<double>, std::__1::hash<forte2::DeterminantImpl<128ul>>, std::__1::equal_to<forte2::DeterminantImpl<128ul>>, std::__1::allocator<std::__1::pair<forte2::DeterminantImpl<128ul>, std::__1::complex<double>>>, ankerl::unordered_dense::v4_8_1::bucket_type::standard, ankerl::unordered_dense::v4_8_1::detail::default_container_t, false>#
elements() ankerl::unordered_dense::v4_8_1::detail::table<forte2::DeterminantImpl<128ul>, std::__1::complex<double>, std::__1::hash<forte2::DeterminantImpl<128ul>>, std::__1::equal_to<forte2::DeterminantImpl<128ul>>, std::__1::allocator<std::__1::pair<forte2::DeterminantImpl<128ul>, std::__1::complex<double>>>, ankerl::unordered_dense::v4_8_1::bucket_type::standard, ankerl::unordered_dense::v4_8_1::detail::default_container_t, false>#
apply(arg: SparseOperator, /) SparseState#

Apply an operator to this SparseState and return a new SparseState

apply_antiherm(arg: SparseOperator, /) SparseState#

Apply the antihermitian combination of the operator (op - op^dagger) to this SparseState and return a new SparseState

number_project(arg0: int, arg1: int, /) SparseState#
spin2() complex#

Calculate the expectation value of S^2 for this SparseState

overlap(arg: SparseState, /) complex#

Calculate the overlap between this SparseState and another SparseState

forte2._forte2.apply_op(sop: SparseOperator, state0: SparseState, screen_thresh: float = 1e-12) SparseState#
forte2._forte2.apply_antiherm(sop: SparseOperator, state0: SparseState, screen_thresh: float = 1e-12) SparseState#
forte2._forte2.apply_number_projector(arg0: int, arg1: int, arg2: SparseState, /) SparseState#
forte2._forte2.get_projection(arg0: SparseOperatorList, arg1: SparseState, arg2: SparseState, /) list[complex]#
forte2._forte2.overlap(arg0: SparseState, arg1: SparseState, /) complex#
forte2._forte2.normalize(arg: SparseState, /) SparseState#

Returns a normalized version of the input SparseState

class forte2._forte2.SparseOperator#
class forte2._forte2.SparseOperator(arg: SparseOperator)
class forte2._forte2.SparseOperator(arg: collections.abc.Mapping[SQOperatorString, complex], /)
class forte2._forte2.SparseOperator(sqop: SQOperatorString, coefficient: complex = ...)

A class to represent a sparse operator

add(sqop: SQOperatorString, coefficient: complex = ...) None#
add(str: SparseOperator.add.str, coefficient: complex = ..., allow_reordering: bool = False) None
add(acre: collections.abc.Sequence[int], bcre: collections.abc.Sequence[int], aann: collections.abc.Sequence[int], bann: collections.abc.Sequence[int], coeff: complex = ...) None

Add a term to the operator by passing lists of creation and annihilation indices. This version is faster than the string version and does not check for reordering

remove(arg: str, /) None#

Remove a term

coefficient(arg: str, /) complex#

Get the coefficient of a term

set_coefficient(arg0: str, arg1: complex, /) None#

Set the coefficient of a term

commutator(arg: SparseOperator, /) SparseOperator#

Compute the commutator of two SparseOperator objects

copy(arg: SparseOperator, /) None#

Create a copy of this SparseOperator

norm() float#

Compute the norm of the operator

str() list[str]#

Get a string representation of the operator

latex() str#

Get a LaTeX representation of the operator

adjoint() SparseOperator#

Get the adjoint

apply_to_state(state: SparseState, screen_thresh: float = 1e-12) SparseState#

Apply the operator to a state

matrix(dets: collections.abc.Sequence[Determinant], screen_thresh: float = 1e-12) Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None)]#

Compute the matrix elements of the operator between a list of determinants

forte2._forte2.sparse_operator(s: str, coefficient: complex = ..., allow_reordering: bool = False) SparseOperator#
forte2._forte2.sparse_operator(list: collections.abc.Sequence[tuple[str, complex]], allow_reordering: bool = False) SparseOperator
forte2._forte2.sparse_operator(s: SQOperatorString, coefficient: complex = ...) SparseOperator
forte2._forte2.sparse_operator(list: collections.abc.Sequence[tuple[SQOperatorString, complex]]) SparseOperator

Create a SparseOperator object from a list of Tuple[SQOperatorString, complex]

forte2._forte2.new_product(arg0: SparseOperator, arg1: SparseOperator, /) SparseOperator#
forte2._forte2.sparse_operator_hamiltonian(scalar_energy: float, one_electron_integrals: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)], two_electron_integrals: Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)], screen_thresh: float = 1e-12) SparseOperator#
forte2._forte2.sparse_operator_hamiltonian(scalar_energy: float, one_electron_integrals: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None)], two_electron_integrals: Annotated[numpy.typing.NDArray[numpy.complex128], dict(shape=None, None, None, None)], screen_thresh: float = 1e-12) SparseOperator
class forte2._forte2.SparseOperatorList#
class forte2._forte2.SparseOperatorList(arg: SparseOperatorList)

A class to represent a list of sparse operators

add(arg0: SQOperatorString, arg1: complex, /) None#
add(str: SparseOperatorList.add.str, coefficient: complex = ..., allow_reordering: bool = False) None
add(acre: collections.abc.Sequence[int], bcre: collections.abc.Sequence[int], aann: collections.abc.Sequence[int], bann: collections.abc.Sequence[int], coeff: complex = ...) None

Add a term to the operator by passing lists of creation and annihilation indices. This version is faster than the string version and does not check for reordering

add_term(op_list: collections.abc.Sequence[std::__1::tuple<bool, bool, int>], value: float = 0.0, allow_reordering: bool = False) None#
to_operator() SparseOperator#
remove(arg: str, /) None#

Remove a specific element from the vector space

coefficients() list[complex]#
set_coefficients(arg: collections.abc.Sequence[complex], /) None#
reverse() SparseOperatorList#

Reverse the order of the operators

pop_left() SparseOperatorList#

Remove the leftmost operator

pop_right() SparseOperatorList#

Remove the rightmost operator

slice(start: int, end: int) SparseOperatorList#

Return a slice of the operator

apply_to_state(state: SparseState, screen_thresh: float = 1e-12) SparseState#

Apply the operator to a state

forte2._forte2.operator_list(s: str, coefficient: complex = ..., allow_reordering: bool = False) SparseOperatorList#
forte2._forte2.operator_list(list: collections.abc.Sequence[tuple[str, complex]], allow_reordering: bool = False) SparseOperatorList
forte2._forte2.operator_list(s: SQOperatorString, coefficient: complex = ...) SparseOperatorList
forte2._forte2.operator_list(list: collections.abc.Sequence[tuple[SQOperatorString, complex]]) SparseOperatorList

Create a SparseOperatorList object from a list of Tuple[SQOperatorString, complex]

class forte2._forte2.SparseExp(maxk: int = 19, screen_thresh: float = 1e-12)#

A class to compute the exponential of a sparse operator

apply_op(sop: SparseOperator, state: SparseState, scaling_factor: float = 1.0) SparseState#
apply_op(sop: SparseOperatorList, state: SparseState, scaling_factor: float = 1.0) SparseState

Apply the exponential of a SparseOperatorList to a state: exp(scaling_factor * sop) |state>

apply_antiherm(sop: SparseOperator, state: SparseState, scaling_factor: float = 1.0) SparseState#
apply_antiherm(sop: SparseOperatorList, state: SparseState, scaling_factor: float = 1.0) SparseState

Apply the antihermitian exponential of a SparseOperatorList to a state: exp(scaling_factor * (sop - sop^dagger)) |state

class forte2._forte2.SparseFactExp(screen_thresh: float = 1e-12)#

A class to compute the product exponential of a sparse operator using factorization

apply_op(sop: SparseOperatorList, state: SparseState, inverse: bool = False, reverse: bool = False) SparseState#

Apply the factorized exponential of a SparseOperator to a state: … exp(op2) exp(op1) |state>. inverse=True computes the inverse, and reverse=Trueapplies the operators in reverse order

apply_antiherm(sop: SparseOperatorList, state: SparseState, inverse: bool = False, reverse: bool = False) SparseState#

Apply the factorized antihermitian exponential of a SparseOperator to a state: … exp(op2 - op2^dagger) exp(op1 - op1^dagger) |state>. inverse=True computes the inverse, and reverse=True applies the operators in reverse order

apply_antiherm_deriv(sqop: SQOperatorString, t: complex, state: SparseState) tuple[SparseState, SparseState]#
forte2._forte2.compute_a_1rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the alpha 1-RDM between two SparseStates

forte2._forte2.compute_b_1rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None)]#

Compute the beta 1-RDM between two SparseStates

forte2._forte2.compute_aa_2rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the alpha-alpha 2-RDM between two SparseStates

forte2._forte2.compute_ab_2rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the alpha-beta 2-RDM between two SparseStates

forte2._forte2.compute_bb_2rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None)]#

Compute the beta-beta 2-RDM between two SparseStates

forte2._forte2.compute_aaa_3rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None)]#

Compute the alpha-alpha-alpha 3-RDM between two SparseStates

forte2._forte2.compute_aab_3rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None)]#

Compute the alpha-alpha-beta 3-RDM between two SparseStates

forte2._forte2.compute_abb_3rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None)]#

Compute the alpha-beta-beta 3-RDM between two SparseStates

forte2._forte2.compute_bbb_3rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None)]#

Compute the beta-beta-beta 3-RDM between two SparseStates

forte2._forte2.compute_aaaa_4rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None, None, None)]#

Compute the alpha-alpha-alpha-alpha 4-RDM between two SparseStates

forte2._forte2.compute_aaab_4rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None, None, None)]#

Compute the alpha-alpha-alpha-beta 4-RDM between two SparseStates

forte2._forte2.compute_aabb_4rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None, None, None)]#

Compute the alpha-alpha-beta-beta 4-RDM between two SparseStates

forte2._forte2.compute_abbb_4rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None, None, None)]#

Compute the alpha-beta-beta-beta 4-RDM between two SparseStates

forte2._forte2.compute_bbbb_4rdm(state_left: SparseState, state_right: SparseState, norb: int) Annotated[numpy.typing.NDArray[numpy.float64], dict(shape=None, None, None, None, None, None, None, None)]#

Compute the beta-beta-beta-beta 4-RDM between two SparseStates

class forte2._forte2.SQOperatorString(arg0: Determinant, arg1: Determinant, /)#

A class to represent a string of creation/annihilation operators

cre() Determinant#

Get the creation operator string

ann() Determinant#

Get the annihilation operator string

sign_mask() Determinant#

Get the precomputed sign mask

str() str#

Get the string representation of the operator string

count() int#

Get the number of operators

adjoint() SQOperatorString#

Get the adjoint operator string

spin_flip() SQOperatorString#

Get the spin-flipped operator string

number_component() SQOperatorString#

Get the number component of the operator string

non_number_component() SQOperatorString#

Get the non-number component of the operator string

latex() str#

Get the LaTeX representation of the operator string

latex_compact() str#

Get the compact LaTeX representation of the operator string

is_identity() bool#

Check if the operator string is the identity operator

is_nilpotent() bool#

Check if the operator string is nilpotent

op_tuple() std::__1::vector<std::__1::tuple<bool, bool, int>, std::__1::allocator<std::__1::tuple<bool, bool, int>>>#

Get the operator tuple

forte2._forte2.sqop(s: str, allow_reordering: bool = False) tuple[SQOperatorString, float]#

Create an operator string from a string representation (default: no not allow reordering)

forte2._forte2.compute_sign_mask(cre: Determinant, ann: Determinant) Determinant#

Compute the sign mask associated with a set of creation and annihilation operators

class forte2._forte2.CommutatorType(*args, **kwds)#

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

commute = 0#
anticommute = 1#
may_not_commute = 2#
forte2._forte2.commutator_type(lhs: SQOperatorString, rhs: SQOperatorString) CommutatorType#

Get the commutator type of two operator strings