3.7.20. horton.meanfield.utils – Utility functions

horton.meanfield.utils.check_dm(dm, overlap, lf, eps=0.0001, occ_max=1.0)

Check if the density matrix has eigenvalues in the proper range.

Arguments:

dm
The density matrix
overlap
The overlap matrix
lf
A LinalgFactory instance.

Optional arguments:

eps
The threshold on the eigenvalue inequalities.
occ_max
The maximum occupation.

A ValueError is raised when the density matrix has illegal eigenvalues.

horton.meanfield.utils.get_level_shift(dm, overlap)

Construct a level shift operator.

Arguments:

dm
A density matrix.
overlap
The overlap matrix

Returns: The level-shift operator.

horton.meanfield.utils.get_spin(exp_alpha, exp_beta, overlap)

Returns the expectation values of the projected and squared spin

Arguments:

exp_alpha, exp_beta
The alpha and beta orbitals.
overlap
The overlap matrix

Returns: sz, ssq

horton.meanfield.utils.get_homo_lumo(*exps)

Return the HOMO and LUMO energy for the given expansion

Arguments:

exp1, exp2, ...
DensityExpansion objects

Returns: homo_energy, lumo_energy. (The second is None when all orbitals are occupied.)

horton.meanfield.utils.compute_commutator(dm, fock, overlap, work, output)

Compute the dm-fock commutator, including an overlap matrix

Arguments: (all TwoIndex objects)

dm
A density matrix
fock
A fock matrix
overlap
An overlap matrix
work
A temporary matrix
output
The output matrix in which the commutator, S.D.F-F.D.S, is stored.