ccu.hubbard package¶
Schemes/algorithms related to Hubbard parameters calculations.
Submodules¶
ccu.hubbard.vasp module¶
This module defines the get_hubbard_u function.
- ccu.hubbard.vasp.archive_results(grid: list[float], chi_ij0: list[float], chi_ij: list[float], *, data_file: str = 'hubbard') None[source]¶
Save hubbard calculation data to a .csv file in a plot-friendly format.
- Parameters:
grid – A list of numbers representing perturbations (e.g., the x-axis).
chi_ij0 – The list values for the non-self consistent response function.
chi_ij – The list values for the self consistent response function.
data_file – The filename under which to save the data. Defaults to “hubbard”.
- ccu.hubbard.vasp.get_hubbard_u(calc, atoms: Atoms | None = None, index: int = 0, grid: Iterable[float] | None = None, enforce_strict: bool = True, data_file: str = 'hubbard') float[source]¶
Calculates the Hubbard U parameter of an atom according to [4].
This method employs the linear response method.
- Parameters:
calc – A pre-configured Vasp calculator instance set up to run the calculation.
atoms – An ase.Atoms instance for which the calculation will be performed. Defaults to None.
index – An int denoting the index of the atom for which the Hubbard parameter is to be calculated.
grid – An iterable of integers specifying the shifting potentials (in eV) that will be applied for the SCF and non-SCF calculations. Defaults to
[-0.2, -0.15, -0.1, -0.05, 0, 0.05, 0.1, 0.15, 0.2].enforce_strict – If True, then calculator parameters will be verified against the following checks:
ICHARG < 10LDAU,LDAUU,LDAUJ,LDAULare not (and won’t be) setLORBIT >= 11LMAXMIX >= 4NSW < 1
data_file – A string indicating the file name to save the raw data used to calculate the response function.
- Returns:
The Hubbard U parameter in eV.
Example
Calculate the Hubbard U parameter for nickel (without magnetization) in NiO similar to the tutorial here:
>>> from ase import Atoms >>> from ase.build import bulk >>> from ase.calculators.vasp.vasp import Vasp >>> from ase.cell import Cell >>> >>> positions = [ ... [0.0, 0.0, 0.0], ... [4.035, 4.035, 4.035], ... [2.0175, 2.0175, 4.035], ... [6.0525, 6.0525, 8.07], ... [2.0175, 4.035, 2.0175], ... [6.0525, 8.07, 6.0525], ... [4.035, 6.0525, 6.0525], ... [8.07, 10.0875, 10.0875], ... [4.035, 2.0175, 2.0175], ... [8.07, 6.0525, 6.0525], ... [6.0525, 4.035, 6.0525], ... [10.0875, 8.07, 10.0875], ... [6.0525, 6.0525, 4.035], ... [10.0875, 10.0875, 8.07], ... [8.07, 8.07, 8.07], ... [12.105, 12.105, 12.105], ... [2.0175, 2.0175, 2.0175], ... [6.0525, 6.0525, 6.0525], ... [4.035, 4.035, 6.0525], ... [8.07, 8.07, 10.0875], ... [4.035, 6.0525, 4.035], ... [8.07, 10.0875, 8.07], ... [6.0525, 8.07, 8.07], ... [10.0875, 12.105, 12.105], ... [6.0525, 4.035, 4.035], ... [10.0875, 8.07, 8.07], ... [8.07, 6.0525, 8.07], ... [12.105, 10.0875, 12.105], ... [8.07, 8.07, 6.0525], ... [12.105, 12.105, 10.0875], ... [10.0875, 10.0875, 10.0875], ... [14.1225, 14.1225, 14.1225], ... ] >>> cell = Cell( ... [[8.07, 4.035, 4.035], [4.035, 8.07, 4.035], [4.035, 4.035, 8.07]] ... ) >>> nio = Atoms("Ni16O16", positions=positions, cell=cell, pbc=True) >>> magmoms = [] >>> for i, atom in enumerate(nio): ... if atom.symbol == "Ni": ... factor = 1 if i % 2 == 0 else -1 ... magmoms.append(factor) ... else: ... magmoms.append(0) >>> >>> nio.set_initial_magnetic_moments(magmoms) >>> calc = Vasp( ... prec="Accurate", ... ediff=1e-6, ... ismear=0, ... sigma=0.2, ... ispin=2, ... lorbit=11, ... lmaxmix=4, ... magmoms=magmoms, ... atoms=atoms, ... ) >>> index = atoms.get_chemical_symbols().index("Ni") >>> perturbations = [x / 100 for x in range(-20, 25, 5)] >>> get_hubbard_u(calc, atoms, index, perturbations) 5....
- ccu.hubbard.vasp.get_ionic_charges(directory: Path | None) list[source]¶
Parses an OUTCAR directory for the charges.
- Parameters:
directory – A string or pathlib.Path instance representing the directory containing the OUTCAR. Defaults to the current working directory.
- Returns:
A list of dictionaries containing the s, p, and d orbital occupancies. The occupancies are ordered consistent with the POSCAR and POTCAR files. For example:
[{"s": 0.1, "d": 0.32, "f": 0.812}]