forte2._forte2#

Module Contents#

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 alfa_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_alfa_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() list[Determinant]#
class forte2._forte2.CISigmaBuilder(lists: CIStrings, E: float, H: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None, None)], V: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', 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: collections.abc.Sequence[Determinant], spin_adapter: CISpinAdapter, spin_adapt_full_preconditioner: bool = False) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]#
energy_csf(dets: collections.abc.Sequence[Determinant], spin_adapter: CISpinAdapter, I: int) float#

Compute the energy of a CSF

form_H_csf(dets: collections.abc.Sequence[Determinant], spin_adapter: CISpinAdapter) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None, None)]#

Form the full Hamiltonian matrix in the CSF basis

slater_rules_csf(dets: collections.abc.Sequence[Determinant], spin_adapter: CISpinAdapter, I: int, J: int) float#
Hamiltonian(basis: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], sigma: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) None#
sf_1rdm(C_left: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None, None)]#

Compute the spin-free one-electron reduced density matrix

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

Compute the spin-free two-electron reduced density matrix

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

Compute the spin-free three-electron reduced density matrix

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

Compute the spin-free two-electron cumulant

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

Compute the spin-free three-electron cumulant

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

Compute the alpha one-electron reduced density matrix

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

Compute the beta one-electron reduced density matrix

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

Compute the alpha-alpha two-electron reduced density matrix

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

Compute the beta-beta two-electron reduced density matrix

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

Compute the alpha-beta two-electron reduced density matrix

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

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

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

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

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

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

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

Compute the beta-beta-beta three-electron 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.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], alfa: bool) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None, None)]#
aa_2rdm_debug(C_left: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], alfa: bool) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None, None)]#

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

ab_2rdm_debug(C_left: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', 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.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], alfa: bool) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None, None)]#

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

aab_3rdm_debug(C_left: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', 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.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', 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.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], alfa: bool) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None, None)]#

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

aaab_4rdm_debug(C_left: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', 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.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', 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.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', 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.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None, None)]#

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

sf_2rdm_debug(C_left: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', 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.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', 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.ArrayLike, dict(dtype='float64', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None, None, None, None)]#

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

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

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

class forte2._forte2.RelCISigmaBuilder(lists: CIStrings, E: float, H: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None, None)], V: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', 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(dets: collections.abc.Sequence[Determinant]) Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)]#
slater_rules(dets: collections.abc.Sequence[Determinant], I: int, J: int) complex#
Hamiltonian(basis: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)], sigma: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)]) None#
so_1rdm(C_left: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None, None)]#

Compute the spin-orbital one-electron reduced density matrix

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

Compute the spin-orbital two-electron reduced density matrix

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

Compute the spin-orbital two-electron cumulant

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

Compute the spin-orbital three-electron reduced density matrix

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

Compute the spin-orbital three-electron cumulant

so_1rdm_debug(C_left: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None, None)]#
so_2rdm_debug(C_left: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None, None, None, None)]#
so_3rdm_debug(C_left: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)], C_right: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None)]) Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None, None, None, None, None, None)]#
class forte2._forte2.CISpinAdapter(twoS: int, twoMs: int, norb: int)#
prepare_couplings(dets: collections.abc.Sequence[Determinant]) None#
csf_C_to_det_C(csf_C: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], det_C: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) None#
det_C_to_csf_C(det_C: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)], csf_C: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None)]) None#
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(arg: str, /)
static zero() Determinant#
set_na(arg0: int, arg1: bool, /) None#
set_nb(arg0: int, arg1: bool, /) None#
na(arg: int, /) bool#
nb(arg: int, /) bool#
count_a() int#
count_b() int#
count() int#
create_a(n: int) float#

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

create_b(n: int) float#

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

destroy_a(n: int) float#

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

destroy_b(n: int) float#

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

spin_flip() Determinant#

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

slater_sign(arg: int, /) float#

Get the sign of the Slater determinant

slater_sign_reverse(arg: int, /) float#

Get the sign of the Slater determinant

gen_excitation(arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[int], arg2: collections.abc.Sequence[int], arg3: collections.abc.Sequence[int], /) float#

Apply a generic excitation

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

Get the excitation connection between this and another determinant

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.

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

Get the string representation of the Slater determinant

is_empt(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 value of an alpha bit

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.ArrayLike, dict(dtype='float64', shape=None, None)], two_electron_integrals: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', shape=None, None, None, None)])#
energy(arg: Determinant, /) float#
slater_rules(lhs: Determinant, rhs: Determinant) float#
class forte2._forte2.RelSlaterRules(nspinor: int, scalar_energy: float, one_electron_integrals: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None, None)], two_electron_integrals: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', shape=None, None, None, None)])#
energy(arg: Determinant, /) float#
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_5_0::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_5_0::bucket_type::standard, ankerl::unordered_dense::v4_5_0::detail::default_container_t, false>#
elements() ankerl::unordered_dense::v4_5_0::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_5_0::bucket_type::standard, ankerl::unordered_dense::v4_5_0::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.spin2(arg0: SparseState, arg1: SparseState, /) complex#

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

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.ArrayLike, dict(dtype='complex128', 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.ArrayLike, dict(dtype='float64', shape=None, None)], two_electron_integrals: Annotated[numpy.typing.ArrayLike, dict(dtype='float64', 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.ArrayLike, dict(dtype='complex128', shape=None, None)], two_electron_integrals: Annotated[numpy.typing.ArrayLike, dict(dtype='complex128', 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]#
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

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)

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