PAWpySeed
Parallel C/Python package for numerical analysis of PAW DFT wavefunctions
|
Public Member Functions | |
def | __init__ (self, struct, pwf, cr, outcar) |
def | make_site_lists (self, basis) |
def | setup_projection (self, basis, setup_basis=True) |
def | single_band_projection (self, band_num, basis) |
def | get_c_projectors_from_pps (self, pps) |
def | make_c_projectors (self, basis=None) |
def | proportion_conduction (self, band_num, bulk, pseudo=False, spinpol=False) |
def | defect_band_analysis (self, bulk, num_below_ef=20, num_above_ef=20, spinpol=False) |
def | check_c_projectors (self) |
def | get_state_realspace (self, b, k, s, dim=None) |
def | write_state_realspace (self, b, k, s, fileprefix="", dim=None, return_wf=False) |
def | write_density_realspace (self, filename="PYAECCAR", dim=None, return_wf=False) |
def | free_all (self) |
Static Public Member Functions | |
def | from_files (struct="CONTCAR", pwf="WAVECAR", cr="POTCAR", vr="vasprun.xml", outcar="OUTCAR") |
def | from_directory (path) |
def | setup_multiple_projections (basis_dir, wf_dirs, ignore_errors=False) |
Public Attributes | |
structure | |
pwf | |
cr | |
dim | |
projector_list | |
nband | |
nwk | |
nspin | |
nums | |
coords | |
site_cat | |
num_proj_els | |
Class for storing and manipulating all electron wave functions in the PAW formalism. Attributes: structure (pymatgen.core.structure.Structure): stucture of the material that the wave function describes pwf (PseudoWavefunction): Pseudowavefunction componenet cr (CoreRegion): Contains the pseudopotentials, with projectors and partials waves, for the structure projector: ctypes object for interfacing with C code wf_ptr (C pointer): pointer to the pswf_t C object for this wavefunction dim (np.ndarray, length 3): dimension of the FFT grid used by VASP and therefore for FFTs in this code
def pawpyseed.core.wavefunction.Wavefunction.__init__ | ( | self, | |
struct, | |||
pwf, | |||
cr, | |||
outcar | |||
) |
Arguments: struct (pymatgen.core.Structure): structure that the wavefunction describes pwf (PseudoWavefunction): Pseudowavefunction componenet cr (CoreRegion): Contains the pseudopotentials, with projectors and partials waves, for the structure outcar (pymatgen.io.vasp.outputs.Outcar): Outcar object for reading ngf Returns: Wavefunction object
def pawpyseed.core.wavefunction.Wavefunction.check_c_projectors | ( | self | ) |
Check to see if the projector functions have been read in and set up. If not, do so.
def pawpyseed.core.wavefunction.Wavefunction.defect_band_analysis | ( | self, | |
bulk, | |||
num_below_ef = 20 , |
|||
num_above_ef = 20 , |
|||
spinpol = False |
|||
) |
Identifies a set of 'interesting' bands in a defect structure to analyze by choosing any band that is more than bound conduction and more than bound valence in the pseudoprojection scheme, and then fully analyzing these bands using single_band_projection Args: bulk (Wavefunction object): bulk structure wavefunction num_below_ef (int, 20): number of bands to analyze below the fermi level num_above_ef (int, 20): number of bands to analyze above the fermi level spinpol (bool, False): whether to return spin-polarized results (only allowed for spin-polarized DFT output)
def pawpyseed.core.wavefunction.Wavefunction.free_all | ( | self | ) |
Frees all of the C structures associated with the Wavefunction object. After being called, this object is not usable.
|
static |
Assumes VASP output has the default filenames and is located in the directory specificed by path.
|
static |
Construct a Wavefunction object from file paths. Arguments: struct (str): VASP POSCAR or CONTCAR file path pwf (str): VASP WAVECAR file path vr (str): VASP vasprun file path Returns: Wavefunction object
def pawpyseed.core.wavefunction.Wavefunction.get_c_projectors_from_pps | ( | self, | |
pps | |||
) |
Returns a point to a list of ppot_t objects in C, to be used for high performance parts of the code Args: pps (dict of Pseudopotential objects): keys are integers, values of Pseudopotential objects Returns: c_void_p object pointing to ppot_t list with each Pseudopotential, ordered in the list by their numerical keys
def pawpyseed.core.wavefunction.Wavefunction.get_state_realspace | ( | self, | |
b, | |||
k, | |||
s, | |||
dim = None |
|||
) |
Returns the real and imaginary parts of a given band. Args: b (int): band number k (int): kpoint number s (int): spin number dim (numpy array of 3 ints): dimensions of the FFT grid Returns: An array (x slow-indexed) where the first half of the values are the real part and second half of the values are the imaginary part
def pawpyseed.core.wavefunction.Wavefunction.make_c_projectors | ( | self, | |
basis = None |
|||
) |
Uses the CoreRegion objects in self and basis (if not None) to construct C representations of the projectors and partial waves for a structure. Also assigns numerical labels for each element and returns a list of indices and positions which can be easily converted to C lists for projection functions. Arguments: basis (None or Wavefunction): an additional structure from which to include pseudopotentials. E.g. can be useful if a basis contains some different elements than self. Returns: projector_list (C pointer): describes the pseudopotential data in C selfnums (int32 numpy array): numerical element label for each site in the structure selfcoords (float64 numpy array): flattened list of coordinates of each site in self basisnums (if basis != None): same as selfnums, but for basis basiscoords (if basis != None): same as selfcoords, but for basis
def pawpyseed.core.wavefunction.Wavefunction.make_site_lists | ( | self, | |
basis | |||
) |
Organizes sites into sets for use in the projection scheme. M_R and M_S contain site indices of sites which are identical in structures R (basis) and S (self). N_R and N_S contain all other site indices, and N_RS contains pairs of indices in R and S with overlapping augmentation spheres in the PAW formalism. Arguments: basis (Wavefunction object): Wavefunction in the same lattice as self. The bands in self will be projected onto the bands in basis Returns: M_R (numpy array): Indices of sites in basis which have an identical site in S (self) (same element and position to within tolerance of 0.02 Angstroms). M_S (numpy array): Indices of sites in self which match sites in M_R (i.e. M_R[i] is an identical site to M_S[i]) N_R (numpy array): Indices of sites in basis but not in M_R N_S (numpy array): Indices of sites in self but not in M_S N_RS (numpy array): Pairs of indices (one in basis and one in self) which are not identical but have overlapping augmentation regions
def pawpyseed.core.wavefunction.Wavefunction.proportion_conduction | ( | self, | |
band_num, | |||
bulk, | |||
pseudo = False , |
|||
spinpol = False |
|||
) |
Calculates the proportion of band band_num in self that projects onto the valence states and conduction states of bulk. Designed for analysis of point defect wavefunctions. Arguments: band_num (int): number of defect band in self bulk (Wavefunction): wavefunction of bulk crystal with the same lattice and basis set as self Returns: v, c (int, int): The valence (v) and conduction (c) proportion of band band_num
|
static |
A convenient generator function for processing the Kohn-Sham wavefunctions of multiple structures with respect to one structure used as the basis. All C memory is freed after each yield for the wavefunctions to be analyzed, and C memory associated with the basis wavefunction is freed when the generator is called after all wavefunctions have been yielded. Args: basis_dir (str): path to the VASP output to be used as the basis structure wf_dirs (list of str): paths to the VASP outputs to be analyzed ignore_errors (bool, False): whether to ignore errors in setting up Wavefunction objects by skipping over the directories for which setup fails. Returns: list -- wf_dir, basis, wf Each iteration of the generator function returns a directory name from wf_dirs (wf_dir), the basis Wavefunction object (basis), and the Wavefunction object associated with wf_dir (wf), fully setup to project bands of wf onto bands of basis.
def pawpyseed.core.wavefunction.Wavefunction.setup_projection | ( | self, | |
basis, | |||
setup_basis = True |
|||
) |
Evaluates projectors <p_i|psi>, as well as <(phi-phit)|psi> and <(phi_i-phit_i)|(phi_j-phit_j)>, when needed Arguments: basis (Wavefunction): wavefunction onto which bands of self will be projected.
def pawpyseed.core.wavefunction.Wavefunction.single_band_projection | ( | self, | |
band_num, | |||
basis | |||
) |
All electron projection of the band_num band of self onto all the bands of basis. Returned as a numpy array, with the overlap operator matrix elements ordered as follows: loop over band loop over spin loop over kpoint Arguments: band_num (int): band which is projected onto basis basis (Wavefunction): basis Wavefunction object Returns: res (np.array): overlap operator expectation values as described above
def pawpyseed.core.wavefunction.Wavefunction.write_density_realspace | ( | self, | |
filename = "PYAECCAR" , |
|||
dim = None , |
|||
return_wf = False |
|||
) |
Writes the real and imaginary parts of a given band to two files, prefixed by fileprefix Args: b (int): band number k (int): kpoint number s (int): spin number dim (numpy array of 3 ints): dimensions of the FFT grid filename (string, "PYAECCAR"): charge density filename return_wf (bool): whether to return the wavefunction Returns: (if return_wf==True) An array (x slow-indexed, as in VASP) with the charge densities The charge density is written with z the slow index.
def pawpyseed.core.wavefunction.Wavefunction.write_state_realspace | ( | self, | |
b, | |||
k, | |||
s, | |||
fileprefix = "" , |
|||
dim = None , |
|||
return_wf = False |
|||
) |
Writes the real and imaginary parts of a given band to two files, prefixed by fileprefix Args: b (int): band number k (int): kpoint number s (int): spin number dim (numpy array of 3 ints): dimensions of the FFT grid fileprefix (string, optional): first part of the file name return_wf (bool): whether to return the wavefunction Returns: (if return_wf==True) An array (x slow-indexed) where the first half of the values are the real part and second half of the values are the imaginary part The wavefunction is written with z the slow index.
pawpyseed.core.wavefunction.Wavefunction.coords |
pawpyseed.core.wavefunction.Wavefunction.cr |
pawpyseed.core.wavefunction.Wavefunction.dim |
pawpyseed.core.wavefunction.Wavefunction.nband |
pawpyseed.core.wavefunction.Wavefunction.nspin |
pawpyseed.core.wavefunction.Wavefunction.num_proj_els |
pawpyseed.core.wavefunction.Wavefunction.nums |
pawpyseed.core.wavefunction.Wavefunction.nwk |
pawpyseed.core.wavefunction.Wavefunction.projector_list |
pawpyseed.core.wavefunction.Wavefunction.pwf |
pawpyseed.core.wavefunction.Wavefunction.site_cat |
pawpyseed.core.wavefunction.Wavefunction.structure |