# Equation systems

`AtomicStructure.AtomicEquations`

— Type`AtomicEquations(atom, equations, integrals)`

Structure representing the (e.g. Hartree–Fock) `equations`

for `atom`

, along with all `integrals`

that are shared between the `equations`

.

`AtomicStructure.SCF.update!`

— Method`SCF.update!(p::DirectPotential)`

Update the direct potential `p`

by solving the Poisson problem with the current values of the orbitals forming the mutual density.

`SCF.update!(p::DirectPotential, atom::Atom)`

Update the direct potential `p`

by solving the Poisson problem with the current values of the orbitals of `atom`

forming the mutual density.

`update!(equations::AtomicEquations[, atom::Atom])`

Recompute all integrals using the current values for the radial orbitals (optionally specifying which `atom`

from which the orbitals are taken).

`update!(eqs; kwargs...)`

Update the equation system `eqs`

, for the current iteration. *To be overloaded by the user.*

`AtomicStructure.SCF.energy_matrix!`

— Method`energy_matrix!(H, hfeqs::AtomicEquations[, which=:energy])`

Compute the energy matrix by computing the energy observable and storing it in `H`

. Requires that `hfeqs`

has the `:energy`

and `:kinetic_energy`

`Observable`

s registered (this is the default).

`AtomicStructure.find_symmetries`

— Function`find_symmetries(orbitals)`

Group all orbitals according to their symmetries, e.g. ℓ for `Orbital`

s. This is used to determine which off-diagonal Lagrange multipliers are necessary to maintain orthogonality.

`AtomicStructure.generate_atomic_orbital_equations`

— Function```
generate_atomic_orbital_equations(atom::Atom, eqs::MCEquationSystem,
integrals, integral_map)
```

For each variationally derived orbital equation in `eqs`

, generate the corresponding `AtomicOrbitalEquation`

.

`Base.diff`

— Function`diff(atom; H=atomic_hamiltonian(atom), overlaps=[], selector=outsidecoremodel, verbosity=0)`

Differentiate the energy expression of the Hamiltonian `H`

associated with the `atom`

's configurations(s) with respect to the atomic orbitals to derive the Hartree–Fock equations for the orbitals.

By default, the Hamiltonian `H=FieldFreeOneBodyHamiltonian()+CoulombInteraction()`

.

Non-orthogonality between orbitals can be specified by providing `OrbitalOverlap`

s between these pairs. Only those electrons not modelled by `atom.potential`

of each configuration are considered for generating the energy expression, this can be changed by choosing another value for `selector`

.

`diff(quantum_system[; kwargs...])`

Varies the the `quantum_system`

with respect to all orbitals. Used to derive the multi-configurational Hartree–Fock equations. To be overloaded by the implementation of `AbstractQuantumSystem`

.

## Common integrals

When deriving the equations of motion from an energy expression, the same integral may appear many times in the equations for different orbitals, multiplied by different factors, etc. To minimize the reevaluation of integrals, `AtomicEquations`

keeps track of all the common integrals, and they are recomputed exactly once, when `SCF.update!`

is called. The routines below are used when setting up the equation system.

`AtomicStructure.pushterms!`

— Function```
pushterms!(terms, operator, equation_terms,
integrals, integral_map, symbolic_integrals)
```

For each term in `equation_terms`

, push a term, located at CI coordinates `i,j`

, of the overall orbital Hamiltonian to `terms`

, constructed from `operator`

and a product of orbital `integrals`

, multiplied by an overall factor given by expression and multipole expansions. `integrals`

contain common `OrbitalIntegral`

s and `integral_map`

maps from `symbolic_integrals`

to `integrals`

.