Unitary Coupled Cluster Wave Function

class slowquant.unitary_coupled_cluster.ucc_wavefunction.WaveFunctionUCC(num_spin_orbs: int, num_elec: int, cas: Sequence[int], c_orthonormal: ndarray, h_ao: ndarray, g_ao: ndarray, include_active_kappa: bool = False)

Initialize for UCC wave function.

Parameters:
  • num_spin_orbs – Number of spin orbitals.

  • num_elec – Number of electrons.

  • cas – CAS(num_active_elec, num_active_orbs), orbitals are counted in spatial basis.

  • c_orthonormal – Initial orbital coefficients.

  • h_ao – One-electron integrals in AO for Hamiltonian.

  • g_ao – Two-electron integrals in AO.

  • include_active_kappa – Include active-active orbital rotations.

add_multiple_theta(theta: dict[str, list[float]], excitations: str) None

Add multiple ranks of thetas.

Parameters:
  • theta – Dictionary of thetas.

  • excitations – Excitations to be included.

property c_orthonormal: ndarray

Get orthonormalization coefficients (MO coefficients).

Returns:

Orthonormalization coefficients.

property c_trans: ndarray

Get orbital coefficients.

Returns:

Orbital coefficients.

check_orthonormality(overlap_integral: ndarray) None

Check orthonormality of orbitals.

\[\boldsymbol{I} = \boldsymbol{C}_\text{MO}\boldsymbol{S}\boldsymbol{C}_\text{MO}^T\]
Parameters:

overlap_integral – Overlap integral in AO basis.

property g_mo: ndarray

Get two-electron Hamiltonian integrals in MO basis.

Returns:

Two-electron Hamiltonian integrals in MO basis.

property h_mo: ndarray

Get one-electron Hamiltonian integrals in MO basis.

Returns:

One-electron Hamiltonian integrals in MO basis.

property rdm1: ndarray

Calcuate one-electron reduced density matrix.

Returns:

One-electron reduced density matrix.

property rdm2: ndarray

Calcuate two-electron reduced density matrix.

Returns:

Two-electron reduced density matrix.

property rdm3: ndarray

Calcuate three-electron reduced density matrix.

Currently not utilizing the full symmetry.

Returns:

Three-electron reduced density matrix.

property rdm4: ndarray

Calcuate four-electron reduced density matrix.

Currently not utilizing the full symmetry.

Returns:

Four-electron reduced density matrix.

run_ucc(excitations: str, orbital_optimization: bool = False, is_silent: bool = False, convergence_threshold: float = 1e-10, maxiter: int = 10000) None

Run optimization of UCC wave function.

Parameters:
  • excitations – Excitation orders to include.

  • orbital_optimization – Do orbital optimization.

  • is_silent – Do not print any output.

  • convergence_threshold – Energy threshold for convergence.

  • maxiter – Maximum number of iterations.

save_wavefunction(filename: str, force_overwrite: bool = False) None

Save the wave function to a compressed NumPy object.

Parameters:
  • filename – Filename of compressed NumPy object without file extension.

  • force_overwrite – Overwrite file if it already exists.

property theta1: list[float]

Get theta1 values.

Returns:

theta1 values.

property theta2: list[float]

Get theta2 values.

Returns:

theta2 values.

property theta3: list[float]

Get theta3 values.

Returns:

theta3 values.

property theta4: list[float]

Get theta4 values.

Returns:

theta4 values.

property theta5: list[float]

Get theta5 values.

Returns:

theta5 values.

property theta6: list[float]

Get theta6 values.

Returns:

theta6 values.

property u: ndarray

Get unitary ansatz.

Returns:

Unitary ansatz.

property u_number_spin_conserving: ndarray

Get unitary that only work on number and spin conserving states.

Returns:

Unitary that only works on number and spin conserving states.

slowquant.unitary_coupled_cluster.ucc_wavefunction.active_space_parameter_gradient(wf: WaveFunctionUCC, parameters: Sequence[float], excitations: str, orbital_optimized: bool) ndarray

Calcuate electronic gradient with respect to active space parameters.

Parameters:
  • wf – Wave function object.

  • parameters – Sequence of all parameters. Ordered as orbital rotations, active-space singles, active-space doubles, …

  • excitations – Excitation orders to consider.

  • orbital_optimized – Do orbital optimization.

Returns:

Electronic gradient with respect to active spae parameters.

slowquant.unitary_coupled_cluster.ucc_wavefunction.eE(wf: WaveFunctionUCC, E: dict[tuple[int, int], OperatorHybrid], p: int, q: int) float

Calcuate expectation value.

\[\left<0\left|\hat{E}_{pq}\right|0\right>\]
slowquant.unitary_coupled_cluster.ucc_wavefunction.eEE(wf: WaveFunctionUCC, E: dict[tuple[int, int], OperatorHybrid], p: int, q: int, r: int, s: int) float

Calcuate expectation value.

\[\left<0\left|\hat{E}_{pq}\hat{E}_{rs}\right|0\right>\]
slowquant.unitary_coupled_cluster.ucc_wavefunction.eEEE(wf: WaveFunctionUCC, E: dict[tuple[int, int], OperatorHybrid], p: int, q: int, r: int, s: int, t: int, u: int) float

Calcuate expectation value.

\[\left<0\left|\hat{E}_{pq}\hat{E}_{rs}\hat{E}_{tu}\right|0\right>\]
slowquant.unitary_coupled_cluster.ucc_wavefunction.energy_ucc(parameters: Sequence[float], excitations: str, orbital_optimized: bool, wf: WaveFunctionUCC) float

Calculate electronic energy of UCC wave function.

\[E = \left<0\left|\hat{H}\right|0\right>\]
Parameters:
  • parameters – Sequence of all parameters. Ordered as orbital rotations, active-space singles, active-space doubles, …

  • excitations – Excitation orders to consider.

  • orbital_optimized – Do orbital optimization.

  • wf – Wave function object.

Returns:

Electronic energy.

slowquant.unitary_coupled_cluster.ucc_wavefunction.gradient_ucc(parameters: Sequence[float], excitations: str, orbital_optimized: bool, wf: WaveFunctionUCC) ndarray

Calcuate electronic gradient.

Parameters:
  • parameters – Sequence of all parameters. Ordered as orbital rotations, active-space singles, active-space doubles, …

  • excitations – Excitation orders to consider.

  • orbital_optimized – Do orbital optimization.

  • wf – Wave function object.

Returns:

Electronic gradient.

slowquant.unitary_coupled_cluster.ucc_wavefunction.load_wavefunction(filename: str) WaveFunctionUCC

Load wave function from a compressed NumPy object.

Parameters:

filename – Filename of compressed NumPy object without file extension.

Returns:

Wave function object.

slowquant.unitary_coupled_cluster.ucc_wavefunction.orbital_rotation_gradient(wf: WaveFunctionUCC) ndarray

Calcuate electronic gradient with respect to orbital rotations.

Parameters:

wf – Wave function object.

Returns:

Electronic gradient with respect to orbital rotations.