diff --git a/lrspectrum/lrspectrum.py b/lrspectrum/lrspectrum.py index 3b06d1f..a349c59 100644 --- a/lrspectrum/lrspectrum.py +++ b/lrspectrum/lrspectrum.py @@ -102,6 +102,7 @@ def __init__(self, *multLogNames, **kwargs): # Keyword arguments. Has to be this way for 2.7 compatibility name = kwargs.pop('name', None) program = kwargs.pop('program', None) + is2c = kwargs.pop('is2c', False) # Support either one list of logfiles or many logfiles as params if isinstance(multLogNames[0], list): @@ -122,6 +123,7 @@ def __init__(self, *multLogNames, **kwargs): self.broad = None self.wlim = None self.res = None + self.is2c = is2c # Always call parser when initializing self.parse_log(program=program) @@ -148,7 +150,10 @@ def parse_log(self, program=None): # separately program = parsers.detect(lg) # TODO: Break up following line for clarity - self.roots.update(parsers.progs[program](lg)) + if program == 'gaussian': + self.roots.update(parsers.progs[program](lg, self.is2c)) + else: + self.roots.update(parsers.progs[program](lg)) def gen_spect(self, broad=0.5, wlim=None, res=100, meth='lorentz'): """ Generates the broadened spectrum and stores it """ diff --git a/lrspectrum/parsers.py b/lrspectrum/parsers.py index a9dff61..d49b41f 100644 --- a/lrspectrum/parsers.py +++ b/lrspectrum/parsers.py @@ -65,7 +65,7 @@ def _parse_delim(logfile): return results -def _parse_gaussian(logfile): +def _parse_gaussian(logfile, is2c=False): """Parses gaussian output""" # No file descriptor logfiles @@ -75,7 +75,10 @@ def _parse_gaussian(logfile): for i, line in enumerate(open(logfile)): if 'Excited State' in line[1:14]: lsp = line.split() - results[lsp[4]] = float(lsp[8].lstrip('f=')) + if not is2c: + results[lsp[4]] = float(lsp[8].lstrip('f=')) + else: + results[lsp[3]] = float(lsp[7]) # eV and unitless, respectively return results