Пример #1
0
#
#    print(abs(rdm1[0] - (numpy.einsum('ijkk->ji', rdm2[0]) +
#                         numpy.einsum('ijkk->ji', rdm2[1]))/(mol.nelectron-1)).sum())
#    print(abs(rdm1[1] - (numpy.einsum('ijkk->ji', rdm2[2]) +
#                         numpy.einsum('kkij->ji', rdm2[1]))/(mol.nelectron-1)).sum())

    if 1:
        from pyscf.ci import ucisd
        from pyscf import fci
        nmo = 8
        nocc = nocca, noccb = (4,3)
        numpy.random.seed(2)
        nvira, nvirb = nmo-nocca, nmo-noccb
        cibra = ucisd.amplitudes_to_cisdvec(numpy.random.rand(1),
                                            (numpy.random.rand(nocca,nvira),
                                             numpy.random.rand(noccb,nvirb)),
                                            (numpy.random.rand(nocca,nocca,nvira,nvira),
                                             numpy.random.rand(nocca,noccb,nvira,nvirb),
                                             numpy.random.rand(noccb,noccb,nvirb,nvirb)))
        ciket = ucisd.amplitudes_to_cisdvec(numpy.random.rand(1),
                                            (numpy.random.rand(nocca,nvira),
                                             numpy.random.rand(noccb,nvirb)),
                                            (numpy.random.rand(nocca,nocca,nvira,nvira),
                                             numpy.random.rand(nocca,noccb,nvira,nvirb),
                                             numpy.random.rand(noccb,noccb,nvirb,nvirb)))
        fcibra = ucisd.to_fcivec(cibra, nmo, nocc)
        fciket = ucisd.to_fcivec(ciket, nmo, nocc)
        s_mo = (numpy.random.random((nmo,nmo)),
                numpy.random.random((nmo,nmo)))
        s_mo = (s_mo[0], s_mo[0])
        s0 = fci.addons.overlap(fcibra, fciket, nmo, nocc, s_mo)
        s1 = ucisd.overlap(cibra, ciket, nmo, nocc, s_mo)
Пример #2
0
#
#    print(abs(rdm1[0] - (numpy.einsum('ijkk->ji', rdm2[0]) +
#                         numpy.einsum('ijkk->ji', rdm2[1]))/(mol.nelectron-1)).sum())
#    print(abs(rdm1[1] - (numpy.einsum('ijkk->ji', rdm2[2]) +
#                         numpy.einsum('kkij->ji', rdm2[1]))/(mol.nelectron-1)).sum())

    if 1:
        from pyscf.ci import ucisd
        from pyscf import fci
        nmo = 8
        nocc = nocca, noccb = (4,3)
        numpy.random.seed(2)
        nvira, nvirb = nmo-nocca, nmo-noccb
        cibra = ucisd.amplitudes_to_cisdvec(numpy.random.rand(1),
                                            (numpy.random.rand(nocca,nvira),
                                             numpy.random.rand(noccb,nvirb)),
                                            (numpy.random.rand(nocca,nocca,nvira,nvira),
                                             numpy.random.rand(nocca,noccb,nvira,nvirb),
                                             numpy.random.rand(noccb,noccb,nvirb,nvirb)))
        ciket = ucisd.amplitudes_to_cisdvec(numpy.random.rand(1),
                                            (numpy.random.rand(nocca,nvira),
                                             numpy.random.rand(noccb,nvirb)),
                                            (numpy.random.rand(nocca,nocca,nvira,nvira),
                                             numpy.random.rand(nocca,noccb,nvira,nvirb),
                                             numpy.random.rand(noccb,noccb,nvirb,nvirb)))
        fcibra = ucisd.to_fcivec(cibra, nmo, nocc)
        fciket = ucisd.to_fcivec(ciket, nmo, nocc)
        s_mo = (numpy.random.random((nmo,nmo)),
                numpy.random.random((nmo,nmo)))
        s_mo = (s_mo[0], s_mo[0])
        s0 = fci.addons.overlap(fcibra, fciket, nmo, nocc, s_mo)
        s1 = ucisd.overlap(cibra, ciket, nmo, nocc, s_mo)