Skip to content

Commit 82362de

Browse files
committed
feat(sktb): add Hubbard U database and retrieval function
Add Hubbard_U_dict import and implement Hubbard_U_builtin_basis function to retrieve Hubbard U values for given atom and basis set, with unit conversion support (Ha, eV, Ry)
1 parent beee23b commit 82362de

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

dptb/nn/sktb/builtin_skbasisDB.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from dptb.nn.sktb.onsiteDB import onsite_energy_database
22
from dptb.nn.sktb.electronic_configDB import electronic_config_dict
3+
from dptb.nn.sktb.HubbardUDB import Hubbard_U_dict
34
from dptb.utils.constants import Harte2eV, Ryd2eV
45

56
skbasisDB={
@@ -363,6 +364,50 @@
363364
]
364365
"""
365366

367+
def Hubbard_U_builtin_basis(atom:str, basis:list, unit:str='Ha'):
368+
'''The function `Hubbard_U_builtin_basis` retrieves Hubbard U values for a given atom and basis set in
369+
different energy units.
370+
371+
Parameters
372+
----------
373+
atom : str
374+
The `atom` parameter in the `Hubbard_U_builtin_basis` function is a string representing the atomic
375+
symbol for which you want to retrieve Hubbard U values.
376+
basis : list
377+
The `basis` parameter in the `Hubbard_U_builtin_basis` function is a list that contains the basis
378+
functions for which you want to retrieve Hubbard U values for a specific atom. You can provide a
379+
list of basis functions as input to the function to get the corresponding Hubbard U values for those
380+
basis
381+
unit : str, optional
382+
The `unit` parameter in the `Hubbard_U_builtin_basis` function specifies the unit in which the
383+
Hubbard U values will be returned. The function supports three units: 'Ha' (Hartree), 'eV' (electron
384+
volts), and 'Ry' (Rydberg).
385+
386+
Returns
387+
-------
388+
The function `Hubbard_U_builtin_basis` returns a dictionary containing Hubbard U values for the
389+
specified atom and basis set, converted to the specified energy unit (Ha, eV, or Ry). The dictionary
390+
has the following structure: `{atom: {basis_set: Hubbard_U_value}}`.
391+
392+
'''
393+
assert atom in Hubbard_U_dict, f"{atom} not found in Hubbard_U database."
394+
if 'ha' in unit.lower():
395+
factor = 1.0
396+
elif 'ev' in unit.lower():
397+
factor = Harte2eV
398+
elif 'ry' in unit.lower():
399+
factor = Harte2eV / Ryd2eV
400+
else:
401+
raise ValueError(f"Unknown unit {unit}.")
402+
Hubbard_U = {atom:{}}
403+
for ib in basis:
404+
if ib in Hubbard_U_dict[atom]:
405+
Hubbard_U[atom][ib] = Hubbard_U_dict[atom][ib] * factor
406+
else:
407+
print(f"{atom} {ib} not found in Hubbard_U database. and set to 0.0")
408+
Hubbard_U[atom][ib] = 0.0
409+
return Hubbard_U
410+
366411
def occupations_builtin_basis(atom:str, basis:list):
367412
'''This function creates a dictionary of occupations for a given atom based on a provided basis.
368413

0 commit comments

Comments
 (0)