SCF

AtomicStructure.SCF.borderless_table_format — Constant
borderless_table_format

Text table format without any visible borders or lines; equivalent to tf_borderless of PrettyTables v2. The vertical lines and the line after the column labels are still present, but drawn using spaces.

source
AtomicStructure.SCF.Fock — Type
Fock(quantum_system, equations, S, symmetries)

A Fock operator consists of a quantum_system, from which equations are variationally derived, via an overload of diff(quantum_system). quantum_system must also provide an overload for overlap_matrix -> S.

equations must provide an overload for energy_matrix!. equations must be iterable, where each element corresponds to the equation for one orbital, and must provide an overload for hamiltonian and energy. Additionally, update! must be provided for equations, to prepare the equation system for the next iteration.

source
AtomicStructure.SCF.KrylovWrapper — Type
KrylovWrapper(hamiltonian)

Proxy object used in the Krylov iterations, during orbital improvement. This is useful, since hamiltonian may be defined to act on objects such as vectors living in function spaces (as e.g. implemented using ContinuumArrays.jl), whereas the SCF iterations act on the coefficients directly.

source
AtomicStructure.SCF.OrthogonalKrylovWrapper — Type
OrthogonalKrylovWrapper(h,A,x′,C,S,tmp)

Proxy object to perform Krylov iterations of the Hamiltonian h, represented by the KrylovWrapper A, in the subspace orthogonal to C. The component of the test vector orthogonal to C is stored in x′, before acting with A, and finally orthogonalized again, i.e. y = (1-C*C')*A*(1-C*C')*x = (1-C*C')*A*x′. S is the overlap matrix of the basis functions, used to compute the inner products.

source
Base.Matrix — Method
Matrix(fock)

Compute the Fock matrix, where each element corresponds to a matrix element between two orbitals.

source
AtomicStructure.SCF.energy — Method
energy(equation::Equation[, term=:total_energy])

Returns the orbital energy for the orbital governed by equation. To be overloaded by the user.

source
AtomicStructure.SCF.energy_matrix! — Method
energy_matrix!(H::AbstractMatrix, equations[, which=:total_energy])

Calculates the energy matrix of the system of equations. This overwrites the entries of H. To be overloaded by the user; must support `which=:totalenergy,which=:doublecountedenergy, andwhich=:kineticenergy`.

source
AtomicStructure.SCF.energy_matrix! — Method
energy_matrix!(H::AbstractMatrix, fock::Fock[, which=:total_energy])

Calculates the energy matrix of the quantum system of fock. This overwrites the entries of H.

source
AtomicStructure.SCF.gershgorin_bounds — Method
gershgorin_bounds(A)

For a Hermitian matrix A, compute the bounds on the real axis of the eigenspectrum. NB that this bound will only be useful for diagonally dominant As.

source
AtomicStructure.SCF.optimize! — Method
optimize!(fock[, ::Type{Optimizer}=BFGS; kwargs...])

Solve the Hartree–Fock problem via non-linear optimization. The algorithm, specified by Optimizer, has to be a first-order algorithm that supports optimization on a manifold, the default being Optim.BFGS. The computation of the gradient is accomplished by applying the fock operator onto test vectors (similar to how scf! performs Krylov iterations).

source
AtomicStructure.SCF.overlap_matrix — Method
overlap_matrix(quantum_system)

Return the overlap matrix which is a suitable metric for quantum_system. Usually, this is Sᵢⱼ = ⟨i|j⟩, where i and j are basis functions for the orbitals. This is used to calculate inner products between orbitals, &c.

source
AtomicStructure.SCF.scf! — Method
scf!([fun!, ]fock[; ω=0, max_iter=200, tol=1e-8, verbosity=1])

Perform the SCF iterations for the fock operator. One iteration is performed by scf_iteration!. The optional fun!(P̃,c̃) argument allows for extra operations to be performed every SCF cycle (such as plotting, etc).

ω is a relaxation parameter; the orbitals and mixing coefficients are updated as wᵢ₊₁ = (1-ω)w̃ + ωwᵢ where w̃ is the solution in the current iteration and wᵢ the previous solution. The default (ω=0) is to only use this solution. A larger value of ω makes it easier to achieve convergence in oscillatory problems, but a too large value decreases the convergence rate. It is therefore desireable to reduce the value of ω if the convergence is deemed to be monotonous, the criterion for which is whether the change over the monotonous_window last iterations is steadily decreasing. If this is the case, ω will be reduced by multiplying by ωfactor. Conversely, if the change is non-monotonous, ω will be increased, but not beyond ωmax.

The SCF procedure continues until either the amount of iterations equals max_iter or the change in the coefficients is below tol.

source
AtomicStructure.SCF.scf_iteration! — Method
scf_iteration!(fock, P, H, c, okws,
               [; verbosity=0, method=:arnoldi, σ=nothing, tol=1e-10,
                update_mixing_coefficients=true])

Perform one step of the SCF iteration. This will

  1. Improve each of the orbitals in turn, using the values of the orbitals P and mixing coefficients c from the previous step as input.

  2. Solve the secular problem to find new values for the mixing coefficients, c, unless update_mixing_coefficients==false.

okws is a vector of OrthogonalKrylovWrappers, one for each orbital.

source
AtomicStructure.SCF.solve_orbital_equation! — Method
solve_orbital_equation!(Pj, okw, method, tol)

Solve the orbital equation for the jth orbital, by solving the eigenproblem of the OrthogonalKrylovWrapper operator okw, and store the result in the radial orbital vector of expansion coefficients Pj. The solution is computed using method; valid choices are

  1. :arnoldi, which uses ArnoldiMethod.jl. Really small grid spacings/large grid extents can be problematic with this method, due to high condition numbers.

  2. :lobpcg, which uses IterativeSolvers.jl. Too coarse grids can cause never-ending loops or errors from the Cholesky decomposition, complaining about non-positive definite subproblems.

Both methods are controlled by the stopping tolerance tol.

source
AtomicStructure.SCF.table_format — Method
table_format(; data_rows=:none, data_columns=:none, bottom=false)

Text table format with a horizontal line after the column labels, horizontal lines after the data_rows, and vertical lines after the data_columns, but no outer borders, except the bottom one if bottom. This corresponds to the PrettyTables v2 options hlines = vcat(1, 1 .+ data_rows) and vlines = data_columns.

source
AtomicStructure.SCF.update! — Method
update!(eqs, quantum_system; kwargs...)

Update the equation system eqs with respect to quantum_system, for the current iteration. To be overloaded by the user.

source
Base.diff — Method
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.

source
Base.size — Method
size(::KrylovWrapper)

Returns the dimension of the KrylovWrapper. For Hamiltonians which are not <:AbstractMatrix, this needs to be overloaded.

source
LinearAlgebra.mul! — Function
mul!(y, ::KrylovWrapper, x[, α=1, β=0])

Compute the action of the wrapped Hamiltonian on x and store it in y

source