PyPWDFT: pure-python plane-wave density functional theory

https://img.shields.io/pypi/v/pypwdft?color=green https://github.com/ifilot/pypwdft/actions/workflows/build_pypi.yml/badge.svg https://img.shields.io/badge/License-GPLv3-blue.svg

PyPWDFT is a pure-Python package for performing plane-wave DFT calculations. PyPWDFT is designed with the aim of teaching students the inner workings of a PW-DFT code. The source code is kept relatively small and contains extensive commenting. Using PyPWDFT is fairly simple, though its application is due to its scope relatively limited.

Features and scope

  • Unit cells are limited to cubes.

  • GTH frozen-core pseudopotentials with local and non-local terms.

  • Sampling is currently limited to the \(\Gamma\)-point.

  • Lowest Kohn-Sham states are found with a block Davidson solver; the ARPACK Lanczos solver is available as a cross-check.

  • Slater exchange functional

  • Vosko-Wilk-Nusair correlation functional (VWN5)

  • Perdew-Burke-Ernzerhof (PBE) exchange-correlation functional

  • Separate cutoffs for the orbitals and the electron density; by default the density cutoff is four times the orbital cutoff.

  • pypwdft.Structure loads bundled molecules and XYZ structures.

  • The self-consistent field procedure allows for verbose (detailed output)

  • Variables and matrices relevant to the computation are accessible to the user such that they can follow the procedure.

Example

The code below will perform a plane-wave density functional theory calculation for carbon monoxide inside a 10x10x10 a.u. unit cell. Five occupied orbitals and the lowest unoccupied orbital are calculated.

from pypwdft import PWDFT, Structure

def main():
   structure = Structure.from_name("CO", cell=10)
   calculation = PWDFT(
      structure,
      cutoff=40,
      xc="pbe",
      pseudopotential="gth",
   )
   result = calculation.run(
      convergence=1e-4,
      bands=6,
      verbosity=1,
   )
   result.plot_orbitals(
      occupied=False,
      plane="xz",
      columns=3,
      save="co-orbitals.png",
   )

if __name__ == '__main__':
   main()

The resulting occupied and lowest unoccupied molecular orbitals are shown below.

Molecular orbitals of carbon monoxide

PyPWDFT has been developed at the Eindhoven University of Technology, Netherlands. PyPWDFT and its development are hosted on Github. Bugs and feature requests are ideally submitted via the github issue tracker.

Indices and tables