PAWpySeed
Parallel C/Python package for numerical analysis of PAW DFT wavefunctions
|
Main utilities file for the Python portion of the code. More...
Classes | |
class | PAWpyError |
Functions | |
def | cfunc_call (func, outsize, args) |
def | check_spin (spin, nspin) |
def | cdouble_to_numpy (arr, length) |
def | cfloat_to_numpy (arr, length) |
def | numpy_to_cdouble (arr) |
def | numpy_to_cfloat (arr) |
def | numpy_to_cint (arr) |
def | el (site) |
Variables | |
c_int_p = POINTER(c_int) | |
c_float_p = POINTER(c_float) | |
c_double_p = POINTER(c_double) | |
MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) | |
PAWC = CDLL(os.path.join(MODULE_DIR, "pawpy.so")) | |
argtypes | |
restype | |
Main utilities file for the Python portion of the code.
This files stores 1) the PAWC ctypes module, which contains all of the C functions used to read and analyze PAW wavefunctions, 2) converter functions than transfer data from numpy arrays to C pointers and vice versa, 3) cfunc_call, which is used to conveniently call ctypes functions, and 4) a few other utilties employed mainly by the wavefunction classes.
def pawpyseed.core.utils.cdouble_to_numpy | ( | arr, | |
length | |||
) |
Convert a pointer to length doubles in C to a numpy array of np.float64. Frees the pointer.
def pawpyseed.core.utils.cfloat_to_numpy | ( | arr, | |
length | |||
) |
Convert a pointer to length floats in C to a numpy array of np.float64. Frees the pointer.
def pawpyseed.core.utils.cfunc_call | ( | func, | |
outsize, | |||
args | |||
) |
converts args to C types and passes them to the C function func
def pawpyseed.core.utils.check_spin | ( | spin, | |
nspin | |||
) |
Utility to check if the spin input parameter to single_band_projection and similar functions is allowed given nspin of the wavefunction object being analyzed. Returns a new value of spin if spin must be changed, raises an error if spin is not allowed.
def pawpyseed.core.utils.el | ( | site | ) |
Return the element symbol of a pymatgen site object
def pawpyseed.core.utils.numpy_to_cdouble | ( | arr | ) |
Convert a numpy array to a C double array.
def pawpyseed.core.utils.numpy_to_cfloat | ( | arr | ) |
Convert a numpy array to a C float array
def pawpyseed.core.utils.numpy_to_cint | ( | arr | ) |
Convert a numpy array to a C int array. Casts each element to int
pawpyseed.core.utils.argtypes |
pawpyseed.core.utils.c_double_p = POINTER(c_double) |
pawpyseed.core.utils.c_float_p = POINTER(c_float) |
pawpyseed.core.utils.c_int_p = POINTER(c_int) |
pawpyseed.core.utils.MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) |
pawpyseed.core.utils.PAWC = CDLL(os.path.join(MODULE_DIR, "pawpy.so")) |
pawpyseed.core.utils.restype |