# Path: postproclib/postproc.py
# class PostProc:
# 
#     def __str__(self):
#         string =  ('\nAvailable outputs in ' + self.resultsdir + ' include:\n\n')
#         string += ('\t{0:^24s}\t{1:>10s}\n'.format('field', 'records'))
#         #string += ('\t{0:^24s}\t{1:^10s}\n'.format('-'*24, '-'*10))
#         for key,field in sorted(self.plotlist.items()):
#             line = '\t{0:<24s}=\t{1:>10f},\n'.format(key, field.maxrec)
#             string += line
#         return string 
# 
# Path: postproclib/pplexceptions.py
# class NoResultsInDir(Exception):
#     pass


import os
from .lammpsfields import *
from .postproc import PostProc
from .pplexceptions import NoResultsInDir 
                n = "3dgrid"
                for l in f:
                    if ("chunk/atom bin/3d") in l:
                       n=l.split()[1]
                    if n in l and "ave/chunk" in l:
                       indx = l.find("file")
                       if indx != -1:
                           fname = l[indx:].split()[1]
                       else:
                           print(("logfile ", logfile, " appears to be corrupted " + 
                                 "so cannot determine output filename"))
        else:
            #print(("logfile ", logfile, " not found"))
            raise NoResultsInDir

        if fname == "":
            print("fname not defined, trying 3dgrid")
            fname = "3dgrid"

        self.plotlist = {}
        for key, field in list(possibles.items()): 
            print(key, field, self.resultsdir)
            try:
                self.plotlist[key] = field(self.resultsdir, fname)
            except IOError:
                pass
            except ValueError:
                pass 

        if (len(self.plotlist) == 0):

# Path: postproclib/postproc.py
# class PostProc:
# 
#     def __str__(self):
#         string =  ('\nAvailable outputs in ' + self.resultsdir + ' include:\n\n')
#         string += ('\t{0:^24s}\t{1:>10s}\n'.format('field', 'records'))
#         #string += ('\t{0:^24s}\t{1:^10s}\n'.format('-'*24, '-'*10))
#         for key,field in sorted(self.plotlist.items()):
#             line = '\t{0:<24s}=\t{1:>10f},\n'.format(key, field.maxrec)
#             string += line
#         return string 
# 
# Path: postproclib/pplexceptions.py
# class NoResultsInDir(Exception):
#     pass


# Path: postproclib/lammpspostproc.py
import os
from .lammpsfields import *
from .postproc import PostProc
from .pplexceptions import NoResultsInDir 

                n = "3dgrid"
                for l in f:
                    if ("chunk/atom bin/3d") in l:
                       n=l.split()[1]
                    if n in l and "ave/chunk" in l:
                       indx = l.find("file")
                       if indx != -1:
                           fname = l[indx:].split()[1]
                       else:
                           print(("logfile ", logfile, " appears to be corrupted " + 
                                 "so cannot determine output filename"))
        else:
            #print(("logfile ", logfile, " not found"))
            raise NoResultsInDir

        if fname == "":
            print("fname not defined, trying 3dgrid")
            fname = "3dgrid"

        self.plotlist = {}
        for key, field in list(possibles.items()): 
            print(key, field, self.resultsdir)
            try:
                self.plotlist[key] = field(self.resultsdir, fname)
            except IOError:
                pass
            except ValueError:
                pass 

        if (len(self.plotlist) == 0):

            raise NoResultsInDir