def oep_hess(jCa, orb_Ea, size, NOrb, NAlpha=None, mo_occ=None, smear=0.0, sym_tab=None): mo_coeff = np.reshape(jCa, (NOrb * NOrb), 'F') hess = np.ndarray((size, size), dtype=float, order='F') nthread = lib.num_threads() e_tol = 1e-4 occ_tol = 1e-8 #this should be small enough? t0 = tools.time0() if smear < 1e-8: if NAlpha is None: raise ValueError("NAlpha has to be set") libhess.calc_hess_dm_fast(hess.ctypes.data_as(ctypes.c_void_p), \ mo_coeff.ctypes.data_as(ctypes.c_void_p), orb_Ea.ctypes.data_as(ctypes.c_void_p), \ ctypes.c_int(size), ctypes.c_int(NOrb), ctypes.c_int(NAlpha), ctypes.c_int(nthread)) else: if mo_occ is None: raise ValueError("mo_occ has to be set") libhess.calc_hess_dm_fast_frac(hess.ctypes.data_as(ctypes.c_void_p), \ mo_coeff.ctypes.data_as(ctypes.c_void_p), orb_Ea.ctypes.data_as(ctypes.c_void_p), \ mo_occ.ctypes.data_as(ctypes.c_void_p),\ ctypes.c_int(size), ctypes.c_int(NOrb), ctypes.c_int(nthread),\ ctypes.c_double(smear), ctypes.c_double(e_tol), ctypes.c_double(occ_tol)) #tools.MatPrint(hess,"hess") t1 = tools.timer("hessian construction", t0) #if sym_tab is not None: # return symmtrize_hess(hess,sym_tab,size) return hess
boundary_atoms2[8:14] = -1 Ne_frag = 58 aoslice = mol.aoslice_by_atom() impurities = np.zeros([mol.nao_nr()], dtype=int) for i in range(natoms): if (impAtom[i] == 1): impurities[aoslice[i, 2]:aoslice[i, 3]] = 1 params = oep.OEPparams(algorithm='split', opt_method='L-BFGS-B', diffP_tol=1e-4, outer_maxit=40) params.options['ftol'] = 1e-10 params.options['gtol'] = 1e-4 params.options['maxiter'] = 100 params.options['svd_thresh'] = 1e-2 umat = None umat = np.load("umat_guess.npy") theDMFET = sdmfet.DMFET( mf, mol_frag, mol_env,myInts,impurities, impAtom, Ne_frag, \ boundary_atoms=boundary_atoms, boundary_atoms2=boundary_atoms2,\ umat = umat, dim_imp =None, dim_bath=None, dim_big =None, smear_sigma = temp, \ oep_params=params,ecw_method='ccsd', mf_method = mf.xc,\ use_umat_ao=False, scf_max_cycle = 100, frac_occ_tol = 1e-4) umat = theDMFET.embedding_potential() t1 = tools.timer("total calc time", t0)