def init_libnao(self, wfsx=None): """ Initialization of data on libnao site """ from pyscf.nao.m_libnao import libnao from pyscf.nao.m_sv_chain_data import sv_chain_data from ctypes import POINTER, c_double, c_int64, c_int32, byref if wfsx is None: data = sv_chain_data(self) # (nkpoints, nspin, norbs, norbs, nreim) #print(' data ', sum(data)) size_x = np.array([1, self.nspin, self.norbs, self.norbs, 1], dtype=np.int32) libnao.init_sv_libnao_orbs.argtypes = (POINTER(c_double), POINTER(c_int64), POINTER(c_int32)) libnao.init_sv_libnao_orbs(data.ctypes.data_as(POINTER(c_double)), c_int64(len(data)), size_x.ctypes.data_as(POINTER(c_int32))) self.init_sv_libnao = True else: size_x = np.zeros(len(self.wfsx.x.shape), dtype=np.int32) for i, sh in enumerate(self.wfsx.x.shape): size_x[i] = sh data = sv_chain_data(self) libnao.init_sv_libnao_orbs.argtypes = (POINTER(c_double), POINTER(c_int64), POINTER(c_int32)) libnao.init_sv_libnao_orbs(data.ctypes.data_as(POINTER(c_double)), c_int64(len(data)), size_x.ctypes.data_as(POINTER(c_int32))) self.init_sv_libnao = True libnao.init_aos_libnao.argtypes = (POINTER(c_int64), POINTER(c_int64)) info = c_int64(-999) libnao.init_aos_libnao(c_int64(self.norbs), byref(info)) if info.value!=0: raise RuntimeError("info!=0") return self
def init_libnao_orbs(self): """ Initialization of data on libnao site """ from pyscf.nao.m_libnao import libnao from pyscf.nao.m_sv_chain_data import sv_chain_data from ctypes import POINTER, c_double, c_int64, c_int32, byref data = sv_chain_data(self) size_x = np.array([1,self.nspin,self.norbs,self.norbs,1], dtype=np.int32) libnao.init_sv_libnao_orbs.argtypes = (POINTER(c_double), POINTER(c_int64), POINTER(c_int32)) libnao.init_sv_libnao_orbs(data.ctypes.data_as(POINTER(c_double)), c_int64(len(data)), size_x.ctypes.data_as(POINTER(c_int32))) self.init_sv_libnao_orbs = True libnao.init_aos_libnao.argtypes = (POINTER(c_int64), POINTER(c_int64)) info = c_int64(-999) libnao.init_aos_libnao(c_int64(self.norbs), byref(info)) if info.value!=0: raise RuntimeError("info!=0") return self
def init_libnao_orbs(self): """ Initialization of data on libnao site """ from pyscf.nao.m_libnao import libnao from pyscf.nao.m_sv_chain_data import sv_chain_data from ctypes import POINTER, c_double, c_int64, c_int32, byref data = sv_chain_data(self) size_x = np.array([1, self.nspin, self.norbs, self.norbs, 1], dtype=np.int32) libnao.init_sv_libnao_orbs.argtypes = (POINTER(c_double), POINTER(c_int64), POINTER(c_int32)) libnao.init_sv_libnao_orbs(data.ctypes.data_as(POINTER(c_double)), c_int64(len(data)), size_x.ctypes.data_as(POINTER(c_int32))) self.init_sv_libnao_orbs = True libnao.init_aos_libnao.argtypes = (POINTER(c_int64), POINTER(c_int64)) info = c_int64(-999) libnao.init_aos_libnao(c_int64(self.norbs), byref(info)) if info.value != 0: raise RuntimeError("info!=0") return self
def init_libnao(self, wfsx=None): """ Initialization of data on libnao site """ from pyscf.nao.m_libnao import libnao from pyscf.nao.m_sv_chain_data import sv_chain_data from ctypes import POINTER, c_double, c_int64, c_int32, byref if wfsx is None: data = sv_chain_data(self) # (nkpoints, nspin, norbs, norbs, nreim) #print(' data ', sum(data)) size_x = np.array([1, self.nspin, self.norbs, self.norbs, 1], dtype=np.int32) libnao.init_sv_libnao_orbs.argtypes = (POINTER(c_double), POINTER(c_int64), POINTER(c_int32)) libnao.init_sv_libnao_orbs(data.ctypes.data_as(POINTER(c_double)), c_int64(len(data)), size_x.ctypes.data_as(POINTER(c_int32))) self.init_sv_libnao = True else: size_x = np.zeros(len(self.wfsx.x.shape), dtype=np.int32) for i, sh in enumerate(self.wfsx.x.shape): size_x[i] = sh data = sv_chain_data(self) libnao.init_sv_libnao_orbs.argtypes = (POINTER(c_double), POINTER(c_int64), POINTER(c_int32)) libnao.init_sv_libnao_orbs(data.ctypes.data_as(POINTER(c_double)), c_int64(len(data)), size_x.ctypes.data_as(POINTER(c_int32))) self.init_sv_libnao = True libnao.init_aos_libnao.argtypes = (POINTER(c_int64), POINTER(c_int64)) info = c_int64(-999) libnao.init_aos_libnao(c_int64(self.norbs), byref(info)) if info.value != 0: raise RuntimeError("info!=0") return self