Ejemplo n.º 1
0
                for i,d in enumerate(TM_3d_orbitals):

                  #These are the 3d orbitals we want to fill to get the correct symmetry
                  if ( ('xy' in aos[d]) or ('yz' in aos[d]) or ('z^2' in aos[d]) or ('x2-y2' in aos[d]) ):
                    print('We are singly filling this d-orbital: '+np.str(aos[d]) )
                    dm[0,d,d]=1
      
              m.chkfile=el+basis+"_r"+str(r)+"_s"+str(S[run])+"_"+method+"_"+str(run)+".chk"
              m.irrep_nelec = symm_dict[run]
              m.max_cycle=100
              m = addons.remove_linear_dep_(m)
              m.conv_tol=1e-6
              
              #Only need an initial guess for CrO and CuO...
              if (el=='Cr' or el=='Cu'):
                total_energy=m.kernel(dm)
              else:
                total_energy=m.kernel()
         
              #Compute the Mulliken orbital occupancies...
              m.analyze()
              assert(np.sum(m.mo_occ)==25)

            #Once we get past the vdz basis, just read-in the existing chk file...
            else:
              ##############################################################################################
              if("U" in method): 
                if("HF" in method): 
                  m=UHF(mol)
                else:
                  m=UKS(mol)
Ejemplo n.º 2
0
    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