def test_project_mo_nr2r(self): numpy.random.seed(15) nao = mol.nao_nr() mo1 = numpy.random.random((nao, nao)) mo2 = addons.project_mo_nr2r(mol, [mo1, mo1], mol_dz) self.assertAlmostEqual(abs(mo2[0]).sum(), 172.66468850263556, 11) self.assertAlmostEqual(abs(mo2[1]).sum(), 172.66468850263556, 11) mo2 = addons.project_mo_nr2r(mol, mo1, mol_dz) self.assertAlmostEqual(abs(mo2).sum(), 172.66468850263556, 11)
def test_project_mo_nr2r(self): numpy.random.seed(15) nao = mol.nao_nr() mo1 = numpy.random.random((nao,nao)) mo2 = addons.project_mo_nr2r(mol, [mo1,mo1], mol_dz) self.assertAlmostEqual(abs(mo2[0]).sum(), 172.66468850263556, 11) self.assertAlmostEqual(abs(mo2[1]).sum(), 172.66468850263556, 11) mo2 = addons.project_mo_nr2r(mol, mo1, mol_dz) self.assertAlmostEqual(abs(mo2).sum(), 172.66468850263556, 11)
def _proj_dmll(mol_nr, dm_nr, mol): from pyscf.scf import addons proj = addons.project_mo_nr2r(mol_nr, 1, mol) # *.5 because alpha and beta are summed in project_mo_nr2r dm_ll = reduce(numpy.dot, (proj, dm_nr*.5, proj.T.conj())) dm_ll = (dm_ll + dhf.time_reversal_matrix(mol, dm_ll)) * .5 return dm_ll
def _proj_dmll(mol_nr, dm_nr, mol): from pyscf.scf import addons proj = addons.project_mo_nr2r(mol_nr, numpy.eye(mol_nr.nao_nr()), mol) # *.5 because alpha and beta are summed in project_mo_nr2r dm_ll = reduce(numpy.dot, (proj, dm_nr * .5, proj.T.conj())) dm_ll = (dm_ll + dhf.time_reversal_matrix(mol, dm_ll)) * .5 return dm_ll
def _proj_dmll(mol_nr, dm_nr, mol): from pyscf.scf import addons proj = addons.project_mo_nr2r(mol_nr, 1, mol) n2c = proj.shape[0] n4c = n2c * 2 dm = numpy.zeros((n4c,n4c), dtype=complex) # *.5 because alpha and beta are summed in project_mo_nr2r dm_ll = reduce(numpy.dot, (proj, dm_nr*.5, proj.T.conj())) dm[:n2c,:n2c] = (dm_ll + time_reversal_matrix(mol, dm_ll)) * .5 return dm
def _proj_dmll(mol_nr, dm_nr, mol): from pyscf.scf import addons proj = addons.project_mo_nr2r(mol_nr, 1, mol) n2c = proj.shape[0] n4c = n2c * 2 dm = numpy.zeros((n4c, n4c), dtype=complex) # *.5 because alpha and beta are summed in project_mo_nr2r dm_ll = reduce(numpy.dot, (proj, dm_nr * .5, proj.T.conj())) dm[:n2c, :n2c] = (dm_ll + time_reversal_matrix(mol, dm_ll)) * .5 return dm
def _proj_dmll(mol_nr, dm_nr, mol): '''Project non-relativistic atomic density matrix to large component spinor representation ''' from pyscf.scf import addons proj = addons.project_mo_nr2r(mol_nr, numpy.eye(mol_nr.nao_nr()), mol) n2c = proj.shape[0] n4c = n2c * 2 dm = numpy.zeros((n4c, n4c), dtype=complex) # *.5 because alpha and beta are summed in project_mo_nr2r dm_ll = reduce(numpy.dot, (proj, dm_nr * .5, proj.T.conj())) dm[:n2c, :n2c] = (dm_ll + time_reversal_matrix(mol, dm_ll)) * .5 return dm
def _proj_dmll(mol_nr, dm_nr, mol): '''Project non-relativistic atomic density matrix to large component spinor representation ''' from pyscf.scf import addons proj = addons.project_mo_nr2r(mol_nr, numpy.eye(mol_nr.nao_nr()), mol) n2c = proj.shape[0] n4c = n2c * 2 dm = numpy.zeros((n4c,n4c), dtype=complex) # *.5 because alpha and beta are summed in project_mo_nr2r dm_ll = reduce(numpy.dot, (proj, dm_nr*.5, proj.T.conj())) dm[:n2c,:n2c] = (dm_ll + time_reversal_matrix(mol, dm_ll)) * .5 return dm
def test_project_dm_nr2r(self): numpy.random.seed(15) nao = mol.nao_nr() mo = numpy.random.random((nao,10)) mo1 = addons.project_mo_nr2r(mol, mo, mol_dz) dm = numpy.dot(mo, mo.T.conj()) dmref = numpy.dot(mo1, mo1.T.conj()) dm1 = addons.project_dm_nr2r(mol, [dm,dm], mol_dz) self.assertAlmostEqual(abs(dmref-dm1[0]).max(), 0, 11) self.assertAlmostEqual(abs(dmref-dm1[1]).max(), 0, 11) self.assertAlmostEqual(lib.finger(dm1[0]), -13.580612999088892-20.209297457056557j, 11) dm1 = addons.project_dm_nr2r(mol, dm, mol_dz) self.assertAlmostEqual(abs(dmref-dm1).max(), 0, 11)