Ground state calculations¶
Configuration interaction super class¶
In our implementation the truncation level of the Slater determinant basis uniquely decides the configuration interaction class. We’ve therefore created a single abstract super-class defining all methods needed by the CI-solvers.
-
class
configuration_interaction.ci.
ConfigurationInteraction
(system, s=None, verbose=False)¶ Abstract base class defining the skeleton of a truncated configuration interaction class. All subclasses need to provide the member
excitations
as this decides the basis of Slater determinants.- Parameters
system (QuantumSystems) – Quantum systems instance.
s (int) – Spin projection number to keep. Default is
None
and all determinants are kept.verbose (bool) – Print timer and logging info. Default value is
False
.
-
compute_ground_state
(k=None)¶ Function constructing the Hamiltonian of the system without any optimization such as the Slater-Condon rules, etc. Having constructed the Hamiltonian the function diagonalizes the matrix and stores the eigenenergies and the eigenvectors (coefficients) of the system.
Note that the current solution assumes orthonormal Slater determinants.
- Parameters
k (int) – The number of eigenpairs to compute using an iterative eigensolver. Default is
None
, which means that all eigenpairs are computed.
-
compute_one_body_density_matrix
(K=0)¶ Function computing the one-body density matrix \((\rho_K)^{q}_{p}\) defined by
\[(\rho_K)^{q}_{p} = \langle\Psi_K\rvert \hat{c}_{p}^{\dagger} \hat{c}_{q} \lvert\Psi_K\rangle,\]where \(\lvert\Psi_K\rangle\) is the \(K\)’th eigenstate of the Hamiltonian defined by
\[\lvert\Psi_K\rangle = C_{JK} \lvert\Phi_J\rangle,\]where \(\lvert\Phi_J\rangle\) is the \(J\)’th Slater determinant and \(C_{JK}\) is the coefficient matrix found from diagonalizing the Hamiltonian.
- Parameters
K (int) – The eigenstate to compute the one-body density matrix from.
- Returns
The one-body density matrix.
- Return type
np.ndarray
-
compute_one_body_expectation_value
(mat, K=0)¶ Function computing the expectation value of a one-body operator. For a given one-body operator \(\hat{A}\) we compute the expectation value by
\[\langle \hat{A} \rangle = \rho^{q}_{p} A^{p}_{q},\]where \(p, q\) are general single-particle indices.
- Parameters
mat (np.ndarray) – The one-body operator to evalute, as a matrix. The dimensionality of the matrix must be the same as the one-body density matrix, i.e., the number of basis functions
l
.K (int) – The eigenstate to use for the one-body density matrix.
- Returns
The expectation value of the one-body operator.
- Return type
complex
-
compute_particle_density
(K=0)¶ Function computing the particle density \(\rho_K(x)\) defined by
\[\rho_K(x) = \phi^{*}_{q}(x) (\rho_K)^{q}_{p} \phi_{p}(x),\]where \(\phi_p(x)\) are the single-particle functions, \((\rho_K)^{q}_{p}\) the one-body density matrix for eigenstate \(K\), and \(x\) some coordinate space. Note the use of the Einstein summation convention in the above expression.
- Parameters
K (int) – The eigenstate to compute the particle density of. Default is
K = 0
.- Returns
Particle density on the same grid as the single-particle functions.
- Return type
np.ndarray
-
compute_two_body_density_matrix
(K=0)¶ Function computing the two-body density matrix \((\rho_K)^{rs}_{pq}\) defined by
\[(\rho_K)^{rs}_{pq} = \langle\Psi_K\rvert \hat{c}_{p}^{\dagger} \hat{c}_{q}^{\dagger} \hat{c}_{s} \hat{c}_{r} \lvert\Psi_K\rangle,\]where \(\lvert\Psi_K\rangle\) is the \(K\)’th eigenstate of the Hamiltonian defined by
\[\lvert\Psi_K\rangle = C_{JK} \lvert\Phi_J\rangle,\]where \(\lvert\Phi_J\rangle\) is the \(J\)’th Slater determinant and \(C_{JK}\) is the coefficient matrix found from diagonalizing the Hamiltonian.
- Parameters
K (int) – The eigenstate to compute the two-body density matrix from.
- Returns
The two-body density matrix.
- Return type
np.ndarray
-
compute_two_body_expectation_value
(op, K=0, asym=True)¶ Function computing the expectation value of a two-body operator. For a given two-body operator \(\hat{A}\), we compute the expectation value by
\[\langle \hat{A} \rangle = \rho^{rs}_{pq} A^{pq}_{rs},\]where \(p, q, r, s\) are general single-particle indices.
- Parameters
op (np.ndarray) – The two-body operator to evalute, as a 4-axis array. The dimensionality of the array must be the same as the two-body density matrix, i.e., the number of basis functions
l
.K (int) – The eigenstate to use for the two-body density matrix.
asym (bool) – Toggle whether or not
op
is anti-symmetrized or not. This determines the prefactor when tracing the two-body density matrix with the two-body operator. Default isTrue
.
- Returns
The expectation value of the two-body operator.
- Return type
complex
To create a specific CI-solver a subclass of the
ConfigurationInteraction
-class must be created setting the field
excitations
.
Creating truncated CI-classes¶
The library includes pre-defined classes for some of the more common truncation levels. These are:
CIS
CID
CISD
CIDT
CISDT
CIDTQ
CISDTQ
However, these classes and others can be created by the function
get_ci_class
listed below.
As an example, we demonstrate how to create a CISDTQ56-class using this function:
# Create the object class
CISDTQ56 = get_ci_class("CISDTQ56")
# Instantiate the object, and setup the Slater determinants
cisdtq56 = CISDTQ56(system, verbose=True)
# Compute the ground state of the system
cisdtq56.compute_ground_state()