PAWpySeed
Parallel C/Python package for numerical analysis of PAW DFT wavefunctions
|
#include <complex.h>
#include <math.h>
Go to the source code of this file.
Classes | |
struct | funcset |
struct | ppot |
struct | projection |
struct | band |
struct | rayleigh_set |
struct | kpoint |
struct | pswf |
struct | projgrid |
struct | real_proj |
struct | real_proj_site |
Typedefs | |
typedef struct funcset | funcset_t |
typedef struct ppot | ppot_t |
typedef struct projection | projection_t |
typedef struct band | band_t |
typedef struct rayleigh_set | rayleigh_set_t |
typedef struct kpoint | kpoint_t |
typedef struct pswf | pswf_t |
typedef struct projgrid | projgrid_t |
typedef struct real_proj | real_proj_t |
typedef struct real_proj_site | real_proj_site_t |
Functions | |
int | min (int a, int b) |
int | max (int a, int b) |
void | vcross (double *res, double *top, double *bottom) |
double | dot (double *x1, double *x2) |
double | mag (double *x1) |
double | determinant (double *m) |
double | dist_from_frac (double *coords1, double *coords2, double *lattice) |
void | frac_to_cartesian (double *coord, double *lattice) |
void | cartesian_to_frac (double *coord, double *reclattice) |
void | min_cart_path (double *coord, double *center, double *lattice, double *path, double *r) |
double complex | trilinear_interpolate (double complex *c, double *frac, int *fftg) |
void | free_kpoint (kpoint_t *kpt, int num_elems, ppot_t *pps) |
void | free_ppot (ppot_t *pp) |
void | free_real_proj (real_proj_t *proj) |
void | free_real_proj_site (real_proj_site_t *site) |
void | free_pswf (pswf_t *wf) |
void | free_ptr (void *ptr) |
void | free_real_proj_site_list (real_proj_site_t *sites, int length) |
void | free_ppot_list (ppot_t *pps, int length) |
double * | get_occs (pswf_t *wf) |
int | get_nband (pswf_t *wf) |
int | get_nwk (pswf_t *wf) |
int | get_nspin (pswf_t *wf) |
void | set_num_sites (pswf_t *wf, int nsites) |
double | legendre (int l, int m, double x) |
double | fac (int n) |
double complex | Ylm (int l, int m, double theta, double phi) |
double complex | Ylm2 (int l, int m, double costheta, double phi) |
double | proj_interpolate (double r, double rmax, int size, double *x, double *proj, double **proj_spline) |
double | wave_interpolate (double r, int size, double *x, double *f, double **wave_spline) |
double complex | proj_value_helper (double r, double rmax, int size, double *pos, double *x, double *f, double **s, int l, int m) |
double complex | proj_value (funcset_t funcs, double *x, int m, double rmax, int size, double *ion_pos, double *pos, double *lattice) |
double complex | smooth_wave_value (funcset_t funcs, double *x, int m, double rmax, int size, double *ion_pos, double *pos, double *lattice) |
double complex | wave_value (funcset_t funcs, int size, double *x, int m, double *ion_pos, double *pos, double *lattice) |
double complex | wave_value2 (double *x, double *wave, double **spline, int size, int l, int m, double *pos) |
void | setup_site (real_proj_site_t *sites, ppot_t *pps, int num_sites, int *site_nums, int *labels, double *coords, double *lattice, int *fftg, int pr0_pw1) |
double ** | spline_coeff (double *x, double *y, int N) |
double | spline_integral (double *x, double *a, double **s, int size) |
void | frac_from_index (int index, double *coord, int *fftg) |
double | sph_bessel (double k, double r, int l) |
double | sbf (double x, int l) |
double complex | rayexp (double *kpt, int *Gs, float complex *Cs, int l, int m, int num_waves, double complex *sum_terms, double *ionp) |
double complex * | rayexp_terms (double *kpt, int *Gs, int num_waves, int l, int wave_gridsize, double *grid, double *wave, double **spline, double *reclattice) |
void | generate_rayleigh_expansion_terms (pswf_t *wf, ppot_t *pps, int num_elems) |
void | copy_rayleigh_expansion_terms (pswf_t *wf, ppot_t *pps, int num_elems, pswf_t *wf_R) |
void | CHECK_ALLOCATION (void *ptr) |
void | ALLOCATION_FAILED () |
Contains several sets of general purpose utilities:
1) structs used by pawpyseed as well as utility functions for freeing allocated memory being used by those structs.
2) General vector math (i.e. dot and cross product, determinant, etc.)
3) Other necessary functionality, such as spline interpolation, spherical harmonics, and plane-wave/radial function overlap, that is used in multiple locations throughout the code.
Stores the data for a single band, or Kohn Sham single particle state, for a structure
One set of augmentation region functions, i.e. p_i, phi_i, and phit_i (projector, all electron partial wave, and partial wave), as well as the difference of the partial waves, the difference expanded in spherical Bessel functions, and spline coefficients for each grid.
typedef struct projection projection_t |
typedef struct projgrid projgrid_t |
typedef struct rayleigh_set rayleigh_set_t |
typedef struct real_proj_site real_proj_site_t |
typedef struct real_proj real_proj_t |
void ALLOCATION_FAILED | ( | ) |
Called when a memory allocation fails to exit the program
void cartesian_to_frac | ( | double * | coord, |
double * | reclattice | ||
) |
void CHECK_ALLOCATION | ( | void * | ptr | ) |
Called after a malloc or calloc call to check that the allocation was successful.
Copy the Rayleigh expansion terms from wf_R to wf.
double determinant | ( | double * | m | ) |
Calculates the determinant of the matrix m with the precondition m is 3x3 (length 9) and in row major order.
double dist_from_frac | ( | double * | coords1, |
double * | coords2, | ||
double * | lattice | ||
) |
Given coords1: fractional coordinate in lattice (length 3) coords2: fractional coordinate in lattice (length 3) lattice: row major lattice matrix, where each row is a lattice unit vector (length 9), returns the distance between coords1 and coords2.
double dot | ( | double * | x1, |
double * | x2 | ||
) |
Returns the dot product of x1 and x2 assuming that x1 and x2 are both of length three
double fac | ( | int | n | ) |
factorial
void frac_from_index | ( | int | index, |
double * | coord, | ||
int * | fftg | ||
) |
void frac_to_cartesian | ( | double * | coord, |
double * | lattice | ||
) |
void free_ppot | ( | ppot_t * | pp | ) |
void free_ppot_list | ( | ppot_t * | pps, |
int | length | ||
) |
void free_pswf | ( | pswf_t * | wf | ) |
void free_ptr | ( | void * | ptr | ) |
void free_real_proj | ( | real_proj_t * | proj | ) |
void free_real_proj_site | ( | real_proj_site_t * | site | ) |
void free_real_proj_site_list | ( | real_proj_site_t * | sites, |
int | length | ||
) |
Calculates the overlaps <(phi_i-phit_i)|(k+G)>, where phi_i are the AE partial waves, phit_i are the PS partial waves, and k+G are the plane waves, in reciprocal space.
int get_nband | ( | pswf_t * | wf | ) |
Return the number of bands in the wavefunction.
int get_nspin | ( | pswf_t * | wf | ) |
Return the number of spins in the wavefunction.
int get_nwk | ( | pswf_t * | wf | ) |
Return the number of kpoins in the wavefunction.
double* get_occs | ( | pswf_t * | wf | ) |
Returns a list with the occupation of each band of the wavefunction at each kpoint as shown: loop over bands loop over spins loop over kpoints
double legendre | ( | int | l, |
int | m, | ||
double | x | ||
) |
Associated legendre polynomial P_lm(x)
double mag | ( | double * | x1 | ) |
Magnitude of a three-element vector
int max | ( | int | a, |
int | b | ||
) |
Maximum of a and b
int min | ( | int | a, |
int | b | ||
) |
Minimum of a and b
void min_cart_path | ( | double * | coord, |
double * | center, | ||
double * | lattice, | ||
double * | path, | ||
double * | r | ||
) |
double proj_interpolate | ( | double | r, |
double | rmax, | ||
int | size, | ||
double * | x, | ||
double * | proj, | ||
double ** | proj_spline | ||
) |
Interpolate the discretely defined projector function proj, defined on linear radial grid x, at radius r. rmax is the maximum radius of the projector. Uses spline interpolation, where proj_spline is the set of spline coefficients for proj set up by spline_coeff
double complex proj_value | ( | funcset_t | funcs, |
double * | x, | ||
int | m, | ||
double | rmax, | ||
int | size, | ||
double * | ion_pos, | ||
double * | pos, | ||
double * | lattice | ||
) |
Return the value of funcs->proj, defined on linear radial grid x centered at 3D vector ion_pos, at position pos, given the real space lattice.
double complex proj_value_helper | ( | double | r, |
double | rmax, | ||
int | size, | ||
double * | pos, | ||
double * | x, | ||
double * | f, | ||
double ** | s, | ||
int | l, | ||
int | m | ||
) |
Helper function for proj_value and smooth_wave_value
double complex rayexp | ( | double * | kpt, |
int * | Gs, | ||
float complex * | Cs, | ||
int | l, | ||
int | m, | ||
int | num_waves, | ||
double complex * | sum_terms, | ||
double * | ionp | ||
) |
Calculates <(phi_i-phit_i)|psit_nk> for one pseudowavefunction band psit_nk using the projections onto plane waves calculated in generate_rayleigh_expansion_terms
double complex* rayexp_terms | ( | double * | kpt, |
int * | Gs, | ||
int | num_waves, | ||
int | l, | ||
int | wave_gridsize, | ||
double * | grid, | ||
double * | wave, | ||
double ** | spline, | ||
double * | reclattice | ||
) |
Calculates <(phi_i-phit_i)|(k+G)> for a specific index i by using the Rayleigh expansion of a plane wave.
double sbf | ( | double | x, |
int | l | ||
) |
Return the value of the l-order spherical bessel function at x.
void set_num_sites | ( | pswf_t * | wf, |
int | nsites | ||
) |
Sets the numer of sites in the structure for the wavefunction.
void setup_site | ( | real_proj_site_t * | sites, |
ppot_t * | pps, | ||
int | num_sites, | ||
int * | site_nums, | ||
int * | labels, | ||
double * | coords, | ||
double * | lattice, | ||
int * | fftg, | ||
int | pr0_pw1 | ||
) |
Convenience function for setting up real_proj_site_t* lists
double complex smooth_wave_value | ( | funcset_t | funcs, |
double * | x, | ||
int | m, | ||
double | rmax, | ||
int | size, | ||
double * | ion_pos, | ||
double * | pos, | ||
double * | lattice | ||
) |
Return the value of funcs->smooth_diffwave, defined on linear radial grid x centered at 3D vector ion_pos, at position pos, given the real space lattice
double sph_bessel | ( | double | k, |
double | r, | ||
int | l | ||
) |
double** spline_coeff | ( | double * | x, |
double * | y, | ||
int | N | ||
) |
Set up spline coefficients for spline interpolation. Essentially a translation into C of the VASP SPLCOF function. G. Kresse and J. Hafner. Ab initio molecular dynamics for liquid metals. Phys. Rev. B, 47:558, 1993.
double spline_integral | ( | double * | x, |
double * | a, | ||
double ** | s, | ||
int | size | ||
) |
Find the integral of a discretely defined function that is fitted with spline coefficients at each point. x is the independent variable grid, a is the function values, s is the spline, and size is the number of points on the grid.
double complex trilinear_interpolate | ( | double complex * | c, |
double * | frac, | ||
int * | fftg | ||
) |
void vcross | ( | double * | res, |
double * | top, | ||
double * | bottom | ||
) |
Calculates the cross product top X bottom and places it in res, assuming that top and bottom are both length three
double wave_interpolate | ( | double | r, |
int | size, | ||
double * | x, | ||
double * | f, | ||
double ** | wave_spline | ||
) |
Interpolate the discretely defined partial wave f, defined on logarithmic radial grix x, at radius r. Uses spline interpolation, where wave_spline is the set of spline coefficients for f set up by spline_coeff
double complex wave_value | ( | funcset_t | funcs, |
int | size, | ||
double * | x, | ||
int | m, | ||
double * | ion_pos, | ||
double * | pos, | ||
double * | lattice | ||
) |
Return the value of funcs->aewave-funcs->pswave, defined on logarithmic radial grid x center at 3D vector ion_pos, at position pos, given the real space lattice.
double complex wave_value2 | ( | double * | x, |
double * | wave, | ||
double ** | spline, | ||
int | size, | ||
int | l, | ||
int | m, | ||
double * | pos | ||
) |
Interpolates the value of a function on a logarithmic radial grid at location pos.
double complex Ylm | ( | int | l, |
int | m, | ||
double | theta, | ||
double | phi | ||
) |
Returns the value of the complex spherical harmonic assuming physics notation (phi is azimuthal angle)
double complex Ylm2 | ( | int | l, |
int | m, | ||
double | costheta, | ||
double | phi | ||
) |
Same as Ylm but takes the cosine of theta instead of the angle itself.