Dear all,
I am trying to rewrite the dump class of the Pizza.py in python 3 but I can not understand the indentation in the next method:
def next(self):
if not self.increment: raise StandardError,“cannot read incrementally”
read next snapshot in current file using eof as pointer
if fail, try next file
if new snapshot time stamp already exists, read next snapshot
while 1:
f = open(self.flist[self.nextfile],‘rb’)
f.seek(self.eof)
snap = self.read_snapshot(f)
if not snap:
self.nextfile += 1
if self.nextfile == len(self.flist): return -1
f.close()
self.eof = 0
continue
self.eof = f.tell()
f.close()
try:
self.findtime(snap.time)
continue
except: break
select the new snapshot with all its atoms
self.snaps.append(snap)
snap = self.snaps[self.nsnaps]
snap.tselect = 1
snap.nselect = snap.natoms
for i in xrange(snap.natoms): snap.aselect[i] = 1
self.nsnaps += 1
self.nselect += 1
return snap.time
To see the correct form of the implemented block of code, please see the attached dump.py file downloaded form the https://pizza.sandia.gov.
Thanks for your help,
Amir
dump.py (43.1 KB)