This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

vp.dft.pw

The iterative engine: the same Kohn-Sham calculation as dft/pwdft.viv, without ever forming the Hamiltonian as a matrix.

Part of the distribution vipyr-chem; it runs from a checkout of the repository. Planned on PyPI as pip install "vipyr[chem]".

Signature

vp.dft.pw(material="si", *, ecut=None, kmesh=None, nbands=None, smear=None, mix=None, scf_tol=None, maxit=None, alat=None, nseg=None)

material picks a deck, a named set of every parameter's value; a keyword left as None keeps the deck's value. The program's checks are written for each deck's settings.

Parameters

material : str, default si
The deck: a named set of every parameter's value, with the checks that hold at it. Range: one of si, ge, c, gaas, al, cu.
ecut : float, default si 10.0, ge 14.0, c 30.0, gaas 14.0, al 10.0, cu 50.0
Plane-wave cutoff, hartree. Units: hartree. Range: >= 0.5.
kmesh : int, default si 2, ge 2, c 2, gaas 2, al 4, cu 4
The k-mesh is NKMESH^3, shifted (dft/kmesh.viv). Range: >= 1, <= 8. The program's NKMESH.
nbands : int, default si 8, ge 8, c 8, gaas 8, al 6, cu 12
Bands computed at every k-point. Range: >= 1.
smear : float, default si 0.0, ge 0.0, c 0.0, gaas 0.0, al 0.01, cu 0.01
Fermi-Dirac width, hartree; 0 for an insulator. Units: hartree. Range: >= 0.
mix : float, default si 0.6, ge 0.6, c 0.6, gaas 0.6, al 0.6, cu 0.6
The damping in the Anderson mixer (dft/pw_common.viv). Range: >= 0, <= 1.
scf_tol : float, default si 1.0e-9, ge 1.0e-9, c 1.0e-9, gaas 1.0e-9, al 1.0e-9, cu 1.0e-9
The SCF stops when the density changes by less than this. Range: >= 0.
maxit : int, default si 80, ge 80, c 80, gaas 80, al 80, cu 80
At most this many SCF iterations. Range: >= 1.
alat : float, default si 10.26, ge 10.68, c 6.74, gaas 10.68, al 7.65, cu 6.82
Lattice constant, bohr. Units: bohr. Range: >= 0.
nseg : int, default si 30, ge 30, c 30, gaas 30, al 30, cu 30
Points per path segment; the figure has 2 NSEG + 1. Range: >= 1.

Returns

A frozen PWResult. Iterating it gives the fields below in order; it also has params, tests, log and check().

etot : float, hartree
Total electronic energy per cell, hartree, without the ion-ion (Ewald) term: a constant for fixed atoms, so it moves no band, but the number is not the full total energy and cannot be compared between structures.
efermi : float, hartree
Fermi level from the smearing, hartree; 0 when SMEAR is 0.
iter : int
SCF iterations.
drho : float
The last density change.
evb : ndarray[float64], eV
Band energies along the path, eV, from the valence-band top (an insulator) or the Fermi level (a metal): path points x bands.
pathx : ndarray[float64]
Each path point's position along the path, for plotting.
gap : float, eV
Smallest gap along the band path, eV (from the check file; insulators only).

Raises

vipyr.ParameterError
A ValueError: an argument outside its range, choices, rank or shape, or one of a group given without the rest; its .param names the argument.
TypeError
An argument of the wrong type, or an unknown keyword.
vipyr.VivBuildError
An ImportError: no C compiler, or the program's C does not build.
RuntimeError
The program stops with its own message (a combination it rejects, or no convergence where the program treats that as an error).

Examples

import vipyr as vp
r = vp.dft.pw(material="si")          # the deck's ecut and k-mesh
print(r.etot, r.gap, r.evb.shape)
assert r.check()
0.4800804469256543 0.4745244429815319 (61, 8)

Each example ran as written when these pages were generated, and the output shown is what it printed.

Checked against

Reference
the dense numpy reference, dft/ref (a different algorithm as well as a different language), through each material's check file (dft/<material>_it_check.viv)
Cases
the six decks, each at its own settings
Band tolerance
10−5 eV, every band at every point of the path
Energy tolerance
10−7 hartree, the total energy

Credits

  • The GTH pseudopotential parameters are CP2K's GTH_POTENTIALS table as PySCF ships it (Goedecker, Teter and Hutter 1996; Hartwigsen, Goedecker and Hutter 1998); only the numbers are used, no CP2K or PySCF code.

Source