コード例 #1
0
dic = {'rdm1':rdm1,
       'rdm2':rdm2}
lib.chkfile.save(name+'.chk', 'pdm', dic)

natocc, natorb = numpy.linalg.eigh(-rdm1)
for i, k in enumerate(numpy.argmax(abs(natorb), axis=0)):
    if natorb[k,i] < 0:
        natorb[:,i] *= -1
natorb = numpy.dot(mc.mo_coeff[:,:nmo], natorb)
natocc = -natocc

wfn_file = name + '.wfn'
with open(wfn_file, 'w') as f2:
    wfn_format.write_mo(f2, cell, natorb, mo_occ=natocc)
    wfn_format.write_coeff(f2, cell, mc.mo_coeff[:,:nmo])
    wfn_format.write_ci(f2, mc.ci, mc.ncas, mc.nelecas, ncore=mc.ncore)

#c = mc.mo_coeff[:,:nmo]
#s = cell.pbc_intor('cint1e_ovlp_sph')
#t = cell.pbc_intor('cint1e_kin_sph')
#h = mc.get_hcore()
#s = reduce(numpy.dot, (c.T,s,c))
#t = reduce(numpy.dot, (c.T,t,c))
#h = reduce(numpy.dot, (c.T,h,c))
#enuc = cell.energy_nuc() 
#ekin = numpy.einsum('ij,ji->',t,rdm1)
#hcore = numpy.einsum('ij,ji->',h,rdm1)
#pop = numpy.einsum('ij,ji->',s,rdm1)
#print('Population : %s' % pop)
#print('Kinetic energy : %s' % ekin)
#print('Hcore energy : %s' % hcore)
コード例 #2
0
ファイル: excited.py プロジェクト: chrinide/pyscf-scripts
mch.fcisolver.pspace_size = 550
mch.fcisolver.nroots = nroots
mch.fcisolver.spin = 0
mch.fcisolver.wfnsym = 'A'
mch.kernel(mo)

nmo = mch.ncore + mch.ncas
orbsym = symm.label_orb_symm(mol, mol.irrep_id, mol.symm_orb,
                             mch.mo_coeff[:, :nmo])
for nr in range(nroots):
    rdm1, rdm2 = mch.fcisolver.make_rdm12(mch.ci[nr], mch.ncas, mch.nelecas)
    rdm1, rdm2 = mcscf.addons._make_rdm12_on_mo(rdm1, rdm2, mch.ncore,
                                                mch.ncas, nmo)
    natocc, natorb = symm.eigh(-rdm1, orbsym)
    #natocc, natorb = numpy.linalg.eigh(-rdm1)
    for i, k in enumerate(numpy.argmax(abs(natorb), axis=0)):
        if natorb[k, i] < 0:
            natorb[:, i] *= -1
    natorb = numpy.dot(mch.mo_coeff[:, :nmo], natorb)
    natocc = -natocc
    wfn_file = '_s%i.wfn' % nr
    wfn_file = name + wfn_file
    with open(wfn_file, 'w') as f2:
        wfn_format.write_mo(f2, mol, natorb, mo_occ=natocc)
        wfn_format.write_coeff(f2, mol, mch.mo_coeff[:, :nmo])
        wfn_format.write_ci(f2,
                            mch.ci[nr],
                            mch.ncas,
                            mch.nelecas,
                            ncore=mch.ncore)