Exemplo n.º 1
0
def get_pop(s, mult):
    nao = s.shape[1]
    fock = numpy.zeros((nao, nao))
    for ia in range(natm):
        fock += mult[ia] * s[ia]
    return fock


def get_cfock(h1e, s1e, vhf, dm, cycle=0, mf_diis=None):
    fock = old_get_fock(h1e, s1e, vhf, dm, cycle, mf_diis)
    fock -= get_pop(saom, mult)
    return fock


diis_obj = scf.ADIIS()
diis_obj.diis_space = 24
diis_obj.diis_start_cycle = 14

# Guess
mf = scf.RHF(mol)
mf.verbose = 0
mf.kernel()
dm = mf.make_rdm1()

# Calc
mf = scf.RHF(mol)  #.newton()
mf.conv_tol = 1e-6
mf.max_cycle = 120
mf.diis = diis_obj
old_get_fock = mf.get_fock
Exemplo n.º 2
0
              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
            m = addons.remove_linear_dep_(m)
            m.conv_tol=1e-5
            m.diis=scf.ADIIS()
            total_energy=m.kernel()
            
            #Compute the Mulliken orbital occupancies...
            m.analyze()
            #m.stability(external=True)
            assert(np.sum(m.mo_occ)==25)
          
          #Once we get past the vdz basis, just read-in the existingmirror.chk file...
          else:
            dm=m.from_chk(el+'vdz'+"_r"+str(r)+"_s"+str(S)+"_"+method+"_"+str(run)+"mirror.chk")
            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
            m = addons.remove_linear_dep_(m)
            m.conv_tol=1e-5
Exemplo n.º 3
0
#   classes: CDIIS, ADIIS, EDIIS
#
mf.DIIS = scf.ADIIS
mf.diis_space = 14
mf.run()

mf.DIIS = scf.EDIIS
mf.diis_space = 14
mf.run()

#
#   2. Overwrite the attribute mf.diis.  In this approach, DIIS parameters
#   specified in the SCF object (mf.diis_space, mf.diis_file, ...) have no
#   effects.  DIIS parameters need to be assigned to the diis object.
#
my_diis_obj = scf.ADIIS()
my_diis_obj.space = 12
my_diis_obj.filename = 'o2_diis.h5'
mf.diis = my_diis_obj
mf.run()

my_diis_obj = scf.EDIIS()
my_diis_obj.space = 12
mf.diis = my_diis_obj
mf.run()

#
# By creating an DIIS object and assigning it to the attribute mf.diis, we can
# restore SCF iterations from an existed SCF calculation (see also the example
# 14-restart.py)
#
Exemplo n.º 4
0
Arquivo: cdft.py Projeto: sapatha2/cuo

if __name__ == '__main__':
    from pyscf import gto, scf, mcscf, fci, lo, ci, cc, lib
    from pyscf.scf import ROHF, ROKS, UHF, UKS, addons
    chkfile = '../ub3lyp_full/Cuvtz_r1.725_s1_UB3LYP_0.chk'
    mol = lib.chkfile.load_mol(chkfile)
    mol.verbose = 4
    mf = UKS(mol)
    mf.__dict__.update(lib.chkfile.load(chkfile, 'scf'))
    mf.xc = 'B3LYP'

    mf.max_cycle = 100
    mf = addons.remove_linear_dep_(mf)
    mf.conv_tol = 1e-5
    mf.diis = scf.ADIIS()

    #3dpi - 2ppi constraint
    '''
  id0 = list(mol.search_ao_label('Cu 3dyz')) + list(mol.search_ao_label('Cu 3dxz'))
  id1 = mol.search_ao_label('Cu 4s')
  orbital_indices = [[id0[0],id0[0]],[id1[0],id1[0]]]
  spin_labels = [[0,1],[0,1]]
  nelec_required = [1.,0.3]
  mf.chkfile = 'Cuvtz_r1.725_s1_UB3LYP_0c.chk'
  mf.irrep_nelec = {'A1':(5,5),'E1x':(3,3),'E1y':(3,2),'E2x':(1,1),'E2y':(1,1)}
  '''

    #3dz2 - 2ppi
    '''
  id0 = list([26])