PAWpySeed Parallel C/Python package for numerical analysis of PAW DFT wavefunctions

- Main Page
- Classes
- Files

pawpyseed

https://kylebystrom.github.io/pawpyseed/

PAWpySeed is a parallelized Python and C tool for reading and analyzing the optimized band structure and wave functions of VASP DFT calculations. The code is written for the PAW formalism developed by P.E. Blochl and implemented in VASP.

## Installation

TO compile the C code, pawpyseed needs to link with the Intel Math Kernel Library (MKL). You can customize how this is done via the config file (see "The customizable way"). However, for most users, the easy way described below is adequate.

### The easy way

First, install `mkl-devel` in your local installation:

1 pip install mkl-devel --user

Next, find your Python installation directory (call it `INST_DIR`) and add the `include` and `lib` to your C compiler paths to link with MKL:

1 export C_INCLUDE_PATH=$INST_DIR/include:$C_INCLUDE_PATH
2 export LIBRARY_PATH=$INST_DIR/lib:$LIBRARY_PATH
3 export LD_LIBRARY_PATH=$INST_DIR/lib:$LD_LIBRARY_PATH

Then run

1 python setup.py build
2 python setup.py install

OR with `pip`.

1 pip install pawpyseed

This has been tested on Scientific Linux 7 and Linux Mint 18, but should work for systems that have the appropriate packages and environment variables defined as described below.

#### Simple site.cfg approach

After installing MKL locally with `pip`, copy `site.cfg.default` from the pawpyseed repository to `~/.pawpyseed-site.cfg`. Open it and set `root=<your home directory>/.local` under the `[mkl]` heading and uncomment it by removing the `#`.

IF you get linking issues at runtime using this method, try setting `sdl=True` in the config file and then setting the environment variable `MKL_THREADING_LAYER=sequential`.

#### Intel easy way

If you have `icc` and prefer to use it to compile pawpyseed's C libraries, set `compiler=icc` in `~/.pawpyseed-site.cfg` and then set `root` to your MKL installation directory. Set `sdl=True`. You MKL distribution must have also been compiled with the Intel compiler. Run the `setup.py` script or `pip install pawpyseed`.

### The customizable way

To make your own config file, make a file in your home directory `~` named `.pawpyseed-site.cfg`. This file allows you to customize configuration settings for pawpyseed. It is read using the Python configparser module https://docs.python.org/3/library/configparser.html. If you don't want to learn about the configuration file options, skip to "The Easy Way" to get this done with quickly. The options (with their defaults) are as follows:

1 [compiler]
2 # Name of the compiler to be used. By default, let's the setup script choose this.
3 compiler_name = <no default> # Examples: icc or gcc
4 # Name of the linker to be used. By default, let's the setup script choose this.
5 # NOTE: Don't forget the -shared tag for icc or gcc!
6 # NOTE: If compiler_name is set and linker_name is not,
7 # linker_name is set to compiler_name with the -shared tag appended.
8 linker_name = <no default> # Examples: icc -shared or gcc -shared
9
10 [mkl]
11 # MKL installation directory. <root>/lib or <root>/lib/intel64 must contain
12 # the MKL shared object libraries, while <root>/include must containn the MKL headers.
13 # Many systems have the environment variable
14 # MKLROOT set for this, so you can set this to the output of:
15 # echo $MKLROOT
16 # If you pip install mkl-devel, this goes to /usr or /usr/local.
17 # If you pip install mkl-devel --user, this goes to ~/.local
18 # (or the equivalents for your system).
19 root = <no default>
20 # Don't change this. Might be used in the future but currently has no effect.
21 interface32 = True
22 # Whether to compile with the single dynamic library libmkl_rt.so.
23 # If you are having installation/performance problems, try setting sdl=True,
24 # pip installing mkl-devel with the --user option, set root=~/.local,
25 # and set the environment variable MKL_THREADING_LAYER=sequential
26 # when using pawpyseed.
27 sdl = False
28
29 [threading]
30 # Whether to use omp_loops. If False, pawpyseed doesn't do any parallelization
31 # on its own, though its calls to MKL, BLAS, LAPACK, etc might be
32 # threaded by MKL.
33 omp_loops = True
34 # Whether to use threading for MKL. OVERRIDDEN if sdl=True, in which case
35 # MKL is threaded by default and you can run sequentially by
36 # setting the environment variable MKL_THREADING_LAYER=sequential
37 # when using pawpyseed.
38 # NOTE: ONLY SET THIS TRUE IF COMPILING WITH icc (OR gcc with omp_loops=False),
39 # and only if you are very concerned about speed. This is because gcc
40 # cannot do nested parallelism with MKL
41 threaded_mkl = False
42
43 # NOTE: Do not link to icc-compiled MKL libraries when compiling the C
44 # extension with gcc or vice versa. Use like type compilers.

### Dependencies

All dependencies indicate the minimum version tested. PAWpySeed might work fine with earlier versions, but use of older versions will not be officially supported.

Python requirements:

1 Python>=3.5
2 numpy>=1.14
3 scipy>=1.0
4 pymatgen>=2018.2.13
5 sympy>=1.1.1
6 matplotlib>=0.2.5

C requirements:

1 icc >= 16.0.4 OR gcc >= 4.8.5
2 Intel Math Kernel Library >= 11.3.4

If you don't want to `pip install` Intel MKL, it is available for free installation on a variety of platforms. Most computing clusters will have Intel MKL, and you can install it on your desktop (or any system to which you have root access) by following the relevant instructions at the following URL: https://software.intel.com/en-us/articles/free-ipsxe-tools-and-libraries.

## Theory and Input

### PAW

The projector augmented wave (PAW) method is a technique used in plane wave density functional theory to simplify the description of the wavefunctions near the nuclei of a system. The strong Coulombic forces near an atomic nucleus creates quickly oscillating wavefunctions that are not well described by plane waves without prohibitively large basis sets, so a "pseudopotential" is introduced near the atomic nuclei which results in smooth "pseudo wavefunctions" well described by plane waves. The full wavefunctions can be recovered by a linear transform of the pseudowavefunctions. The PAW method requires three sets of functions: projector functions, onto which pseudowavefunctions are projected to probe their character; full partial waves, which describe atomic valence states derived from the true potential; and pseudo partial waves, which are derived from the full partial waves and pseudopotential.

### Files

The projector functions and partial waves are unique to each element and stored in the POTCAR file used in a VASP calculation. The pseudowavefunction is the part of the wavefunction optimized during a DFT calculation and is stored in the WAVECAR output file in VASP. PAWpySeed parses both files to retrieve all parts of the full Kohn Sham wavefunctions.

## The Code

The main purpose of PAWpySeed is to evaluate overlap operators between Kohn-Sham wavefunctions from different structures, which is not done by standard plane-wave DFT codes. Such functionality can be useful for analyzing the composition of defect levels in solids, which is main application for which the code is currently focused.

### Implementation

- Python Interface
- Computationally intensive tasks in C
- Parallelized with openmp

### Current Functionality

- Read pseudowavefunctions
- Read projectors and partial waves from VASP POTCAR
- Evaluate overlap operators between bands, including when bands belong to different structures with the same lattice
- Project point defect levels onto bulk valence and conduction bands
- Convenient pycdt interface
- Perturbation-extrapolation correction for point defect calculations
- Read noncollinear pseudo wavefunctions and construct all-electron wavefunctions (no overlap operator evaluation for noncollinear data)
- Calculate plane-wave matrix elements between bands.

## Acknowledgments

The code in PAWpySeed is based on a several algorithms and codes, which are enumerated here.

1. PAW: The PAW method was developed by P. E. Blochl in 1994. His paper deriving the method was helpful to me in deriving the extensions to the formalism needed to develop this code.
   - P. E. Blochl. Projector augmented-wave method. Phys. Rev. B, 50:17953, 1994.
