Ejemplo n.º 1
0
                #Find the O 2s labels
                if (('2s' in x) and ('O' in x)):
                  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:
Ejemplo n.º 2
0
#
'''
DF-MP2 natural orbitals for the allyl radical
'''

from pyscf.gto import Mole
from pyscf.scf import UHF
from pyscf.tools import molden
from pyscf.mp.dfump2_native import DFMP2

mol = Mole()
mol.atom = '''
C    -1.1528    -0.1151    -0.4645
C     0.2300    -0.1171    -0.3508
C     0.9378     0.2246     0.7924
H     0.4206     0.5272     1.7055
H     2.0270     0.2021     0.8159
H    -1.6484    -0.3950    -1.3937
H    -1.7866     0.1687     0.3784
H     0.8086    -0.4120    -1.2337
'''
mol.basis = 'def2-TZVP'
mol.spin = 1
mol.build()

mf = UHF(mol).run()

# MP2 natural occupation numbers and natural orbitals
natocc, natorb = DFMP2(mf).make_natorbs()
# store the natural orbitals in a molden file
molden.from_mo(mol, 'allyl_mp2nat.molden', natorb, occ=natocc)
Ejemplo n.º 3
0
#Various analyses
import json
from pyscf import lib, gto, scf, mcscf, fci, lo, ci, cc
from pyscf.scf import ROHF, UHF, ROKS
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pyscf2qwalk import print_qwalk_mol

charge = 0
for name in ['4Phi', '4Delta', '2Delta', '4SigmaM']:
    mol_spin = int(name[0]) - 1
    for r in [1.963925]:
        for method in ['B3LYP']:
            for basis in ['vtz']:
                for el in ['Cu']:
                    for charge in [0]:
                        chkfile = "../full_chk/" + el + basis + "_r" + str(
                            r) + "_c" + str(charge) + "_s" + str(
                                mol_spin) + "_" + method + "_" + name + ".chk"
                        mol = lib.chkfile.load_mol(chkfile)

                        if ("U" in method): m = UHF(mol)
                        else: m = ROHF(mol)
                        m.__dict__.update(lib.chkfile.load(chkfile, 'scf'))

                        #Generate files for plotting orbitals in ../orbs
                        #print_qwalk_mol(mol,m,basename="../full_orbs/"+el+basis+"_r"+str(r)+"_c"+str(charge)+"_s"+str(mol_spin)+"_"+method+"_"+name)
Ejemplo n.º 4
0
        for el in ['Cu']:
          molname=el+'O'
          mol=gto.Mole()

          mol.ecp={}
          mol.basis={}
          for e in [el,'O']:
            mol.ecp[e]=gto.basis.parse_ecp(df[e]['ecp'])
            mol.basis[e]=gto.basis.parse(df[e][basis])
          mol.charge=charge
          mol.spin=S
          mol.build(atom="%s 0. 0. 0.; O 0. 0. %g"%(el,r),verbose=4,symmetry=True)
         
          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

          if basis=='vdz':
            #m=m.newton()
            m.chkfile=el+basis+"_r"+str(r)+"_s"+str(S)+"_"+method+"_"+str(run)+"mirror.chk"
            m.irrep_nelec = symm_dict[run]
            m.max_cycle=100
Ejemplo n.º 5
0
#Gather IAOs
f = 'b3lyp_iao_b.pickle'
a = np.load(f)
print(a.shape)
for mol_spin in [1]:
    for r in [1.963925]:
        for method in ['B3LYP']:
            for basis in ['vtz']:
                for el in ['Cu']:
                    for charge in [0]:
                        chkfile = "../chkfiles/" + el + basis + "_r" + str(
                            r) + "_c" + str(charge) + "_s" + str(
                                mol_spin) + "_" + method + ".chk"
                        mol = lib.chkfile.load_mol(chkfile)

                        if ("U" in method): m = UHF(mol)
                        else: m = ROHF(mol)
                        m.__dict__.update(lib.chkfile.load(chkfile, 'scf'))

                        #Highest 3 MOs transformed into IAO basis
                        s = m.get_ovlp()
                        act = np.zeros(s.shape[1])
                        act[10:14] = 1
                        H1 = np.diag(act * m.mo_energy)
                        e1 = reduce(np.dot, (a.T, s, m.mo_coeff, H1,
                                             m.mo_coeff.T, s.T, a)) * 27.2114
                        e1 = (e1 + e1.T) / 2.

                        labels = [
                            "3s", "4s", "3px", "3py", "3pz", "3dxy", "3dyz",
                            "3dz2", "3dxz", "3dx2y2", "2s", "2px", "2py", "2pz"
Ejemplo n.º 6
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
Ejemplo n.º 7
0
Archivo: scf.py Proyecto: sapatha2/cuo
                #Find the O 2s labels
                if (('2s' in x) and ('O' in x)):
                  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: