diff --git a/src/fqe/hamiltonians/diagonal_coulomb.py b/src/fqe/hamiltonians/diagonal_coulomb.py index f2b0b00..47abcea 100644 --- a/src/fqe/hamiltonians/diagonal_coulomb.py +++ b/src/fqe/hamiltonians/diagonal_coulomb.py @@ -22,14 +22,30 @@ class DiagonalCoulomb(hamiltonian.Hamiltonian): """The diagonal coulomb Hamiltonian is characterized as being a two-body operator with a specific structure such that it is the product of two - number operators. + number operators. It is generally written as + + .. math:: + \\hat{H} = E_0 + \\sum_r f_r \\hat{n}_r + + \\sum_{rs} v_{rs} \\hat{n}_r \\hat{n}_s + + where n is a number operator. Note that this Hamiltonian is diagonal + in the Slater determinant space, + + .. math:: + \\langle I|\\hat{H}|J\\rangle = p \\delta_{IJ} + + where p is an appropriate factor. """ def __init__(self, h2e: np.ndarray, e_0: complex = 0.0 + 0.0j) -> None: """Initialize a DiagonalCoulomb Hamiltonian. Args: - h2e: Dense two-body tensor that contains DiagonalCoulomb elements. + h2e: either (1) a dense rank-2 array that contains the diagonal + elements :math:`|v_{rs}|` above, or (2) a dense rank-4 array + in the format used for two-body operator in the dense + Hamiltonian code. + e_0: Scalar potential associated with the Hamiltonian. """ diff --git a/src/fqe/hamiltonians/diagonal_hamiltonian.py b/src/fqe/hamiltonians/diagonal_hamiltonian.py index f0a8e63..b2b962c 100644 --- a/src/fqe/hamiltonians/diagonal_hamiltonian.py +++ b/src/fqe/hamiltonians/diagonal_hamiltonian.py @@ -14,23 +14,36 @@ """Defines the DiagonalHamiltonian class.""" import copy -from typing import Tuple +from typing import TYPE_CHECKING import numpy as np from fqe.hamiltonians import hamiltonian +if TYPE_CHECKING: + from numpy import ndarray as Nparray + class Diagonal(hamiltonian.Hamiltonian): - """Diagonal Hamiltonian class.""" + """ + One-body diagonal Hamiltonian class. Diagonal Hamiltonians are defined as + those that are diagonal in the Slater determinant space, namely, + + .. math:: + \\langle I|\\hat{H}|J\\rangle = p \\delta_{IJ} + + where I and J are Slater determinants, and p is some phase. Generally + such Hamiltonians can be written as + + .. math:: + \\hat{H} = = E_0 + \\sum_r h_{rr} a_r^\\dagger a_r + """ - def __init__(self, hdiag: np.array, e_0: complex = 0.0 + 0.0j) -> None: + def __init__(self, hdiag: 'Nparray', e_0: complex = 0.0 + 0.0j) -> None: """ Args: - hdiag: A variable length tuple containing between one and four - numpy.arrays of increasing rank. The tensors contain the n-body - Hamiltonian elements. Tensors up to the highest order must be - included even if the lower terms are full of zeros. + hdiag: A rank-1 numpy.array that contains the diagonal part of the + 1-body Hamiltonian elements. e_0: Scalar potential associated with the Hamiltonian. """