2. VASP: PAWpySeed is primarily built to read and process the output of VASP calculations. PAWpySeed reads PAW wavefunctions and calculate overlap operators using algorithms derived from VASP and other plane-wave codes, so the following citations are necessary. The last citation is specifically for the PAW method and potentials. See the VASP website at http://community.hartree.stfc.ac.uk/wiki/site/admin/vasp.html for information on citing specific functionals.
   - G. Kresse and J. Hafner. Ab initio molecular dynamics for liquid metals. Phys. Rev. B, 47:558, 1993.
   - G. Kresse and J. Hafner. Ab initio molecular-dynamics simulation of the liquid-metal-amorphous-semiconductor transition in germanium. Phys. Rev. B, 49:14251, 1994.
   - G. Kresse and J. Furthmüller. Efficiency of ab-initio total energy calculations for metals and semiconductors using a plane-wave basis set. Comput. Mat. Sci., 6:15, 1996.
   - G. Kresse and J. Furthmüller. Efficient iterative schemes for ab initio total-energy calculations using a plane-wave basis set. Phys. Rev. B, 54:11169, 1996.
   - G. Kresse and D. Joubert. From ultrasoft pseudopotentials to the projector augmented-wave method. Phys. Rev. B, 59:1758, 1999.
3. NUMSBT: NUMSBT is a code written by J. D. Talman, which implements an algorithm that calculates the spherical Bessel transform (SBT) in O(NlogN) time. PAWpySeed employs the high-k transform algorithm implemented in NUMSBT to calculate the overlap operators between overlapping augmentation spheres that have different positions or elements. It is also used to filter out high-frequency components from AE partial waves, which allows projections from pseudowavefunctions to AE partial waves to be performed in real space, which is a vital component of the code. NUMSBT is distributed under the Standard CPC License, and the algorithm is developed in the following paper:
   - Talman, J. Computer Physics Communications 2009, 180, 332 –338.
4. WaveTrans: reader.c and reader.h, which read WAVECAR files from VASP output, are based on the Fortran program, WaveTrans, written by R. M. Feenstra and M. Widom from the Dept. of Physics at Carnegie Mellon University. To see the original work, please visit https://www.andrew.cmu.edu/user/feenstra/wavetrans/.
5. Doxygen: Doxygen is a documentation generator from which I built the docs for PAWpySeed. It is an excellent tool that allows for clean, up-to-date documentaton that is easy to make and navigate. Check it out at http://www.stack.nl/~dimitri/doxygen/.

## Citing

If you find pawpyseed useful, please encourage its development by citing the following paper in your research:

1 @ARTICLE{2019arXiv190411572B,
2 author = { {Bystrom}, Kyle and {Broberg}, Danny and {Dwaraknath}, Shyam and
3 {Persson}, Kristin A. and {Asta}, Mark},
4 title = "{Pawpyseed: Perturbation-extrapolation band shifting corrections for point defect calculations}",
5 journal = {arXiv e-prints},
6 keywords = {Condensed Matter - Materials Science},
7 year = "2019",
8 month = "Apr",
9 eid = {arXiv:1904.11572},
10 pages = {arXiv:1904.11572},
11 archivePrefix = {arXiv},
12 eprint = {1904.11572},
13 primaryClass = {cond-mat.mtrl-sci},
14 adsurl = {https://ui.adsabs.harvard.edu/abs/2019arXiv190411572B},
15 adsnote = {Provided by the SAO/NASA Astrophysics Data System}
16 }

You can view the paper here: https://arxiv.org/abs/1904.11572

## Questions and Comments

Find a bug? Areas of code unclearly documented? Other questions? Feel free to contact Kyle Bystrom at kyleb.nosp@m.ystr.nosp@m.om@gm.nosp@m.ail..nosp@m.com with the subject "pawpyseed: (Your Topic)" AND/OR create an issue on the Github page at https://github.com/kylebystrom/pawpyseed.