import numpy as np from ctypes import c_int, c_double, c_char_p import ctypes import os import cpp_utils # ============================== bohrRadius2angstroem = 0.5291772109217 # ============================== interface to C++ core cpp_name='GridUtils' #cpp_utils.compile_lib( cpp_name ) cpp_utils.make("GU") lib = ctypes.CDLL( cpp_utils.CPP_PATH + "/" + cpp_name + cpp_utils.lib_ext ) # load dynamic librady object using ctypes # define used numpy array types for interfacing with C++ array1i = np.ctypeslib.ndpointer(dtype=np.int32, ndim=1, flags='CONTIGUOUS') array1d = np.ctypeslib.ndpointer(dtype=np.double, ndim=1, flags='CONTIGUOUS') array2d = np.ctypeslib.ndpointer(dtype=np.double, ndim=2, flags='CONTIGUOUS') array3d = np.ctypeslib.ndpointer(dtype=np.double, ndim=3, flags='CONTIGUOUS') array4d = np.ctypeslib.ndpointer(dtype=np.double, ndim=4, flags='CONTIGUOUS') # ============== Filters def renorSlice( F ): vranges = []
#!/usr/bin/python import numpy as np from ctypes import c_int, c_double, c_char_p import ctypes import os import common as PPU import cpp_utils # ============================== # ============================== interface to C++ core # ============================== cpp_name='ProbeParticle' #cpp_utils.compile_lib( cpp_name ) cpp_utils.make( "PP" ) lib = ctypes.CDLL( cpp_utils.CPP_PATH + "/" + cpp_name + cpp_utils.lib_ext ) # load dynamic librady object using ctypes # define used numpy array types for interfacing with C++ array1i = np.ctypeslib.ndpointer(dtype=np.int32, ndim=1, flags='CONTIGUOUS') array1d = np.ctypeslib.ndpointer(dtype=np.double, ndim=1, flags='CONTIGUOUS') array2d = np.ctypeslib.ndpointer(dtype=np.double, ndim=2, flags='CONTIGUOUS') array3d = np.ctypeslib.ndpointer(dtype=np.double, ndim=3, flags='CONTIGUOUS') array4d = np.ctypeslib.ndpointer(dtype=np.double, ndim=4, flags='CONTIGUOUS') # ======== # ======== Python warper function for C++ functions # ======== '''
''' # make_Ratoms def make_Ratoms(atom_types, type_R, fmin=0.9, fmax=1.3): atom_R = type_R[atom_types] return atom_R * fmin, atom_R * fmax # ============================== # ============================== interface to C++ core # ============================== cpp_name = 'Multipoles' #cpp_utils.compile_lib( cpp_name ) cpp_utils.make("MP") lib = ctypes.CDLL( cpp_utils.CPP_PATH + "/lib" + cpp_name + cpp_utils.lib_ext) # load dynamic librady object using ctypes # define used numpy array types for interfacing with C++ array1b = np.ctypeslib.ndpointer(dtype=np.bool, ndim=1, flags='CONTIGUOUS') array1i = np.ctypeslib.ndpointer(dtype=np.int32, ndim=1, flags='CONTIGUOUS') array1d = np.ctypeslib.ndpointer(dtype=np.double, ndim=1, flags='CONTIGUOUS') array2d = np.ctypeslib.ndpointer(dtype=np.double, ndim=2, flags='CONTIGUOUS') array3d = np.ctypeslib.ndpointer(dtype=np.double, ndim=3, flags='CONTIGUOUS') # ======== # ======== Python warper function for C++ functions # ========
#!/usr/bin/python import numpy as np from ctypes import c_int, c_double, c_char_p import ctypes import os import common as PPU import cpp_utils # ============================== # ============================== interface to C++ core # ============================== cpp_name = 'ProbeParticle' #cpp_utils.compile_lib( cpp_name ) cpp_utils.make("PP") lib = ctypes.CDLL( cpp_utils.CPP_PATH + "/" + cpp_name + cpp_utils.lib_ext) # load dynamic librady object using ctypes # define used numpy array types for interfacing with C++ array1i = np.ctypeslib.ndpointer(dtype=np.int32, ndim=1, flags='CONTIGUOUS') array1d = np.ctypeslib.ndpointer(dtype=np.double, ndim=1, flags='CONTIGUOUS') array2d = np.ctypeslib.ndpointer(dtype=np.double, ndim=2, flags='CONTIGUOUS') array3d = np.ctypeslib.ndpointer(dtype=np.double, ndim=3, flags='CONTIGUOUS') array4d = np.ctypeslib.ndpointer(dtype=np.double, ndim=4, flags='CONTIGUOUS') # ======== # ======== Python warper function for C++ functions # ========