Skip to content

Instantly share code, notes, and snippets.

@baoilleach
Created June 5, 2013 20:26
Show Gist options
  • Save baoilleach/5717024 to your computer and use it in GitHub Desktop.
Save baoilleach/5717024 to your computer and use it in GitHub Desktop.
Use GaussSum to automatically generate UV-Vis spectra
"""Script to plot UV-Vis spectrum using GaussSum
Before running, set the PYTHONPATH to the directory containing GaussSum.py.
This script runs the UV-Vis spectrum generator across every .out file
in the current folder.
"""
import os
import sys
import glob
import logging
from gausssum.electrontrans import ET
from gausssum.cclib.parser import ccopen
ver = "2.2"
def gaussdir(filename):
return os.path.join(os.path.dirname(filename), "gausssum%s" % ver)
if __name__ == "__main__":
start, end = 200, 500
numpts, fwhm = 500, 3000
filenames = glob.glob("*.out")
for filename in filenames:
log = ccopen(filename)
log.logger.setLevel(logging.ERROR)
data = log.parse(filename)
ET(None, sys.stdout, data, filename, start, end, numpts, fwhm, True,
None, False)
os.rename(gaussdir(filename), filename.split(".")[0] +"_gs")
@neusnow
Copy link

neusnow commented Feb 14, 2017

I am trying your script, and as I am not very used to python yet, so I am getting this error:

/usr/local/lib/python3.6/site-packages/matplotlib/__init__.py:1401: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
warnings.warn(_use_error_msg)

Could you help me, please?
Thank you in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment