p.add_option('-s', '--superposition', default='potential', help='Which superposition scheme? ' 'Choose "potential" (default) or "density"') p.add_option('-t', '--stride', default=1, type=int, help='Which SK-table stride length? Default = 1. ' 'See hotcent.slako.run for more information.') opt, args = p.parse_args() # Get KS all-electron ground state of confined atom: element = 'C' r0 = 1.85 * covalent_radii[atomic_numbers[element]] / Bohr atom = AtomicDFT(element, xc=opt.functional, confinement=PowerConfinement(r0=r0, s=2), configuration='[He] 2s2 2p2', valence=['2s', '2p'], timing=True, ) atom.run() atom.plot_Rnl(only_valence=False) atom.plot_density() # Compute Slater-Koster integrals: rmin, dr, N = 0.5, 0.05, 250 sk = SlaterKosterTable(atom, atom, timing=True) sk.run(rmin, dr, N, superposition=opt.superposition, xc=opt.functional, stride=opt.stride) sk.write('%s-%s_no_repulsion.par' % (element, element)) sk.write('%s-%s_no_repulsion.skf' % (element, element)) sk.plot()
print("nls = ", nls) #rNum = 600 rNum = int(elem_list[5]) print("rNum = ", rNum) #lmax = valence[-1][1] lmax = str(elem_list[6]) print("lmax = ", lmax) # Setting up the atomic DFT instance(s) and # calculating the eigenvalues and Hubbard values atom = AtomicDFT(element, configuration=configuration, valence=valence, xc=xc, scalarrel=True, mix=0.005, maxiter=50000, confinement=PowerConfinement(r0=40., s=4), txt=None) atom.run() atom.info = {} atom.info['eigenvalues'] = {nl: atom.get_eigenvalue(nl) for nl in atom.valence} U_p = atom.get_hubbard_value(nls, scheme='central', maxstep=1.) atom.info['hubbardvalues'] = {'s': U_p} atom.info['occupations'] = occupations # Creating a DFTB+ band structure evaluator and # supplying it with a reference (DFT) band structure dpbs = DftbPlusBandStructure(Hamiltonian_SCC='Yes',
rNum1 = int(elem1_list[5]) rNum2 = int(elem2_list[5]) # -------------------------------------------------------- # Compute eigenvalues and Hubbard values of the free atoms # -------------------------------------------------------- for el in elements: valence = valences[el] atom = AtomicDFT( el, xc=xc, configuration=configurations[el], valence=valence, scalarrel=True, confinement=PowerConfinement(r0=40., s=4), maxiter=50000, mix=0.005, txt='-', ) atom.run() eigenvalues[el] = {nl: atom.get_eigenvalue(nl) for nl in valence} nl = nls2 if el == elements[1] else nls1 scheme = 'central' if el == elements[1] else 'backward' if (el == "H"): # https://webbook.nist.gov/cgi/cbook.cgi?ID=C12385136&Mask=20 # hubbard value = U = IE - EA = 13.59844 - 0.75497 = 12.84347 [eV] U = 12.84347 / Ha else: U = atom.get_hubbard_value(nl, scheme=scheme)
from hotcent.slako import SlaterKosterTable element = 'C' xc = 'LDA' configuration = '[He] 2s2 2p2' valence = ['2s', '2p'] occupations = {'2s': 2, '2p': 2} # ------------------------------------ # Compute eigenvalues of the free atom # ------------------------------------ atom = AtomicDFT( element, xc=xc, configuration=configuration, valence=valence, scalarrel=False, ) atom.run() eigenvalues = {nl: atom.get_eigenvalue(nl) for nl in valence} # --------------------------------------- # Compute Hubbard values of the free atom # --------------------------------------- atom = AtomicDFT( element, xc=xc, configuration=configuration, valence=valence,
#!/usr/bin/python3 from ase.units import Ha from hotcent.atomic_dft import AtomicDFT from hotcent.confinement import PowerConfinement atom = AtomicDFT( 'Si', xc='LDA', configuration='[Ne] 3s2 3p2', valence=['3s', '3p'], scalarrel=False, # Add a very weak confinement potential to aid anion convergence: confinement=PowerConfinement(r0=40., s=4), ) # Like above, we use a central difference scheme # with changes in the occupation of 1 |e| U = atom.get_hubbard_value('3p', scheme='central', maxstep=1) print('=======================================') print('U [Ha]:', U, '[eV]:', U * Ha)
reference_level='vbm', nsemicore=0, weight=1., distribution={ 'type': 'Boltzmann', 'kBT': 1.5 }) elements = ['N', 'O'] atoms = [] for element in elements: occ_2p = 3 if element == 'N' else 4 atom = AtomicDFT(element, configuration='[He] 2s2 2p%d' % occ_2p, valence=['2s', '2p'], xc='LDA', scalarrel=False, confinement=PowerConfinement(r0=40., s=4), txt='atomic.out') atom.run() atom.info = {} atom.info['eigenvalues'] = { nl: atom.get_eigenvalue(nl) for nl in atom.valence } U_p = atom.get_hubbard_value('2p', scheme='central', maxstep=1.) atom.info['hubbardvalues'] = {'s': U_p} atom.info['occupations'] = {'2s': 2, '2p': occ_2p} atoms.append(atom) sk_kwargs = {
def check(x, y, eps): line = 'Result: {: .8f} | Ref.: {: .8f} | '.format(x, y) line += 'OK' if abs(x - y) < eps else 'FAIL' return line 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',
xc = 'GGA_X_PBE+GGA_C_PBE' # Get KS all-electron ground state of confined atom conf = PowerConfinement(r0=9.41, s=2) wf_conf = { '5d': PowerConfinement(r0=6.50, s=2), '6s': PowerConfinement(r0=6.50, s=2), '6p': PowerConfinement(r0=4.51, s=2), } atom = AtomicDFT( element, xc=xc, confinement=conf, wf_confinement=wf_conf, configuration='[Xe] 4f14 5d10 6s1 6p0', valence=['5d', '6s', '6p'], scalarrel=True, timing=True, nodegpts=150, mix=0.2, txt='-', ) atom.run() atom.plot_Rnl() atom.plot_density() # Compute Slater-Koster integrals: rmin, dr, N = 0.4, 0.02, 900 sk = SlaterKosterTable(atom, atom, timing=True) sk.run(rmin, dr, N, superposition='density', xc=xc) sk.write('Au-Au_no_repulsion.par')
for el in elements: lines = get_dummy_spline() with open('%s-%s_spline.skf' % (el, el), 'w') as f: f.write(lines) # -------------------------------------------------------- # Compute eigenvalues and Hubbard values of the free atoms # -------------------------------------------------------- for el in elements: valence = valences[el] atom = AtomicDFT( el, xc=xc, configuration=configurations[el], valence=valence, scalarrel=True, confinement=PowerConfinement(r0=40., s=4), txt='-', ) u = atom.get_hubbard_value('2p', scheme='central') hubbardvalues[el] = {'s': u} atom.run() eigenvalues[el] = {nl: atom.get_eigenvalue(nl) for nl in valence} # -------------------------------------------------- # Get KS all-electron ground state of confined atoms # -------------------------------------------------- atoms = {} for el in elements:
#!/usr/bin/python3 from ase.units import Ha from hotcent.atomic_dft import AtomicDFT atom = AtomicDFT('Si', xc='LDA', configuration='[Ne] 3s2 3p2', # the electron configuration we want to use valence=['3s', '3p'], # these will be our valence states scalarrel=False, # for Si we don't need (scalar) relativistic effects ) atom.run() atom.plot_Rnl('Si_Rnl_free.png') # plot the radial parts of the valence orbitals atom.plot_rho('Si_rho_free.png') # plot the valence orbital densities and total electron density print('=======================================') for nl in ['3s', '3p']: e = atom.get_eigenvalue(nl) print(nl, '[Ha]:', e, '[eV]:', e * Ha)
from ase.units import Ha from hotcent.confinement import SoftConfinement from hotcent.atomic_dft import AtomicDFT kwargs = {'xc': 'LDA', 'configuration': '[Ne] 3s2 3p2', 'valence': ['3s', '3p'], 'confinement': None, 'scalarrel': True, 'timing': True, 'txt': '-'} atom = AtomicDFT('Si', wf_confinement=None, **kwargs) atom.run() eps_free = {nl: atom.get_eigenvalue(nl) for nl in atom.valence} wf_confinement = {'3s': SoftConfinement(amp=12., rc=6.74, x_ri=0.6), '3p': SoftConfinement(amp=12., rc=8.70, x_ri=0.6)} atom = AtomicDFT('Si', wf_confinement=wf_confinement, perturbative_confinement=True, **kwargs) atom.run() eps_conf = {nl: atom.get_eigenvalue(nl) for nl in atom.valence} print('\nChecking eigenvalues and their shifts upon confinement:') # gpaw-setup Si -f LDA -a eps_ref = {'3s': -0.399754, '3p': -0.152954} # gpaw-basis Si -f LDA -t sz
from ase.io.jsonio import read_json from ase.units import Bohr from ase.build import bulk from ase.data import atomic_numbers, covalent_radii from hotcent.atomic_dft import AtomicDFT from hotcent.confinement import PowerConfinement from hotcent.tools import ConfinementOptimizer, DftbPlusBandStructure # Setting up the atomic DFT instance(s) and # calculating the eigenvalues and Hubbard values atom = AtomicDFT('Si', configuration='[Ne] 3s2 3p2 3d0', valence=['3s', '3p', '3d'], xc='LDA', scalarrel=False, mix=0.05, maxiter=500, confinement=PowerConfinement(r0=40., s=4), txt=None) atom.run() atom.info = {} atom.info['eigenvalues'] = {nl: atom.get_eigenvalue(nl) for nl in atom.valence} U_p = atom.get_hubbard_value('3p', scheme='central', maxstep=1.) atom.info['hubbardvalues'] = {'s': U_p} atom.info['occupations'] = {'3s': 2, '3p': 2, '3d': 0} # Creating a DFTB+ band structure evaluator and # supplying it with a reference (DFT) band structure dpbs = DftbPlusBandStructure(Hamiltonian_SCC='Yes',
#!/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)
from ase.units import Ha from hotcent.atomic_dft import AtomicDFT from hotcent.confinement import PowerConfinement atom = AtomicDFT('C', xc='LDA', confinement=PowerConfinement(r0=40., s=4), configuration='[He] 2s2 2p2', valence=['2s', '2p'], scalarrel=False, timing=False, ) values = [] schemes = ['central', 'forward', 'backward'] for scheme in ['central', 'forward', 'backward']: u = atom.get_hubbard_value('2p', scheme=scheme, maxstep=1.) values.append(u) references = [0.35665217698348783, 0.2694950932099687, 0.4310705719360044] eps = 1e-4 print('\n========================================================') print('# Scheme\tU_ref [Ha]\tU [Ha]\t\tU [eV]') for s, v, r in zip(schemes, values, references): print('%s\t%.6f\t%.6f\t%.3f' % (s.ljust(8), r, v, v * Ha)) assert abs(v - r) < eps, (s, v, r, eps)
from hotcent.atomic_dft import AtomicDFT atom = AtomicDFT( 'Sn', xc='LDA', configuration='[Kr] 4d10 5s2 5p2', valence=['5s', '5p', '4d'], scalarrel=True, nodegpts=150, mix=0.2, txt='-', timing=True, ) atom.run() atom.plot_density() atom.plot_Rnl() atom.fit_sto('5s', 5, 4, filename='Sn_5s_STO.png') atom.fit_sto('5p', 5, 4, filename='Sn_5p_STO.png') atom.fit_sto('4d', 5, 4, filename='Sn_4d_STO.png') atom.write_hsd(filename='Sn_wfc.hsd')