SCF
AtomicStructure.SCF.borderless_table_format — Constant
borderless_table_formatText 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.
AtomicStructure.SCF.AbstractQuantumSystem — Type
AbstractQuantumSystemAny implementation of the AbstractQuantumSystem interface, used for self-consistent field calculations, must implement the functions coefficients, orbitals, diff, normalize!.
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.
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.
AtomicStructure.SCF.MetricSphere — Type
Spherical manifold {|x| = 1}.
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.
Base.Matrix — Method
Matrix(fock)Compute the Fock matrix, where each element corresponds to a matrix element between two orbitals.
AtomicStructure.SCF.circshiftpush! — Method
circshiftpush!(v, e)Shifts all elements of the vector v one step to the left and sets e as the last element.
AtomicStructure.SCF.coefficients — Method
coefficients(quantum_system)Retrieves the mixing coefficients of quantum_system. Must return a view that the scf! routine can modify. To be overloaded by the implementation of AbstractQuantumSystem.
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.
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`.
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.
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.
AtomicStructure.SCF.gershgorin_disc — Method
gershgorin_disc(i, row)Return the Gershgorin disc for the ith row of a matrix.
AtomicStructure.SCF.gershgorin_discs — Method
gershgorin_discs(A)Compute all Gershgorin discs of a matrix A.
AtomicStructure.SCF.hamiltonian — Method
hamiltonian(equation::Equation)Returns the orbital Hamiltonian of equation. To be overloaded by the user.
AtomicStructure.SCF.ismonotonous — Method
ismonotonous(v[, comp=isless])Returns true if the magnitude of every value fulfils comp(cur,prev).
AtomicStructure.SCF.norm_rot! — Method
norm_rot!(fock, v)Normalize and rotate the eigenvector v such that the first lobe has positive sign.
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).
AtomicStructure.SCF.orbitals — Method
orbitals(quantum_system)Retrieves the orbitals of quantum_system. Must return a view that the scf! routine can modify. To be overloaded by the implementation of AbstractQuantumSystem.
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.
AtomicStructure.SCF.rotate_first_lobe! — Method
rotate_first_lobe!(v)Rotate the vector v such that the first lobe has positive sign.
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.
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
Improve each of the orbitals in turn, using the values of the orbitals
Pand mixing coefficientscfrom the previous step as input.Solve the secular problem to find new values for the mixing coefficients,
c, unlessupdate_mixing_coefficients==false.
okws is a vector of OrthogonalKrylovWrappers, one for each orbital.
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
:arnoldi, which uses ArnoldiMethod.jl. Really small grid spacings/large grid extents can be problematic with this method, due to high condition numbers.: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.
AtomicStructure.SCF.solve_secular_problem! — Method
solve_secular_problem!(H, c, fock)Form the energy matrix, store it in H, and then solve the secular problem Hc = Ec for the lowest eigenvalue.
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.
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.
AtomicStructure.SCF.update! — Method
update!(eqs; kwargs...)Update the equation system eqs, for the current iteration. To be overloaded by the user.
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.
LinearAlgebra.mul! — Function
mul!(y, ::KrylovWrapper, x[, α=1, β=0])Compute the action of the wrapped Hamiltonian on x and store it in y
LinearAlgebra.normalize! — Method
normalize!(quantum_system, v)Normalize the orbital v of quantum_system. To be overloaded by the implementation of AbstractQuantumSystem.