Example #1
0
def check_abs(x, y, eps):
    return check(abs(x), abs(y), eps)


# Check confined boron atom
atom1 = AtomicDFT(
    'B',
    xc='LDA',
    confinement=PowerConfinement(r0=2.9, s=2),
    configuration='[He] 2s2 2p1',
    valence=['2s', '2p'],
    txt=None,
)
atom1.run()
ener = atom1.get_energy()
print('B -- Etot  | %s' % check(ener, -23.079723850586106, eps_etot))
e_2s = atom1.get_epsilon('2s')
print('B -- E_2s  | %s' % check(e_2s, 0.24990807910273996, eps))
e_2p = atom1.get_epsilon('2p')
print('B -- E_2p  | %s' % check(e_2p, 0.47362603289831301, eps))

# Check confined hydrogen atom
atom2 = AtomicDFT(
    'H',
    xc='LDA',
    confinement=PowerConfinement(r0=1.1, s=2),
    configuration='1s1',
    valence=['1s'],
    txt=None,
)
#!/usr/bin/python3

from ase.units import Ha
from hotcent.atomic_dft import AtomicDFT
from hotcent.confinement import PowerConfinement

energies = {}
for occupation, kind in zip([2, 1, 3], ['neutral', 'cation', 'anion']):
    atom = AtomicDFT(
        'Si',
        xc='LDA',
        configuration='[Ne] 3s2 3p%d' % occupation,
        valence=['3s', '3p'],
        scalarrel=False,
        # Add a very weak confinement potential to aid anion convergence:
        confinement=PowerConfinement(r0=40., s=4),
    )
    atom.run()
    energies[kind] = atom.get_energy()

EA = energies['neutral'] - energies['anion']  # the electron affinity
IE = energies['cation'] - energies['neutral']  # the ionization energy
U = IE - EA  # the Hubbard value

print('=======================================')
for value, label in zip([EA, IE, U], ['EA', 'IE', 'U']):
    print(label, '[Ha]:', value, '[eV]:', value * Ha)