## Confusion with LDA+U double counting and energy

# Summary

The definitions of the double counting corrections in LDA+U and the LDA+U energy in v_mmp.f90 are really confusing. I want to clear them up and move them out of v_mmp to be used in other places without having two separate definitions (see e.g. Hubbard 1 uses the double counting to set the occupation in the impurity solver)

I have the following definitions for the FLL and AMF limit, which can be derived from the occupations being either 0 or 1 (FLL) or `\frac{1}{2l+1}N_\sigma`

(AMF):

FLL:

`E^{FLL}_{dc} = \frac{U}{2} N(N-1) - \frac{J}{2} \sum_\sigma N_\sigma(N_\sigma-1)`

`V^{FLL,\sigma}_{dc} = U(N-\frac{1}{2}) - J(N_\sigma-\frac{1}{2})`

AMF:

`E^{AMF}_{dc} = Un_\uparrow n_\downarrow + \frac{l(n^2_\uparrow+n^2_\downarrow)}{2l+1}(U-J)`

`V^{AMF,\sigma}_{dc} = U n_{-\sigma} + \frac{2l}{2l+1}(U-J)n_\sigma`

There are a couple of things I noticed in v_mmp (the AMF values have to be reformulated in terms of these eta factors to compare):

- There is/was an inconsistency in the AMF double counting potential (a missing factor 2), which I already patched up a while ago
- For jspins=1 there is a piece of the double counting energy missing (the other spin), which is essentially again a factor 2 for the j part of the energy

If you look at the v26 version of v_mmp these problems are not there, but its also relatively confusing.

If I fix these issues I will have to change the energy values in the GaAsMultiForceXML test. For this reason I'm opening this issue so other people can have a look at it before changing a test.