qrunch.quantum.operators.second_quantization.hardcore_boson.sums
A chemistry-specific representation of a hard-core bosonic operator.
Consisting only of single and double excitations.
Classes
Backward-compatible alias for deserializing legacy paired hardcore boson operator data. |
|
Compact representation of the full second quantization hard-core bosonic hermitian sum. |
- class ChemistryPairedHardcoreBosonHermitianSum
Bases:
PairedHardcoreBosonHermitianSumBackward-compatible alias for deserializing legacy paired hardcore boson operator data.
This operator used to live in a chemistry-specific module and class. Legacy serialized data references this class name, so this shim reconstructs the current operator from its pickled
__dict__state, whose attribute names match the current implementation.Note that the old implementation did not implement the
encodeanddecodemethods, so this shim does not implement them either, relying on __setstate__ instead.- __init__(single_excitations: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]] | DenseArray | SingleExcitationsArray, two_body_integrals: RestrictedTwoBodyElectronRepulsionIntegralsProtocol, *, tolerance: float = 1e-10) None
Initialize the full operator.
- Parameters:
single_excitations (ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]] | DenseArray | SingleExcitationsArray) – Single excitation part of the operator.
two_body_integrals (RestrictedTwoBodyElectronRepulsionIntegralsProtocol) – Double excitation part of the operator.
tolerance (float) – Remove terms with a value lower than this.
- Return type:
None
- classmethod decode(data: dict[str, Any]) PairedHardcoreBosonHermitianSum
Decode a dictionary to an instance of PairedHardcoreBosonHermitianSum.
- Parameters:
data (dict[str, Any]) – The dictionary representation of a PairedHardcoreBosonHermitianSum instance.
- Return type:
- double_data() ndarray[tuple[Any, ...], dtype[float64]]
Return the double data.
- Return type:
ndarray[tuple[Any, …], dtype[float64]]
- property double_excitations: DenseArray
Double excitations in the Paired Hard Core Boson representation.
- double_excitations_einsum(einsum_str: str, *operands: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]]
Wrap np.einsum where the first operand is always double_excitations integrals.
Note, that the integrals are expected to be in a chemistry (8-fold symmetry) ordering.
- Parameters:
einsum_str (str) – The einsum string, e.g. “pqii->pq” or “pqrs,rs->pq”. The first operand-label (before the first comma) must have exactly 4 characters.
*operands (ndarray[tuple[Any, ...], dtype[float64]]) – Any additional ndarrays, in the order their labels appear in einsum_str.
- Raises:
ValueError – If the first label isn’t length 4 or the number of extra operands doesn’t match.
- Return type:
ndarray[tuple[Any, …], dtype[float64]]
- encode() dict[str, Any]
Encode the instance into a dictionary.
- Return type:
dict[str, Any]
- energy_einsum(einsum_str: str, *operands: ndarray[tuple[Any, ...], dtype[float64]]) float
Wrap np.einsum where the first operand is always double_excitations integrals.
Note, that the integrals are expected to be in a chemistry (8-fold symmetry) ordering.
- Parameters:
einsum_str (str) – The einsum string, e.g. “pqii->pq” or “pqrs,rs->pq”. The first operand-label (before the first comma) must have exactly 4 characters.
*operands (ndarray[tuple[Any, ...], dtype[float64]]) – Any additional ndarrays, in the order their labels appear in einsum_str.
- Raises:
ValueError – If the first label isn’t length 4 or the number of extra operands doesn’t match.
- Return type:
float
- integrals_are_real() bool
Return True, if the integrals are real.
- Return type:
bool
- static is_hardcore_bosonic() Literal[True]
Specify if the sum is a hardcore bosonic hermitian sum.
- Return type:
Literal[True]
- property is_restricted: Literal[True]
Whether it is restricted.
- one_body_index_coefficient_pairs() Iterator[tuple[tuple[int, int], float]]
Iterate over the one-body terms as
((p, q), coefficient)pairs.A diagonal pair
p == qis a number term; an off-diagonal pair is paired hard-core boson hopping.- Return type:
Iterator[tuple[tuple[int, int], float]]
- rotate(rotation_matrices: tuple[ndarray[tuple[Any, ...], dtype[float64]], ...]) Self
Rotate the excitations.
- Parameters:
rotation_matrices (tuple[ndarray[tuple[Any, ...], dtype[float64]], ...]) – The matrix to rotate with.
- Return type:
Self
- rotation_matrix_structure() list[RotationBlockDefinition]
Get information on which blocks should be non-zero in the rotation matrix.
- Return type:
list[RotationBlockDefinition]
- single_data() ndarray[tuple[Any, ...], dtype[float64]]
Return the single data.
- Return type:
ndarray[tuple[Any, …], dtype[float64]]
- property single_excitations: DenseArray
Single excitations in the Paired Hard Core Boson representation.
- two_body_index_coefficient_pairs() Iterator[tuple[tuple[int, int], float]]
Iterate over the two-body terms as
((i, j), coefficient)pairs.Each pair represents the density-density interaction \(\text{coefficient} \cdot n_i n_j\).
- Return type:
Iterator[tuple[tuple[int, int], float]]
- class PairedHardcoreBosonHermitianSum
Bases:
objectCompact representation of the full second quantization hard-core bosonic hermitian sum.
This operator takes single and double fermionic excitation operators and translate them into Paired Hard Core Boson operators.
Note that only the alpha-alpha part of the single excitation and the alpha-alpha-alpha-alpha part of the double excitations are preserved.
- __init__(single_excitations: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]] | DenseArray | SingleExcitationsArray, two_body_integrals: RestrictedTwoBodyElectronRepulsionIntegralsProtocol, *, tolerance: float = 1e-10) None
Initialize the full operator.
- Parameters:
single_excitations (ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]] | DenseArray | SingleExcitationsArray) – Single excitation part of the operator.
two_body_integrals (RestrictedTwoBodyElectronRepulsionIntegralsProtocol) – Double excitation part of the operator.
tolerance (float) – Remove terms with a value lower than this.
- Return type:
None
- classmethod decode(data: dict[str, Any]) PairedHardcoreBosonHermitianSum
Decode a dictionary to an instance of PairedHardcoreBosonHermitianSum.
- Parameters:
data (dict[str, Any]) – The dictionary representation of a PairedHardcoreBosonHermitianSum instance.
- Return type:
- double_data() ndarray[tuple[Any, ...], dtype[float64]]
Return the double data.
- Return type:
ndarray[tuple[Any, …], dtype[float64]]
- property double_excitations: DenseArray
Double excitations in the Paired Hard Core Boson representation.
- double_excitations_einsum(einsum_str: str, *operands: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]]
Wrap np.einsum where the first operand is always double_excitations integrals.
Note, that the integrals are expected to be in a chemistry (8-fold symmetry) ordering.
- Parameters:
einsum_str (str) – The einsum string, e.g. “pqii->pq” or “pqrs,rs->pq”. The first operand-label (before the first comma) must have exactly 4 characters.
*operands (ndarray[tuple[Any, ...], dtype[float64]]) – Any additional ndarrays, in the order their labels appear in einsum_str.
- Raises:
ValueError – If the first label isn’t length 4 or the number of extra operands doesn’t match.
- Return type:
ndarray[tuple[Any, …], dtype[float64]]
- encode() dict[str, Any]
Encode the instance into a dictionary.
- Return type:
dict[str, Any]
- energy_einsum(einsum_str: str, *operands: ndarray[tuple[Any, ...], dtype[float64]]) float
Wrap np.einsum where the first operand is always double_excitations integrals.
Note, that the integrals are expected to be in a chemistry (8-fold symmetry) ordering.
- Parameters:
einsum_str (str) – The einsum string, e.g. “pqii->pq” or “pqrs,rs->pq”. The first operand-label (before the first comma) must have exactly 4 characters.
*operands (ndarray[tuple[Any, ...], dtype[float64]]) – Any additional ndarrays, in the order their labels appear in einsum_str.
- Raises:
ValueError – If the first label isn’t length 4 or the number of extra operands doesn’t match.
- Return type:
float
- integrals_are_real() bool
Return True, if the integrals are real.
- Return type:
bool
- static is_hardcore_bosonic() Literal[True]
Specify if the sum is a hardcore bosonic hermitian sum.
- Return type:
Literal[True]
- property is_restricted: Literal[True]
Whether it is restricted.
- one_body_index_coefficient_pairs() Iterator[tuple[tuple[int, int], float]]
Iterate over the one-body terms as
((p, q), coefficient)pairs.A diagonal pair
p == qis a number term; an off-diagonal pair is paired hard-core boson hopping.- Return type:
Iterator[tuple[tuple[int, int], float]]
- rotate(rotation_matrices: tuple[ndarray[tuple[Any, ...], dtype[float64]], ...]) Self
Rotate the excitations.
- Parameters:
rotation_matrices (tuple[ndarray[tuple[Any, ...], dtype[float64]], ...]) – The matrix to rotate with.
- Return type:
Self
- rotation_matrix_structure() list[RotationBlockDefinition]
Get information on which blocks should be non-zero in the rotation matrix.
- Return type:
list[RotationBlockDefinition]
- single_data() ndarray[tuple[Any, ...], dtype[float64]]
Return the single data.
- Return type:
ndarray[tuple[Any, …], dtype[float64]]
- property single_excitations: DenseArray
Single excitations in the Paired Hard Core Boson representation.
- two_body_index_coefficient_pairs() Iterator[tuple[tuple[int, int], float]]
Iterate over the two-body terms as
((i, j), coefficient)pairs.Each pair represents the density-density interaction \(\text{coefficient} \cdot n_i n_j\).
- Return type:
Iterator[tuple[tuple[int, int], float]]