.. _20_smeared_occupations: .. include:: ../../examples/20_smeared_occupations/README.rst ---- .. code-block:: python from eminus import Cell, RSCF from eminus.tools import get_Efermi from eminus.units import ha2kelvin Create a cell for an aluminum crystal Set a smearing value in atomic units The resulting SCF will use a Fermi-Dirac function to smear the occupations over the selected bands .. code-block:: python cell = Cell("Al", "fcc", ecut=10, a=7.63075, bands=6, smearing=0.01) Create the SCF object The occupations update per SCF cycle can be controlled with the :code:`smear_update` parameter .. code-block:: python scf = RSCF(cell, etol=1e-5, verbose=0) scf.smear_update = 1 Do the DFT calculation .. code-block:: python scf.run() The resulting total energy includes an entropic term when smearing is enabled .. code-block:: python print(scf.energies) We can extrapolate the energy to T=0 .. code-block:: python print(f"\nEtot({ha2kelvin(cell.occ.smearing):.2f} K) = {scf.energies.Etot:.6f} Eh") print(f"Etot({0:>7.2f} K) = {scf.energies.extrapolate():.6f} Eh") Calculate the Fermi energy .. code-block:: python print(f"\nEf = {get_Efermi(scf):.6f} Eh") Download :download:`20_smeared_occupations.py <../../examples/20_smeared_occupations/20_smeared_occupations.py>`