THESE PROGRAMS / SCRIPTS ARE PROVIDED AS IS.
THE AUTHOR IS NOT RESPONSIBLE FOR DATA LOSS, ERRONEOUS PLOTS
DUE TO PROGRAM BUGS OR ANY OTHER PROBLEMS THAT MAY DIRECTLY
OR INDIRECTLY BE CAUSED BY THE USAGE OF THE PROGRAM.

-------
General
-------

This archive contains some software tools for plotting simulated
CD spectra and UV spectra from data produced by an ADF computation.
Output from Turbomole can also be processed.
Please read the instructions below. Drop me an email
(jochena@buffalo.edu) in case something doesn't work as expected.

You need Gnuplot version 3.7 or higher. With older versions the lines
with "set xrange noautoscale" in graphit* need to be replaced with the 
"set xrange restore". I am not 100% sure if this affects versions prior to
3.7 or 3.6.  

You need to compile the "plotspec3" program. On my Linux systems I use
ifc version 8 or the Portland group compiler. Compile with:

ifort -Bstatic -o plotspec3 plot-spec-3.f90

or

pgf90 -Bstatic -o plotspec3 plot-spec-3.f90

If you want to use the package with Turbomole, you need to
compile the plotspecTM program:

ifort -Bstatic -o plotspecTM plot-spec-tm.f90 (or pgf90).

Please note that plot-spec-tm.f90 is based on an older version of 
plot-spec-3.f90.

----------------
ADF calculations
----------------

Let the ADF output for CD calculation be "adf.out". In the following,
"molecule" stands for some descriptive name such as 
mymolecule_basisTZP_funcBP86 or whatever. 

The CD spectrum is then generated with:

parse-cd3 adf.out > molecule.cddat

Example: parse-cd3 adf.out > fephen3-adf-bp86-TZ2P-15ex-d3-analyt.cddat

Edit "molecule.cddat" to change plot settings and adjust degeneracies
for symmetry representations (array ndegen).
WARNING: the script tries to guess from the output if a certain irrep
is two, three, etc. fold degenerate. DO NOT RELY ON THIS, I HAVEN'T 
TESTED THIS A LOT. Having said that I should add that it works for me ... 

Then run

plotspec3 < molecule.cddat

This generates two files in the current working directory:
"graph.dat" and "impulses.dat". The names for these files are always the 
same, so before you plot a spectrum with "graphit" et al. make sure you run 
"plotspec3" on the molecule's .cddat input before. Otherwise there could be
"graph.dat" and "impulses.dat" lying around from another molecule. You have
been warned. 

----------------------
Turbomole calculations
----------------------

For Turbomole, make sure you run the calculation with the keyword

$cdspectrum rcm

in the "control file"

Next, take this file and place a Fortran namelist at the beginning 
if the file "cdspectrum" so that it looks similar to the following:

--- plotspecTM input file begins next line ---
&plot nsyme(1)=20,35, ndegen(1)=1,1, sigma=0.13, sharpen=1, npoints=300,
 nexcit=55, lorentz=.f., invert=.t., ev=.t. /

# Electronic CD-spectrum of , IRREP a2  
#  excitation energy / cm^(-1)  rot. strength (length rep.) / 10^(-40)erg*cm^3
--- below are the calculated excitation energies and rotatory strengths
--- as printed in the "cdspectrum" file by Turbomole. 

The namelist entries are explained in the source code for plotspec3. 
If the excitation energies are in inverse cm as assumed here, then ev=.t.
must be used. If ev=.f. the excitation energies must be in eVolts.
(Not that this makes any sense, but I was in a rush when I implemented
this and never got around to changing it. If you want to know the logic
behind it: I was thinking of the necessity of applying a conversion factor
_to_ eVolts, which must be true when the excitation energies are in cm**(-1)).

Here, we have 2 symmetries with degeneracy 1 each (A and B, say), with 
20 and 35 excitations, respectively. In fact, I applied the above to a D3
symmetric system where the symmetries were A1 and E but Turbomole outputs
the rotatory strengths for degenerate irreps already with the proper factor
so we don't have to apply it here. For adf, ndegen(1)=1,2 would be necessary
in this case because only one of the E representation is counted.

sigma is the Gaussian width parameter, in eV. If set to 0, an empirical
formula is applied (see source code). invert=.t. inverts the CD spectrum,
in case you need it for the optical antipode. 


--------------------
Plotting the spectra
--------------------
 
The spectra are plotted with

graphit filename-prefix

or 

graphit-cm filename-prefix

The latter one uses cm**(-1) units for the energy scale, the other one uses 
evolts. filename-prefix must not contain blanks. Example

graphit fephen3-adf-bp86-TZ2P-15ex-d3-analyt

(indicating the basis, no. of excitations, symmetry, etc) produces the files

fephen3-adf-bp86-TZ2P-15ex-d3-analyt-graph-eV-cd.ps
fephen3-adf-bp86-TZ2P-15ex-d3-analyt-graph-eV-UV.ps
fephen3-adf-bp86-TZ2P-15ex-d3-analyt-graph-eV-UV-log.ps
fephen3-adf-bp86-TZ2P-15ex-d3-analyt-graph-nm-cd.ps
fephen3-adf-bp86-TZ2P-15ex-d3-analyt-graph-nm-UV.ps

graphit-cm generates the same files, but the "eV" scale is replaced by
inverse centimeters.

The graphit scripts take some options. For instance you might want to 
enlarge or reduce the length of the lines in the line spectrum in relation 
to the curve of the simulated spectrum. 

-o 0.8  scales the bars for the oscillator strengths by 0.8
-r 0.65 scales the bars for the rotatory strengths by 0.65

You can also shift the entire spectrum up or down in energy.

-s 1.1 blue-shifts the spectrum by 1.1 eV. The units are always in eV,
       also for the nm and cm**(-1) scales. 1 eV is about 8066 inverse
       cm. 

To digitize experimental data which was only available in form of spectra
I have previously used the program
"g3data" to extract numbers from a scanned picture (by clicking on the curve)
and used gnuplot to plot a nice spectrum together with the calculated one.
For that it's good to save "graph.dat" and "impulses.dat" (or regenerate them)
which contain the calculated spectrum and line spectrum. 
I found "g3data" very useful. At the time of writing this README one could
download g3data from 
http://koti.welho.com/jfrantz/software/g3data.html
They change the link periodically, so it's best to do a search at Google et al.
If you find a program that can do this job semi-automatically please
tell me about it! I tried several shareware and commercial programs and
none worked well enough so that I couldn't have done it faster with g3data.

May 2005
J. Autschbach
jochena@buffalo.edu
