Ejemplo n.º 1
0
    def hop_rhf2uhf(x1):
        x1 = _unpack(x1, mo_occ)
        dmvo = []
        for k in range(nkpts):
            # *2 for double occupancy
            dm1 = reduce(numpy.dot, (orbv[k], x1[k]*2, orbo[k].T.conj()))
            dmvo.append(dm1 + dm1.T.conj())
        dmvo = lib.asarray(dmvo)

        v1ao = vresp1(dmvo)
        x2 = [0] * nkpts
        for k in range(nkpts):
            x2[k] = numpy.einsum('ps,sq->pq', fvv[k], x1[k])
            x2[k]-= numpy.einsum('ps,rp->rs', foo[k], x1[k])
            x2[k]+= reduce(numpy.dot, (orbv[k].T.conj(), v1ao[k], orbo[k]))

        # The displacement x2 corresponds to the response of rotation for bra.
        # Hessian*x also provides the rotation for ket which equals to
        # x2.T.conj(). The overall displacement is x2 + x2.T.conj(). This is
        # the reason of x2.real below
        return numpy.hstack([x.real.ravel() for x in x2])
Ejemplo n.º 2
0
    def hop_rhf2uhf(x1):
        x1 = _unpack(x1, mo_occ)
        dmvo = []
        for k in range(nkpts):
            # *2 for double occupancy
            dm1 = reduce(numpy.dot, (orbv[k], x1[k] * 2, orbo[k].T.conj()))
            dmvo.append(dm1 + dm1.T.conj())
        dmvo = lib.asarray(dmvo)

        v1ao = vresp1(dmvo)
        x2 = [0] * nkpts
        for k in range(nkpts):
            x2[k] = numpy.einsum('ps,sq->pq', fvv[k], x1[k])
            x2[k] -= numpy.einsum('ps,rp->rs', foo[k], x1[k])
            x2[k] += reduce(numpy.dot, (orbv[k].T.conj(), v1ao[k], orbo[k]))

        # The displacement x2 corresponds to the response of rotation for bra.
        # Hessian*x also provides the rotation for ket which equals to
        # x2.T.conj(). The overall displacement is x2 + x2.T.conj(). This is
        # the reason of x2.real below
        return numpy.hstack([x.real.ravel() for x in x2])