import signal import data import misc import param import grids import logger import chkfile # For code compatiblity in python-2 and python-3 if sys.version_info >= (3, ): unicode = str signal.signal(signal.SIGINT, signal.SIG_DFL) libgsurf = misc.load_library('libgsurf') def rho_grad(self, point): rho = 0.0 gun = numpy.zeros(self.nmo) gun1 = numpy.zeros((self.nmo, 3)) grad = numpy.zeros(3) fun = numpy.zeros((3)) fun1 = numpy.zeros((3)) # TODO: avoid natm loop and loop only over total shells for ic in range(self.natm): xcoor = point - self.coords[ic, :] dis2 = numpy.einsum('i,i->', xcoor, xcoor) for m in range(self.ngroup[ic]): if (dis2 >= self.rcutte[m, ic]): continue
#!/usr/bin/env python import numpy import ctypes import misc libfapi = misc.load_library('libfapi') libgapi = misc.load_library('libgapi') def eval_rho(self, coords): npoints = coords.shape[0] out = numpy.zeros(npoints) feval = 'eval_rho' drv = getattr(libfapi, feval) drv(ctypes.c_int(self.nmo), ctypes.c_int(self.nprims), self.icen.ctypes.data_as(ctypes.c_void_p), self.ityp.ctypes.data_as(ctypes.c_void_p), self.oexp.ctypes.data_as(ctypes.c_void_p), self.ngroup.ctypes.data_as(ctypes.c_void_p), self.nzexp.ctypes.data_as(ctypes.c_void_p), self.nuexp.ctypes.data_as(ctypes.c_void_p), self.rcutte.ctypes.data_as(ctypes.c_void_p), self.mo_coeff.ctypes.data_as(ctypes.c_void_p), self.mo_occ.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(self.natm), self.coords.ctypes.data_as(ctypes.c_void_p), ctypes.c_int(npoints), coords.ctypes.data_as(ctypes.c_void_p), out.ctypes.data_as(ctypes.c_void_p))
import time import h5py import numpy import ctypes import logger import param import data import chkfile import misc # For code compatiblity in python-2 and python-3 if sys.version_info >= (3, ): unicode = str libfapi = misc.load_library('libfapi.so') def density_grad_shell(self, point): rho = 0.0 gun = numpy.zeros(self.nmo) gun1 = numpy.zeros((self.nmo, 3)) grad = numpy.zeros(3) fun = numpy.zeros((3)) fun1 = numpy.zeros((3)) # TODO: avoid natm loop and loop only over total shells for ic in range(self.natm): xcoor = point - self.coords[ic, :] dis2 = numpy.einsum('i,i->', xcoor, xcoor) for m in range(self.ngroup[ic]): if (dis2 >= self.rcutte[m, ic]): continue