Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
[8 , (0. , 0. , 0.)],
[1 , (0. , -.957 , .587)],
[1 , (0.2, .757 , .487)]]
mol.basis = 'ccpvdz'
mol.build()
rhf = scf.RHF(mol)
rhf.conv_tol = 1e-14
rhf.scf()
mcc = cc.CCSD(rhf)
mcc.conv_tol = 1e-14
mcc.ccsd()
e3a = kernel(mcc, mcc.ao2mo())
print(e3a - -0.0033300722704016289)
mol = gto.Mole()
mol.atom = [
[8 , (0. , 0. , 0.)],
[1 , (0. , -.757 , .587)],
[1 , (0. , .757 , .587)]]
mol.symmetry = True
mol.basis = 'ccpvdz'
mol.build()
rhf = scf.RHF(mol)
rhf.conv_tol = 1e-14
rhf.scf()
mcc = cc.CCSD(rhf)
mcc.conv_tol = 1e-14
mcc.ccsd()
e3a = kernel(mcc, mcc.ao2mo())
print(e3a - -0.003060022611584471)
#!/usr/bin/env python
import numpy
from pyscf import gto
from pyscf import scf
from pyscf import nmr
mol = gto.Mole()
mol.verbose = 5
bco = 1.14
bcc = 2.0105
mol.output = 'crco6-msc.out'
mol.atom = [
['Cr',( 0.000000, 0.000000, 0.000000)],
['C', ( bcc , 0.000000, 0.000000)],
['O', ( bcc+bco , 0.000000, 0.000000)],
['C', ( -bcc , 0.000000, 0.000000)],
['O', ( -bcc-bco , 0.000000, 0.000000)],
['C', ( 0.000000, bcc , 0.000000)],
['O', ( 0.000000, bcc+bco , 0.000000)],
['C', ( 0.000000, -bcc , 0.000000)],
['O', ( 0.000000, -bcc-bco , 0.000000)],
['C', ( 0.000000, 0.000000, bcc )],
['O', ( 0.000000, 0.000000, bcc+bco )],
def MolDensity(self,samps,m,p=[0.0,0.0,0.0],tag=None):
Ps = np.zeros(len(samps))
mol = gto.Mole()
pyscfatomstring=''
if (tag==None):
for j in range(len(m.atoms)):
pyscfatomstring=pyscfatomstring+"H@"+str(m.atoms[j])+" "+str(m.coords[j,0])+" "+str(m.coords[j,1])+" "+str(m.coords[j,2])+(";" if j!= len(m.atoms)-1 else "")
else:
for j in range(len(m.atoms)):
if (j == tag):
print("Tagging atom", j)
pyscfatomstring=pyscfatomstring+"N@0"+" "+str(m.coords[j,0])+" "+str(m.coords[j,1])+" "+str(m.coords[j,2])+(";" if j!= len(m.atoms)-1 else "")
else:
pyscfatomstring=pyscfatomstring+"H@"+str(m.atoms[j])+" "+str(m.coords[j,0])+" "+str(m.coords[j,1])+" "+str(m.coords[j,2])+(";" if j!= len(m.atoms)-1 else "")
mol.atom = pyscfatomstring
mol.basis = TOTAL_SENSORY_BASIS
mol.verbose = 0
if (len(m.atoms)%2 == 0):
mol.spin = 0
def get_atm_nrhf(mol):
if mol.has_ecp():
raise NotImplementedError('Atomic calculation with ECP is not implemented')
atm_scf_result = {}
for a, b in mol._basis.items():
atm = gto.Mole()
atm.stdout = mol.stdout
atm.atom = atm._atom = [[a, (0, 0, 0)]]
atm._basis = {a: b}
atm.nelectron = gto.charge(a)
atm.spin = atm.nelectron % 2
atm._atm, atm._bas, atm._env = \
atm.make_env(atm._atom, atm._basis, atm._env)
atm._built = True
if atm.nelectron == 0: # GHOST
nao = atm.nao_nr()
mo_occ = mo_energy = numpy.zeros(nao)
mo_coeff = numpy.zeros((nao,nao))
atm_scf_result[a] = (0, mo_energy, mo_coeff, mo_occ)
else:
atm_hf = AtomSphericAverageRHF(atm)
atm_hf.verbose = 0
occdic = {}
for symb, nelec_ecp in nelec_ecp_dic.items():
occ_add, basis_add = minao_basis(symb, nelec_ecp)
occdic[symb] = occ_add
basis[symb] = basis_add
occ = []
new_atom = []
for ia in range(mol.natm):
symb = mol.atom_symbol(ia)
if not gto.is_ghost_atom(symb):
occ.append(occdic[symb])
new_atom.append(mol._atom[ia])
occ = numpy.hstack(occ)
pmol = gto.Mole()
pmol._atm, pmol._bas, pmol._env = pmol.make_env(new_atom, basis, [])
pmol._built = True
dm = addons.project_dm_nr2nr(pmol, numpy.diag(occ), mol)
# normalize eletron number
# s = mol.intor_symmetric('int1e_ovlp')
# dm *= mol.nelectron / (dm*s).sum()
return dm
##################
mol1 = gto.Mole()
mol1.atom = '''
N 0.0000 0.0000 0.000000
N 0.0000 0.0000 1.090105
'''
mol1.basis = 'sto-3g'
mol1.symmetry = 1
mol1.charge = 0
mol1.spin = 0 #2*S; multiplicity-1
mol1.build()
##################
# Molecule 2 #
##################
mol2 = gto.Mole()
mol2.atom = '''
O 0.000000000 0.00000000 0.000000000
H 0.790689766 0.00000000 0.612217330
H -0.790689766 0.00000000 0.612217330
'''
mol2.basis = '6-31g'
mol2.symmetry = 1
mol2.charge = 0
mol2.spin = 0 #2*S; multiplicity-1
mol2.build()
for geval in range(1):
if ( geval == 0 ):
mol = mol1
psi4group = 7 #d2h
#[[ -8.20194970e-16 -2.04319288e-15 2.44405835e-02]
# [ 4.36709255e-18 2.73690416e-02 -1.22232039e-02]
# [ 3.44483899e-17 -2.73690416e-02 -1.22232039e-02]]
g.grid_response = True
print(g.kernel())
mf.xc = 'b3lypg'
e0 = mf.scf()
g = Gradients(mf)
print(g.kernel())
#[[ -3.59411142e-16 -2.68753987e-16 1.21557501e-02]
# [ 4.04977877e-17 2.11112794e-02 -6.08181640e-03]
# [ 1.52600378e-16 -2.11112794e-02 -6.08181640e-03]]
mol = gto.Mole()
mol.atom = [
['H' , (0. , 0. , 1.804)],
['F' , (0. , 0. , 0. )], ]
mol.unit = 'B'
mol.basis = '631g'
mol.charge = -1
mol.spin = 1
mol.build()
mf = dft.ROKS(mol)
mf.conv_tol = 1e-14
mf.kernel()
print(Gradients(mf).kernel())
# sum over z direction non-zero, due to meshgrid response
#[[ 0 0 -2.68934738e-03]
# [ 0 0 2.69333577e-03]]
tau = np.einsum('ia,jb->ijab', t1, r1)
tau = tau + tau.transpose(1,0,3,2)
tau *= fac * .5
tau += t2
return tau
def _cp(a):
return np.array(a, copy=False, order='C')
if __name__ == '__main__':
from pyscf import scf
from pyscf import gto
from pyscf.cc import rccsd
mol = gto.Mole()
mol.atom = [
[8 , (0. , 0. , 0.)],
[1 , (0. , -0.757 , 0.587)],
[1 , (0. , 0.757 , 0.587)]]
mol.basis = 'cc-pvdz'
mol.verbose = 0
mol.spin = 0
mol.build()
mf = scf.RHF(mol).run(conv_tol=1e-14)
mycc = rccsd.RCCSD(mf)
ecc, t1, t2 = mycc.kernel()
print(ecc - -0.21334326214236796)
myeom = EOMIP(mycc)
print("IP energies... (right eigenvector)")
H -0.00000000 -0.84695236 0.59109389
H -0.00000000 0.89830571 0.52404783 '''
mol.basis = '3-21g' #cc-pvdz'
mol.build()
cm = DDCOSMO(mol)
cm.verbose = 4
mf = ddcosmo_for_scf(scf.RHF(mol), cm)#.newton()
mf.verbose = 4
print(mf.kernel() - -75.570364368059)
cm.verbose = 3
e = ddcosmo_for_casci(mcscf.CASCI(mf, 4, 4)).kernel()[0]
print(e - -75.5743583693215)
cc_cosmo = ddcosmo_for_post_scf(cc.CCSD(mf)).run()
print(cc_cosmo.e_tot - -75.70961637250134)
mol = gto.Mole()
mol.atom = ''' Fe 0.00000000 0.00000000 -0.11081188
H -0.00000000 -0.84695236 0.59109389
H -0.00000000 0.89830571 0.52404783 '''
mol.basis = '3-21g' #cc-pvdz'
mol.build()
cm = DDCOSMO(mol)
cm.eps = -1
cm.verbose = 4
mf = ddcosmo_for_scf(scf.ROHF(mol), cm).newton()
mf.verbose=4
mf.kernel()
if gtensor or True:
ncore, ncas = mc.ncore, mc.ncas
h1ao = mc.mol.intor("cint1e_cg_irxp_sph", comp=3)
h1 = numpy.einsum("xpq,pi,qj->xij", h1ao, mc.mo_coeff, mc.mo_coeff)[:, ncore:ncore + ncas, ncore:ncore + ncas]
print1Int(h1, "GTensor")
runQDPT(mc, gtensor)
if __name__ == "__main__":
from pyscf import gto, scf
from pyscf.shciscf import shci
# Initialize N2 molecule
b = 1.098
mol = gto.Mole()
mol.build(
verbose=5,
output=None,
atom=[
["N", (0.000000, 0.000000, -b / 2)],
["N", (0.000000, 0.000000, b / 2)],
],
basis={
"N": "ccpvdz",
},
)
# Create HF molecule
mf = scf.RHF(mol)
mf.conv_tol = 1e-9
mf.scf()