|
1 | 1 | from dptb.nn.sktb.onsiteDB import onsite_energy_database
|
2 | 2 | from dptb.nn.sktb.electronic_configDB import electronic_config_dict
|
| 3 | +from dptb.nn.sktb.HubbardUDB import Hubbard_U_dict |
3 | 4 | from dptb.utils.constants import Harte2eV, Ryd2eV
|
4 | 5 |
|
5 | 6 | skbasisDB={
|
|
363 | 364 | ]
|
364 | 365 | """
|
365 | 366 |
|
| 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 | + |
366 | 411 | def occupations_builtin_basis(atom:str, basis:list):
|
367 | 412 | '''This function creates a dictionary of occupations for a given atom based on a provided basis.
|
368 | 413 |
|
|
0 commit comments