# Fraction charge calculations in UKS vs UHF

I have been able to setup fractional charge calculations for HF. I would like to do so for DFAs as well, but the energy returned by such calculations remains static, as if there were no fractional charge at all. I have attached a minimal example.

``````import psi4
import matplotlib.pyplot as plt
import numpy as np

psi4.set_memory('500 MB')
psi4.set_options({'reference' : 'uks'})

h2o = psi4.geometry("""
O
H 1 0.96
H 1 0.96 2 104.5
symmetry c1
""")

occ = np.arange(0, 1.1, 0.1)
fracs_hf = []
for i in occ:
psi4.set_options({  'frac_start' : 5,
'frac_occ' : ,
'frac_val' : [i],
'frac_diis' : True})
frac = psi4.energy('hf/6-31G')
fracs_hf.append(frac)

occ = np.arange(0, 1.1, 0.1)
fracs_blyp = []
for i in occ:
psi4.set_options({  'frac_start' : 5,
'frac_occ' : ,
'frac_val' : [i],
'frac_diis' : True})
frac = psi4.energy('blyp/6-31G')
fracs_blyp.append(frac)
print(fracs_hf)
print(fracs_blyp)
``````

You’re starting fractional occupations in the 5th iteration, but the HF/6-31G calculation converges in 4 iterations.

Decreasing frac_start to 3 leads to the use of fractional occupations in the calculation.

Thank you! That is exactly my problem.