Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lrspectrum/lrspectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -122,6 +123,7 @@ def __init__(self, *multLogNames, **kwargs):
self.broad = None
self.wlim = None
self.res = None
self.is2c = is2c
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs testing (test___init__() in test_lrspectrum.py)


# Always call parser when initializing
self.parse_log(program=program)
Expand All @@ -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 """
Expand Down
7 changes: 5 additions & 2 deletions lrspectrum/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs testing. (test__parse_gaussian() in test_parsers.py)
You will probably need to add another file to lrspectrum/test/data/ similar to example_methane.log

# eV and unitless, respectively
return results

Expand Down