States

A State represents a set of occupied local manifolds, one for each ion to which occupation constraints are applied, or that have a Hubbard U parameter. Usually no direct interaction with these is needed as the search is happening, but they are used for some postprocessing analysis.

They hold:

  • occupations: the occupation matrices for each ion
  • totoccs: total electron occupation of each ion
  • magmoms: magnetic moments defined as tr(up) - tr(down)
  • eigvals: the eigen values for each occupation matrix
  • eigvecs: the eigen vectors for each occupation matrix

Euclidean distance

The Euclidean distance metric is defined between states, which essentially does

\[\sqrt{\sum_I \sum_{\alpha\beta}(n^I_{1, \alpha\beta} - n^I_{2, \alpha\beta})^2}\]

and can be called like

RomeoDFT.Euclidean()(state1, state2)

Refeference

RomeoDFT.StateType
State

Represents the local state of a system. This is given by the occupation matrices of the local orbitals. These are usually the valence shells for example to which the +U correction is applied in DFT + U calculations.

Examples

A State can be constructed from the :Hubbard entry from a QE pw output like:

using DFControl
using RomeoDFT

o = DFC.FileIO.qe_parse_pw_output("<pw_lda_U_output_file_with_Hubbard_blocks>")
s = RomeoDFT.State(o[:Hubbard][end])

or using a Vector with MagneticArrays from DFWannier.jl.

using DFWannier
using RomeoDFT
using LinearAlgebra

up   = diagm(0 => ones(5))
down = diagm(0 => ones(5))
occs = [DFWannier.ColinMatrix(up, down)]

s = RomeoDFT.State(occs)

Using RomeoDFT.generate_Hubbard_occupations this can generate the :Hubbard_occupations scf input parameter which will be used as the target during a constrained scf calculation. RomeoDFT.generate_starting_ns_eigenvalue generates the :starting_ns_eigenvalue parameter instead.

source