# 3.7.7. horton.meanfield.hamiltonian – Mean-field DFT/HF Hamiltonian data structures¶

class horton.meanfield.hamiltonian.REffHam(terms, external=None)

Bases: horton.meanfield.hamiltonian.EffHam

Initialize an EffHam instance.

Parameters: terms (list with instances of Observable) – The terms in the Hamiltonian. external (dict) – A dictionary with external energy contributions that do not depend on the wavefunction, e.g. nuclear-nuclear interactions or QM/MM mechanical embedding terms. Use nn as key for the nuclear-nuclear term.
__init__(terms, external=None)

Initialize an EffHam instance.

Parameters: terms (list with instances of Observable) – The terms in the Hamiltonian. external (dict) – A dictionary with external energy contributions that do not depend on the wavefunction, e.g. nuclear-nuclear interactions or QM/MM mechanical embedding terms. Use nn as key for the nuclear-nuclear term.
compute_dot_hessian(output_alpha)

Compute the dot product of the energy Hessian with a delta DM.

The Hessian in this method is the second derivative of the energy towards the matrix elements of the input density matrix or matrices. The dms and delta_dms are set via the reset and reset_delta methods, respectively.

Parameters: outputs (TwoIndex) – A list of output TwoIndex objects in which the dot product of the energy Hessian with the delta density matrices is stored. that the result must be multiplied by the feactor deriv_scale squared in (Note) – to obtain the proper second order derivative. This is due to conventions (order) – to the definition of the Fock matrix. (related) –
compute_energy()

Compute the total energy.

The input for this method must be provided through the reset method.

Returns: energy – The expectation value, including the constant terms defined through the external argument of the constructor float
compute_fock(fock_alpha)

Compute the fock matrices.

A Fock matrix is the derivative of the energy toward the components of the corresponding input density matrices.

The input for this method must be provided through the reset method. Note that the Fock matrix must be multiplied by the factor deriv_scale to obtain the proper derivative of the energy toward the density matrix, in order to maintain the common conventions for Fock matrices.

Parameters: fock2, .. (fock1,) – A list of output Fock operators. Old content is discarded.
log()

Write an overview of the last computation on screen.

reset(in_dm_alpha)

Remove intermediate results from cache and specify new input density matrices.

Parameters: dm2, .. (dm1,) – The input density matrices. Their interpretation is fixed in derived classes.
reset_delta(in_delta_dm_alpha)

Remove intermediate results for delta_dms from cache and specify new inputs.

Parameters: delta_dm2, .. (delta_dm1,) – First-order changes to the density matrix, used to compute the dot product with the energy Hessian.
deriv_scale = 2.0
ndm = 1
class horton.meanfield.hamiltonian.UEffHam(terms, external=None)

Bases: horton.meanfield.hamiltonian.EffHam

Initialize an EffHam instance.

Parameters: terms (list with instances of Observable) – The terms in the Hamiltonian. external (dict) – A dictionary with external energy contributions that do not depend on the wavefunction, e.g. nuclear-nuclear interactions or QM/MM mechanical embedding terms. Use nn as key for the nuclear-nuclear term.
__init__(terms, external=None)

Initialize an EffHam instance.

Parameters: terms (list with instances of Observable) – The terms in the Hamiltonian. external (dict) – A dictionary with external energy contributions that do not depend on the wavefunction, e.g. nuclear-nuclear interactions or QM/MM mechanical embedding terms. Use nn as key for the nuclear-nuclear term.
compute_dot_hessian(output_alpha, output_beta)

Compute the dot product of the energy Hessian with a delta DM.

The Hessian in this method is the second derivative of the energy towards the matrix elements of the input density matrix or matrices. The dms and delta_dms are set via the reset and reset_delta methods, respectively.

Parameters: outputs (TwoIndex) – A list of output TwoIndex objects in which the dot product of the energy Hessian with the delta density matrices is stored. that the result must be multiplied by the feactor deriv_scale squared in (Note) – to obtain the proper second order derivative. This is due to conventions (order) – to the definition of the Fock matrix. (related) –
compute_energy()

Compute the total energy.

The input for this method must be provided through the reset method.

Returns: energy – The expectation value, including the constant terms defined through the external argument of the constructor float
compute_fock(fock_alpha, fock_beta)

Compute the fock matrices.

A Fock matrix is the derivative of the energy toward the components of the corresponding input density matrices.

The input for this method must be provided through the reset method. Note that the Fock matrix must be multiplied by the factor deriv_scale to obtain the proper derivative of the energy toward the density matrix, in order to maintain the common conventions for Fock matrices.

Parameters: fock2, .. (fock1,) – A list of output Fock operators. Old content is discarded.
log()

Write an overview of the last computation on screen.

reset(in_dm_alpha, in_dm_beta)

Remove intermediate results from cache and specify new input density matrices.

Parameters: dm2, .. (dm1,) – The input density matrices. Their interpretation is fixed in derived classes.
reset_delta(in_delta_dm_alpha, in_delta_dm_beta)

Remove intermediate results for delta_dms from cache and specify new inputs.

Parameters: delta_dm2, .. (delta_dm1,) – First-order changes to the density matrix, used to compute the dot product with the energy Hessian.
deriv_scale = 1.0
ndm = 2