#! /usr/bin/env python3 # Note import path which is different to molecule code #from pyscf.pbc import gto, scf, df, dft from pyscf import gto, scf, df, dft import numpy cell = gto.M( atom ='''O 0.0 0.0 0.0''', basis ='cc-pcvdz', unit ='A', spin=2, verbose = 5, cart=False, ) mf = scf.UHF(cell) mf.kernel() title='O-UHF-Triplet' from PyscfToQmcpack import savetoqmcpack savetoqmcpack(cell,mf,title)
urlretrieve("{0}/{1}/{2}/{3}".format(pplib,atom,pptype,basfile), filename=basfile) urlretrieve("{0}/{1}/{2}/{3}".format(pplib,atom,pptype,ecpfile), filename=ecpfile) urlretrieve("{0}/{1}/{2}/{3}".format(pplib,atom,pptype,xmlfile), filename=xmlfile) #Initialize molecule object mol = gto.Mole() mol.atom = "{0} 0.0 0.0 0.0".format(atom) with open(os.path.join(cwd,basfile)) as f: bas = f.read() mol.basis = {atom: gto.basis.parse(bas)} with open(os.path.join(cwd,ecpfile)) as f: ecp = f.read() mol.ecp = {atom: gto.basis.parse_ecp(ecp)} mol.spin = 2 mol.charge = 0 mol.build() #run HF and PBE hf = scf.ROHF(mol) hf.kernel() pbe = dft.ROKS(mol) pbe.xc = 'pbe' pbe.kernel() savetoqmcpack(mol,hf,title='{}.hf'.format(atom)) savetoqmcpack(mol,pbe,title='{}.pbe'.format(atom))
ecp2 = f.read() mol.basis = {atom1: gto.basis.parse(bas1), atom2: gto.basis.parse(bas2)} mol.ecp = {atom1: gto.basis.parse_ecp(ecp1), atom2: gto.basis.parse_ecp(ecp2)} mol.build() #~~~Run HF on molecule~~~~ mf = scf.RKS(mol) mf.xc = 'hf' #mf.irrep_nelec = { #'Ag' : (4,2), # s #'B3u': (1,1), # x 1 #'B1u': (1,1), # z 0 #'B2u': (1,1), # y -1 #'B2g': (1,1), # xz 1 #'B3g': (1,0), # yz -1 #'B1g': (1,0), # xy -2 #'Au' : (0,0) # xyz #} mf.verbose = 4 mf.max_cycle = 100 #dm=mf.init_guess_by_chkfile('../../scf_guess/guess/scf.chkfile') mf.chkfile = 'scf.chkfile' #en=mf.kernel(dm) en = mf.kernel() ### generated conversion text ### from PyscfToQmcpack import savetoqmcpack savetoqmcpack(mol, mf, 'scf') ### end generated conversion text ###
sp_twist = [0.07761248, 0.07761248, -0.07761248] kmesh = [2, 1, 1] kpts = array([[0.07761248, 0.07761248, -0.07761248], [0.54328733, 0.54328733, -0.54328733]]) mydf = df.GDF(cell, kpts) mydf.auxbasis = 'weigend' mydf._cderi_to_save = 'df_ints.h5' mydf.build() mf = scf.KROHF(cell, kpts).density_fit() mf.exxdiv = 'ewald' mf.max_cycle = 200 mf.with_df = mydf mf.chkfile = 'diamond-scf.chk' mf.with_df._cderi = 'df_ints.h5' e_scf = mf.kernel() ener = open('e_scf', 'w') ener.write('%s\n' % (e_scf)) print('e_scf', e_scf) ener.close() title = "C_diamond-twist" from PyscfToQmcpack import savetoqmcpack savetoqmcpack(cell, mf, title=title, kmesh=kmesh, kpts=kpts, sp_twist=sp_twist) from MolPyscfToQPkpts import pyscf2QP pyscf2QP(cell, mf, kpts=kpts, int_threshold=1E-15)
cell.unit = 'B' cell.drop_exponent = 0.1 cell.ke_cutoff = 120 cell.verbose = 5 cell.build() supcell = super_cell(cell, nmp) mydf = df.FFTDF(supcell) mydf.auxbasis = 'weigend' kpts = [] mf = dft.RKS(supcell) mf.xc = 'lda' mf.exxdiv = 'ewald' mf.with_df = mydf e_scf = mf.kernel() assert mf.converged ener = open('e_scf', 'w') ener.write('%s\n' % (e_scf)) title = "C_Diamond" from PyscfToQmcpack import savetoqmcpack savetoqmcpack(supcell, mf, title=title, kpts=kpts)
cell.atom = ''' C 0.00000000 0.00000000 0.00000000 C 1.686580575 1.686580575 1.686580575 ''' cell.basis = 'bfd-vtz' cell.ecp = 'bfd' cell.unit = 'B' cell.drop_exponent = 0.1 cell.verbose = 5 cell.build() kpts = cell.make_kpts(kmesh) kpts -= kpts[0] supcell = cell mydf = df.GDF(supcell, kpts) mydf.auxbasis = 'weigend' mf = scf.KRHF(supcell, kpts).density_fit() mf.exxdiv = 'ewald' mf.with_df = mydf e_scf = mf.kernel() title = "C_Diamond-211" from PyscfToQmcpack import savetoqmcpack savetoqmcpack(supcell, mf, title=title, kpts=kpts, kmesh=kmesh)
cell.verbose = 5 cell.charge = 0 cell.spin = 0 cell.build() kpts = array([ [0.0, 0.0, 0.0], [0.4656748546088228, 0.4656748546088228, -0.4656748546088228]]) ### end generated system text ### #print cell.make_kpts([2,1,1]) #exit() gdf = df.GDF(cell,kpts) gdf.auxbasis = 'weigend' gdf.build() mf = scf.KRKS(cell,kpts).density_fit() mf.xc ='b3lyp' mf.tol = 1e-10 mf.exxdiv = 'ewald' mf.with_df = gdf mf.kernel() ### generated conversion text ### from PyscfToQmcpack import savetoqmcpack savetoqmcpack(cell,mf,'scf',kpts) ### end generated conversion text ###
2 13.65512 85.86406 '''), 'H': gto.basis.parse_ecp(''' H nelec 0 H ul 1 21.24359508259891 1.00000000000000 3 21.24359508259891 21.24359508259891 2 21.77696655044365 -10.85192405303825 H S 2 1.000000000000000 0.00000000000000 ''') } mol.spin = 0 #Value of S where the spin multiplicity is 2S+1 mol.build() #Hartree Fock #mf = scf.ROHF(mol) #DFT mf = dft.ROKS(mol) mf.xc = 'b3lyp' e_scf = mf.kernel() #Section for QMCPACK title = "H2O_DFT_NCSU" from PyscfToQmcpack import savetoqmcpack savetoqmcpack(mol, mf, title=title)
#! /usr/bin/env python3 from pyscf import gto from pyscf import scf, dft, df mol = gto.Mole() mol.verbose = 5 mol.atom = ''' C 0.97091888623401 -0.07609978449644 -0.06440023695551 N -0.17562187186916 -0.07610010775030 -0.06439988152408 H 2.03800298563516 -0.07610010775326 -0.06439988152041 ''' mol.unit = 'A' mol.basis = 'cc-pvtz' #mol.cart=True mol.build() mf = dft.RKS(mol).density_fit() mf.xc = 'B3LYP' mf.chkfile = 'CHN.chk' e_scf = mf.kernel() title = "CHN" kpts = [] from PyscfToQmcpack import savetoqmcpack savetoqmcpack(mol, mf, title=title, kpts=kpts)