Quantum System

All systems are represented by the QuantumSystem-class. This class allows the construction of custom systems by passing in matrix elements. Alternatively, there are subclasses setting up specific systems.

class quantum_systems.QuantumSystem(n, basis_set)

Abstract base class defining general methods and data on a quantum system. The class is used to further specify a system beyond a general BasisSet by specifying the number of particles in the system.

Parameters
  • n (int) – Number of occupied basis functions.

  • basis_set (BasisSet) – A BasisSet-class or subclass containing matrix elements and basis states.

property bra_spf

Getter returning the conjugate single particle functions.

change_module(np)

Function converting between modules.

Parameters

np (module) – Array- and linalg-module.

copy_system()

Function creating a deep copy of the current system. This function is a hack as we have to temporarily remove the stored module before using Python’s copy.deepcopy-function.

Returns

A deep copy of the current system.

Return type

QuantumSystem

property dipole_moment

Getter returning the dipole moment elements.

property h

Getter returning the one-body Hamiltonian.

property momentum

Getter returning the momentum matrix.

property nuclear_repulsion_energy

Getter returning the nuclear repulsion energy.

property particle_charge

Getter returning the electronic charge of the particles.

property position

Getter retuning the position matrix.

property s

Getter returning the overlap matrix.

set_system_size(n, l)

Function setting the system size. Note that l should correspond to the length of each axis of the matrix elements.

Parameters
  • n (int) – Number of basis functions.

  • l (int) – Number of basis functions.

set_time_evolution_operator(time_evolution_operator, add_h_0=True, add_u_0=True)

Function adding time-dependent terms to the Hamiltonian.

Parameters
  • time_evolution_operator (TimeEvolutionOperator, list) – Either a list or a single instance of TimeEvolutionOperator.

  • add_h_0 (bool) – When True includes the time-independent part of the one-body Hamiltonian when calling QuantumSystem.h_t. Default is True.

  • add_u_0 (bool) – When True includes the time-independent part of the two-body Hamiltonian when calling QuantumSystem.u_t. Default is True.

See also

TimeEvolutionOperator

property spf

Getter returning the single particle functions.

property u

Getter returning the two-body Hamiltonian.

class quantum_systems.SpatialOrbitalSystem(n, basis_set, **kwargs)

Quantum system containing orbital matrix elements, i.e., we only keep the spatial orbitals as they are degenerate in each spin direction. We have

\[\psi(x, t) = \psi(\mathbf{r}, t) \sigma(m_s),\]

where \(x = (\mathbf{r}, m_s)\) is a generalized coordinate of position and spin, and \(\sigma(m_s)\) is either \(\alpha(m_s)\) or \(\beta(m_s)\) as the two-dimensional spin basis states. This means that we only store \(\psi(\mathbf{r}, t)\).

Parameters
  • n (int) – Number of particles. Internally SpatialOrbitalSystem converts n to n // 2 such that n denotes the number of occupied basis functions (half the number of particles). See example in doctest below.

  • basis_set (BasisSet) – Spatial orbital basis set without explicit spin-dependence.

See also

QuantumSystem

Example

>>> n = 4 # Four particles
>>> l = 20 # Twenty basis functions
>>> dim = 2
>>> from quantum_systems import RandomBasisSet
>>> spas = SpatialOrbitalSystem(n, RandomBasisSet(l, dim))
>>> spas.n == n // 2
True
compute_reference_energy()

Function computing the reference energy in an orbital system. This is given by

\[E_0 = \langle \Phi_0 \rvert \hat{H} \lvert \Phi_0 \rangle = 2 h^{i}_{i} + 2 u^{ij}_{ij} - u^{ij}_{ji},\]

where \(\lvert \Phi_0 \rangle\) is the reference determinant, and \(i, j\) are occupied indices.

Returns

The reference energy.

Return type

complex

construct_fock_matrix(h, u, f=None)

Function setting up the restricted Fock matrix in a closed-shell orbital basis.

In an orbital basis we compute:

\[f^{p}_{q} = h^{p}_{q} + 2 u^{pi}_{qi} - u^{pi}_{iq},\]

where \(p, q, r, s, ...\) run over all indices and \(i, j, k, l, ...\) correspond to the occupied indices. The two-body elements are assumed to not be anti-symmetric.

Parameters
  • h (np.ndarray) – The one-body matrix elements.

  • u (np.ndarray) – The two-body matrix elements.

  • f (np.ndarray) – An empty array of the same shape as h to be filled with the Fock matrix elements. Default is None which means that we allocate a new matrix.

Returns

The filled Fock matrix.

Return type

np.ndarray

construct_general_orbital_system(a=[1, 0], b=[0, 1], anti_symmetrize=True)

Function constructing a GeneralOrbitalSystem by duplicating every basis element of current system. That is,

\[\psi(\mathbf{r}, t) \to \psi(x, t) = \psi(\mathbf{r}, t) \sigma(m_2),\]

where \(x = (\mathbf{r}, m_s)\) is a generalized coordinate of both position \(\mathbf{r}\) and spin \(m_s\), with \(\sigma(m_s)\) one of the two spin-functions.

Note that this function creates a copy of the basis set.

Parameters
  • a (list, np.array) – The \(\alpha\) (up) spin basis vector. Default is \(\alpha = (1, 0)^T\).

  • b (list, np.array) – The \(\beta\) (down) spin basis vector. Default is \(\beta = (0, 1)^T\). Note that a and b are assumed orthonormal.

  • anti_symmetrize (bool) – Whether or not to create the anti-symmetrized two-body elements. Default is True.

Returns

The doubly degenerate general spin-orbital system.

Return type

GeneralOrbitalSystem

class quantum_systems.GeneralOrbitalSystem(n, basis_set, a=[1, 0], b=[0, 1], anti_symmetrize=True, **kwargs)

Quantum system containing matrix elements represented as general spin-orbitals, i.e.,

\[\psi(x, t) = \psi^{\alpha}(\mathbf{r}, t) \alpha(m_s) + \psi^{\beta}(\mathbf{r}, t) \beta(m_s),\]

where \(x = (\mathbf{r}, m_s)\) is a generalized coordinate of position and spin, and \(\alpha(m_s)\) and \(\beta(m_s)\) are the two-dimensional spin basis states. Using general spin-orbitals allows mixing between different spin-directions, furthermore the spatial orbitals \(\psi^{\alpha}(\mathbf{r}, t)\) and \(\psi^{\beta}(\mathbf{r}, t)\) are allowed to vary freely. The spin-orbital representation is the most general representation of the single-particle states, but note that the system size grows quickly. Furthermore, we are unable to categorize a general spin-orbital as having a definitive spin-direction.

Parameters
  • a (list, np.array) – The \(\alpha\) (up) spin basis vector. Default is \(\alpha = (1, 0)^T\).

  • b (list, np.array) – The \(\beta\) (down) spin basis vector. Default is \(\beta = (0, 1)^T\). Note that a and b are assumed orthonormal.

  • anti_symmetrize (bool) – Whether or not to create the anti-symmetrized two-body elements. Default is True.

See also

QuantumSystem

Parent class with constructor and main interface functions.

compute_reference_energy()

Function computing the reference energy in a general spin-orbital system. This is given by

\[E_0 = \langle \Phi_0 \rvert \hat{H} \lvert \Phi_0 \rangle = h^{i}_{i} + \frac{1}{2} u^{ij}_{ij},\]

where \(\lvert \Phi_0 \rangle\) is the reference determinant, and \(i, j\) are occupied indices.

Returns

The reference energy.

Return type

complex

construct_fock_matrix(h, u, f=None)

Function setting up the Fock matrix, that is, the normal-ordered one-body elements, in a general spin-orbital basis. This function assumes that the two-body elements are anti-symmetrized.

In a general spin-orbital basis we compute:

\[f^{p}_{q} = h^{p}_{q} + u^{pi}_{qi},\]

where \(p, q, r, s, ...\) run over all indices and \(i, j, k, l, ...\) correspond to the occupied indices.

Parameters
  • h (np.ndarray) – The one-body matrix elements.

  • u (np.ndarray) – The two-body matrix elements.

  • f (np.ndarray) – An empty array of the same shape as h to be filled with the Fock matrix elements. Default is None which means that we allocate a new matrix.

Returns

The filled Fock matrix.

Return type

np.ndarray