diff --git a/pyerrors/input/openQCD.py b/pyerrors/input/openQCD.py index 0cf4762b..23a1b1dd 100644 --- a/pyerrors/input/openQCD.py +++ b/pyerrors/input/openQCD.py @@ -1001,6 +1001,7 @@ def read_ms5_xsf(path, prefix, qc, corr): files = sorted(files) for file in files: with open(path+"/"+file, "rb") as fp: + t = fp.read(8) kappa = struct.unpack('d', t)[0] t = fp.read(8) @@ -1018,30 +1019,63 @@ def read_ms5_xsf(path, prefix, qc, corr): bnd = struct.unpack('i', t)[0] print("T:", tmax) - t = fp.read(4) - cnfg = struct.unpack('i', t)[0] - print(cnfg) - placesBI = ["gS", "gP", "gA", "gV", "gVt", "lA", "lV", "lVt", - "lT", "lTt"] - placesBB = ["g1", "l1"] - if not corr in placesBB: - for i in range(placesBI.index(corr)): - t = fp.read(8*2*tmax) - t = fp.read(8*2*tmax) - tmpcorr = struct.unpack('d'*2*tmax, t) - corrres = [[],[]] - for i in range(len(tmpcorr)): - corrres[i%2].append(tmpcorr[i]) - else: - # boundary to boundary correlators - for i in range(len(placesBI)): - t = fp.read(8*2*tmax) - for i in range(placesBB.index(corr)): - t = fp.read(8*2) - t = fp.read(8*2) - corrres = list(struct.unpack('d'*2, t)) + placesBI = ["gS", "gP", + "gA", "gV", + "gVt", "lA", + "lV", "lVt", + "lT", "lTt"] + placesBB = ["g1", "l1"] + # bytes per config + # the chunks have the following structure: + # confignumber, 10x timedependent complex correlators, 2x timeindependent complex correlators + + chunksize = 4 +( 8 *2*tmax*10)+( 8 *2*2) + print(chunksize) + packstr ='i'+('d'*2*tmax*10)+('d'*2*2) + while True: + cnfgt = fp.read(chunksize) + if not cnfgt: + break + asascii=struct.unpack(packstr, cnfgt) + cnfg = asascii[0] + #cnfg = struct.unpack('i', t)[0] + print(cnfg) + + if not corr in placesBB: + #for i in range(placesBI.index(corr)): + # t = fp.read(8*2*tmax) + tmpcorr = asascii[1+2*tmax*placesBI.index(corr):1+2*tmax*placesBI.index(corr)+2*tmax] + #t = fp.read(8*2*tmax) + #tmpcorr = struct.unpack('d'*2*tmax, t) + corrres = [[],[]] + for i in range(len(tmpcorr)): + corrres[i%2].append(tmpcorr[i]) + # jump to next config + #t = fp.read(chunksize-(4+placesBI.index(corr)*8*2*tmax+2*8*2)) + else: + #for i in range(placesBI.index(corr)): + # t = fp.read(8*2*tmax) + tmpcorr = asascii[1+2*tmax*len(placesBI):1+2*tmax*len(placesBI)+2] + #t = fp.read(8*2*tmax) + #tmpcorr = struct.unpack('d'*2*tmax, t) + corrres = [[],[]] + for i in range(len(tmpcorr)): + corrres[i%2].append(tmpcorr[i]) + # jump to next config + #t = fp.read(chunksize-(4+placesBI.index(corr)*8*2*tmax+2*8*2)) + + # boundary to boundary correlators + #for i in range(len(placesBI)): + # t = fp.read(8*2*tmax) + #for i in range(placesBB.index(corr)): + # t = fp.read(8*2) + #t = fp.read(8*2) + #corrres = list(struct.unpack('d'*2, t)) + # jump to next config + #t = fp.read(chunksize-(4+len(placesBI)*8*2*tmax+(2-placesBB.index(corr))*8*2)) + print(corrres)