Beispiel #1
0
    def dump_raw(self):
        for k, v in zip(self.__dict__.keys(), self.__dict__.values()):
            try:
                print k
                pretty_print(v)
            except:
                print v

            print ""
Beispiel #2
0
def print_1rdm(rdm):
    #fmt = '% -016.10E'
    fmt = '%e'

    L = int(rdm.props["L"])
    mat = np.zeros((L, L))

    for lab, val in zip(rdm.x, rdm.y[0]):
        i = lab[0]
        j = lab[1]

        mat[i, j] = val
        mat[j, i] = val

    pretty_print(mat)
Beispiel #3
0
        str(i) + ' ' + str(j) + '  ' + str(fmt % val_real) + '  ' +
        str(fmt % val_imag) + '\n')


if __name__ == '__main__':

    inputfile = sys.argv[1]

    props = DmrgInput.loadProperties(inputfile)

    if props["symmetry"] == "u1dg":
        print_rdm1(inputfile, sys.argv[2])
    else:
        dm_ = oneptdm(inputfile)
        dm = dm_.rdm()
        pretty_print(dm)

        blocks = [len(dm)]
        if len(sys.argv) == 3:
            orbfile = sys.argv[2]
            irrlist = read_irreps(orbfile)
            blocks = np.bincount(irrlist)[1:]

        print "Point group blocks", blocks

        bstart = 0
        for l in blocks:
            subblock = dm[bstart:bstart + l, bstart:bstart + l]
            diag_dm(subblock)
            bstart += l
Beispiel #4
0

def load_1spdm(inputfile):
    """From the diagonal and upper triangle, construct a symmetric matrix
       diag: diagonal
       triang: upper triangle, sequential reversed rows"""

    diagup = pyalps.loadEigenstateMeasurements([inputfile], what='Nup')[0][0]
    diagdown = pyalps.loadEigenstateMeasurements([inputfile],
                                                 what='Ndown')[0][0]
    triangup = pyalps.loadEigenstateMeasurements([inputfile],
                                                 what='dm_up')[0][0]
    triangdown = pyalps.loadEigenstateMeasurements([inputfile],
                                                   what='dm_down')[0][0]

    # Create the full matrix from the diagonal (nup.y[0]) and upper triangle (dmup)
    dmu = assemble_halfcorr(diagup.y[0], triangup)
    dmd = assemble_halfcorr(diagdown.y[0], triangdown)

    # this is the spin-density matrix
    ds = dmu - dmd

    return ds


if __name__ == '__main__':
    inputfile = sys.argv[1]

    spdm = load_1spdm(inputfile)
    pretty_print(spdm)
Beispiel #5
0
        return cf

    def dump_raw(self):
        for k, v in zip(self.__dict__.keys(), self.__dict__.values()):
            try:
                print k
                pretty_print(v)
            except:
                print v

            print ""


if __name__ == '__main__':
    inputfile = sys.argv[1]

    guinea_pig = MaquisMeasurement(inputfile)

    print "s1 matrix"
    print guinea_pig.s1()

    print "s2 matrix"
    s2m = guinea_pig.s2()
    pretty_print(s2m)

    print "I (mutual information)"
    pretty_print(guinea_pig.I())

    #guinea_pig.dump_raw()