O_2s_orbitals.append(i) #Find the O 2p labels if (('2p' in x) and ('O' in x)): O_2p_orbitals.append(i) #There should be 5 3d TM orbitals. Let's check this! assert len(TM_3d_orbitals)==5 ############################################################################################## if("U" in method): if("HF" in method): m=UHF(mol) else: m=UKS(mol) m.xc=method[1:] else: if(method=="ROHF"): m=ROHF(mol) else: m=ROKS(mol) m.xc=method ############################################################################################## dm=np.zeros(m.init_guess_by_minao().shape) #The 3s is always doubly-occupied for the TM atom for s in TM_3s_orbitals: for spin in [0,1]: dm[spin,s,s]=1
def init_density(self, in_dmat=None, scf_obj=None, env_method=None, kpts=None): """ Initializes the periodic subsystem density Parameters ---------- in_dmat : ndarray, optional New subsystem density matrix (default is None). scf_obj : pyscf:pbc:scf object, optional The PySCF subsystem object (default is None). env_method : str, optional Subsystem environment energy method (default is None). kpts : ndarray, optional Kpoints to use in calculation (default is None). Returns ------- dmat : ndarray The new / guessed density matrix """ import numpy as np import pyscf from pyscf.scf import RKS, RHF, ROKS, ROHF, UKS, UHF if in_dmat is not None: return in_dmat if scf_obj is None: scf_obj = self.env_scf if env_method is None: env_method = self.env_method if kpts is None: kpts = self.kpts nkpts = len(kpts) nao = scf_obj.cell.nao_nr() dmat = np.zeros((2, nkpts, nao, nao)) mol = scf_obj.cell.to_mol() mol.verbose = 0 if self.unrestricted: if env_method in ('hf', 'hartree-fock'): mf = UHF(mol) else: mf = UKS(mol) mf.xc = env_method mf.kernel() dtemp = mf.make_rdm1() elif mol.spin != 0: if env_method in ('hf', 'hartree-fock'): mf = ROHF(mol) else: mf = ROKS(mol) mf.xc = env_method mf.kernel() dtemp = mf.make_rdm1() else: if env_method in ('hf', 'hartree-fock'): mf = RHF(mol) else: mf = RKS(mol) mf.xc = env_method mf.kernel() dtemp = mf.make_rdm1() / 2.0 dtemp = [dtemp, dtemp] for k in range(nkpts): dmat[0, k] = dtemp[0] dmat[1, k] = dtemp[0] return dmat