\documentclass[11pt,oneside]{report} % one-sided or two-sided hardcopy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% uncomment these two lines when running pdflatex (i.e. pdf output)
%\usepackage[pdftex]{color}
%\usepackage[pdftex,colorlinks,breaklinks,backref]{hyperref}
%%
%% uncomment this line when running normal latex (i.e. dvi output)
%\usepackage{hyperref}
%%
%% comment all three of the above lines for latex2html output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% all the rest of the feffdoc stuff:
\usepackage{feffdoc}
\usepackage{html} % put after hyperref to avoid conflict in pdf mode

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% these lines handle html and pdf issues that cannot be addressed in
%% the feffdoc.sty file
\bodytext{bgcolor=white}

\begin{latexonly}
  \renewcommand{\htmladdnormallink}[2]{\href{#2}{#1}}
\end{latexonly}
%% moved outside of latexonly to fix card linking problems with \htmlref
%% it's not clear why it's an issue
\renewcommand{\htmlref}[2]{\hyperlink{#2}{#1}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This portion of the file is used to generate card documentation 
%% for JFEFF (the GUI) using latex2html. It is included here since 
%% neither \usepackage{feffdoc} nor \include can be used. 
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% On a system with latex2html installed, 
%% use on the command line: 
%% > latex2html feffXX[this file].tex
%%
%% Be sure to comment out the above three lines used for dvi/pdf.
%%
%% Warnings should include: 
%% No implementation found for style 'feffdoc'
%% redefining command \htmlref
%% Substitution of arg to newlabelxx delayed.
%% Unknown commands: dotfill tightlist bullet
%%
%% if there is no feffXX.aux present, first run regular latex:
%% > latex feffXX.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The document uses htmlonly and latexonly environments to preserve 
%% compatibility with both html and single-file output.
%%
%% These environments have been used to remove references to other 
%% sections that are not appropriate to card descriptions to be used 
%% in JFEFF. They also prevent outputting anything but the chapter 
%% on FEFF control cards, when using latex2html.
%%
%% This is also done in some cases because latex2html doesn't check for 
%% duplicates and the card html filenames should be of the form: 
%% CARDNAME.html
%% (set by $LONG_TITLES = 1 in .latex2html-init)
%%
%% Note that this file won't result in a complete set of html documentation
%% (but it is a start, since latex2html won't choke on the it anymore).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The file .latex2html-init sets the important parameters for 
%% formatting the latex2html output, so it should be present in the 
%% "home/user" directory. alternatively, the same parameters can be 
%% set on the whole latex2html installation, but this is not advisable.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% ::8/24/06 - Bryan Schultz::
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{htmlonly} %%ignored by regular latex, for use of latex2html
  \HTMLset{TITLE}{FEFF8 Documentation}
  % mimics feffdoc.sty, but also contains important modifications:
  \newcommand{\program}[1]{\textsc{#1}}
  \newcommand{\feff}{\program{feff}}
  \newcommand{\vnum}{8}
  \newcommand{\feffcur}{\feff\vnum}
 
  %%% Card environment for describing a feff keyword - modified for GUI
    \newenvironment{Card}[4]%
      {\vspace{3ex}%
        \subsection{#1}
        %\hypertarget{card:#4}{}%
        \quad\textsl{#3}\newline
        \quad\texttt{#2}\newline%
        \label{card:#4}\\}
      {}  
  %%% miscellaneous definitions
                                 % typographic conventions
  \newcommand{\file}[1]{`\texttt{#1}'}
  \newcommand{\module}[1]{\textrm{\bf{#1}}} 
  \newcommand{\command}[1]{\texttt{\textsl{#1}}}
                                  % program names
  \newcommand{\atoms}{\program{atoms}}
  \newcommand{\feffit}{\program{feffit}}
                                  % other redefined commands
  \renewcommand{\Re}{\operatorname{Re}}
  \renewcommand{\Im}{\operatorname{Im}}
  \renewcommand{\htmlref}[2]{{#1}} % (linking currently disabled)
\end{htmlonly}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



\begin{document}
\begin{latexonly}%ends at end of chapter

\pagenumbering{roman}           % Roman numerals in front matter
\MakeTitle                      % write out a title page


\newchapter{}

\begin{abstract}
  {\feff} is {\it ab initio} self-consistent real space multiple-scattering 
  code for simultaneous calculations of x-ray-absorption spectra and 
  electronic structure. 
  
  The approach builds in core-hole effects and can include local fields (TDLDA).
  Output includes extended x-ray-absorption fine structure
  (EXAFS), full multiple scattering calculations of various x-ray absorption
  spectra (XAS) and projected local densities of states (LDOS).
  The spectra include x-ray absorption near edge structure (XANES), x-ray 
  natural and magnetic circular dichroism (XNCD and XMCD), spin polarized 
  x-ray absorption spectra (SPXAS and SPEXAFS), non-resonant x-ray emission 
  spectra (XES), the x-ray scattering amplitude (Thomson and 
  anomalous parts), and electron energy loss spectroscopy (EELS).
  
  This work has been supported in part by grants from the U.S.\ 
  Department of Energy and by the University of Washington
  Office of Technology Transfer. {\feff} is copyright \copyright\
  1992--2006, The {\feff} Project, Department of Physics, University
  of Washington, Seattle, WA 98195-1560.

  \vspace*{\stretch{1}}

	\noindent This document is copyright \copyright\ 2002-2006 by J.J.\ Rehr, A.\ Ankudinov, and B.\ Ravel.
	  
  \noindent Permission is granted to reproduce and distribute this
  document in any form so long as the copyright notice and this
  statement of permission are preserved on all copies.
  
  \noindent This document can also be found on the internet in the {\feff} Project Wiki:
 
 \centerline{\htmladdnormallink{http://leonardo.phys.washington.edu/feff/wiki}
 {http://leonardo.phys.washington.edu/feff/wiki/}}
 
\end{abstract}

\newchapter{}
\tableofcontents
\newchapter{}

\setcounter{page}{1}
\pagenumbering{arabic}

\chapter{Synopsis}
\label{sec:Synopsis}

{\feffcur} calculates extended x-ray-absorption fine structure
(EXAFS), x-ray-absorption near-edge structure (XANES), x-ray
natural circular dichroism (XNCD), spin-dependent calculations 
of x-ray magnetic dichroism (XMCD) and spin polarized x-ray absorption 
(SPXAS and SPEXAFS), nonresonant x-ray emission (XES), electronic 
structure including local densities of states (LDOS), and
x-ray elastic scattering amplitude $f=f_0+f'+if''$.
This release is also highly optimized for calculation of 
electron energy loss spectroscopy (EELS).

{\feff} uses an \textit{ab initio} self-consistent real space multiple 
scattering (RSMS) approach for clusters of atoms ($Z < 99$), including 
polarization dependence, core\--hole effects, and local field 
corrections. Calculations are based on an all-electron, real space 
relativistic Green's function formalism with no symmetry requirements. 
The method combines both full multiple scattering based on LU or Lanczos 
algorithms and a high-order path expansion based on the Rehr--Albers 
multiple scattering formalism.

For a quick start or self-guided tutorial
we suggest that new users try a few of the examples in Section
\ref{sec:Calc-Strat-Exampl}. For details on use of the code, examples
and suggestions for calculation strategies, see Sections
\ref{sec:Input-File-Control-Cards}, \ref{sec:Input-and-Output-Files}, and
\ref{sec:Calc-Strat-Exampl}. For details about the algorithms used,
see the discussion for the appropriate module in Section
\ref{sec:Input-File-Control-Cards}.  For additional details, see the published
references listed in Appendix~\ref{sec:Append-C-Refer}.

The principal investigator of the {\feff} project is:
\begin{description}
\item[John J.~Rehr, Principal Investigator]\hfill\\
Department of Physics, BOX 351560 University of Washington, Seattle, WA 98195\\
email: \htmladdnormallink{jjr@phys.washington.edu}
{mailto:jjr@phys.washington.edu}\\
telephone: (206) 543-8593,\  FAX: (206) 685-0635
\end{description}

{\feff} is written in ANSI Fortran 77, with the non-standard extension
of double precision complex (\texttt{complex*16}) variables. It requires at
least 250 megabytes (MB) of available memory (RAM) to run. For XANES
calculations, one generally needs more memory (about 500 MB of RAM for
a cluster of 100 atoms, about 750 MB for a cluster of 200 atoms, and
so on). See Appendix~\ref{sec:Append-B-Inst} for installation instructions.

Please contact the authors concerning any problems with the code. See
Appendix~\ref{sec:Append-F-Trouble} for trouble-shooting hints and
problem/bug reports or the FAQ on the {\feff} WWW pages (see below).

The full {\feffcur} code is copyright protected software and users must
obtain a
license from the University of Washington Office of Technology
Transfer for its use. 
See Appendix~\ref{sec:Append-A-Copyr} for
complete copyright notice and other details. Documentation and
information on how to obtain the code can be found at the {\feff}
Project WWW URL:

\centerline{\htmladdnormallink{http://leonardo.phys.washington.edu/feff/}
  {http://leonardo.phys.washington.edu/feff/}}

\noindent or by e-mail to the {\feff} Project Coordinator at
\htmladdnormallink{feff@phys.washington.edu}{mailto:feff@phys.washington.edu}.

Please cite {\feff} and an appropriate {\feff} reference if the code
or its results are used in published work. See
Appendix~\ref{sec:Append-C-Refer} for a list of appropriate
citations. The main published reference for {\feffcur} is: 

\emph{Real Space Multiple Scattering Calculation and Interpretation of X-ray
  Absorption Near Edge Structure}, A.L.~Ankudinov, B.~Ravel,
J.J.~Rehr, and S.D.~Conradson Phys.\ Rev.\ B\textbf{58}, 7565 (1998).

A manuscript dealing with the improvements added in {\feff}8.20
is 

\emph{Parallel calculation of electron multiple scattering using Lanczos algorthms}, A.\ L.\ Ankudinov, C.\ E.\ Bouldin, J.\ J.\ Rehr, J.\ Sims, and  H.\ Hung,
Phys.\ Rev.\ B\textbf{65}, 104107 (2002).

 {\bf FEFF Project Developers} -- Several developers contributed to
the {\feff}8.00 code, and its advanced versions {\feff}8.10, {\feff}8.20,
and {\feff}8.40.

The following developers have contributed to {\feff}8.40 and other recent 
project developments: 
Fernando D.\ Vila, response functions and Debye-Waller factors;
Micah Prange, {\feff}/Optical; 
Joshua Kas, Bayesian XAS analysis;
Yoshinari Takimoto, response functions;
Adam Sorini, inelastic losses;
and
Kevin Jorissen, electron-energy loss spectroscopy (EELS).

  Alexei Ankudinov (ALA) was the principal developer for previous versions
of the {\feff}8 series.
ALA implemented the automated self-consistent potential algorithm, and
added calculations of the $\ell$DOS, the Fermi level, and charge transfer.
\htmladdnormallink{Bruce Ravel}{http://cars9.uchicago.edu/~ravel/} 
was the principal developer of the full
multiple scattering (FMS) algorithm in {\feff}8, which uses LU
decomposition and
is necessary for the SCF loop, DOS and for FMS/LU XANES calculations. 
For version {\feff}8.10 ALA added calculations of elastic scattering
amplitude, x-ray natural circular dichroism and nonresonant x-ray
emission. ALA was largely responsible for {\feff}8.20, which 
introduced an improved input/output structure to facilitate
interaction with other codes. He also added quadrupolar transitions
and implemented fast Lanczos methods for the iterative FMS algorithm.

 In collaboration with A.\ Nesvizhskii, new routines for sum-rules
applications were added. Anna Poiarkova and Patrick Konrad
contributed new codes for calculating multiple-scattering Debye--Waller
factors and anharmonic contributions.
Matthew Newville added an improved padded ascii output structure
to facilitate the interface to XAFS analysis codes and portability
between different machines. Jim Sims (NIST) modified the code for
MPI based parallel execution, in collaboration with C.\ Bouldin and
JJR.

 The high-order multiple-scattering
routines, pathfinder, and input/output routines were largely developed by
Steven Zabinsky and JJR for {\feff}5 and 6, and are still in use. The
Hedin--Lundqvist self-energy and phase shift routines were developed
for early versions of {\feff} in collaboration with Jose Mustre de
Leon, Dan Lu and R.C.~Albers and are still part of {\feffcur}.

  The authors thank many users of experimental versions of the {\feffcur}
code for feedback, suggestions and bug reports. The authors also thank R.C.\
Albers, K.\ Baberschke, C.\ Bouldin, C.\ Brouder, G.\ Brown,
S.D.\ Conradson, F.\ Farges, G.\ Hug, M.\ Jaouen, J. Sims, and E.\ Stern
for useful comments.

\newpage
\vspace*{\stretch{1}}
\begin{table}[htbp]
  \caption{Typographic conventions in this document}
  \label{tab:typographic}
  \begin{center}
    \begin{tabular}[h]{ll}
      \hline\hline
      \quad font & \quad denotes \\
      \hline
      \program{small caps} & names of programs\\
      \texttt{typewriter font} &  contents of files\\
      \file{quoted typewriter font} & file names\\
      ROMAN CAPITALS & names of cards in the \file{feff.inp} file\\
      \texttt{\textsl{slanted typewriter font}} &
      commands executed at a command line \\
      \hline\hline
    \end{tabular}
  \end{center}
\end{table}
\vspace*{\stretch{1}}
\end{latexonly} % begins at start of this chapter



\chapter{Input File Control Cards}
\label{sec:Input-File-Control-Cards}

The main program {\feff} reads a single file (\file{feff.inp})
 created by the user and executes the various program
modules described below. An auxiliary FORTRAN program ({\atoms}), developed
by \htmladdnormallink{Bruce
  Ravel}{http://cars9.uchicago.edu/~ravel/}, is provided to 
generate the \file{feff.inp} file for crystals from crystallographic 
input parameters. A perl-based graphical user interface to {\atoms} is
also available. Information about {\atoms} can be found on the WWW at:

\centerline{\htmladdnormallink
{http://cars9.uchicago.edu/$\sim$ravel/software/aboutatoms.html}
{http://cars9.uchicago.edu/~ravel/software/aboutatoms.html}}

This section describes \file{feff.inp} and the commands that control
{\feff}. It may be helpful to look at one or more of the
sample input files in Section \ref{sec:Calc-Strat-Exampl} while
reading this section. 

The input for {\feffcur} is similar to that for {\feff} versions 5 through 7, 
except that several additional options have been added to permit 
self-consistent potential generation, full multiple scattering 
XANES calculations, polarization dependence, and others
listed in Section~\ref{sec:Complete-list-FEFF8}. {\feffcur}
is backwards compatible and supports input files earlier style
input files (from {\feff} versions 5 through 7).

The input file \file{feff.inp} is a loosely formatted, line-oriented
text file. Each type of input read by the program is on a line which
starts with a \emph{card} or \emph{keyword} and, in
some cases, is followed by alpha-numeric data. All card arguments
listed below inside square brackets are optional. The sequence of
keyword cards is arbitrary. If any card or optional data is omitted,
default values are used; an exception is the POTENTIALS card, which is
always required. (Either the ATOMS card or the OVERLAP card is also required
for {\feff} to run.)

Alpha-numeric values are listed in free format,
separated by blanks. Tab characters are \emph{not allowed} (due to
Fortran 77 portability constraints) and may cause confusing error
messages. Any characters appearing after the card and its required or
optional data on a given line are ignored by {\feff} and can be used
as end-of-line comments. Spaces between lines (empty lines) are ignored. Any
line beginning with an asterisk (\texttt{*}) is regarded as a comment
and is also ignored. 

All distances are in angstroms ({\AA}) and
energies in electron-volts (eV). 

After reading the \file{feff.inp} file (in the ``zeroth'' module 
\module{rdinp}, read input), the calculations of various 
spectroscopies are done sequentially in six steps:

\begin{enumerate}

\item  The scattering potentials are calculated using atomic
overlap (Mattheiss) prescription or self-consistently using
an automated SCF loop. Absolute energies are estimated.
(module \module{pot}, potentials.)

\item  The scattering phase shifts, dipole matrix
elements, and x-ray cross-section are calculated. 
(module \module{xsph}, cross-section and phases.)

\item  Full multiple scattering XANES calculations are
done for a specified cluster size.
(module \module{fms}, full multiple scattering.)

\item  The leading multiple scattering paths for the cluster are enumerated.
(module \module{path}, path enumeration.)

\item  The effective scattering amplitudes $f_{\rm eff}$ and other XAFS
parameters are calculated for each scattering path.
(module \module{genfmt}, general-path F-matrix calculation.)

\item  The XAFS parameters from one or more paths are combined to
calculate a total XAFS or XANES spectrum.
(module \module{ff2x}, scattering
amplitude to $\chi$.)

\end{enumerate}

There are also several optional steps:

\begin{enumerate}

%\item Describe (module {\bfseries SCREEN}.)

\item  If the \htmlref{LDOS}{card:ldo} card is present in 
\file{feff.inp}, the angular momentum projected density of 
states is calculated. This calculation was previously part 
of the module \module{xsph}, but it now runs independently, 
between \module{pot} and \module{xsph}. (module \module{ldos}.) 

\item If the \htmlref{SO2CONV}{card:s02c} card is used,
this module convolves regular XAS output files (e.g., \file{xmu.dat})
with a many body spectral function to include many body effects.
(module \module{so2conv}.)

\item If the \htmlref{ELNES}{card:eln} card or the 
\htmlref{EXELFS}{card:exe} card is present in 
\file{feff.inp}, the electron energy loss spectrum is 
calculated based on the specified arguments. (module 
{\module{eels}}. See Section~\ref{sec:EELS}.)

Note that steps 2, 3, 4, 5 and 6 are affected by the presence 
of the ELNES/EXELFS cards.  See Section~\ref{sec:File-structure-code}
for details on how the various module output files change.

\end{enumerate}


This section describes how to control each module using the
\file{feff.inp} file.



\section{Complete List of FEFF8 Control Cards}
\label{sec:Complete-list-FEFF8}

The \file{feff.inp} options fall into three categories:
\textsl{standard} options frequently and easily used, \textsl{useful}
options that are often used, and \textsl{advanced} options that are
seldom necessary, but may be helpful in some cases. Every card in
\file{feff.inp} will influence the calculations, beginning in some 
module. Thus, for better understanding of how each module can 
be affected by the input cards, we list them separately for each module.

\begin{description}
  %%
  %% Module 0
\item[\large\textbf{Module 0}]\dotfill\  {\large\module{rdinp}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Read input data
  \item[\textbf{Standard cards:}] 
    \htmlref{ATOMS}{card:ato}, 
    \htmlref{CONTROL}{card:con},
    \htmlref{END}{card:end}, 
    \htmlref{PRINT}{card:pri},
    and \htmlref{TITLE}{card:tit}
  \item[\textbf{Useful Cards:}] 
    \htmlref{RMULTIPLIER}{card:rmu}
  \item[\textbf{Advanced Cards:}] 
    \htmlref{CFAVERAGE}{card:cfa} and
    \htmlref{OVERLAP}{card:ove}
  \end{description}
  %%
  %% Module 1
\item[\large\textbf{Module 1}]\dotfill\  \large\module{pot}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate (self-consistent)
    scattering potentials and Fermi energy
  \item[\textbf{Standard cards:}] 
    \htmlref{AFOLP}{card:afo}, 
    \htmlref{EDGE}{card:edg},
    \htmlref{HOLE}{card:hol},
    \htmlref{POTENTIALS}{card:pot},
    and \htmlref{S02}{card:s02}
  \item[\textbf{Useful Cards:}] 
    \htmlref{EXCHANGE}{card:exc},
    \htmlref{FOLP}{card:fol},
    \htmlref{NOHOLE}{card:noh}, 
    \htmlref{RGRID}{card:rgr},
    \htmlref{SCF}{card:scf}, 
    and \htmlref{UNFREEZEF}{card:unf}
  \item[\textbf{Advanced Cards:}] 
    \htmlref{INTERSTITIAL}{card:int}, 
    \htmlref{ION}{card:ion},
    and \htmlref{SPIN}{card:spi} 
  \end{description}
  %%
  %% Module 2
\item[\large\textbf{Module 2}]\dotfill\  {\large\module{xsph}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate cross-section and phase
    shifts and $\ell$DOS
  \item[\textbf{Standard cards:}] 
    \htmlref{EXAFS}{card:exa}
    and \htmlref{XANES}{card:xan}
  \item[\textbf{Useful Cards:}] 
    \htmlref{ELLIPTICITY}{card:ell},
    \htmlref{MULTIPOLE}{card:mul},
    and \htmlref{POLARIZATION}{card:pol} 
  \item[\textbf{Advanced Cards:}] 
    \htmlref{DANES}{card:dan}, 
    \htmlref{FPRIME}{card:fpr}, 
    \htmlref{PLASMON}{card:pla},
    \htmlref{RPHASES}{card:rph},
    \htmlref{RSIGMA}{card:rsi},
    \htmlref{TDLDA}{card:tdl},
    \htmlref{XES}{card:xes},
    and \htmlref{XNCD (or XMCD)}{card:xnc}
  \end{description}
  %%
  %% Module 3
\item[\large\textbf{Module 3}]\dotfill\  {\large\module{fms}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate full multiple
    scattering for XAS
  \item[\textbf{Standard cards:}] \htmlref{FMS}{card:fms}
  \item[\textbf{Useful Cards:}] \htmlref{DEBYE}{card:deb1}
  \item[\textbf{Advanced Cards:}]
  \end{description}
  %%
  %% Module 4
\item[\large\textbf{Module 4}]\dotfill\  {\large\module{path}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Path enumeration
  \item[\textbf{Standard cards:}] \htmlref{RPATH}{card:rpa}
  \item[\textbf{Useful Cards:}] \htmlref{NLEG}{card:nle}
  \item[\textbf{Advanced Cards:}] 
  \htmlref{PCRITERIA}{card:pcr} 
  and \htmlref{SS}{card:ss}
  \end{description}
  %%
  %% Module 5
\item[\large\textbf{Module 5}]\dotfill\  {\large\module{genfmt}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate scattering amplitudes
    and other XAFS parameters
  \item[\textbf{Standard cards:}]
  \item[\textbf{Useful Cards:}] \htmlref{CRITERIA}{card:cri}
  \item[\textbf{Advanced Cards:}] \htmlref{IORDER}{card:ior} and
    \htmlref{NSTAR}{card:nst}
  \end{description}
  %%
  %% Module 6
\item[\large\textbf{Module 6}]\dotfill\ {\large\module{ff2x}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate final output. 
  \item[\textbf{Standard cards:}] \htmlref{DEBYE}{card:deb2}
  \item[\textbf{Useful Cards:}] \htmlref{CORRECTIONS}{card:cor} and
    \htmlref{SIG2}{card:sig}
  \item[\textbf{Advanced Cards:}]
  \end{description}
  %%
  %% Other Modules
\item[\large\textbf{Optional Modules}]\dotfill\  
    {\large\module{screen, ldos, so2conv, eels}}
  \begin{description}
%  \item[\textbf{Purpose of \module{screen} Module:}] Calculate screened potentials?
%  \item[\textbf{Cards:}] \htmlref{SCREEN}{card:scr}
  %%
  \item[\textbf{Purpose of \module{ldos} Module:}] Calculate LDOS. 
  \item[\textbf{Cards:}] \htmlref{LDOS}{card:ldo}
  %%
  \item[\textbf{Purpose of \module{so2conv} Module:}] Convolve output with 
    spectral function. 
  \item[\textbf{Cards:}] \htmlref{SO2CONV}{card:s02c},
	\htmlref{SELF}{card:sel} and
	\htmlref{SFSE}{card:sfs}
  %%
  \item[\textbf{Purpose of \module{eels} Module:}] Calculate EELS. 
  \item[\textbf{Cards:}] \htmlref{ELNES}{card:eln}, 
        \htmlref{EXELFS}{card:exe}
        and \htmlref{MAGIC}{card:mag}
  %%

  \end{description}
%%
\end{description}


These data types are listed below in the same order as in the table above.
Each description is of this form:

\begin{Card}{CARD}{required arguments [optional arguments]}{type}{}
  The type is one of \textsl{Standard}, \textsl{Useful}, or
  \textsl{Advanced}. The argument list is a brief statement of the
  valid arguments to the card. Arguments in square brackets are 
  optional. The text description will explain the arguments and 
  their uses more fully. Example uses of the card look like this:
\begin{verbatim}
  * brief description of the example
  CARD  arguments
\end{verbatim}
\end{Card}


\section{Main Control Cards}
\label{sec:Main-Control-Cards}


The cards in this section either control module \module{rdinp} or are 
not associated with any particular module, and are used throughout 
the {\feff} calculations. In either case, they begin influencing 
the calculations in \module{rdinp}.
The ATOMS card is used to specify the absorbing atom and its environment 
(if atomic coordinates are not known, then the OVERLAP card can be used 
to construct approximate potentials). Without this structural
information, no calculations can be done. The CONTROL card is used to
selectively run parts of {\feff}. The PRINT card controls which
output files are written by the modules.


\begin{Card}{ATOMS}{}{Standard}{ato}
  Cartesian coordinates (in \AA ngstroms) and unique potential indices
  of each atom in the cluster are entered following the ATOMS card, one 
  per line. See the discussion of the \htmlref{POTENTIALS}{card:pot} card. 
  An auxiliary code, {\atoms}, written by \htmladdnormallink{Bruce Ravel}
  {http://cars9.uchicago.edu/~ravel/}, is supplied with {\feff} to generate 
  the ATOMS list for crystals from crystallographic data. See the document 
  for {\atoms} for more information.
\begin{verbatim}
  ATOMS
  * x      y      z     ipot     SF6 molecule
    0.0    0.0    0.0     0      S K-shell hole
    1.56   0.00   0.00    1      F 1st shell atoms
    0.00   1.56   0.00    1
    0.00   0.00   1.56    1
   -1.56   0.00   0.00    1
    0.00  -1.56   0.00    1
    0.00   0.00  -1.56    1
\end{verbatim}
\end{Card}


\begin{Card}{CONTROL}{ipot ixsph ifms ipaths igenfmt iff2x}{Standard}{con}
  The CONTROL card lets you run one or more of the modules separately.
  There is a switch for each module: 0 means not to run that module, 1
  means to run it. You can do the whole run in sequence, one module
  at a time, but you \emph{must} run all modules sequentially.
  \emph{Do not} skip modules: \hbox{\texttt{CONTROL 1 1 1 0 0 1}}
  is incorrect. The default is \hbox{\texttt{CONTROL 1 1 1 1 1 1}},
  i.e.\ run all 6 modules.
\begin{verbatim}

  * example 1
  * calculate self consistent potentials, phase shifts and fms only
  CONTROL  1 1 1 0 0 0   ipot  ixsph  ifms   ipaths  igenfmt  iff2x

  * example 2
  * run paths, genfmt and ff2x; do not run pot, xsph, fms
  * this run assumes previous modules have already been run and
  * adds MS paths between rfms  and rpath to the MS expansion
  CONTROL  0 0 0 1 1 1    ipot  ixsph  ifms   ipaths  igenfmt  iff2x
\end{verbatim}

\end{Card}


\begin{Card}{END}{}{Standard}{end}
  The END card marks the end of the portion of the \file{feff.inp} file
  that {\feff} will read. All data following the END card is ignored.
  Without an END card, the entire input file is read.
\begin{verbatim}
  * ignore any lines in feff.inp that follow this card
  END
\end{verbatim}
\end{Card}


%% the use of \vspace{-4ex} in PRINT is a crufty hack to avoid having to
%% use the array package
\begin{Card}{PRINT}{ppot pxsph pfms ppaths pgenfmt pff2x}{Standard}{pri}
  The PRINT card determines which output files are printed by each
  module. 
\begin{latexonly}
  See Section~\ref{sec:Input-and-Output-Files} for details about 
  the contents of these files.
\end{latexonly}
  The default is print level 0 for each module.
\begin{verbatim}
  * add crit.dat and feffNNNN.dat files to minimum output
  PRINT  0  0  0  1  0  3
\end{verbatim}
\begin{latexonly}
  The print levels for each module are summarized in
  Table~\ref{tab:printlevels} on page \pageref{tab:printlevels}.
\end{latexonly}
\end{Card}

%% the use of \vspace{-4ex} in this table is a crufty hack to avoid
%% having to use the array package
\begin{table}[htbp]
    %% caption moved here for table visibility (links go to the caption)
    \caption[Print levels]{Print levels controlling output files from the modules.}
    \begin{center}
    \begin{tabular}[h]{p{0.1\linewidth}p{0.8\linewidth}}
          \hline\hline
      module & \hspace{5em} print levels\\
      \hline
      \module{pot} &
      \vspace{-4ex}
      \begin{itemize}
        \tightlist
      \item[0] write \file{pot.bin} only
      \item[1] add \file{misc.dat}
      \item[2] add \file{potNN.dat}
      \item[3] add \file{atomNN.dat}
      \end{itemize}\\
      %%
      \module{xsph} &
      \vspace{-4ex}
      \begin{itemize}
        \tightlist
      \item[0] write \file{phase.bin} and \file{xsect.bin} only
%; with the LDOS card add \file{ldosNN.dat} and \file{logdos.dat}
      \item[1] add \file{axafs.dat}
      \item[2] add \file{phaseNN.dat} and \file{phminNN.dat}
      \item[3] add \file{ratio.dat} (for XMCD normalization) and \file{emesh.dat}
      \end{itemize} \\
      %%
      \module{fms} &
      \vspace{-4ex}
      \begin{itemize}
        \tightlist
      \item[0] write \file{fms.bin}
      \end{itemize}\\
      %%
      \module{path} &
      \vspace{-4ex}
      \begin{itemize}
        \tightlist
      \item[0] write \file{paths.dat} only
      \item[1] add \file{crit.dat}
      \item[3] add \file{fbeta} files (plane wave $|f(\beta)|$ approximations)
      \item[5] Write only \file{crit.dat} and do not write \file{paths.dat}.
        (This is useful when exploring the importance of paths for large runs.)
      \end{itemize}\\
      %%
      \module{genfmt} &
      \vspace{-4ex}
      \begin{itemize}
        \tightlist
      \item[0] write \file{list.dat}, and write \file{feff.bin} with all paths with importance greater than or equal to two thirds of the curved wave importance criterion
      \item[1] write all paths to \file{feff.bin}
      \end{itemize}\\
      %%
      \module{ff2x} &
      \vspace{-4ex}
      \begin{itemize}
        \tightlist
      \item[0] write \file{chi.dat} and \file{xmu.dat}
      \item[2] add \file{chipNNNN.dat} ($\chi(k)$ from each path
        individually, this can quickly fill up your disk if you're doing
        a large run)
      \item[3] add \file{feffNNNN.dat} (input files for Matt Newville's
        {\feffit} program) and \file{files.dat}, and do not add \file{chipNNNN.dat} files
      \end{itemize}\\
      \hline\hline
    \end{tabular}
    \label{tab:printlevels}
    \end{center}
\end{table}

\begin{Card}{TITLE}{title\_line}{Standard}{tit}
  User supplied title lines. You may have up to 10 of these. Titles
  may have up to 75 characters. Leading blanks in the titles will be
  removed.
\begin{verbatim}
  TITLE  Andradite  (Novak and Gibbs, Am.Mineral 56,791 1971)
  TITLE  K-shell 300K
\end{verbatim}
\end{Card}


\begin{Card}{RMULTIPLIER}{rmult}{Useful}{rmu}
  With RMULTIPLIER all atomic coordinates are multiplied by the
  supplied value. This is useful to adjust lattice spacing, for
  example, when fractional unit cell coordinates are used. By
  default, \texttt{rmult}=1.
\begin{verbatim}
  *increase distances by 1%
  RMULTIPLIER 1.01
\end{verbatim}
\end{Card}


\begin{Card}{CFAVERAGE}{iphabs nabs rclabs}{Advanced}{cfa}
  A ``configuration'' average over the spectra of multiple 
  absorbing atoms is done if the CFAVERAGE card is used. 
  CFAVERAGE currently assumes phase transferability, which 
  is usually good for EXAFS calculations, but may not be 
  accurate for XANES. Note that the CFAVERAGE card is currently
  unreliable in general, and in particular is  
  incompatible with the \htmlref{DEBYE}{card:deb2} card for 
  options other than the correlated Debye model ($\mathtt{idwopt} > 0$).
  \begin{description}
  \item[\texttt{iphabs}]\hfill\\ potential index for the type of absorbing atoms  
    over which to make the configuration average (any potential index is allowed).
  \item[\texttt{nabs}]\hfill\\ the configuration average is made over
    the first \texttt{nabs} absorbers in the \file{feff.inp} file of
    type \texttt{iphabs}. You do not need to have potential of index 0
    in your input file when using the CFAVERAGE card, but you must
    have the same type of potential for iph=0 and iph=iphabs. The
    configurational average is done over ALL atoms of type
    \texttt{iphabs}, if \texttt{nabs} is less than or equal to zero.
  \item[\texttt{rclabs}]\hfill\\ radius to make a small atom list from a
    bigger one allowed in \file{feff.inp}. Currently the parameter
    controlling the maximum size of the list, \texttt{natxx}, is set to
    100,000, but this can be increased. The pathfinder will choke on too
    big an atoms list. You must choose \texttt{rclabs} to have fewer
    than 1,000 atoms in the small atom list. If your cluster is less 1,000
    atoms simply use \texttt{rclabs}=0 or negative always to include
    all atoms.
  \end{description}
  Default values are \texttt{iphabs}=0, \texttt{nabs}=1,
  \texttt{rclabs}=0 (where $\mathtt{rclabs}=0$ means to consider an
  infinite cluster size).
\begin{verbatim}
  *average over all atoms with iph=2 in feff.inp with less than 1000 atoms
  CFAVERAGE 2  0  0
\end{verbatim}
\end{Card}


\begin{Card}{OVERLAP}{iph}{Advanced}{ove}
  The OVERLAP card can be used to construct approximate overlapped
  atom potentials when atomic coordinates are not known or specified.
  If the atomic positions are listed following the \htmlref{ATOMS}{card:ato} 
  card, the OVERLAP card is not needed. {\feffcur} will stop if both 
  the ATOMS and OVERLAP cards are used. The OVERLAP card contains the 
  potential index of the atom being overlapped and is followed by a list
  specifying the potential index, number of atoms of a given type to
  be overlapped and their distance to the atom being overlapped. The
  examples below demonstrate the use of an OVERLAP list. This option
  can be useful for initial single scattering XAFS calculations in
  complex materials where very little is known about the structure.

  You should verify that the coordination chemistry built in using the
  OVERLAP cards is realistic. It is particularly important to specify
  all the nearest neighbors of a typical atom in the shell to be
  overlapped. The most important factor in determining the scattering
  amplitudes is the atomic number of the scatterer, but the coordination 
  chemistry should be approximately correct to ensure good scattering 
  potentials. Thus it is important to specify as accurately as possible 
  the coordination environment of the scatterer. Note: If you use the 
  OVERLAP card, then you cannot use the \htmlref{FMS}{card:fms} or 
  \htmlref{SCF}{card:scf} cards. Also the pathfinder won't be called 
  and you must explicitly specify single scattering paths using the 
  \htmlref{SS}{card:ss} card
  \begin{latexonly}
    , which is described in Section~\ref{sec:Path-enum-modul}
  \end{latexonly}.

\begin{verbatim}
  * Example 1. Simple usage
  * Determine approximate overlap for central and 1st nearest neighbor in Cu
  OVERLAP 0         determine overlap for central atom of Cu
    *iphovr   novr   rovr       * ipot, number in shell, distance
     1        12     2.55266
  OVERLAP 1         determine approximate overlap for 1st shell atoms
    *iphovr   novr   rovr       * ipot, number in shell, distance
     0        12     2.55266

  * Example 2. More precise usage
  * Determine approximate overlap for 3rd shell atoms of Cu
  OVERLAP 3
    0  1 2.55266    ipot, number in shell, distance
    1  4 2.55266
    2  7 2.55266
    2  6 3.61000
    2 24 4.42133
\end{verbatim}
\end{Card}

\section{POT: Scattering Potentials}
\label{sec:Scatt-potent-modul}

Initially the free atom potentials of each atomic type are calculated
using a relativistic Dirac--Fock atom code, treating the atoms as if
they were isolated in space. Scattering potentials are
calculated by overlapping the free atom densities in the muffin tin
approximation (Mattheiss prescription), and then including the
Hedin--Lundqvist/Quinn self energy for excited states. 
Non-overlapping muffin-tin radii are determined automatically from
the calculated Norman radii. Automatic overlapping of muffin tin
spheres (see the AFOLP card) is done by default, since it typically
leads to better results than non overlapping muffin-tin spheres.
{\feffcur} can also calculate self-consistent potentials by successively
calculating the electron density of states, electron density and Fermi
level at each stage within a small cluster and then iterating, using
the Mattheiss prescription for the initial iteration.

XAFS spectra are referenced to the threshold Fermi level. This
quantity is best determined with the self-consistent field procedure 
(typically to within a fraction of an eV), 
or (less accurately but faster) can be estimated from the electron
gas result at the mean interstitial density in the Mattheiss prescription, 
as in {\feff}7. An absolute energy scale is obtained by an atomic
calculation of the total energy of the system with and without the
core-hole. Atomic configurations and core-hole lifetimes are built
in, and mean free paths are determined from the imaginary part of the
average interstitial potential, including self-energy and lifetime
contributions.

The potential calculations need as input only the atomic number of the
atoms, and, for the absorbing atom, the type of the core hole being
considered. To do the overlapping of the unique potentials, the
neighboring atoms must be identified, either by position (from a list
of the Cartesian coordinates of each atom) or by explicit overlapping
instructions using the OVERLAP card described in
the previous section.

To save time the code calculates the overlapped atom potential for each
unique potential only once, using as a sample geometry the atom with
a given unique potential index that is closest to the absorbing atom. 
Thus it is essential that the neighborhood of each sample atom be appropriate.


\begin{Card}{AFOLP}{folpx}{Standard}{afo}
  This automatically overlaps all muffin-tins to a specified
  maximum value (default \texttt{folpx}=1.15) to reduce the effects of
  potential discontinuities at the muffin-tins. Automatic overlapping
  is done by default and is useful in highly inhomogeneous materials.
  Typical values of the overlapping fraction should be between 1.0 and
  1.3. See \htmlref{FOLP}{card:fol} for a non-automated version. 
  Automatic overlapping is done by default; to switch overlapping off, 
  use 1.0 as the argument for AFOLP.
\begin{verbatim}
  * touching muffin-tins; do not use automatic overlapping
  AFOLP  1.0
\end{verbatim}
\end{Card}


\begin{Card}{EDGE}{label s02}{Standard}{edg}
  The EDGE card is equivalent to the HOLE card, but you don't have to
  look up the appropriate integer index. Simply use the hole label:
  \texttt{K} means $K$-shell, \texttt{L1} means $L_{I}$, and so on.  
  NO means no hole, but {\feff} will not accept it and one must use the 
  \htmlref{NOHOLE}{card:noh} card instead. Calculations with very shallow 
  edges, e.g. $M$-shells and higher, are not well tested; please complain 
  to the authors if you encounter problems. As with the HOLE card, you may 
  also use the integer index instead of the label. All comments for the HOLE 
  card are valid for the EDGE card---see the description below. If the
  entry for the amplitude reduction factor $S_0^2$ is less than 0.1, $S_0^2$ 
  will be estimated from atomic overlap integrals.

\begin{verbatim}
  * L1-shell core hole, S02 = 1
  EDGE  L1   1.0
\end{verbatim}
\end{Card}


\begin{Card}{HOLE}{ihole s02}{Standard}{hol}
  The HOLE card is equivalent to the EDGE card, but the shell is specified
  by a hole-code index. It includes the amplitude reduction factor $S_0^2$
  just as the EDGE card does. If the entry for $S_0^2$ is less than 0.1,
  then $S_0^2$ will be estimated from atomic overlap
  integrals. Experimental values of $S_0^2$ are typically
  between 0.8 and 1.0. The defaults if the HOLE card is omitted are
  \texttt{ihole}=1 for the $K$ shell and $S_0^2$=1. The hole codes
  are shown in Table~\ref{tab:holecodes}, however, note that {\feff}
  will not accept ihole=0 and one must use the \htmlref{NOHOLE}{card:noh} 
  card instead to calculate without the core-hole.

  For $\texttt{ihole}>4$, the core-hole lifetime parameter
  ($\gamma_{\textrm{ch}}$) is not tabulated in {\feff} and is set
  equal to 0.1 eV, since the final state losses are then dominated by
  the self-energy. Use the \htmlref{EXCHANGE}{card:exc} card to make
  adjustments ($\gamma_{\textrm{ch}} = 0.1 + 2\cdot\mathtt{vi0}$).


\begin{verbatim}
  * K-shell core hole, S02 estimated by overlap integrals
  HOLE  1   0.0
\end{verbatim}
\end{Card}

\begin{table}[htbp]
  \begin{center}
    \begin{tabular}[h]{|c>{\ttfamily}c|c>{\ttfamily}c|c>{\ttfamily}c|c>{\ttfamily}c|}
      \hline
      index & \textrm{edge} & index & \textrm{edge} & index &
      \textrm{edge} & index & \textrm{edge} \\
      \hline
      0  & NO & 7  & M3 & 14 & N5 & 21 & O5 \\
      1  & K  & 8  & M4 & 15 & N6 & 22 & O6 \\
      2  & L1 & 9  & M5 & 16 & N7 & 23 & O7 \\
      3  & L2 & 10 & N1 & 17 & O1 & 24 & P1 \\
      4  & L3 & 11 & N2 & 18 & O2 & 25 & P2 \\
      5  & M1 & 12 & N3 & 19 & O3 & 26 & P3 \\
      6  & M2 & 13 & N4 & 20 & O4 &    &    \\
      \hline
    \end{tabular}
    \caption[Available hole codes]{Available hole codes. The entries
      in the columns marked edge are written as they are recognized by
      the EDGE card. Index 0, \texttt{NO}, is the no hole option
      described in the \htmlref{NOHOLE}{card:noh} card.}
    \label{tab:holecodes}
  \end{center}
\end{table}


\begin{Card}{POTENTIALS}{ipot   Z   [tag   lmax1   lmax2  xnatph  spinph]}{Standard}{pot}
  The POTENTIALS card is followed by a list which assigns a unique
  potential index to each distinguishable atom. The potential index
  \texttt{ipot} is the index of the potential to be used for the phase shift
  calculation.
  
  The required list entries are the unique potential index
  \texttt{ipot} and the atomic number \texttt{Z}.  The \texttt{tag} is
  at most 6 characters and is used to identify the unique potential in
  the \file{paths.dat} output file.  
  
  The optional list entries 
  \texttt{lmax1} and \texttt{lmax2} are used to limit the angular
  momentum bases of the self-consistent potentials (SCF) and full
  multiple scattering calculations (FMS).  If a negative number (e.g.,
  $\mathtt{lmax1}=-1$) is specified for either \texttt{lmax1} or
  \texttt{lmax2}, {\feff} will automatically use a default based upon the
  atomic number of the species normal lmax(atomic).  

  The next optional entry, \texttt{xnatph}, can be used to specify the
  stoichiometric number of each unique potential in the unit cell of a
  crystalline material. This helps in the calculation of the Fermi
  level. In the case of an infinite solid, $\mathtt{xnatph}=0.01$
  (default value) is a suitable value for the absorbing atom. For
  materials finite in extent, see the example below.

  The last optional entry \texttt{spinph} is used to specify 
  the spin amplitude and relative spin alignment for spin-dependent 
  calculations (see the \htmlref{SPIN}{card:spi} card in this section
  for more information on spin-dependent calculations).  

  The absorbing atom must be given unique potential index 0 (there is an 
  exception to this rule when the \htmlref{CFAVERAGE}{card:cfa} card is 
  used). These unique potential indices are simply labels, so the order is 
  not important, except that the absorbing atom is index 0, and you may not
  have missing indices (i.e., if you use index 3, you must also have
  defined unique potentials 1 and 2).

  To save time, the code calculates the overlapped atom potential for
  each unique potential only once, using the atom with a given unique 
  potential index.
  Thus it is essential that the neighborhood of that sample atom be
  representative.  If it is not, the code may generate inaccurate potentials 
  and phase shifts, as well as poor XAS results.

  It is often useful to assume that the potential for a given shell of
  atoms is the same as that of a previously calculated shell in order
  to save calculation time. For example, in Cu it is a good
  approximation to determine potentials only for the central atom and
  the first shell and to use the first shell potential
  ($\mathtt{ipot}=1$) for all higher shells. Such approximations should
  be checked in each case, however.
\begin{verbatim}
  * molecular SF6  Sulfur K edge, lamx1=default, lmax2=3 (spdf basis)
  POTENTIALS
  *   ipot     Z  tag  lmax1 lmax2  xnatph
       0      16   S    -1     3     1
       1       9   F    -1     3     6
\end{verbatim}
An example of spin-dependent usage can be found in the SPIN card description
in the next section.
\end{Card}


\begin{Card}{S02}{s02}{Standard}{s02}
  The S02 card specifies the amplitude reduction factor $S_0^2$. If
  the entry for $S_0^2$ is less than 0.1, then the value of $S_0^2$ is
  estimated from atomic overlap integrals. Experimental values of
  $S_0^2$ are typically between 0.8 and 1.0.

  Alternatively, you can specify the value of $S_0^2$ in the 
  \htmlref{HOLE}{card:hol} or \htmlref{EDGE}{card:edg} card; however, 
  the meaning of the parameters in the \file{feff.inp} file is more 
  clear if you use the S02 card.
\begin{verbatim}
  * let FEFF calculate S02
  S02    0.0
\end{verbatim}
\end{Card}


\begin{Card}{EXCHANGE}{ixc vr0 vi0 [ixc0]}{Useful}{exc}
  The EXCHANGE card specifies the energy dependent exchange
  correlation potential to be used for the fine structure and for the
  atomic background. 

  \texttt{ixc} is an index specifying the
  potential model to use for the fine structure and the optional
  \texttt{ixc0} is the index of the model to use for the background
  function. 

  The calculated potential can be corrected by adding a
  constant shift to the Fermi level given by \texttt{vr0} and to a
  pure imaginary ``optical'' potential (i.e., uniform decay)
  given by \texttt{vi0}. Typical errors in {\feff}'s self-consistent
  Fermi level estimate are about 1 eV. (The
  \htmlref{CORRECTIONS}{card:cor} card 
  \begin{latexonly}
    in Section~\ref{sec:Comb-contr-from}
  \end{latexonly}
  is similar but allows the user to make small changes in \texttt{vi0}
  and \texttt{vr0} {\it after}  the rest of the calculation is completed,
  for example in a fitting process.)  

  The Hedin--Lundqvist self-energy is used by default and appears to be 
  the best choice for most applications we have tested in detail. The
  partially nonlocal model (ixc=5) gives slightly better results in some
  cases, but has not been tested extensively.

  Another useful exchange model is the Dirac-Hara exchange correlation
  potential with a specified imaginary potential vi0. This may be
  useful to correct the typical error in non-self-consistent estimates of
  the Fermi level of about +3 eV and to add final state and
  instrumental broadening.

  Defaults if the EXCHANGE card is omitted are: \texttt{ixc}=0
  (Hedin--Lundquist), vr0=0.0, vi0=0.0. For XANES, the ground state
  potential (\texttt{ixc0}=2) is used for the background function and
  for EXAFS the Hedin--Lundqvist (\texttt{ixc0}=0) is used.

  Indices for the available exchange models:
  \begin{itemize}
    \tightlist
  \item[ \texttt{0}\quad] Hedin--Lundqvist + a constant imaginary part
  \item[ \texttt{1}\quad] Dirac--Hara + a constant imaginary part
  \item[ \texttt{2}\quad] ground state + a constant imaginary part
  \item[ \texttt{3}\quad] Dirac--Hara + HL imag part + a constant
    imaginary part
  \item[ \texttt{5}\quad] Partially nonlocal: Dirac--Fock for core +
    HL for valence electrons + a constant imaginary part
  \end{itemize}
\begin{verbatim}
  *Hedin-Lundqvist -2eV edge shift and 1eV expt broadening
  EXCHANGE 0 2. 1.

  *Dirac-Hara exchange -3 eV edge shift and 5 eV optical potential
  EXCHANGE 1 3. 5.
\end{verbatim}

\end{Card}


\begin{Card}{NOHOLE}{}{Useful}{noh}
  This card roughly simulates the effect of complete core-hole
  screening. It is useful to test the final state rule for
  calculated XAS, and to compare with other calculations (such as band
  structure or other codes) that do not have a core hole.
  The code will use the final states specified by the \htmlref{HOLE}{card:hol}
  or \htmlref{EDGE}{card:edg} card
  for the matrix element calculation --- the NOHOLE card will cause
  {\feff} to calculate potentials and phase shifts as if
  there is no core-hole. For $d$DOS and $L_{II}$ or $L_{III}$
  absorption calculations, for example,  NOHOLE often gives better
  agreement for white line intensities. Conversely NOHOLE tends to give
  poor XANES intensities for K-shell absorption in insulators.
\end{Card}


\begin{Card}{RGRID}{delta}{Useful}{rgr}
  The radial grid used for the potential and phase shift calculation
  is $$r(i) = \exp(-8.8 + (i-1)\cdot\delta)$$ where $\delta\equiv\mathtt{delta}$. 
  $\delta=0.05$ by default, which is sufficient for most cases. 
  However, occasionally there are convergence problems in the atomic background 
  at very high energies (the background curves upward) and in the phase
  shifts for very large atoms. If such convergence problems are encountered
  we suggest reducing $\delta$ to 0.03 or even 0.01. This will solve
  these problems at the cost of longer computation times (the time is
  proportional to $1/\delta $). This option is also useful for testing
  and improving convergence of atomic background calculations.
\end{Card}
\begin{verbatim}
  * reduce grid for more accurate background at high energy
  RGRID 0.03
\end{verbatim}


\begin{Card}{SCF}{rfms1 [lfms1 nscmt ca nmix]}{Useful}{scf}
  This card controls {\feff}'s automated self-consistent potential
  calculations. Thus all fields except rfms1 are optional.
  If this card is not specified, then all calculations are done with the
  non-self-consistent (overlapped atomic) potential.
  By default \texttt{lfms1}=0, \texttt{nscmt}=30, \texttt{ca}=0.2, and 
  \texttt{nmix}=1.
  \begin{description}
  \item[\texttt{rfms1}]\hfill\\ This specifies the radius of the cluster
    for full multiple scattering during the self-consistency loop.
    Typically one needs about 30 atoms within the sphere specified by
    \texttt{rfms1}. Usually this value is smaller than the value \texttt{rfms}
    used in the \htmlref{FMS}{card:fms} card, but it should be larger than the 
    radius of the second coordination shell.
  \item[\texttt{lfms1}]\hfill\\ The default value 0 is appropriate for
    solids; in this case the sphere defined by \texttt{rfms1} is
    located on the atom for which the density of states is calculated.
    The value 1 is appropriate for molecular calculations and will
    probably save computation time, but may lead to inaccurate
    potentials for solids. When $\mathtt{lfms1} = 1$ the center of the
    sphere is located on the absorbing atom.
  \item[\texttt{nscmt}]\hfill\\ This is the maximum number of iterations
    the potential will be recalculated. A value of 0 leads to
    non-self-consistent potentials and Fermi energy estimates. A value of
    1 also yields non-self-consistent potentials but the Fermi energy is
    estimated more reliably from calculations of the $\ell$DOS.
    Otherwise, the value of \texttt{nscmt} sets an
    upper bound on the number of iterations in the self-consistency
    loop. Usually self-consistency is reached in about 10 iterations.
  \item[\texttt{ca}]\hfill\\ The convergence accelerator factor. This
    is needed only for the first iteration, since {\feff} uses
    the Broyden algorithm to reach self-consistency. A typical value
    is 0.2; however, you may want to try smaller values if there are
    problems with convergence. After a new density is calculated from
    the new Fermi level, the density after the first iteration is
    $$\rho_\mathrm{next} = ca*\rho_\mathrm{new} + (1-ca)*\rho_\mathrm{old}$$ 
    $\mathtt{ca}=1.0$ is extremely unstable and should not be used.
  \item[\texttt{nmix}]\hfill\\ This specifies how many iterations to do 
    with the mixing algorithm before starting the Broyden algorithm.
    The SCF calculations in materials containing f-elements may not converge. 
    We encountered such a
    problem for Pu. However, the SCF procedure converged if we started the
    Broyden algorithm after 10 iterations with the mixing algorithm with
    $\mathtt{ca}=0.05$.  \texttt{nmix} must be between 1 and 30; a value 
    outside of this range will be ignored, and replaced with an acceptable 
    value.
  \end{description}

\begin{verbatim}
  * Automated FMS SCF potentials for a molecule of radius 3.1 Angstroms
  SCF  3.1 1

  * To reach SCF for f-elements and UNFREEZEF we sometimes had to use
  SCF  3.7 0  30  0.05  10
\end{verbatim}
\end{Card}


\begin{Card}{UNFREEZEF}{}{Useful}{unf}
In many applications of $f$-electron
systems, we found that it is usually preferable to freeze the $f$-electron
density at the atomic value in order to achieve well converged
SCF potentials. This is the default in {\feff}8.4. If one still wants
to attempt to calculate the $f$-DOS self-consistently,
as in {\feff}8.00 and 8.10, the UNFREEZEF card should be used.
\begin{verbatim}
  * To include f-electrons in SCF calculations use
  UNFREEZEF 
\end{verbatim}
\end{Card}



\begin{Card}{FOLP}{ipot folp}{Advanced}{fol}
  The FOLP card sets a parameter which determines by what factor the
  muffin-tin radii are overlapped for the specified potential index. 
  We recommend that the \htmlref{AFOLP}{card:afo} 
  card be used (default overlap = 1.15) in cases with severe anisotropy.
  FOLP should be used with caution, for example, for hydrogen or for 
  fitting AXAFS. Typically only values larger than 1 and less than 1.3
  should be used, except for hydrogen atoms, where we recommend
  the value 0.8. The AFOLP card is ignored when FOLP
  is used for a particular potential type.
\begin{verbatim}
  *  +20% overlap of muffin tin with unique potential 1
  *  -20% overlap of muffin tin with unique potential 2
  FOLP 1  1.2    * adjust overlap to fit AXAFS
  FOLP 2  0.8    * use 0.8 for hydrogen
\end{verbatim}
\end{Card}



\begin{Card}{INTERSTITIAL}{inters vtot}{Advanced}{int}
  The construction of the interstitial potential and density may be
  changed by using this card. $\mathtt{inters} = \mathtt{ipot} + 
  2*\mathtt{irav} + 6*\mathtt{irmt}$.
  \texttt{ipot}=1 might be useful when only the surroundings of the absorbing
  atom are specified in \file{feff.inp}. \texttt{irmt} and 
  \texttt{irav} are described only for completeness, and use of nonzero values 
  is strongly discouraged.
  \begin{description}
  \item[\texttt{ipot}]\hfill\\ potential index. \texttt{ipot} defines how to 
    find the interstitial potential. \texttt{ipot}=0 (default): the interstitial 
    potential is found by averaging over the entire extended cluster in 
    \file{feff.inp}. \texttt{ipot}=1 : the interstitial potential is found locally 
    around the absorbing atom.
  \item[\texttt{irav}]\hfill\\ also changes how the interstitial potential
    is found. \texttt{irav}=0 (default): the equation for V$_int$ is constructed 
    at \texttt{rav}=\texttt{rnrm}. \texttt{irav}=1 : at \texttt{rav}=(\texttt{rmt}
    +\texttt{rnrm})/2.
    \texttt{irav}=2 : at rav=rmt, where \texttt{rmt} is the muffin-tin radius and 
    rnrm is the Norman radius.
 irmt apparently does not exist in the code
 \item[\texttt{irmt}]\hfill\\ \texttt{irmt}=0 (default): Norman prescription for mt radii.
   \texttt{irmt}=1 : Matching point prescription for mt radii (do not
   use).
  \item[\texttt{vtot}]\hfill\\ the volume per atom normalized
   by \texttt{ratmin}$^3$ (\texttt{vtot}=(volume per atom)/\texttt{ratmin}$^3$),
    where \texttt{ratmin} is the shortest bond for the absorbing atom. This 
    quantity defines the total volume (needed to calculate the interstitial 
    density) of the extended cluster specified in \file{feff.inp}. If \texttt{vtot} 
    $\leq0$ then the total volume is calculated as a sum of Norman sphere volumes. 
    Otherwise, $total\ volume = \mathtt{nat} * (\mathtt{vtot}*\mathtt{ratmin}^3)$,
    where \texttt{nat} is the number of atoms in an extended cluster. Thus 
    \texttt{vtot}=1.0 is appropriate for cubic structures, such as NaCl. The 
    INTERSTITIAL card may be useful for open systems (e.g. those which have ZnS 
    structure).
  \end{description}

\begin{verbatim}
  * improve interstitial density for ZnS structures.
  * vtot = (unit_cell_volume/number_of_atoms_in_unit_cell)/ratmin**3)=1.54
  INTERSTITIAL  0 1.54
\end{verbatim}
\end{Card}


\begin{Card}{ION}{ipot ionization}{Advanced}{ion}
  The ION card ionizes all atoms with unique potential index
  \texttt{ipot}. Negative values and non-integers are permitted,
  however ionicities larger than 2 and less than $-1$ often yield
  unphysical results. Our experience with charge transfers using the
  SCF card suggests values for \texttt{ionization} about 5--10 times
  smaller than the formal oxidation state. The ION card is probably
  not needed if the potential is self-consistent. However, it can be
  used to put some total charge on a cluster. In this case we suggest
  using the same ionicity for all atoms in the cluster (i.e. total
  ionization divided by number of atoms). For example, for diatomics
  like Br2, the fully relaxed configuration has a formal ionization of
  1 on the scattering atom. Because of charge transfer, the actual
  degree of ionization is much smaller. In non-self-consistent
  calculations the default (non-ionized) scattering potentials are
  often superior to those empirically ionized, and the results should
  be checked both ways. If ION is omitted, the atoms are not ionized 
  by default.
\begin{verbatim}
  * Simulates effective ionization for formal valence state +1
  * ipot, ionization
  ION  1  0.2
\end{verbatim}
\end{Card}


\begin{Card}{SPIN}{ispin [x  y  z] }{Advanced}{spi}
 This card is used to specify the type of spin-dependent calculation 
 for spin along the (x, y, z) direction, along the z-axis by default. 
 The SPIN card is required for the calculation of all spin-dependent effects, 
 including \htmlref{XMCD}{card:xnc} and SPXAS
 \begin{latexonly}
   (see Section~\ref{sec:SPXAS}) 
 \end{latexonly}. 

  Whenever spin-dependent calculations are made, the spin amplitude and 
 relative spin orientation should be specified in the \texttt{spinph} argument
 of the \htmlref{POTENTIALS}{card:pot} card.
 
 If {\feff} has been compiled with the parameter \texttt{nspx}=1 (default), 
 the values of the index \texttt{ispin} correspond to the following calculations:
\begin{table}[htbp]
  \begin{center}
    \begin{tabular}[h]{rl}
      \hline\hline
      \texttt{ispin} & \quad meaning \\
      \hline
      2    & spin-up SPXAS and $\ell$DOS\\
      $-2$ & spin-down SPXAS and $\ell$DOS\\
      1    & spin-up portion of XMCD calculations \\
      $-1$ & spin-down portion of XMCD calculations \\
      \hline\hline
    \end{tabular}
    \caption{Allowed values of the \texttt{ispin} argument of the SPIN card.}
    \label{tab:spin}
  \end{center}
\end{table}

  The default $\mathtt{ispin}=0$ is used for spin-independent calculations.

 If {\feff} is compiled with $\mathtt{nspx}=2$, one simply uses $\mathtt{ispin}=1$ 
 or $\mathtt{ispin}=2$ as needed, and the up and down spins are taken care of 
 automatically.
 \begin{latexonly}
   See Section~\ref{sec:Spin-depend-calc} for more information on 
   the strategies and options available for spin-dependent calculations.
 \end{latexonly}
  
  The spin-dependent potentials are calculated from the spin-dependent 
 densities, using von Barth-Hedin results for the uniform electron gas.
 We use this approximation to construct the spin-dependent muffin-tin potential. 
 This should be fine for EXAFS, where small details of the potential are irrelevant, 
 but may not be good enough in the XANES region, where the self-consistent 
 spin-dependent muffin-tin potential can lead to better results.

\begin{verbatim} 
  * Make spin-up XMCD calculation (XMCD card must also be included)
  SPIN 1
  XMCD
\end{verbatim}

POTENTIALS card for spin-dependent calculations:
\begin{verbatim} 
  * GdFeO, spin-dependent
  * Note that SPIN card must also be present in feff.inp, as well as 
  * additional cards specific to desired calculations
  POTENTIALS
  *  ipot  z  tag  lmax1  lmax2  xnatph  spinph
      0   64   Gd    3      3     0.1     7.0     (c sublattice)     up
      1   26   Fe    2      3     2       4.0     (a sublattice)     up
      2   26   Fe    2      3     3      -4.0     (d sublattice)     down
      3    8   O     2      3     12.0    0.0     (h sublattice)
      4   64   Gd    3      3     2.9     7.0     (c sublattice)     up
\end{verbatim}
\end{Card}


\section{XSPH: Cross-section and Phase Shifts}
\label{sec:Cross-section-phase}


Relativistic dipole matrix elements (alpha form) are calculated using
atomic core and normalized continuum wave functions. Polarization
dependence is optionally incorporated in the dipole-operator.
Scattering phase shifts are determined by matching at the muffin-tin
radius. 

{\feff} is designed to calculate absorption from completely filled
shells. You can try to simulate absorption from valence electrons
with {\feff}, but you may get unreliable results. If you
encounter difficulties and need valence shell absorption, please
contact the authors.%%?? placement?

The $\ell$-projected density of states used to be calculated in this 
module.  This is now done in a separate part of the code, but the LDOS 
card is still described in this section for the sake of simplicity. 
This calculation is of limited quality due to finite cluster calculations 
and neglect of nonspherical corrections.


\begin{Card}{EXAFS}{[xkmax]}{Standard}{exa}
  The EXAFS card is used to change the maximum value of $k$ for EXAFS 
calculations. $k$ is set by \texttt{xkmax}, and the default value is 
20 \AA$^{-1}$. The code can calculate to even higher values, however, 
the user may be prompted to increase dimensions in the file \file{dim.h}
and recompile the code. For high $k$ calculations it might be necessary 
to make smaller steps using the \htmlref{RGRID}{card:rgr} card.
\begin{verbatim}
  *make EXAFS calculation through k=25 Angstroms^-1
  EXAFS 25
\end{verbatim}
\end{Card}


\begin{Card}{XANES}{[xkmax xkstep vixan]}{Standard}{xan}
  The XANES card is used when a calculation of the near edge structure
  including the atomic background and absolute energies is desired. All 
  parameters are optional, and are used to change the output energy mesh
  for the XANES calculation. XANES is not calculated unless the XANES card 
  is present.

  The XANES calculation is currently limited to the (extended) continuum
  spectrum beyond the Fermi level. Thus bound states are not generally
  included; however, in molecules weakly bound states that are below the
  vacuum but above the muffin-tin zero will show up as resonances. The
  absolute energies are based on atomic total energy calculations using 
  the Dirac-Fock-Desclaux atom code. The accuracy of this approximation
  varies from a few eV at low Z to a few hundred eV for very large Z. 

\begin{description}
\item[\texttt{xkmax}]\hfill\\
   The maximum $k$ value of the XANES calculation. If FMS calculations are 
  being made, note that these are not accurate beyond about $k=6$; for 
  larger values of $k$, e.g. $k=20$ with the path expansion, FMS must be 
  turned off. 
\item[\texttt{xkstep}]\hfill\\
  This argument specifies the size of the output $k$ grid far from the edge. 
\item[\texttt{vixan}]\hfill\\
  This argument specifies the energy step of the grid at the edge. 
\end{description}  
  The default values are $\mathtt{xkmax}=8$, $\mathtt{xkstep}=0.07$, and
  $\mathtt{vixan}=0.0$.
%  $\mathtt{vixan}= \gamma_{\mathrm{ch}}/2+\mathtt{vi0}$, where
%  \texttt{vi0} is given by the \htmlref{EXCHANGE}{card:exch} card, described 
%  in Section~\ref{sec:Scatt-potent-modul}.

\begin{verbatim}
  * finer grid for XANES calculation
  XANES  6 0.05 0.3
\end{verbatim}
\end{Card}


\begin{Card}{ELLIPTICITY}{elpty x y z}{Useful}{ell}
  This card is used with the POLARIZATION card 
  \begin{latexonly}
    (see below)
  \end{latexonly}.
  The ellipticity \texttt{elpty} is the ratio of amplitudes of electric
  field in the two orthogonal directions of elliptically polarized
  light. Only the absolute value of the ratio is important for
  nonmagnetic materials. The present code can distinguish left- and
  right-circular polarization only with the XMCD or XNCD cards.
  A zero value of the ellipticity corresponds to linear polarization,
  and unity to circular polarization. The default value is zero.

  \texttt{x}, \texttt{y}, \texttt{z} are coordinates of any nonzero
  vector in the direction of the incident beam. This vector should be
  approximately normal to the polarization vector.
\begin{verbatim}
  * Average over linear polarization in the xy-plane
  ELLIPTICITY  1.0  0.0  0.0  -2.0
\end{verbatim}
\end{Card}


\begin{Card}{MULTIPOLE}{le2 [l2lp]}{Useful}{mul}
  Specifies which multipole transitions to include in the calculations.
The options are: only dipole ($\mathtt{le2}=0$, default), dipole and magnetic dipole ($\mathtt{le2}=1$), dipole and quadrupole ($\mathtt{le2}=2$). 

The additional field \texttt{l2lp} can be used to calculate individual dipolar contributions
coming from $L \rightarrow L+1$ ($\mathtt{l2lp}=1$) and from $L \rightarrow L-1$ 
($\mathtt{l2lp}=-1$). Notice that in polarization dependent data there is also a
cross term, which is calculated only when $\mathtt{l2lp}=0$.
\begin{verbatim}
  MULTIPOLE  2   0  *combine dipole and quadrupole transitions.
  MULTIPOLE  0  -1  *calculate dipolar L -> L-1 transitions
\end{verbatim}
\end{Card}


\begin{Card}{POLARIZATION}{x y z}{Useful}{pol}
  This card specifies the direction of the electric field of the
  incident beam, or the main axis of the ellipse, in the case of
  elliptical polarization. \texttt{x}, \texttt{y}, \texttt{z} are the
  coordinates of the nonzero polarization vector. The \htmlref{ELLIPTICITY}{card:ell}
  card is not needed for linear polarization. If the POLARIZATION
  card is omitted, spherically averaged XAFS will be calculated.

  Note that polarization reduces the degeneracy of the paths,
  increasing the calculation time. Choosing polarization in the
  directions of symmetry axes will result in a faster calculation.
\begin{verbatim}
  POLARIZATION  1.0  2.5  0.0
\end{verbatim}
\end{Card}


\begin{Card}{DANES}{[xkmax xkstep vixan]}{Advanced}{dan}
  To calculate the x-ray scattering amplitude $f'$ instead of absorption $f''$, 
  including solid state effects. Calculates the contribution from the specified
  edge and grid, which is specified as in the \htmlref{XANES}{card:xan} card.
%  This card is still experimental.
\end{Card}
 
\begin{Card}{FPRIME}{emin emax estep}{Advanced}{fpr}
  To calculate ehe x-ray scattering factor $f'$ far from the edge
  (only the atomic part). The energy grid is regular in energy with \texttt{estep} 
  between \texttt{emin} and \texttt{emax}. This is typically needed to find 
  the contributions from edges other than those calculated with the DANES card. 
  Later it may be automated. 
  The total scattering amplitude is $$f'(Q,E) = f_0(Q) + f'(E) +if''(E)$$
  In the dipole approximation $f'$ and $f''$ do not depend on $Q$, but
  this is not true with quadrupole transitions added. This is currently 
  neglected
  and $$f'(E)={\rm DANES(edge)+FPRIME(all\ other\ edges) + (total\ energy\ term\ in\ fpf0.dat)}$$
  $f_0(Q)$ is also tabulated in \file{fpf0.dat};
  $f''$ is printed out by FPRIME and can be used to obtain the total $f'$.
  The total energy correction to $f'$ is given in the first line of
  \file{fpf0.dat} in Cromer-Liberman, and the more accurate Kissel-Pratt 
  form. See our paper on elastic scattering amplitude for references and 
  details.
\end{Card}


\begin{Card}{PLASMON}{ipl}{Advanced}{pla}
  This card runs {\feff} with the multiple-pole self energy.

  The values of the argument \texttt{ipl} correspond to the following:  
  0: run regular feff but print out the self energy; 
  1: run multiple pole self energy without renormalization; 
  2: run multiple pole self energy with renormalization.

  It takes as input \file{exc.dat} which can be formed in the following
  way: 
\begin{enumerate}
  \item Calculate or measure the energy loss spectrum $\epsilon^{-1}$
  \item Use the formula detailed in \file{EpsInvFormula.ps} to calculate $\omega_i$ 
  and f$_i$. Now write three columns in \file{exc.dat}, $\omega_i$, $\gamma_i$, 
  and f$_i$. $\gamma_i$ is irrelevant at this time. Units should be eV.
\end{enumerate}

  The output file \file{sigma.dat} contains the self energy and the renormalization
  constant (at the interstitial radius) as a function of photoelectron energy 
  in eV.

\begin{verbatim}
* make regular FEFF calculations, print out multiple-pole self-energy
PLASMON  0
\end{verbatim}

\end{Card}

 
\begin{Card}{RPHASES}{}{Advanced}{rph}
  If this card is present, real phase shifts rather than complex phase
  shifts will be used. The results of the calculation will not be
  accurate. This option is intended to allow users to obtain real
  scattering phase shifts for use with other programs, or for
  diagnostic purposes. The phase shifts can be written to output
  files \file{phaseNN.dat} using the \htmlref{PRINT}{card:pri} card. 
  If the RPHASES card is present, these will contain the real phase shifts.
\end{Card}


\begin{Card}{RSIGMA}{}{Advanced}{rsi}
  If this card is present, the imaginary part of the self-energy will be 
  neglected. It might be useful for calculations in the XANES region, since 
  the imaginary part of the Hedin-Lundqvist self-energy tends to overestimate 
  losses in this region.
\end{Card}


\begin{Card}{TDLDA}{ixfc}{Advanced}{tdl}
 Uses time-dependent local density approximation (TDLDA) theory 
 to account for screening of the x-ray field and of the 
 photoelectron--core-hole interaction. The parameter \hbox{\texttt{ixfc}} 
 determines whether static or dynamic screening is used. 
 $\mathtt{ixfc}=0$ (static screening) accounts for screening 
 of the x-ray field (but not the field of the core-hole), 
 blue-shifting the spectrum. Thus \hbox{\texttt{TDLDA 0}} 
 works well at high energies. $\mathtt{ixfc}=1$ (dynamic 
 screening) accounts for screening of the x-ray and core-hole 
 fields, blue-shifting the spectrum less than $\mathtt{ixfc}=0$. 
 The TDLDA card affects only module 2.

 TDLDA theory takes into account polarization�type many body 
 effects (i.e., polarization of the electronic charge) which screen 
 the local x-ray field. These effects are most important for x�rays 
 with energies less than 1 keV, hence \hbox{\texttt{TDLDA 0}} works 
 well at high energies. The screened interaction is calculated 
 partially based on the Bethe-Salpeter equation, in the basis of 
 local atomic states. This approximation yields efficient calculations 
 of the spectra in terms of screened transition matrix elements. Note 
 that TDLDA does not account for core-hole relaxation effects.
 
 L-shell x-ray absorption in 3d transition metals is sensitive to dynamic 
 screening effects. For rare-gas solids, dynamic screening accounts for 
 deviations of the $L_{3}$/$L_{2}$ intensity branching ratio from the 2:1 
 value of independent-electron theory.
 
 See the paper on dynamic screening by Ankudinov, Nesvizhskii, and Rehr 
 \begin{latexonly}
 (see the references in Appendix~\ref{sec:Append-C-Refer}) 
 \end{latexonly}
 for further details 
 on the implementation of TDLDA in the {\feff} calculations. See also A.I. 
 Nesvizhskii's thesis, Ch. 8 (pp. 82-105, available on the {\feff}  
 webpage, see \htmladdnormallink{http://feff.phys.washington.edu/}{http://feff.phys.washington.edu/feff/}) for a brief description of the TDLDA theory.

\begin{verbatim}
  * use static screening. this will only impact module 2, XSPH
  TDLDA 0
\end{verbatim}
\end{Card}


\begin{Card}{XES}{emin  emax  estep}{Advanced}{xes}
  To calculate nonresonant x-ray emission spectra (XES) for a specified
  grid. XES may be compared to the occupied DOS.
\end{Card}


\begin{Card}{XMCD or XNCD}{[xkmax xkstep estep]}{Advanced}{xnc}
  Use either of the cards to calculate x-ray circular dichroism
 (the output will contain both magnetic and natural).
 The code calculates XMCD and XNCD from specified edge and grid, specified 
 by auxiliary fields exactly as in the \htmlref{XANES}{card:xan} card.
 
  For nonmagnetic systems only XNCD will be present,
 while for magnetic materials with high symmetry only XMCD is present.
 Both will be present for magnetic materials with low symmetry, and
 x-ray direction (\htmlref{ELLIPTICITY}{card:ell} card) must be used to 
 disentangle the two contributions. The EXAFS region can also be used to 
 determine the position of spins relative to magnetic field. The XMCD card 
 has to be present in \file{feff.inp} for these calculations with {\feff}8.40. 

  The XNCD originates from cross dipole-quadrupole contributions
 for certain nonmagnetic materials, such as special types of crystals.
 It will change sign for opposite direction of propagation (use the 
 ELLIPTICITY card to do this). We performed calculations  for LiIO$_3$ 
 and found results very similar to previous multiple scattering XNCD 
 calculations. XNCD requires that the XANES card also be used.

  The XMCD (dipolar and quadrupolar) does not change sign under the
 change of direction of x-ray propagation, and is zero for nonmagnetic
 systems. The origin of the effect is that due to spin-orbit coupling,
 the right circular polarized light will produce more electrons
 with spin along or opposite to the direction of x-ray propagation.
 Thus it is important to use spin-dependent calculations for XMCD
 calculations. See the \htmlref{SPIN}{card:spi} card
 \begin{latexonly}
 and Section~\ref{sec:Spin-depend-calc}
 \end{latexonly}
 for more details on spin-dependent calculations and an example for XMCD.

  Note that the XMCD signal will only be contained in the output if the 
 {\feff} code has been compiled with $\mathtt{nspx=2}$. For the (default) 
 value $\mathtt{nspx=1}$, you have to combine data from two \file{xmu.dat}
 files. A simple program to do this, \file{spin.f} is available on the {\feff} 
 web site
 \begin{latexonly}
 , and printed in Section~\ref{sec:Spin-depend-calc}, 
 where you can also find more details on the signal extraction process
 \end{latexonly}.

\end{Card}



\begin{latexonly}
  \section{FMS: Full Multiple Scattering}
\end{latexonly}
\begin{htmlonly}
  \section{module FMS: Full Multiple Scattering}
\end{htmlonly}
\label{sec:Full-mult-scatt}

This module carries out a full multiple scattering XANES calculation
for a cluster centered on the absorbing atom. Thus all
multiple-scattering paths within this cluster are summed to infinite
order. This is useful for XANES calculations, but usually cannot be
used for EXAFS analysis. FMS loses accuracy beyond $k =
(l_{\mathrm{max}}+1)/r_{\mathrm{mt}}$, which is typically about 4
\AA$^{-1}$ since the muffin-tin radius $r_{\mathrm{mt}}$ is
typically about 1 \AA.


\begin{Card}{FMS}{rfms  [lfms2 minv toler1 toler2 rdirec]}{Standard}{fms}
  Compute full multiple scattering within a sphere of radius
  \texttt{rfms} centered on the absorbing atom. If the FMS card is not present 
  in \file{feff.inp}, the multiple scattering path expansion is used.
\begin{description}
  \item[\texttt{rfms}]\hfill\\ This is the cluster radius used in all modules 
  but \module{pot}. Specifically, it is used for the $\ell$DOS and FMS, and as the lower 
  limit of pathfinder calculations. The \module{fms} module sums all MS paths within 
  the specified cluster. Typically, a converged XANES calculation requires
  about 50-150 atoms in a cluster, but sometimes more are needed. The number of 
  atoms in this cluster is limited to 175 by default, but one can manually 
  change the dimension parameter \texttt{nclusx} in the ancillary {\feffcur} 
  source code file \file{dim.h} to alter the maximum cluster size. If there 
  are more than \texttt{nclusx} atoms within the specified cluster size, 
  {\feff} will reduce the cluster size and issue a warning.

  For EXAFS analysis, one typically calculates to $k=20$, but FMS results
  are not accurate at high energies. Thus if you are running
  {\feffcur} for EXAFS, you should not use the FMS card.

  If the value of \htmlref{RPATH}{card:rpa} 
  \begin{latexonly}
    as described in Section~\ref{sec:Path-enum-modul}
  \end{latexonly} 
  is greater than \texttt{rfms}, the
  pathfinder will look for paths which extend beyond the cluster used
  for the FMS and add them to the FMS calculation of the $\ell$DOS and
  XANES:
  $$G_{\mathrm{tot}}=G_{\mathtt{fms}} + G_0t_iG_0 +
  G_0t_iG_0t_jG_0+\cdots$$
  where at least one atoms $i$ in the path is outside the FMS cluster
  and the value of RPATH is the maximum half path length for the \module{ldos},
  \module{fms} and \module{path} modules. Note: this approximation may not be 
  accurate and should be used with caution.

  The MS expansion sometimes does not converge well in the XANES energy
  region. Thus one should avoid adding paths for LDOS and XANES, and
  RPATH should be less than \texttt{rfms}. Adding single scattering
  paths only (NLEG 2) usually works well to check the convergence of
  FMS. But adding double scattering (NLEG 3) often leads to very bad
  results in XANES. Thus RPATH is useful for EXAFS or for XANES only
  when the path expansion is stable.

  \item[\texttt{lfms2}]\hfill\\ Optional argument. This is a logical 
  flag that defines how the FMS is done, similar to the flag \texttt{lfms1} 
  in the \htmlref{SCF}{card:scf} card. With the default value of 0 (appropriate 
  for solids), the FMS is calculated for a cluster of size \texttt{rfms}
  around each representative unique potential. With \texttt{lfms}=1
  (appropriate for molecules), FMS is done only once for a cluster of 
  size \texttt{rfms} around the absorbing atom only. The proper use of this 
  flag can lead to a considerable time savings.

  For example, if you calculate FMS for a molecule smaller than 40
  atoms, there is no need to invert $\mathtt{nph}+1$ matrices, and
  $\mathtt{lfms1}=1$ will reduce time for calculations by a factor
  ($\mathtt{nph}+1$), where \texttt{nph} is the number of unique
  potentials listed in the \htmlref{POTENTIALS}{card:pot} card).

  Typically the FMS card will be used with $\mathtt{lfms2}=0$, for example:

\begin{verbatim}
  * for XANES and LDOS need about 100 atom cluster
  FMS  6.0
\end{verbatim}
% removed for the sake of simplicity of example:
%  * usually use rpath < rfms
%  RPATH 8.0    
%  * adds 2 leg paths between 6 and 8 angstroms
%  NLEG  2      


  For molecules of less than 30 atoms of radius 4.0 {\AA} we suggest
  using $\mathtt{lfms2}=\mathtt{lfms1}=1$, as in:
\begin{verbatim}
  SCF 5.0 1 
  FMS  5.0 1
  RPATH  -1
\end{verbatim}

  \item[\texttt{minv}]\hfill\\ Optional. This is an index that defines 
the FMS algorithm used in the calculations. By default, ($\mathtt{minv}=0$)
 the FMS matrix inversion is performed using LU decomposition. However,
several alternatives have been designed for the FMS algorithm that start to
work faster than LU decomposition for clusters of more than 100 atoms.
(See the {\feff}8.2 reference).
We strongly recommend the Lanczos recursion method ($\mathtt{minv}=2$) which is very robust
and speeds the calculations by a factor of 3 or more.
The Broyden algorithm ($\mathtt{minv}=3$) is faster, but less reliable, and 
may fail to converge if the FMS matrix has large eigenvalues.

  \item[\texttt{toler1}]\hfill\\ Optional. This defines the tolerance to stop
recursion and Broyden algorithm. The default value of 0.001 gives results
in agreement with LU decomposition to within a linewidth. 

  \item[\texttt{toler2}]\hfill\\ Optional. Sets the matrix element of the $Gt$ matrix
to zero if its value is less than \texttt{toler2} (default 0.001).

  \item[\texttt{rdirec}]\hfill\\ Optional. Sets the matrix element of the $Gt$ matrix
to zero if the distance between atoms is larger than \texttt{rdirec}.
\end{description}
The last two variables can make the matrix $Gt$ very sparse so both recursion
and Broyden algorithms work faster. For example for large Si calculations
with the Lanczos algorithm, we used:
\begin{verbatim}
  FMS  29.4 0  2  0.001 0.001 40.0
\end{verbatim}
\end{Card}


\begin{Card}{DEBYE}{temp thetad [idwopt]}{Useful}{deb1}

\begin{latexonly}
  See the full description in Section~\ref{sec:Comb-contr-from} for details.
\end{latexonly}
 \begin{htmlonly}
  {\large DEBYE in \module{fms}:}\newline
 \end{htmlonly}  
  The effect of temperature on FMS is approximated by multiplying each free
  propagator by $\exp(-\sigma^2 k^2)$, which gives correct DW
  factors for single scattering. The DW factors for multiple
  scattering are not exact, but their contribution is reduced both by
  thermal factors and by the mean free path. Also if you are running
  the \module{fms} module, then you can only obtain XANES, where this approximate
  treatment of thermal effects is probably adequate.

 \begin{htmlonly}
  {\large DEBYE in \module{ff2x}:}\newline
  The DEBYE card is used to calculate Debye--Waller factors for each
  path using the correlated Debye Model. The model is best suited for
  homogeneous systems, where it is quite accurate. CAUTION: in
  heterogeneous systems the model only gives approximate values which
  can easily be off by factors of two or more. If this card is present, 
  the correlated Debye model Debye--Waller factors will be summed with the 
  DW factors from the \htmlref{SIG2}{card:sig} card and from the \file{list.dat} 
  file, if present. Note that the DEBYE card is currently incompatible with the 
  \htmlref{CFAVERAGE}{card:cfa} card for options other than the correlated Debye 
  model (\texttt{idwopt} $>$ 0). Temperatures are specified in kelvin.

\begin{verbatim}
  *Debye-Waller factors for Cu at 190K with correlated Debye Model
  DEBYE  190 315
\end{verbatim}

  By default, \texttt{idwopt}=0 specifies that the correlated Debye model 
  is used to calculate EXAFS Debye--Waller factors. Two additional models for
  calculating DW factors are available in {\feffcur} based on the information
  about the harmonic force constants in the material. \texttt{idwopt}=1
  means the equation of motion (EM) method is used to get Debye--Waller
  factors and \texttt{idwopt}=2 means the recursion method (RM) which
  is an improved correlated Einstein model. Both methods are faster than 
  molecular dynamics simulations, and the recursion method is much faster 
  than the equation of motion method. However, the equation of motion method 
  leads to somewhat more accurate results than the recursion method. These 
  additional methods seem to be superior to the correlated Debye model in cases 
  with tetrahedral coordination, such as solid Ge and many biological materials. 
  Both EM and RM methods need additional input (the force constants) and a 
  complete description of both is given in Anna Poiarkova's thesis (see the 
  {\feff} project web site, \htmladdnormallink{http://feff.phys.washington.edu/feff/}{http://feff.phys.washington.edu/feff/Docs/Docs.html}) 
  and in the associated documentation.

\begin{verbatim}
  * Calculate Debye-Waller factors for Cu at 190K with equation of motion
  DEBYE  190 0 1
\end{verbatim}
 \end{htmlonly}

\end{Card}


\section{PATHS: Path Enumeration}
\label{sec:Path-enum-modul}

The code uses a constructive algorithm with several path importance
filters to explore all significant multiple-scattering paths in order
of increasing path length. The paths are determined from the list of
atomic coordinates in \file{feff.inp}. An efficient degeneracy
checker is used to identify equivalent paths (based on similar
geometry, path reversal symmetry, and space inversion symmetry). To
avoid roundoff errors, the degeneracy checker is conservative and
occasionally treats two degenerate paths as not degenerate.
These errors occur in the third or fourth decimal place (less than
0.001 Ang) but are fail-safe; that is, no paths will be lost. All 
paths which are completely inside the FMS cluster are automatically 
excluded from the paths list, if specified by the \htmlref{FMS}{card:fms} 
card.

The criteria used in filtering are based on increasingly accurate
estimates of each path's amplitude. The earliest filters, the
pathfinder heap and keep filters, are applied as the paths are being
searched for. A plane wave filter, based on the plane wave approximation
(plus a curved wave correction for multiple-scattering paths) and
accurate to about 30\%, is applied after the paths have been enumerated
and sorted. Finally, an accurate curved wave filter is applied to
all remaining paths.


\begin{Card}{RPATH}{rpath}{Standard}{rpa}
  The RPATH card determines the maximum effective (half-path)
  distance, \texttt{rpath}, of a given path. RPATH is equivalent to
  the RMAX card in the {\feff}7 code. We changed the name because it provides
  a clearer distinction between the max distance in the MS path expansion
  and that for FMS calculations.
  Typically \texttt{rpath} is needed for EXAFS calculations only to
  set limits on the number of calculated paths. Note that
  \texttt{rpath} is one-half of the total path length in
  multiple-scattering paths. Setting this too large can cause the
  heap in the pathfinder to fill up. Default is \texttt{rpath} = 2.2
  times the nearest neighbor distance. Since the multiple scattering
  expansion is unstable close to the absorption edge, the path (MS)
  expansion should be used only for EXAFS calculations or for
  diagnosing the XANES or $\ell$DOS calculations. If you use FMS for XANES
  calculations, better results are obtained without the MS
  contribution. For EXAFS analysis this card is extremely useful,
  since it cuts off long paths which contribute only at high
  R values in R-space.
\begin{verbatim}
  * include MS paths with effective length up to 5.10 Ang
  RPATH     5.10
\end{verbatim}
\end{Card}


\begin{Card}{NLEG}{nleg}{Useful}{nle}
  The NLEG card limits the number of legs of each scattering path to
  \texttt{nleg}. If \texttt{nleg} is set to 2, only single scattering
  paths are found. The default is nleg = 8.

\begin{verbatim}
  * only single scattering paths (i.e. 2 legged paths)
  NLEG 2
\end{verbatim}
\end{Card}


\begin{Card}{PCRITERIA}{pcritk pcrith}{Advanced}{pcr}
  These criteria, like those described in the CRITERIA card, also
  limit the number of paths. However, they are applied in the
  pathfinder and eliminate unimportant paths while the pathfinder is
  doing its search. The pathfinder criteria do not know the
  degeneracy of a path and are therefore much less reliable than the
  curved wave and plane wave criteria in the \htmlref{CRITERIA}{card:cri} 
  card below. These path finder criteria (keep and heap) are turned off 
  by default, and we recommend that they be used only with very large
  runs, and then with caution.

  The keep-criterion \texttt{pcritk} looks at the amplitude of $\chi$ (in the plane wave
  approximation) for the current path and compares it to a single scattering
  path of the same effective length. To set this value, consider the
  maximum degeneracy you expect and divide your plane wave criterion
  by this number. For example, in fcc Cu, typical degeneracies are
  196 for paths with large r, and the minimum degeneracy is 6. So a
  keep criterion of 0.08\% is appropriate for a pw criteria of 2.5\%.

  The heap-criterion \texttt{pcrith} filters paths as the pathfinder 
  puts all paths into a heap (a partially ordered data structure), then 
  removes them in order of increasing total path length. Each path that 
  is removed from the heap is modified and then considered again as part 
  of the search algorithm. The heap filter is used to decide if a path has
  enough amplitude in it to be worth further consideration. If a path can
  be eliminated at this point, entire trees of derivative paths can
  be neglected, leading to enormous time savings. This test does not
  come into play until paths with at least 4 legs are being
  considered, so single scattering and triangular (2 and 3 legged)
  paths will always pass this test. Because only a small part of a
  path is used for this criterion, it is difficult to predict what
  appropriate values will be. To use this (it is only necessary if
  your heap is filling up, and if limiting rpath doesn't help), study
  the results in \file{crit.dat} from runs with shorter rpath and experiment
  with the heap criterion accordingly. In the future, we hope to
  improve this filter.

  Before using these criteria, study the output in the file
  \file{crit.dat} (use print option 1 for \module{path}
  \begin{latexonly}
    , see Table~\ref{tab:printlevels}
  \end{latexonly}
  ), 
  which has the values of \texttt{critpw}, keep criterion, and heap criterion 
  for all paths which pass the \texttt{critpw} filter.

  Default: If this card is omitted, the keep and heap criteria are set
  to zero, that is, no filtering will be done at this step in the
  calculation.

\begin{verbatim}
  * fcc Cu had degeneracies from 6 to 196, so correct for this by
  * dividing pw-crit of 2.5% by 30 to get 0.08 for keep crit. Check this
  * empirically by running with pcrits turned off and studying crit.dat.
  * After studying crit.dat, choose 0.5 for heap crit.
  PCRITERIA   0.08  0.5
\end{verbatim}
\end{Card}


\begin{Card}{SS}{index ipot deg rss}{Advanced}{ss}
  The SS card can {\it only} be used with the \htmlref{OVERLAP}{card:ove} card
  when the atomic structure is unknown, but the distance and coordination
  numbers are known, and one wants to generate an approximate EXAFS 
  contribution. Thus the pathfinder cannot be used in this
  case. Instead, the user has to specify explicitly the single
  scattering paths and their degeneracy. The OVERLAP card must be used
  to construct the potentials for use with the SS card. The
  parameters are:
\begin{description}
\item[\texttt{index}]\hfill\\
  The shell index and label used for the \file{feffNNNN.dat} file name.
\item[\texttt{ipot}]\hfill\\
  The unique potential index identifying the unique potential 
  of the scattering atom.
\item[\texttt{deg}]\hfill\\
  The degeneracy (or multiplicity) of the single scattering path.
\item[\texttt{rss}]\hfill\\ 
  The distance to the central atom.
\end{description}
  This information is used to write the file \file{paths.dat} and is not
  needed when the \htmlref{ATOMS}{card:ato} card is used. To generate single
  scattering paths with ATOMS, use \htmlref{NLEG}{card:nle} 2.
\begin{verbatim}
  *  index  ipot   deg  rss    generate single scattering results
  SS   29     1     48  5.98       parameters for 19th shell of Cu
\end{verbatim}
\end{Card}


\section{GENFMT: XAFS Parameters}
\label{sec:Calc-contr-from}

For each path the code calculates, the effective scattering amplitude
($F_{\mathrm{eff}}$, from which {\feff} gets its name
\begin{latexonly}
  , see Section~\ref{sec:Vari-EXAFS-form}
\end{latexonly}
) and the total scattering phase
shift along with other XAFS parameters using the scattering matrix
algorithm of Rehr and Albers. Once the scattering phase shifts and
the paths are determined, no other input is necessary for this
calculation.


\begin{Card}{CRITERIA}{critcw critpw}{Useful}{cri}

  Since the number of multiple scattering paths gets large very
  quickly, it is necessary to eliminate as many paths as possible.
  Fortunately, we have found that most multiple scattering paths have
  small amplitudes and can be neglected. Various cutoff criteria
  are used in {\feffcur} to limit the number of paths to consider. These
  criteria are based on the importance of the path, defined as the
  integral over the full energy range of $\chi(k)\cdot\mathtt{dk}$.
  Very close to the edge these cutoff criteria should be examined
  with care and in some cases reduced from the values used for EXAFS.
 \begin{description}
  \item[\texttt{critcw}]\hfill\\ 
  This is the cutoff for a full curved wave calculation. A
  typical curved wave calculation requires a complete spherical wave
  calculation, which typically takes seconds of CPU time per path.
  The default value of \texttt{critcw} is 4\%, meaning that any path
  with mean amplitude exceeding 4\% of the largest path will be used in
  the calculation of $\chi$. The criterion \texttt{critcw} is used by 
  \module{genfmt}.
  Since the XAFS parameter calculation is already done, the savings is
  not in computation time, but in disk space and ease of analysis. The
  values of critcw for each path are written in the file \file{list.dat}
  written by module \module{genfmt}.

  \item[\texttt{critpw}]\hfill\\ 
  This is a plane-wave approximation to $\chi$. This is
  extremely fast to calculate, and is used in the pathfinder. The
  default value of critpw is 2.5, meaning that any path with mean
  amplitude exceeding 2.5\% of the largest path, including degeneracy 
  factors, (in plane wave approximation) will be kept. Any path that does 
  not meet this criterion will not be written to \file{paths.dat}, and 
  there is no need to calculate the XAFS parameters for this path. The
  default for \texttt{critpw} is less than that for \texttt{critcw}
  since some paths are more important when the full curved wave
  calculation is done than they appear in the plane wave
  approximation. Since the plane wave estimate is extremely fast, use
  this to filter out as many paths as you can. The file
  \file{crit.dat} (written by the module \module{path}) tells you
  \texttt{critpw} for each path that passes the criterion.
 \end{description}
  The method of calculation of these importance factors has been
  improved for {\feffcur}, so don't worry if the values for
  some paths have changed slightly from previous versions. (Default
  values critcw=4\% critpw=2.5\%)

\begin{verbatim}
  CRITERIA  6.0  3.0   * critcw 6%, critpw 3%
  CRITERIA  0    0     * use all paths (cw and pw criteria turned off)
\end{verbatim}
\end{Card}




\begin{Card}{IORDER}{iord}{Advanced}{ior}
  Order of the approximation used in module \module{genfmt}. {\feff} uses
  order 2 by default, which is correct to terms of order $1/(pR)^2$,
  and corresponds to 6x6 scattering matrices in the Rehr--Albers
  formalism. Single scattering is calculated exactly to this order.
  The 6x6 approximation is accurate to within a few percent in every
  case we have tried (that is, higher order doesn't change the result
  more than a few percent). However $M_{\mathit{IV}}$ shells and
  higher shells may require increased iorder for coupling the matrix
  elements. Changing the default values requires some familiarity
  with the Rehr--Albers paper and the structure of the module \module{genfmt}.
  To do so, follow the instructions in the {\feff} source code in
  subroutine \texttt{setlam}. The key \texttt{iord} is passed to
  \texttt{setlam} for processing. You may need to change the code
  parameter \texttt{lamtot} if you want to do higher order
  calculations. For details of the algorithm used by \module{genfmt}, see the
  paper by J.J.\ Rehr and R.C.\ Albers
  \begin{latexonly}
    (see the references in Appendix~\ref{sec:Append-C-Refer})
  \end{latexonly}
  . For the
  $M_{\mathit{IV}}$ and higher edges, you may receive an error
  message like: \texttt{Lambda array overfilled}. In that case the
  calculations should be repeated with IORDER -70202 (10x10 matrices).
\begin{verbatim}
  * change iorder for M4 calculations
  IORDER -70202
\end{verbatim}
\end{Card}


\begin{Card}{NSTAR}{}{Advanced}{nst}
  When this card is present, \module{genfmt} will write the file
  \file{nstar.dat} with the effective coordination number $N^\star$
  which is the coordination number weighted by $\cos^2(\theta)$ to
  correct for polarization dependence in SEXAFS calculations.
\end{Card}




\section{FF2X: XAFS Spectrum}
\label{sec:Comb-contr-from}

The module \module{ff2x} constructs the XAS spectrum $\chi(k)$ or $\mu$ using the
XAFS parameters
\begin{latexonly}
  described in Section~\ref{sec:Vari-EXAFS-form} 
\end{latexonly}
from one or more paths, including any FMS contributions.
Single and multiple scattering Debye--Waller
factors are calculated using, for example, the correlated Debye model.
Output from this module is the total XAFS spectrum and optionally, the
contribution to the XAFS from each path individually. Numerous
options for filtering, Debye--Waller factors, and other corrections are
available.


\begin{latexonly}
\begin{Card}{DEBYE}{temperature  Debye-temperature [idwopt]}{Standard}{deb2}
  The DEBYE card is used to calculate Debye--Waller factors for each
  path using the correlated Debye Model. The model is best suited for
  homogeneous systems, where it is quite accurate. CAUTION: in
  heterogeneous systems the model only gives approximate values which
  can easily be off by factors of two or more. If this card is present, 
  the correlated Debye model Debye--Waller factors will be summed with the 
  DW factors from the \htmlref{SIG2}{card:sig} card and from the \file{list.dat} 
  file, if present. Note that the DEBYE card is currently incompatible with the 
  \htmlref{CFAVERAGE}{card:cfa} card for options other than the correlated Debye 
  model ($\mathtt{idwopt} > 0$). Temperatures are specified in kelvin.

\begin{verbatim}
  *Debye-Waller factors for Cu at 190K with correlated Debye Model
  DEBYE  190 315
\end{verbatim}

  By default, $\mathtt{idwopt}=0$ specifies that the correlated Debye model 
  is used to calculate EXAFS Debye--Waller factors. Two additional models for
  calculating DW factors are available in {\feffcur} based on the information
  about the harmonic force constants in the material. $\mathtt{idwopt}=1$
  means the equation of motion (EM) method is used to get Debye--Waller
  factors and $\mathtt{idwopt}=2$ means the recursion method (RM) which
  is an improved correlated Einstein model. Both methods are faster than 
  molecular dynamics simulations, and the recursion method is much faster 
  than the equation of motion method. However, the equation of motion method 
  leads to somewhat more accurate results than the recursion method. These 
  additional methods seem to be superior to the correlated Debye model in cases 
  with tetrahedral coordination, such as solid Ge and many biological materials. 
  Both EM and RM methods need additional input (the force constants) and a 
  complete description of both is given in Anna Poiarkova's thesis (see the 
  {\feff} project web site, \htmladdnormallink{http://feff.phys.washington.edu/feff/}{http://feff.phys.washington.edu/feff/Docs/Docs.html}) 
  and in the associated documentation.

\begin{verbatim}
  * Calculate Debye-Waller factors for Cu at 190K with equation of motion
  DEBYE  190 0 1
\end{verbatim}

\end{Card}
\end{latexonly}


\begin{Card}{CORRECTIONS}{vrcorr vicorr}{Useful}{cor}
  The real energy shift \texttt{vrcorr} moves $E_0$ in the final $\chi(k)$ and the
  imaginary energy shift \texttt{vicorr} adds broadening to the result. The real
  energy shift is useful to correct the error in {\feff}'s Fermi
  level estimate and the imaginary part can be used to correct
  for experimental resolution or errors in the core-hole lifetime.
  This error in the Fermi level is typically about 1 eV with self-consistent
  calculations and about 3 eV with overlapped atom potentials. The imaginary
  energy is typically used to correct for instrument broadening or as
  a correction to the mean free path calculated by {\feff}. This
  affects only the module \module{ff2x}, which combines the results in all of
  the \file{feffNNNN.dat} files. This card is useful in fitting loops
  because you can simply make such energy corrections and see the results
  without redoing the entire XAFS parameter calculation. CAUTION: the
  results are not as accurate as those obtained with the EXCHANGE card.
  Both energies are in eV.
  (See also the \htmlref{EXCHANGE}{card:exc} card
  \begin{latexonly}
    in Section~\ref{sec:Scatt-potent-modul}
  \end{latexonly}
  ).
\begin{verbatim}
  * Reduce E0 by 3.0 eV and add 1 eV of broadening (full width)
  * This will only affect module ff2x
  CORRECTIONS   3.0   1.0       real shift, imag shift
\end{verbatim}
\end{Card}


\begin{Card}{SIG2}{sig2}{Useful}{sig}
  Specify a global Debye--Waller factor to be used or added to
  Debye--Waller calculations (see the \htmlref{DEBYE}{card:deb2} card) for all paths. This
  value will be summed with the correlated Debye model value (if the
  DEBYE card is present) and any value added to \file{list.dat}. Units are
  \AA$^2$. This card can be used, for example to add Debye--Waller
  factors from structural disorder.

\begin{verbatim}
  SIG2 0.001    add 0.001 globally to all DW factors
\end{verbatim}
\end{Card}


\section{Optional Modules}
\label{sec:Opt-modul}
  These modules run only if certain cards are specified, and so are not 
  relevant to all calculations made with {\feff}.


%\begin{latexonly}
%\subsection{SCREEN: Core-hole Screening?}
%\label{sec:Ldos-modul}
%\end{latexonly}

%\begin{Card}{SCREEN}{}{Advanced}{scr}
% placeholder--currently still called NOHOLE 2, need desc.
%\end{Card}


\begin{latexonly}
\subsection{LDOS: $\ell$-projected Density of States}
\label{sec:Ldos-modul}
\end{latexonly}


\begin{Card}{LDOS}{emin   emax   eimag}{Useful}{ldo}
  To obtain the $\ell$DOS you need only run the \module{pot} module first 
  to produce 
  the file \file{pot.bin}
  \begin{latexonly}
    (this can be accomplished using the CONTROL card from 
    Section~\ref{sec:Main-Control-Cards})
  \end{latexonly}.
  The calculations are made in a separate program, which will run as 
  long as the LDOS card appears in \file{feff.inp}.

  The angular momentum projected density of states is placed by
  default on a standard grid currently fixed at 84 points. \texttt{emin} and
  \texttt{emax} are the minimum and maximum energies of the $\ell$DOS
  calculation and \texttt{eimag} is the imaginary part of potential
  used in the calculations. This is equivalent to Lorentzian broadening 
  of the $\ell$DOS with half-width = \texttt{eimag}. If \texttt{eimag} 
  is negative, the code automatically sets it to be 1/3 of the energy 
  step. The output will be written in \file{ldosNN.dat} files. 
  If 84 points are not
  enough, you can divide the energy range by 2 and run the code twice.
  The LDOS card is very useful when examining densities of states for
  interpreting XANES or when the self-consistency loop fails or gives
  very strange results. For crystals our $\ell$DOS will always
  be broadened due to the effect of finite cluster size.
\begin{verbatim}
  *     emin emax eimag
  LDOS  -20  20   0.2
\end{verbatim}
\end{Card}


\begin{latexonly}
\subsection{SO2CONV: Spectral Function Convolution}
\label{sec:So2c-modul}
\end{latexonly}

\begin{Card}{SO2CONV}{}{Useful}{s02c}
  SO2CONV will convolute the single particle XAS files (\file{xmu.dat}, 
  \file{chi.dat}, \file{feffNNNN.dat}, etc.) from {\feff} with a many 
  body spectral function, to include many body effects in the spectra. 
  This includes an ab-initio calculation of the amplitude reduction 
  factor S$_0^2$. SO2CONV uses Hedin-Lundqvist self energies, so it 
  will probably work best with XAS files calculated using {\feff}'s 
  HL self energies.
\begin{verbatim}
SO2CONV
\end{verbatim}
\end{Card}


\begin{Card}{SELF}{}{Useful}{sel}
  Print out on-shell self energy as calculated by this module.
\begin{verbatim}
SELF
\end{verbatim}
\end{Card}


\begin{Card}{SFSE}{k0}{Useful}{sfs}
Print out off shell self energy $\sigma(k0,E)$.
\begin{verbatim}
SFSE
\end{verbatim}
\end{Card}



\subsection{EELS: Electron Energy Loss Spectrum}
\label{sec:Eels-modul}
  This module assembles an EELS spectrum as specified by the cards ELNES 
  and EXELFS. Since these cards provide all needed parameters, one of 
  these cards must be specified in \file{feff.inp} in order to run this 
  module and obtain the EELS spectrum. See Section~\ref{sec:EELS} for a
  more complete description of EELS calculations.

\begin{Card}{ELNES}{[xkmax xkstep vixan]}{Standard}{eln}
\texttt{E [aver [cross [relat]]]}\\% : beam energy in keV; optional parameters
\texttt{kx} \texttt{ky} \texttt{kz}\\% : beam direction in the crystal frame
$\mathtt{\beta}$ $\mathtt{\alpha}$\\% : collection semiangle, convergence semiangle (in mrad)
\texttt{nr} \texttt{na}\\% : q-integration mesh : radial size, angular size
\texttt{dx} \texttt{dy}% : position of the detector (x,y angle in mrad)

\begin{description}
  \item[\texttt{xkmax}]\hfill\\ 
    The maximum k-value for the calculation. \texttt{xkmax}, \texttt{xkstep} 
    and \texttt{vixan} are exactly the same parameters as those used for the 
    \htmlref{XANES}{card:xan} and \htmlref{EXAFS}{card:exa} cards.

  \item[\texttt{xkstep}]\hfill\\ 
    The step size of the upper part of the k-mesh
  \item[\texttt{vixan}]\hfill\\ 
    The step size of the lower part of the k-mesh
  \item[\texttt{E}]\hfill\\ 
    energy of the electron beam in keV (typical values are 100-400 keV);
  \item[\texttt{aver}]\hfill\\ 
    index 1: calculate orientation averaged spectrum (e.g., a polycrystalline 
    sample, working at the magic angle) ; 0 to use specific sample to beam 
    orientation (default);
  \item[\texttt{cross}]\hfill\\
    1: use cross terms for the cross section (e.g., xy or yx ; default); 0: use 
    only direct terms (eg., atom coordinates entered in symmetric coordinate 
    frame ; assumed as default if aver is set to 1);
  \item[\texttt{relat}]\hfill\\ 
    1 (default): to use relativistic formula for the cross-section (default, 
    always recommended) ; 0 to use nonrelativistic formula (for checking against
    old results ; does not save any time!);
  \item[\texttt{kx,ky,kz}]\hfill\\ 
    wave vector of the incoming electron in the crystal frame (i.e., the 
    Cartesian coordinate system in which the atom positions of the
    \htmlref{ATOMS}{card:ato} card are given); in arbitrary units (only the 
    direction, not the size of k is used). This line should be present for 
    orientation-sensitive calculations, and absent for averaged calculations.
  \item[$\mathtt{\beta}$]\hfill\\
    the collection semiangle of the EELS detector in mrad (typical values are of
    the order of 1 mrad);
  \item[$\mathtt{\alpha}$]\hfill\\ 
    The convergence semiangle of the incoming beam in mrad (typical values are on
    the order of 1 mrad); 
  \item[\texttt{nr}, \texttt{na}]\hfill\\
    The cross section is integrated over the values of q allowed by $\alpha$ 
    and $\beta$; the integration grid consists of nr concentric circles sampling 
    a disc of radius $\alpha$ + $\beta$; circle i contains $\mathtt{na}*(2\mathtt{i}-1)$ 
    points, making for $\mathtt{nr}*\mathtt{nr}*\mathtt{na}$ points in total 
    (this is a nonphysical parameter and should be converged; typical would be, 
    e.g., 50, 1; the integration is quite fast ; only for small values of nr is it 
    necessary to increase \texttt{na} above 1);
  \item[\texttt{dx}, \texttt{dy}]\hfill\\ 
    The position of the detector in the scattering plane, specified by angles 
    in mrad along the x and y axes (the same as used in the ATOMS card) (typical 
    values are 0.0, 0.0)
\end{description}

The line giving beam orientation must only be present 
when an oriented spectrum is calculated.

\end{Card}

\begin{Card}{EXELFS}{xkmax}{Standard}{exe}
\texttt{E [aver [cross [relat]]]} : beam energy in keV; optional 
parameters\\
\texttt{kx} \texttt{ky} \texttt{kz} : beam direction in 
the crystal frame\\
$\mathtt{\beta}$ $\mathtt{\alpha}$ : collection semiangle, 
convergence semiangle (in mrad)\\
\texttt{nr} \texttt{na} : q-integration mesh : radial size, 
angular size\\
\texttt{dx} \texttt{dy} : position of the detector (x,y angle in 
mrad)

See the ELNES card for a full description of these 
parameters.  Note that \texttt{xkmax}, the maximum k value, is the only 
parameter immediately following the EXELFS card, unlike ELNES.

The following example simulates an experiment with a 300 keV beam 
hitting the sample along the y-axis. The detector is set in the 
forward direction and has a 2.4 mrad (semi-)opening; the width of 
the incoming beam is 0 mrad. To do the integration over the detector 
aperture, $5*5*3=75$ points are used. The calculation is relativistic 
and takes sample to beam orientation into account. Default settings 
are used for the energy/k-mesh.

\begin{verbatim}
ELNES # calculate elnes.
300 # beam energy in keV
0 1 0 # beam direction in the crystal frame
2.4 0.0 # collection semiangle, convergence semiangle (in mrad)
5 3 # q-integration mesh : radial size, angular size
0.0 0.0 # position of the detector (x,y angle in mrad)
\end{verbatim}
\end{Card}


\begin{Card}{MAGIC}{emagic}{Useful}{mag}
%%Currently, there is only one additional new card : the MAGIC card.
%%
  The MAGIC card makes {\feff} calculate cross sections as a function of 
  collection angle at a particular energy loss. So, in addition to the 
  energy-resolved output produced by the EELS cards, the MAGIC card produces 
  angle-resolved output.

  The name MAGIC was chosen because the output of this card enables one to 
  find the magic angle for a material very quickly : run {\feff} for two 
  different orientations, and see where the sp$^2$-curves cross. This gives 
  you the magic collection angle for the collection angle and EELS edge chosen 
  in \file{feff.inp}. 

\begin{verbatim}
* create a plot that shows the sp^2 ratio at 20 eV above threshold.
MAGIC 20
\end{verbatim}
\end{Card}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{latexonly}% ends at end of doc

\chapter{Input and Output Files}
\label{sec:Input-and-Output-Files}

Other files required by the various modules are created by {\feff}
from \file{feff.inp}. Some of these other files may be edited by the
user as a way to modify the input data to the modules, see
Section~\ref{sec:Addit-progr-contr}. See the \htmlref{PRINT}{card:pri} card in
Section~\ref{sec:Main-Control-Cards} to obtain various diagnostic
files. Section~\ref{sec:File-structure-code} summarizes this
structure, the rest of this section describes the structure in more
detail.


\section{Module Input and Output Files}
\label{sec:File-structure-code}

\begin{description}
  %%
  %% Module 0
\item[\large\textbf{Module 0}]\dotfill\  {\large\module{rdinp}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Read input data
  \item[\textbf{Input files:}] \file{feff.inp}
  \item[\textbf{Output files:}] \file{geom.dat}, \file{global.dat},
       \file{modN.inp} (N=1-6), and \file{eels.inp}
  \item[\textbf{Other output:}] \file{paths.dat} (only if the SS card is used)
  \item[\textbf{Description:}] Reads the \file{feff.inp} file, makes
    appropriate operations on the data, and writes the resulting
    information into several output files, which
    contain formatted data needed for all modules.
  \end{description}
  %%
  %% Module 1
\item [\large\textbf{Module 1}]\dotfill\  {\large\textrm{POT}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate embedded atomic
    potentials for the photoelectron
  \item[\textbf{Input files:}] \file{mod1.inp} and \file{geom.dat}
  \item[\textbf{Output files:}] \file{pot.bin}
  \item[\textbf{Other output:}] diagnostic files (see
    Table~\ref{tab:printlevels} on page \pageref{tab:printlevels})
  \item[\textbf{Description:}] Reads \file{mod1.inp} and calculates potentials
    for the photoelectron, which are written into \file{pot.bin}.
    Optionally, \module{pot} will write other diagnostic files with information
    about the potentials.
  \end{description}
  %%
  %% Module 2
\item [\large\textbf{Module 2}]\dotfill\  {\large\module{xsph}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate cross-section and phase
    shifts
  \item[\textbf{Input files:}] \file{mod2.inp}, \file{geom.dat},
    \file{global.dat} and \file{pot.bin}
  \item[\textbf{Output files:}] \file{phase.bin}, and \file{xsect.bin},
  \item[\textbf{Other output:}] diagnostic files (see
  Table~\ref{tab:printlevels} on page \pageref{tab:printlevels}),
    and \file{axafs.dat}.
  \item[\textbf{Description:}]  \module{xsph} writes the binary file
    \file{phase.bin}, which contains the scattering phase shifts and
    other information needed by \module{path} and \module{genfmt}. 
    The  atomic  cross-section data is written in \file{xsect.bin} and
    used in the final module (\module{ff2x}) for overall normalization.
    Optionally, \module{xsph} will write other diagnostic files with 
    information about the phase shift calculations.

    If an \htmlref{ELNES}{card:eln}/\htmlref{EXELFS}{card:exe} card is 
    present, the polarization tensor is set to the unit matrix before 
    proceeding. A message is written to \file{log2.dat}.
  \end{description}
  %%
  %% Module 3
\item [\large\textbf{Module 3}]\dotfill\  {\large\module{fms}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate full multiple
  scattering for XANES and $\ell$DOS
  \item[\textbf{Input files:}] \file{mod3.inp}, \file{global.dat},
     \file{geom.dat}, and \file{phase.bin}, 
  \item[\textbf{Output files:}] \file{fms.bin}
  \item[\textbf{Other output:}]
  \item[\textbf{Description:}]  Performs the full multiple scattering
    algorithm.
    Writes output into \file{fms.bin} for the \module{ff2x} module, which
    contains the $\chi(k)$ from \module{fms}.

    If an ELNES/EXELFS card is present, all of the requested components 
    of the sigma tensor are written to \file{fms.bin}, instead of just one. 
    This is fully compatible with non-EELS calculations.
  \end{description}
  %%
  %% Module 4
\item [\large\textbf{Module 4}]\dotfill\  {\large\module{path}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Path enumeration
  \item[\textbf{Input files:}] \file{mod4.inp}, \file{geom.dat},
     \file{global.dat} and \file{phase.bin}
  \item[\textbf{Output files:}] \file{paths.dat}
  \item[\textbf{Other output:}] \file{crit.dat}
  \item[\textbf{Description:}] \module{path} writes \file{paths.dat} for use 
    by \module{genfmt} and as a complete description of each path for use of 
    the user. \module{path} will optionally write other diagnostic files. 
    The file \file{crit.dat} is particularly useful when studying 
    large numbers of paths. When studying large numbers of paths, 
    this module will optionally write only \file{crit.dat} and 
    not \file{paths.dat}.

    If an ELNES/EXELFS card is present, a separate \file{list.dat} file is 
    written for each polarization component (i.e., \file{list.dat}, 
    \file{list02.dat}, etc.).
  \end{description}
  %%
  %% Module 5
\item [\large\textbf{Module 5}]\dotfill\  {\large\module{genfmt}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate scattering amplitudes and other
    XAFS parameters
  \item[\textbf{Input files:}] \file{mod5.inp},
    \file{global.dat}, \file{phase.bin}, and \file{paths.dat}
  \item[\textbf{Output files:}] \file{feff.bin}, and \file{list.dat}
  \item[\textbf{Other output:}]
  \item[\textbf{Description:}] \module{genfmt} reads input files, and writes a file
    \file{feff.bin}, which contains all the EXAFS information for the
    paths, and \file{list.dat}, which contains some basic information
    about them. These files are the main output of {\feff} for EXAFS
    analysis. To read \file{feff.bin} into your own program, use the 
    subroutine feffdt as an example.

    If an ELNES/EXELFS card is present, a \file{listNN.dat} file is 
    written for each polarization component, and a separate \file{feff.bin} 
    file is written (i.e., \htmlref{feff.bin}, \htmlref{feff02.bin}, etc.). 
    The format of the files is unchanged.
  \end{description}
  %%
  %% Module 6
\item [\large\textbf{Module 6}]\dotfill\  {\large\module{ff2x}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate specified x-ray spectrum
  \item[\textbf{Input files:}] \file{mod6.inp}, \file{global.dat},
    \file{list.dat}, \file{feff.bin}, \file{fms.bin}, \file{xsect.bin}
  \item[\textbf{Output files:}] \file{chi.dat} and \file{xmu.dat}
  \item[\textbf{Other output:}] \file{chipNNNN.dat} and \file{feffNNNN.dat}
  \item[\textbf{Description:}] \module{ff2x} reads \file{list.dat},
    \file{fms.bin}, \file{feff.bin}, and writes \file{chi.dat}
    with the total XAFS from the paths specified in \file{list.dat}.
    Additional instructions are passed to \module{ff2x} from \file{feff.bin}, so you
    can change S02, the Debye temperature and some other parameters
    without re-doing the whole calculation. The file \file{list.dat}
    can be edited by hand to change the paths being considered, and
    individual \file{chipNNNN.dat} files with $\chi(k)$ from each path are
    optionally written. If any of the \htmlref{XANES}{card:xan}, 
    \htmlref{DANES}{card:dan}, \htmlref{FPRIME}{card:fpr} or 
    \htmlref{XNCD}{card:xnc} cards are specified, \module{ff2x} will write 
    the corresponding calculated data in \file{xmu.dat}. Various 
    corrections are possible at this point in the calculations---
    see the input cards above.

    If an ELNES/EXELFS card is present, this module reads the large  
    \file{fms.bin} and all the \file{feffNN.bin} files, and produces 
    a \file{xmuNN.dat} file containing the corresponding component of 
    the sigma tensor (\file{xmu.dat}, \file{xmu02.dat}, ..., \file{xmu09.dat}). 
    Those files have the traditional \file{xmu.dat} format. Similarly, 
    \file{chiNN.dat} files are produced.
  \end{description}
  %%
\item[\large\textbf{Optional Modules:}]
  %%
  %% Module screen
%\item[\large\textbf{Module \module{ldos}}]\dotfill\  {\large\module{ldos}}
  %\begin{description}
  %\end{description}
  %%
  %% Module ldos
\item[\large\textbf{Module \module{ldos}}]\dotfill\  {\large\module{ldos}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate LDOS
  \item[\textbf{Input files:}] \file{ldos.inp}, \file{geom.dat}, 
    and \file{pot.bin}.
  \item[\textbf{Output files:}] \file{ldosNN.dat} ($\ell$DOS) and 
    \file{logdos.dat}
  \item[\textbf{Other output:}] 
  \item[\textbf{Description:}] LDOS runs only if the LDOS card is 
    present in \file{feff.inp}, in which case it executes between \module{pot} 
    and \module{xsph}. It outputs the angular momentum ($\ell$) projected DOS 
    into \file{ldosNN.dat} files, with each value of NN corresponding 
    to each unique potential.
  \end{description}
  %%
  %% Module SO2CONV
\item[\large\textbf{Module \module{so2conv}}]\dotfill\  {\large\module{so2conv}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Convolve output files with the 
    spectral function.
  \item[\textbf{Input files:}] \file{so2conv.inp}, \file{xmu.dat}, 
  \file{chi.dat}, \file{chipNNNN.dat}, or \file{feffNNNN.dat} files 
  \item[\textbf{Output files:}] \file{specfunct.dat}, 
  \item[\textbf{Other output:}] The following files are overwritten 
    with convolved spectral data: \file{xmu.dat}, \file{chi.dat}, 
    \file{chipNNNN.dat}, and \file{feffNNNN.dat}.
  \item[\textbf{Description:}] SO2CONV convolutes the single particle 
    XAS files with a many body spectral function to include many body 
    effects on the spectra, including an ab-initio calculation of the 
    amplitude reduction factor S$_0^2$.  This module runs after
    \module{ff2x} if the SO2CONV card is present in \file{feff.inp}.

    In the presence of an EELS card, the module is run for all 
    components of the sigma tensor: each \file{xmu.dat} file is 
    opened and altered individually.
  \end{description}
  %% Module ?? no number.
\item[\large\textbf{Module \module{eels}}]\dotfill\  {\large\module{eels}}
  \begin{description}
  \item[\textbf{Purpose of Module:}] Calculate EELS
  \item[\textbf{Input files:}] \file{eels.inp} 
  \item[\textbf{Output files:}] \file{eels.dat}, \file{magic.dat} and 
    \file{logeels.dat}
  \item[\textbf{Other output:}] 
  \item[\textbf{Description:}] EELS runs only in the presence of an 
    EELS card. It reads \file{eels.inp}, and sums the partial spectra 
    from the various polarizations to assemble a physical EELS spectrum. 
    This module is active if one of the EELS cards (\htmlref{ELNES}{card:eln} 
    and \htmlref{EXELFS}{card:exe}) 
    is specified.
  \end{description}
  %%
\end{description}


There is an internal limit on the number of paths (set to 1200) that
will be read from \file{feff.bin}. This limit was chosen to handle
any reasonable problem without using an excessive amount of memory.
If you must use more paths, change the parameter \texttt{npx} in the
{\feff} source in subroutine \texttt{ff2chi} to whatever you need. This
will require more memory. We have not had a case where the filter
criteria were not able to solve the problem with fewer than 1200
paths.

\section{Descriptions of Output Files}
\label{sec:Descr-Outp-Files}

\subsection{Intermediate Output Files}
\label{sec:Interm-Outp-Files}

\begin{description}
\item[\file{modN.inp} and \file{ldos.inp}]\hfill\\ These ASCII files contain
   basic information 
  from \file{feff.inp} for a particular module. They can still be edited,
  for example to take advantage of symmetries.
\item[\file{global.dat} ]\hfill\\ This ASCII file contains
   global information  about x-ray polarization and about
   configurational averaging.
\item[\file{geom.dat} ]\hfill\\ This ASCII file contains
   Cartesian coordinates of all atoms and first-bounce information 
   for the  degeneracy reduction in the pathfinder.
\item[\file{pot.bin}]\hfill\\ Charge density and potential (SCF or not) for
  all types of atoms. This file is used by the \module{xsph} module.
\item[\file{phase.bin}]\hfill\\ This is a binary file with the scattering
  phase shifts for each unique potential and with relativistic dipole matrix
  elements, normalized to total cross section in \file{xsect.bin}.
  It is used by the \module{fms}, \module{path} and \module{genfmt} modules.
\item[\file{xsect.bin}]\hfill\\ Total atomic cross section for x-ray
  absorption. This is an ASCII file, but it is highly sensitive to format. The 
  information it contains can be viewed, but editing this file is \emph{not} 
  recommended.
\item[\file{ldosNN.dat}]\hfill\\ $\ell$-projected density of states for the
  NN$^{\mathrm{th}}$ potential index (see the \htmlref{LDOS}{card:ldo} card)
\item[\file{fms.bin}]\hfill\\ contains the results of FMS calculations. Used
  by \module{ff2x} to get the total XAFS or XANES.
\item[\file{paths.dat}]\hfill\\ Written by the pathfinder, this is a
  description of all the paths that fit the criteria used by the
  pathfinder. It is used by \module{genfmt}. The path descriptions include
  Cartesian coordinates of atoms in the path, scattering angles, leg
  lengths and degeneracy. For details on editing this file by hand, see
  Section~\ref{sec:Addit-progr-contr}. (\file{pathNN.dat} files are also
  created during the $\ell$DOS calculations for each type of potential, but
  they are deleted after use.)
\item[\file{crit.dat}]\hfill\\ Values of the quantities tested against the
  various criteria in the pathfinder.
\item[\file{list.dat}]\hfill\\ List of paths to use for the final calculations.
  Written by \module{genfmt} when the XAFS parameters are calculated and used
  by \module{ff2x}. It contains the curved wave importance ratios, which
  you may wish to study. For details on editing this file by hand, see
  Section~\ref{sec:Addit-progr-contr}.

  The curved wave importance ratios are the importance of a particular
  path relative to the shortest single scattering path.
\item[\file{eels.inp}]\hfill\\ Written by \module{rdinp}, this file is 
  the input for the \module{eels} module. It read by \module{eels} and 
  determines how {\feff} will make the EELS calculations.
\item[\file{so2conv.inp}]\hfill\\ This file contains control inputs for 
  running the \module{so2conv} module.
\item[\file{specfunct.dat}]\hfill\\ This is a binary file containing the 
  spectral function. If it is not present, \module{so2conv} will create it. Every 
  time the material is changed, \file{specfunct.dat} will be recomputed.
\end{description}



\subsection{Diagnostic Files}
\label{sec:Diagn-Files-from}

\begin{description}
\item[\file{misc.dat}]\hfill\\ Header file for quick reference.
\item[\file{phaseNN.dat}] \hfill\\ Complex phase shifts for each
  shell.
\item[\file{phminNN.dat}] \hfill\\ Real part of phase shifts for
  $\ell$=0,1,2 only. They are smaller versions of corresponding
  \file{phaseNN.dat}.
\item[\file{potNN.dat}]\hfill\\  Detailed atomic potentials and
  densities.
\item[\file{atomNN.dat}] \hfill\\ Diagnostic information on Desclaux
  free atom NN.
\end{description}



\subsection{Main Output Data}
\label{sec:Final-Results-Calc}

\begin{description}
\item[\file{chi.dat}]\hfill\\ Standard XAFS data containing $k$,
  $\chi(k)$, $|\chi(k)|$ relative to threshold ($k=0$). The header
  also contains enough information to specify which model was used to
  create this file.
\item[\file{xmu.dat}]\hfill\\ The file \file{xmu.dat} contains both XANES and
  XAFS data $\mu$, $\mu_0$, and 
  $\tilde \chi = \chi \frac{\mu_0}{\mu_0({\rm edge} + 50 {\rm eV})}$ 
  as functions of absolute energy
  $E$, relative energy $E-E_f$ and wave number $k$.
\item[\file{feff.bin}] \hfill\\ A binary file that contains all the
  information about the XAFS from all of the paths. This replaces the
  old \file{feffNNNN.dat} files (which you can make using the PRINT
  card). If you want to use this file with your own analysis package,
  use the code in subroutine feffdt as an example of how to read it.
\item[\file{feffNNNN.dat}]\hfill\\ You have to use the PRINT option to
  obtain these files. Effective scattering amplitude and phase shift
  data, with $k$ referenced to threshold for shell nn: $k$, $\phi_c$,
  $|F_{\mathrm{eff}}|$, $\phi_{\mathrm{eff}}$, the reduction factor,
  $\lambda$, $\Re(p)$.

  If you need these, use the \htmlref{PRINT}{card:pri} option for \module{ff2x}
  greater than or equal to 3, which will read \file{feff.bin} and write the
  \file{feffNNNN.dat} files in exactly the form you're used to.
\item[\file{fpf0.dat}] \hfill\\ Thomson scattering amplitude $f_0(Q)$
  and constant contribution to f' from total energy term.
\item[\file{ratio.dat}] \hfill\\ Ratio $\mu_0(E)$, $ \rho_0(E)$ and
  their ratio versus energy, for XMCD sum rules normalization.
\item[\file{eels.dat}]\hfill\\ This contains the EELS spectrum: energy loss in 
  eV, total spectrum, contribution from each component of the cross section tensor.
\item[\file{magic.dat}]\hfill\\ This file is only written if the 
\htmlref{MAGIC}{card:mag} card is used. It contains the collection 
angle in rad, the pi to sigma ratio, the pi and sigma components 
of the spectrum, and the total spectrum. 
\end{description}




\subsection{Variables in the EXAFS and XANES Formulae}
\label{sec:Vari-EXAFS-form}

\begin{Reflist}
\item[$k$] The wave number in units of \AA$^{-1}$.
  $k=\sqrt{E-E_f}$ where $E$ is energy and $E_f$ is the Fermi level
  computed from electron gas theory at the average interstitial charge
  density.
\item[$\chi(k)$]
  $$ \chi(k) = S_0^2  \mathcal{R}  \sum\limits_{\mathrm{shells}}
  \frac{NF_\mathrm{eff}}{kR^2} \exp(-2r/\lambda)
  \sin(2kR + \phi_{\mathrm{eff}} + \phi_c)
  \exp(-2k^2\sigma^2) \notag $$
\item[$\phi_c$]
  The total central atom phase shift, $\phi_c=2\delta_{\ell,c} - \ell\pi$
\item[$F_{\mathrm{eff}}$]
  The effective curved-wave backscattering amplitude in the EXAFS
  formula for each shell.
\item[$\phi_{\mathrm{eff}}$]
  The phase shift for each shell
\item[$\mathcal{R}$]
  The total central atom loss factor, $\mathcal{R}=\exp(-2\Im(\delta_c))$
\item[$R$]
  The distance to the central atom for each shell
\item[$N$]
  The mean number atoms in each shell
\item[$\sigma^2$]
  The mean square fluctuation in $R$ for each shell
\item[$\lambda$]
  The mean free path in \AA, $\lambda = {1/ |\Im p |}$
\item[$k_f$]
  The Fermi momentum at the average interstitial charge density
\item[$p(r)$]
  The local momentum, $p^2(r)=k^2+k_f^2(r)+\Sigma-\Sigma_f$
\item[$\Sigma(E)$]
  The energy dependent self energy at energy $E$, $\Sigma_f$ is the self
  energy at the Fermi energy.
\item[$\mu(E)$]
  The total absorption cross-section
\item[$\mu_0(E)$]
  The embedded atomic background absorption
\end{Reflist}





\section{Program Control Using Intermediate Output Files}
\label{sec:Addit-progr-contr}




In addition to the \htmlref{CONTROL}{card:con} card and other 
options in \file{feff.inp}, some parameters in the files read 
by the various modules can be changed. For example, you can create 
your own paths by editing \file{paths.dat} and explicitly change 
Debye--Waller factors in the final result by editing \file{list.dat}.

Users may edit the some files as a quick and sometimes convenient way
to prepare a given run. It is easiest to use an existing file as a
template, since the code that reads these files is fussy about their format.



\subsection{Using \file{paths.dat}}
\label{sec:paths.dat}

You can modify a path, or even invent new ones, such as paths
with more than the pathfinder maximum of 8 legs. For example, you
could make a path to determine the effect of a focusing atom on a
distant scatterer. Whatever index you enter for the path will be used
in the filename given to the \file{feffNNNN.dat} file. For example,
for the choice of index 845, the EXAFS parameters will appear in
\file{feff0845.dat}.
A handy way to add a single scattering path of length $R$ is to make a
2-leg path with the central atom at (0, 0, 0) and the scatterer at
($R$, 0, 0).

\module{genfmt} will need the positions, unique potentials, and character tags
for each atom in the path. The angles and leg lengths are printed out
for your information, and you can omit them when creating your own
paths by hand. The label lines in the file are required (there is code
that skips them, and if they're missing, you'll get incorrect results).






\subsection{Using \file{list.dat}}
\label{sec:list.dat}

This is the list of files that \module{ff2x} uses to calculate chi. It
includes the paths written by module \module{genfmt}, curved wave importance
factors, and user-defined Debye--Waller factors. If you want to set
Debye--Waller factors for individual paths, you may edit this file to
set them. \module{ff2x} will sum the Debye--Waller factors in this file with
the correlated Debye model $\sigma^2$ and the global $\sigma^2$, if
present. You may also delete paths from this file if you want to
combine some particular set of paths. (CAUTION: Save the original, or
you'll have to re-run \module{genfmt}!)



\subsection{Using \file{geom.dat}}
\label{sec:geom.dat}

This file can be manually edited to take advantage of the paths
symmetries. %See the NOGEOM card. %%currently disabled




\chapter{Calculation Strategies and Examples}
\label{sec:Calc-Strat-Exampl}





\section{General Comments}
\label{sec:EXAFS-Calculations}


Self-consistent or overlapped atom potentials are necessary
for the calculation of the scattering phase shifts. Self-consistent
calculations take more time, and are often essential for XANES,
especially for cases with significant charge transfer.
Although the effect of self-consistency on EXAFS is small,
such calculations give an accurate determination of $E_0$,
thus eliminating an important parameter in EXAFS
distance determinations.

Scattering phase shifts for each unique potential are necessary for
\module{fms}, \module{path} and \module{genfmt}. They are needed for the importance filters in
\module{path} and are the basis of the XAFS parameters calculation in \module{genfmt}.
This part of the calculation is relatively slow, so it is usually best to run
it only once and use the results while studying the paths and XAFS.

To enumerate the necessary paths, the pathfinder module \module{path} needs the
atomic positions of any atoms from which scattering is expected. If
the structure is completely unknown, only single-scattering paths can be
created explicitly. Because the number of possible paths increases
exponentially with total path length, one should start with a short total path
length, examine the few paths (representing scattering from the nearest
neighbors), and gradually increase the total path length, possibly
studying the path importance coefficients and using the filters to
limit the number of paths. This process is not automated, and if done
carelessly can yield so many paths that no analysis will be possible.

Finally, use \module{genfmt} to calculate the XAFS parameters, and \module{ff2x} to
assemble the results into a chi curve. Here, the slow part is \module{genfmt}
and \module{ff2x} is very fast. Therefore, to explore parameters such as
Debye--Waller factors, mean free path and energy zero shifts, various
combinations of paths and coordination numbers, run only module \module{ff2x}
using the results saved from \module{genfmt}.

There are three ways to modify the Debye--Waller factor, all of which affect
only the module \module{ff2x}. The \htmlref{DEBYE}{card:deb2} card
calculates a Debye--Waller factor for each path. The \htmlref{SIG2}{card:sig} card adds
a constant Debye--Waller factor to each path. And you can edit \file{list.dat}
to add a particular Debye--Waller factor to a particular path. These three
Debye--Waller factors are summed, so if the DEBYE and SIG2 cards are present,
and if you have added a Debye--Waller factor to a particular path, the Debye--Waller factor 
used will be the sum of all three. See documentation below for details.

If your model changes significantly, the phase shifts (which are based
in part on the structure of the material) should be recalculated.
Any time the phase shifts change, the XAFS parameters will also have to be
re-calculated. If the path filters have been used, the path list will
also have to be recomputed.

\section{EXAFS Calculation}
\label{sec:EXAFS-calculation}


\subsection{SF$_6$ Molecule}
\label{sec:Molecule}


SF$_6$ Molecule. This is the simplest example of running {\feff} to obtain
results for EXAFS. Only two input cards are necessary. Only the file \file{chi.dat} is
produced.

\begin{verbatim}
  TITLE Molecular SF6
  
  POTENTIALS
  * absorbing atom must be unique pot 0
  *    ipot    z   tag
         0    16   S        
         1     9   F
  
  ATOMS
  *  x      y      z     ipot
     0      0      0       0          S absorber
     1.56   0      0       1          6 F backscatters
     0      1.56   0       1
     0      0      1.56    1
    -1.56   0      0       1
     0     -1.56   0       1
     0      0     -1.56    1
\end{verbatim}




\subsection{Solids}
\label{sec:Solid}


\subsubsection{Cu metal}
\label{sec:Cu-metal}

Cu, fcc metal, 4 shells. The list of atomic coordinates
(\htmlref{ATOMS}{card:ato} card) for crystals can be produced by the program
{\atoms}. Thus instead of giving a long atoms list, we present a short
\file{atoms.inp} file. For connection with EXAFS fitting programs see
Section~\ref{sec:Input-and-Output-Files} and the \htmlref{PRINT}{card:pri}
card on page \pageref{card:pri}.

\begin{verbatim}
  TITLE Cu crystal, 4 shells
  * Cu is fcc, lattice parameter a=3.61 (Kittel)
  
  *Cu at 190K, Debye temp 315K (Ashcroft & Mermin)
  DEBYE  190  315 0
  
  POTENTIALS
    0  29  Cu0
    1  29  Cu
  
  ATOMS
  atoms list generated using atoms.inp file below
  --------------------------------------------
  title Cu  metal  fcc a=3.6032
  fcc                   ! shorthand for F M 3 M
  rmax= 11.13   a=3.6032
  out=feff.inp          ! index=true
  geom = true
  atom
  !   At.type    x    y    z
  Cu       0.0  0.0  0.0
  --------------------------------------------
\end{verbatim}



\subsubsection{YBCO High-Tc superconductor}
\label{sec:YBCO-High-Tc}


\begin{verbatim}
  TITLE  YBCO: Y Ba2 Cu3 O7      Cu2 core hole
  
  CONTROL  1  1  1  1  1  1
  PRINT    0  0  0  0  0  0
  
  RPATH   4.5
  
  POTENTIALS
  *    ipot  z  tag
        0   29  Cu2
        1    8  O
        2   39  Y
        3   29  Cu1
        4   56  Ba
  
  ATOMS
  atoms list generated by the following atoms.inp file
  -----------------------------------
  title YBCO: Y Ba2 Cu3 O7  (1-2-3 structure)
  space P M M M
  rmax=5.2         a=3.823  b=3.886  c=11.681
  core = Cu1
  atom
  ! At.type  x     y     z       tag
    Y       0.5   0.5   0.5
    Ba      0.5   0.5   0.184
    Cu      0     0     0        Cu1
    Cu      0     0     0.356    Cu2
    O       0     0.5   0        O1
    O       0     0     0.158    O2
    O       0     0.5   0.379    O3
    O       0.5   0     0.377    O4
  --------------------------------------
\end{verbatim}





\subsection{Estimate of S$_0^2$}
\label{sec:S02-estimate}


All above examples yield calculations for the K edge (default). To do
calculations for other edges, use the \htmlref{EDGE}{card:edg} or 
\htmlref{HOLE}{card:hol} cards. These cards
will also yield an estimate of $S_0^2$ from atomic calculations if you
set $\mathtt{S02}<0.1$ by the one of three possible ways shown below.
\begin{verbatim}
  EDGE   L3    0.0
  HOLE    4   0.0
  S02     0.0
\end{verbatim}

The result for S02 is given in \file{chi.dat} or \file{xmu.dat} files.
$S_0^2$ is a square of determinant of overlap integrals for core
orbitals calculated with and without core hole. The core-valence
separation can be changed by editing the subroutine \texttt{getorb}, but
it is currently set by default to the most chemically reasonable one.


\subsection{Configuration Averaging Over Absorbers}
\label{sec:Aver-over-absorb}


In amorphous materials or materials with distortions from regular
crystals, the absorbing atoms (with the same number in the periodic table)
may have different surroundings. Thus one may want to average the
calculation over different types of sites for the same atom or even
over all atoms in the \file{feff.inp} file. This can be accomplished using
\htmlref{CFAVERAGE}{card:cfa} card of Section~\ref{sec:Main-Control-Cards}.
The usefulness of this type of calculation is currently curtailed by 
the limited functionality of the CFAVERAGE card, which should be used 
with caution.



\subsection{Adding Self-consistency}
\label{sec:Adding-self-cons}


Self-consistency is expected to be more important for XANES
calculations, but even for EXAFS one may want to have a more reliable
determination of Fermi level or to account for charge transfers in
order to do fits with a single energy shift $E_0$. Our experience shows
that reliable EXAFS phase shifts are best achieved using the 
\htmlref{SCF}{card:scf} card.

\begin{verbatim}
  *calculate EXAFS with SCF potentials and paths to R=6 angstroms
  EXAFS
  SCF   3.8
  RPATH 6.0
\end{verbatim}

The above example works for solids or large molecules, but for molecules with 
less than 30 atoms, calculations can be done faster if you set $\mathtt{lfms1}=1$:
\begin{verbatim}
  SCF   10.0  1
\end{verbatim}

For details see the \htmlref{SCF}{card:scf} and \htmlref{FMS}{card:fms} cards in
Sections~\ref{sec:Scatt-potent-modul} and \ref{sec:Full-mult-scatt}.


\section{XANES Calculations}
\label{sec:XANES-calculations}

\subsection{Need for SCF and Additional Difficulties for XANES}
\label{sec:Addit-diff}

XANES calculations are usually more challenging than EXAFS calculations.
They usually take more time and require more experience from the user.
Fortunately {\feffcur} automates many steps in the procedure and includes
important full multiple scattering terms and self-consistency. This improves
on the high order path expansion approach to XANES in {\feff}7 which only 
allowed the maximum number of paths of amplitude larger than a plane wave
criteria in \htmlref{PCRITERIA}{card:pcr} card. To account for the poor 
electron gas estimates of the Fermi level, the \htmlref{CORRECTIONS}{card:cor} 
card was needed. Moreover, to obtain good results for the spectra, one had 
also to play with \htmlref{AFOLP}{card:afo}, \htmlref{EXCHANGE}{card:exc} and 
\htmlref{ION}{card:ion} cards, which alter the way the scattering potential 
is constructed in somewhat uncontrolled ways.

One of the main advantages of {\feffcur} is that it yields self-consistent
potentials using the \htmlref{SCF}{card:scf} card. The use of the SCF card 
also gives a more reliable estimate of the Fermi level (the CORRECTIONS card
can still be used, since the error in Fermi level position is only a few eV).
{\feffcur} thus automatically accounts for charge transfer. The ION card should 
be used only to specify the total charge of a cluster. AFOLP in general
leads to better results for XANES and is done by default. With
{\feff}7 we also had to use an EXCHANGE 5 model for Pu hydrates,
but with the self-consistent {\feffcur} the standard EXCHANGE 0
works well. Thus the use of self-consistency leads to
closer results for different exchange correlation models.

The use of the high order MS path expansion and PCRITERIA
can lead to unreliable XANES calculations when the MS series converges
poorly (for example, near the Fermi level). Thus the inclusion
of FMS capabilities in {\feffcur} is essential for calculations of $\ell$DOS and
electronic densities and is often an improvement on path calculations
of XANES. We suggest that for $\ell$DOS calculations
one uses FMS exclusively and uses path expansion for testing its convergence.
This will cost CPU time, but will lead to more
reliable results. The FMS calculations for a cluster of 175 atoms
typically take more time and memory than the other 5 modules. The
results can be somewhat better with larger clusters, but typically
one achieves convergence with about 50-200 atoms and calculation
time scales as a third power of number of atoms in a cluster and
quickly becomes prohibitive.
Below we present several sample input files for XANES calculations.


\subsection{GeCl$_4$ Molecule}
\label{sec:Molecule-1}

This is historically the first molecule for which EXAFS was calculated
by Hartree, Kronig and Peterson (1934), using short range order
theory.

\begin{verbatim}
  TITLE   GeCl_4  r=2.09 /AA
  
  NOHOLE
  HOLE 1   1.0
  RSIGMA
  
  CONTROL   1  1  1  1  1  1
  
  SCF    3.0  1
  FMS    3.0  1
  RPATH  1.0
  XANES  8.0 0.05
  
  AFOLP  1.30
  
  POTENTIALS
  *   ipot   z  label
        0   32   Ge  3 3
        1   17   Cl  3 3
  ATOMS
  *     x          y          z     ipot atom           distance
     0.0000     0.0000     0.0000     0   Ge
     1.2100     1.2100     1.2100     1   Cl
     1.2100    -1.2100    -1.2100     1   Cl
    -1.2100     1.2100    -1.2100     1   Cl
    -1.2100    -1.2100     1.2100     1   Cl
  END
\end{verbatim}


\subsection{Solid: XANES and $\ell$DOS}
\label{sec:Solid-1}

BN crystal has a zinc sulfide structure, and is a case in which a
multiple scattering expansion does not converge near the Fermi level.
Using the full multiple scattering approach leads to good agreement
with experiment.

\begin{verbatim}
  TITLE   BN cubic zinc sulfide structure
  CONTROL   1 1 1 1 1 1
  PRINT     5 0 0 0 0 0 
 
  SCF  3.1
  HOLE 1   1.0     1=k edge, s0^2=1.0
  EXCHANGE  0  0  1.0
  LDOS -20  10  0.5
  FMS  5.1
  RPATH   1.0
  XANES 4.0
 
  INTERSTITIAL 0  1.54
 
  POTENTIALS
 *   ipot   z  label lmax1  lmax2
        0    5   B     2    2  0.1
        1    7   N     2    2  1
        2    5   B     2    2  1
 
  ATOMS
  list generated by ATOMS program
  -------------------------------------
  title BN (zincblende structure)
  Space  zns
  a=3.615 rmax=8.0   core=B
  atom
  ! At.type  x        y       z      tag
     B      0.0      0.0     0.0
     N      0.25     0.25    0.25
  ----------------------------------------
\end{verbatim}


\subsection{Absolute Cross-section}
\label{sec:Absol-cross-sect}

The absolute cross section can be obtained from the output in
\file{xmu.dat}. Look for this line:

\begin{verbatim}
  xsedge+100, used to normalize mu           2.5908E-04
\end{verbatim}

Since our distances are in \AA, we report cross section also in \AA$^2$.
If you multiply the 4-th or 5-th column by this normalization value
you will obtain the cross section in \AA$^2$. Often the absolute
cross section is reported in barns, which have a simple connection
with our units (1 \AA$^2 = 100 \mathrm{Mbarn}$)

\section{Spin-dependent Calculations}
\label{sec:Spin-depend-calc}

\subsection{General Description}
\label{sec:General-description}

This section contains information on extracting the \htmlref{XMCD}{card:xnc} 
signal and a description of the SPXAS technique, as well as example input 
files.

Spin-dependent calculations have been automated in {\feff}8.40. All 
spin-dependent calculations require that the SPIN card be present in 
\file{feff.inp} (see the \htmlref{SPIN}{card:spi} card in 
Section~\ref{sec:Scatt-potent-modul} for additional details on its use). 
The method one uses to extract the signal depends on the value of the 
parameter \texttt{nspx}, which is found in the header file \file{dim.h}.

In order for the final result to be contained in \file{feff.inp}, 
{\feff} must be compiled with $\mathtt{nspx}=2$ to take care of both the 
spin-up and spin-down calculations. This will also add the contribution from 
spin-flip processes (which we find typically very small), but may require up 
to 4 times the memory and 8 times the execution time for the XANES region. 
Thus, in general, $\mathtt{nspx}=2$ will not always be feasible.
%%Thus in general we would recommend the use of $\mathtt{nspx}=1$, unless 
%%spin-flip processes are expected to be significant (e.g. for 5f elements).

With $\mathtt{nspx}=1$, the code must be run twice, once for spin-up 
and once for spin-down. An additional simple program \file{spin.f} 
is useful for taking care of the different normalizations and giving 
the final results in \htmlref{XMCD}{card:xnc} or SPXAS (Section~\ref{sec:SPXAS}). 
\file{spin.f} is printed below, and may also be found on the {\feff} website
(\htmladdnormallink{http://feff.phys.washington.edu/feff/}{http://feff.phys.washington.edu/feff/}).

In the monolithic source code, all instances of $\mathtt{nspx}=1$ must be 
changed to $\mathtt{nspx}=2$ in order to automate the calculations. In the 
source tree, \file{dim.h} is located in \file{src/HEADERS/}, and \texttt{nspx} 
can be changed there. Please contact the authors if you need help modifying the 
source code.

The same paths should be used for spin-up and spin-down calculations, 
otherwise the difference between 2 calculations may be due to 
different paths used. Typically the paths list in \file{paths.dat} 
should be generated by running the usual EXAFS calculations and 
comparing with experiment (to make sure that all important paths 
are included). Then, when running with SPIN, turn off the pathfinder 
module using the \htmlref{CONTROL}{card:con} card.

\file{spin.f}:
\begin{verbatim}

      implicit double precision (a-h,o-z)
c     This program read two xmu.dat files for spin -up and -down,
c     calculated with Feff8.20 for the SAME paths list.
c     spin-up file is fort.1, spin-down file is fort.2
c     Both have to be edited: All lines should be deleted except
c       1) line: xsedge+100, used to normalize mu           1.3953E-04
c          leave only on this line:  1.3953E-04
c       2) 6-column data lines
c     The output will be written in fort.3 in 6 columns
c     E+shift1  E(edge)+shift2  xk cmd_total cmd_background  cmd_fs
c     where total = atomic background + fine structure

c     There are 3 possibilities
c     case 1) you want XMCD signal and used SPIN \pm 1
c     case 2) you want XMCD signal and used SPIN \pm 2, in order
c       to use non-relativistic formula for XMCD
c       factor li/2j+1 which was not convenient to do in a program
c     case 3) you want SPXAFS and used  SPIN \pm 2
c     ENTER your case here (icase is positive integer only)
      icase = 2

c     if icase=2 ENTER factor=(-1)**(L+1/2-J) * L/(2*J+1)
c     where L,J are for your edge (ex. for L3 L=1 J=3/2, for L2 L=1 J=1/2)
c     for L3
c      factor = 0.25
c     for L2
c     factor = -0.5

c     ENTER the energy shift you want for columns 1 and 2 in xmu.dat
      shift1 = 0
      shift2 = 0

c     everything below is automated further
      read (1,*,end=10) ap
      read (2,*,end=10) am
      xnorm = 0.5 *(ap+am)
c     read the data
   3     read(1,*,end=10)   x1, x2, ek, y1, y2, y3
         read(2,*,end=10)  x1, x2, ek, z1, z2, z3
         if (icase.eq.1) then
c           no xafs in this case:xfs - atomic part of XMCD
            t1 = (y1*ap + z1*am)/xnorm
            t2 = (y2*ap + z2*am)/xnorm
            t3 = (y3*ap + z3*am) /xnorm

         elseif (icase.eq.2) then
            t1 = (y1*ap - z1*am)*factor /xnorm
            t2 = (y2*ap - z2*am)*factor /xnorm
            t3 = (y3*ap - z3*am)*factor /xnorm

         elseif (icase.eq.3) then
c           factor=0.5 always for SPXAFS
            t1 = (y1*ap - z1*am)/2.0/xnorm
            t2 = (y2*ap - z2*am)/2.0/xnorm
            t3 = (y3*ap - z3*am)/2.0/xnorm
c           you may want average total XAS as output in last column
c           t3 = (y1*ap + z1*am)/2.0/xnorm
         endif
         x1 =x1 + shift1
         x2 =x2 + shift2
         write(3,5)    x1, x2, ek, t1, t2, t3
   5     format (6e13.5)
      goto 3
  10  continue
      stop
      end
\end{verbatim}

\subsection{XMCD for the Gd L1 edge}
\label{sec:XMCD-ex}

Example input file for calculation of XMCD for the Gd L1 edge. 
Note the presence of both the \htmlref{SPIN}{card:spi} and 
\htmlref{XMCD}{card:xnc} cards.

\begin{verbatim}
  TITLE   Gd  l1  hcp 
 
  HOLE 2   1.0     2=l1 edge, s0^2=1.0
  SPIN    1
  EXCHANGE  2   0.0  0.0
  RGRID .01
 
  CONTROL   1      1     1     1    1    1
 
  RPATH    7.29
  PRINT   5 0 0 0 0 3
 
  CRITERIA   0.0  0.0  curved   plane
  DEBYE   150    176   temp     debye-temp
  XANES
  XMCD
 
  POTENTIALS
  *   ipot   z  label
        0   64   Gd
        1   64   Gd
 
  ATOMS
  the list of atoms is created by ATOMS program
  ---------------------------------------------
  title    Gd , hcp
  ! Wycoff, vol.1 p.331
  space  hcp
  rmax = 9.0
  a = 3.6354
  c = 5.7817
  atom
    Gd   0.33333   0.66667   0.25   center
  -----------------------------------
\end{verbatim}

\subsection{SPXAS}
\label{sec:SPXAS}

For antiferromagnets, the XMCD should be zero, and a measure of the 
spin-up and spin-down signals can be accomplished using SPXAS. SPXAS 
is a technique where you measure the spin-up and spin-down signal by 
measuring the intensity of two spin-split K$_{\beta}$ lines. This 
corresponds to measuring spin-order relative to the spin on the absorber 
(not relative to the external magnetic field as in XMCD). As an example, 
let us look at the Mn K edge of antiferromagnetic MnF$_2$. Our calculations 
agree well with experiment in the EXAFS region.

Here is an example input file for MnF$_2$:

\begin{verbatim}
  TITLE   MnF2 (rutile) cassiterite (Wykoff)
  
  HOLE 1   1.0     1=k edge, s0^2=1.0
  SPIN   2
 
  CONTROL   1      1     1     1     1     1
  PRINT     0      0     0     2     0     4
  EXCHANGE  0  0.0  0.0
  CORRECTIONS  0.0   0.0
 
  RPATH  10.0
  XANES
 
  PCRITERIA       0.8     40.0
  *CRITERIA     curved   plane
  CRITERIA       0.0     0.0
  *DEBYE        temp     debye-temp
  DEBYE        300       350
  NLEG         4

  POTENTIALS
  *   ipot   z  label
        0   25   Mnup
        1    9   F
        2   25   Mnup
        3   25   Mndown
 
  ATOMS
    0.0000     0.0000     0.0000    0   Mnup             0.0000
    1.4864     1.4864     0.0000    1   F                2.1021
   -1.4864    -1.4864     0.0000    1   F                2.1021
    0.9503    -0.9503     1.6550    1   F                2.1319
    0.9503    -0.9503    -1.6550    1   F                2.1319
   -0.9503     0.9503     1.6550    1   F                2.1319
   -0.9503     0.9503    -1.6550    1   F                2.1319
    0.0000     0.0000    -3.3099    3   Mndown           3.3099
    0.0000     0.0000     3.3099    3   Mndown           3.3099
   -3.3870     1.4864     0.0000    1   F                3.6988
    3.3870    -1.4864     0.0000    1   F                3.6988
    1.4864    -3.3870     0.0000    1   F                3.6988
   -1.4864     3.3870     0.0000    1   F                3.6988
    2.4367     2.4367    -1.6550    2   Mnup             3.8228
   -2.4367    -2.4367    -1.6550    2   Mnup             3.8228
    2.4367    -2.4367    -1.6550    3   Mndown           3.8228
   -2.4367    -2.4367     1.6550    3   Mndown           3.8228
   -2.4367     2.4367    -1.6550    3   Mndown           3.8228
    2.4367     2.4367     1.6550    3   Mndown           3.8228
    2.4367    -2.4367     1.6550    2   Mnup             3.8228
   -2.4367     2.4367     1.6550    2   Mnup             3.8228
  ...
  END

\end{verbatim}


\section{Elastic Scattering Amplitudes}
\label{sec:DANES}

All necessary components to obtain the elastic scattering amplitude
can be calculated with the {\feff}8.2 code and higher. The Thomson scattering
amplitudes are written in the file \file{fpf0.dat}. The elastic amplitudes
near a specific edge are calculated with the \htmlref{DANES}{card:dan} 
card, while those far from the edge are calculated with the 
\htmlref{FPRIME}{card:fpr} card, which neglects solid state effects on $f'$.
$f''$ can be obtained with the \htmlref{XANES}{card:xan} card. 
The formula connecting $f''$ and the absorption cross section $\sigma $ 
is (in atomic units) $f'' = \omega c \sigma /4/\pi $. For calculations 
at energies well above the absorption edge, we found that ground state 
potentials yield better results and that quadrupolar transitions 
have to be included.


\section{X-ray Emission Spectra XES}
\label{sec:XES}

Nonresonant x-ray emission spectra (fluorescence spectra) 
are treated in the same way as the x-ray absorption process
for states below the Fermi level. To perform these calculations one simply
replaces the \htmlref{XANES}{card:xan} card with \htmlref{XES}{card:xes}. 
Preliminary comparisons with experiment
for the phosphorous K$_{\beta}$ line show good agreement with experiment for various
compounds. Further tests are in progress. Please report any problems with
this card to the authors.


\section{Calculation of EELS}
\label{sec:EELS}

\subsection{General Description}
\label{sec:EELS-gen}

EELS, or electron-energy loss spectroscopy, measures the spectrum of 
energy losses of a beam of high-energy electrons passing through a 
sample in an electron microscope. In the dipole approximation, EELS 
is very similar to XAS, and one can use {\feff}'s XAS spectra (i.e., 
calculations for XANES or EXAFS) to model EELS experiments. In 
particular, we add relativistic effects [Schattschneider] to the cross 
section, which is currently of much interest in the EELS community.

This release of {\feffcur} is highly optimized for EELS 
calculations and is able to handle additional instrumental parameters

\subsection{Running FEFF for EELS}
\label{EELS-run-code}

To tell {\feff} to calculate EELS and give it all relevant parameters, 
you need to add either the \htmlref{ELNES}{card:eln} card or the 
\htmlref{EXELFS}{card:exe} card (``the EELS cards'') to your \file{feff.inp} 
input file.

Prepare \file{feff.inp} using one of the EELS cards, and run {\feff}. 
If you run each module individually, then do not forget to add the 
\module{eels} module to your calling sequence. If you run {\feff} 
as a single executable file, then you need not worry about this.
Your installation contains a script \file{feff} that allows you to 
do this in a very simple way. A full calculation should consist of 
the steps:

\module{rdinp}, \module{pot}, \module{screen}, \module{xsph}, 
\module{ldos}, \module{fms}, \module{path}, \module{genfmt}, 
\module{ff2x}, \module{so2conv}, \module{eels}.

The modules \module{so2conv}, \module{screen} and \module{ldos} are optional.

If you change something in the calculation of the material properties--such as atom 
positions, or the FMS radius---you need to rerun the traditional modules of {\feff}.
If you only change an experimental parameter---i.e., most of the parameters in the 
EELS and MAGIC cards---then you do the following :

\begin{enumerate}
  \item Edit \file{feff.inp}
  \item Run module \module{rdinp} to update \file{eels.inp} (alternatively, you can edit 
    \file{eels.inp} directly--but beware, this file is format-sensitive!)
  \item Run module \module{eels} to calculate a new EELS spectrum.
\end{enumerate}

Note: For certain types of calculations, you need all 9 components of the cross 
section tensor. If you don�t have them (because aver=1 or cross=0\ in the EELS 
card), then you will need to rerun {\feff} starting from module \module{fms} 
through \module{eels}.

The time increase should be quite modest, since most of the time goes 
into (1) calculating self-consistent potentials in module 1, which is not affected 
at all; and (2) inverting the matrix for FMS, which is still done only once---only 
the postprocessing in the \module{fms} module takes longer. A test on an ELNES 
calculation for a 100 atom FMS cluster in graphite showed a negligible computation 
time increase compared to the corresponding XANES calculation (2 seconds longer on 
a total of about 9 minutes).

This is a new software development. As such, bugs and various annoying little problems 
may occur. Contact the author if necessary.

So far, {\feff}'s EELS calculations have been used for the following purposes:

\begin{itemize}

\item Calculate the graphite C K edge, in symmetric and nonsymmetric coordinates, with 
either FMS+ELNES or RPATH+EXELFS card, with and without cross terms, relativistically 
and nonrelativistically, for various experimental parameters.

\item Calculate BN N K and B K edges.

\item Calculate GaN N K and Ga K and Ga L$_{23}$ edges.

\item It was used on the following platform: Linux PC with ifc compiler, single node.

\end{itemize}

Compatibility with the use of other input cards and with existing files has been attempted, but may not have been achieved. Please report any problems encountered.


\subsection{Using Traditional FEFF Cards for EELS Calculations}
\label{sec:EELS-trad-cards}

The EELS calculations use the machinery that is at the heart of {\feff} to calculate spectra for 
each polarization component: either full multiple scattering, or path expansion (or both). So, in
addition to the ELNES/EXELFS cards, one must also have either this in the input file:
\begin{verbatim}
FMS 7.0
ELNES ...
\end{verbatim}
to use the full multiple scattering, or, to use the path expansion:
\begin{verbatim}
RPATH 8.0
EXELFS ...
\end{verbatim}
Additional cards may also be used.

For EELS calculations, the polarization vector is an internal 
variable that is set by {\feff} itself. Therefore, the 
\htmlref{POLARIZATION}{card:pol} card cannot be used. If the 
card is present, {\feff} should give a warning and ignore it.

Similarly, the beam direction is given by the input parameters 
of an ELNES/EXELFS card. It is not allowed to use the 
\htmlref{ELLIPTICITY}{card:ell} card when an EELS card is present. 
Again, if it is used, {\feff} should complain and ignore it.

The \htmlref{FPRIME}{card:fpr} and \htmlref{DANES}{card:dan} 
cards will work in combination with an ELNES/EXELFS card.  
Combination with other spectroscopy cards (XANES, EXAFS, XES) 
should make {\feff} complain. 

The \htmlref{CONTROL}{card:con} and \htmlref{PRINT}{card:pri} cards do not have an 
additional field for the \module{eels} module. Execution of the EELS module 
is governed by the presence of an ELNES/EXELFS card in \file{feff.inp}
(or, on a lower level, by the corresponding switch in \file{eels.inp}). 
The output level can not be modified at this time, except through 
the \htmlref{MAGIC}{card:mag} card.


\subsection{EELS Files}
\label{sec:EELS-files}
This section describes the following files with more detail specific to EELS than Chapter~\ref{sec:Input-and-Output-Files}.

\begin{description}
  \item[\textbf{Input Files:}]\hfill
    \begin{description}
      \item[\file{feff.inp}]\hfill\\ This input file contains all parameters 
        related to EELS calculation and is the preferred way for non-expert 
        users to set those parameters. After each change, \module{rdinp} must 
        be run to update \file{eels.inp}.
      \item[\file{eels.inp}]\hfill\\ is read by the \module{eels} module and 
        determines what {\feff} will actually do. Expert users can tweak this 
        file directly. Basically, the file contains everything that�s in the 
        EELS and MAGIC cards. Of particular interest is the very first 
        parameter, which determines whether \module{eels} is executed (=1) or not (=0), 
        and also the parameters on the next line, which select the components 
        (1-9) of the sigma tensor that will be calculated.

        These parameters are very important because other modules will check 
        for the presence of \file{eels.inp} and the values of these parameters 
        to determine their course of action! People who have done EELS and then 
        want to do something else in the same working directory may want to set 
        the execution switch to 0 (or comment the EELS card in \file{feff.inp} 
        and rerun \module{rdinp}, which amounts to the same) to make sure none 
        of the regular modules do anything special for EELS.
    \end{description}

  \item[\textbf{Output Files:}]\hfill
    \begin{description}
      \item[\file{eels.dat}]\hfill\\ This contains the EELS spectrum. Its 
        first column contains energy loss in eV, the second column the total 
        spectrum, and the next columns contain the contribution to the total 
        spectrum from each of the nine components of the cross section tensor.

      \item[\file{magic.dat}]\hfill\\ This file is only written if the MAGIC 
        card is present in feff.inp (and the corresponding switch is set to 1\ 
        in \file{mod8.inp}). It contains the collection angle in rad, the pi 
        to sigma ratio, the pi and sigma components of the spectrum, and the 
        total spectrum; all as a function of collection angle, evaluated at 
        the energy loss set by the MAGIC card. Caution: this has not been 
        tested in the presence of cross terms. E-mail the author if in doubt.

      \item[\file{logeels.dat}]\hfill\\ This file contains reports on the 
        execution of the program. In particular, it contains a summary of the 
        input options used. Most of the information in the file is also 
        written to the screen during program execution.
    \end{description}

\end{description}
\subsection{Computational Details}
\label{sec:EELS-comp-summary}

A central quantity in {\feff} is the polarization tensor (\texttt{ptz}). 
In regular {\feff} calculations, it is calculated from the polarization 
vector e (\texttt{evec} in {\feff}) and the beam direction k (\texttt{xivec}), 
and then the spectrum corresponding to that physical situation is calculated. 
\texttt{ptz} is processed internally.

For EELS calculations, we want access to all 9 polarizations (6 of which 
are independent), giving us 9 partial spectra that we can sum, with weights 
depending on experimental conditions, allowing a physical EELS spectrum to 
be assembled very quickly (as sample information is precomputed into those 
9 components).

{\feff} has some FORTRAN90 in its \module{eels} module. In particular, there is 
a file \file{modules.f} in the source package containing some f90. 
Use of a FORTRAN90 compiler (or higher) is required. A f77 version was 
prepared for specific users, but is not recommended because only the f90 
version will be supported in the future.

More details on EELS implementation are available in a separate programmer�s guide,
available from the author.



\section{Local Field and Core-hole Effects (PMBSE, TDDFT)}
\label{sec:Loc-field-core-hole}

These are features of {\feff} that are still under development, 
which are not reliable in this release of {\feffcur}.

Many-body effects such as local fields and the core-hole interaction 
can be significant in x-ray absorption spectra, even several hundred 
eV above an absorption edge. The treatment of these effects requires 
theories beyond the independent-particle approximation, e.g., the Bethe-Salpeter
equation (BSE) or the time-dependent density-functional theory (TDDFT).

The projection-operator method Bethe-Salpeter equation (PMBSE) is used 
for core-hole absorption spectra calculations. The BSE is usually limited 
to low energies, while the TDDFT often ignores the nonlocality of the 
core-hole interaction. Time dependent density functional theory (TDDFT) 
is a general framework for studying non-stationary electronic processes. 
TDDFT is used for local-field absorption spectra calculations. 

The approach being developed for {\feff} is a combined approach for 
calculations of the x-ray spectra that include both of these effects, 
together with inelastic losses and self-energy shifts over a wide 
energy range. 

Note that the \htmlref{TDLDA}{card:tdl} card accounts for some of the same 
effects, and is functional in this release of {\feffcur}.

See \emph{Combined Bethe-Salpeter equations and time-dependent density-functional 
theory approach for x-ray absorption calculations}; A.L.\ Ankudinov, Y.\ Takimoto, 
and J.J.\ Rehr, Phys.\ Rev.\ B 71, 165110 (2005)

%\subsection{PMBSE}
%The PMBSE card is essentially an alternative to the \htmlref{TDLDA}{card:tdl)
%card. The advantage of PMBSE calculations is the ability to account for the 
%core-hole interaction in variety of ways. It also accounts for the fine structure, 
%while TDLDA calculation are currently done with G$_c$ only (neglecting G$_sc$ and 
%fine structure). 
%PMBSE ipmbse nonlocal ifxc ibasis

\appendix

\chapter{Copyright Information,  Restrictions and License}
\label{sec:Append-A-Copyr}

\section{Restrictions and License Information}
\label{sec:Restr-License-Inform}

The full {\feff} distribution is copyrighted software and a
license from the University of
Washington Office of Technology Transfer must be obtained for its use.
This is necessary to protect the interests both of users and the
University of Washington. Both academic/non-profit and commercial
licenses are available --- see Section~\ref{sec:ADDEND-Governm-Copyr}
of this document for details. New users should request the latest
version of this code. The license form may be
obtained from the {\feff} WWW pages,

\centerline{\htmladdnormallink{http://leonardo.phys.washington.edu/feff/}
  {http://leonardo.phys.washington.edu/feff/}}

\noindent or by writing or sending a FAX to
\begin{quotation}
\noindent The {\feff} Project\\
c/o {\feff} Project Assistant\\
Department of Physics\\
BOX 351560\\
University of Washington\\
Seattle, WA 98195\\[2ex]
E-mail: \htmladdnormallink{feff@phys.washington.edu}
{mailto:feff@phys.washington.edu}\\
Telephone: (206) 543-4615
Fax: (206) 685-0635 
\end{quotation}


\section{ADDENDUM: Government Copyrights}
\label{sec:ADDEND-Governm-Copyr}

This work was supported in part by Grants from DOE. In accordance with
the DOE FAR rules part 600.33 ``Rights in Technical Data - Modified
Short Form'' the following clause applies to {\feff}:

(c)(1)The grantee agrees to and does hereby grant to the U.S.
Government and to others acting on its behalf:

(i) A royalty-free, nonexclusive, irrevocable, world-wide license for
Governmental purposes to reproduce, distribute, display, and perform
all copyrightable material first produced or composed in the
performance of this grant by the grantee, its employees or any
individual or concern specifically employed or assigned to originate
and prepare such material and to prepare derivative works based
thereon,

(ii) A license as aforesaid under any and all copyrighted or
copyrightable work not first produced or composed by the grantee in the
performance of this grant but which is incorporated in the material
furnished under the grant, provided that such license shall be only to
the extent the grantee now has, or prior to completion or close-out of
the grant, may acquire the right to grant such license without becoming
liable to pay compensation to others solely because of such grant.

(c)(2) The grantee agrees that it will not knowingly include any
material copyrighted by others in any written or copyrightable material
furnished or delivered under this grant without a license as provided
for in paragraph (c)(1)(ii) of this section, or without the consent of
the copyright owner, unless it obtains specific written approval of the
Contracting Officer for the inclusion of such copyright material.

\section{FEFF8 LICENSE}
\label{sec:F8license}

 FEFF PROGRAMS (referred to below as "the System")
 Copyright (c) 1986-2002, University of Washington.

 END-USER LICENSE

 A signed End-user License Agreement from the University of Washington
 Office of Technology Transfer is required to use these programs and
 subroutines.

 See the URL: http://leonardo.phys.washington.edu/feff/

 USE RESTRICTIONS:

 1. The End-user agrees that neither the System, nor any of its
 components shall be used as the basis of a commercial product, and
 that the System shall not be rewritten or otherwise adapted to
 circumvent the need for obtaining additional license rights.
 Components of the System subject to other license agreements are
 excluded from this restriction.

 2. Modification of the System is permitted, e.g., to facilitate
 its performance by the End-user. Use of the System or any of its
 components for any purpose other than that specified in this Agreement
 requires prior approval in writing from the University of Washington.

 3. The license granted hereunder and the licensed System may not be
 assigned, sublicensed, or otherwise transferred by the End-user.

 4. The End-user shall take reasonable precautions to ensure that
 neither the System nor its components are copied, or transferred out
 side of his/her current academic or government affiliated laboratory
 or disclosed to parties other than the End-user.

 5. In no event shall the End-user install or provide this System
 on any computer system on which the End-user purchases or sells
 computer-related services.

 6. Nothing in this agreement shall be construed as conferring rights
 to use in advertising, publicity, or otherwise any trademark or the
 names of the System or the UW. In published accounts of the use or
 application of FEFF the System should be referred to  by this name,
 with an appropriate literature reference:

 FEFF8: A.L. Ankudinov, B. Ravel, J.J.\ Rehr, and S.D. Conradson,
        Phys.\ Rev.\ B 58, pp. 7565-7576 (1998).

 LIMITATION OF LIABILITY:

 1. THE UW MAKES NO WARRANTIES , EITHER EXPRESSED OR IMPLIED, AS TO
 THE CONDITION OF THE SYSTEM, ITS MERCHANTABILITY, OR ITS FITNESS FOR
 ANY PARTICULAR PURPOSE. THE END-USER AGREES TO ACCEPT THE SYSTEM
 'AS IS' AND IT IS UNDERSTOOD THAT THE UW IS NOT OBLIGATED TO PROVIDE
 MAINTENANCE, IMPROVEMENTS, DEBUGGING OR SUPPORT OF ANY KIND.

 2. THE UW SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
 INCIDENTAL OR CONSEQUENTIAL DAMAGES SUFFERED BY THE END-USER OR ANY
 OTHER PARTIES FROM THE USE OF THE SYSTEM.

 3. The End-user agrees to indemnify the UW for liability resulting
 from the use of the System by End-user. The End-user and the UW each
 agree to hold the other harmless for their own negligence.

 TITLE:

 1. Title patent, copyright and trademark rights to the System are
 retained by the UW. The End-user shall take all reasonable precautions
 to preserve these rights.

 2. The UW reserves the right to license or grant any other rights to
 the System to other persons or entities.


Note: According to the terms of the above End-user license, 
no part of the standard distributions of {\feff} can be included in other
codes without a license or permission from the authors. However, some subroutines
in {\feff} explicitly contain such a license, and all components subject to
other license agreements are excluded from the restrictions of the
End-user license. Moreover, we are willing to collaborate with other code
developers, and our development version with all the
comments (and subroutines in individual files!) can be made available,
although it makes use of some features that are not standard FORTRAN.
Also we cannot guarantee that any new version of {\feff} will be compatible 
with these subroutines or with any changes you make in the codes.




\chapter{Installation Instructions}
\label{sec:Append-B-Inst}

The program {\feff}8.40 is provided as a single file \file{feff84.f}.
An experimental modular form consisting of eight source files 
\file{rdinp-tot.f}, \file{pot-tot.f}, \file{ldos-tot.f}, \file{xsph-tot.f},
\file{fms-tot.f}, \file{path-tot.f}, \file{genfmt-tot.f} and 
\file{ff2x-tot.f} is available by request. 
$\ell$DOS calculations are no longer executed in the second module, 
since it is now a separate program, but this has not affected 
compatibility with other {\feff} input files. 
The modular code requires less memory
and yields more effective compilation and execution on small machines;
however, the \htmlref{CFAVERAGE}{card:cfa} card is disabled in the modular 
version. 
Parallel execution on MPI clusters has been tested for modular 
code only and is still experimental. For details, please contact the authors.

 Each file contains a main program and all necessary
subroutines. Simply compile (and link) every program on your system
using a Fortran 77 compiler (and your usual linker), e.g., for any
UNIX system the command \command{f77 -o module module.f} is usually
sufficient, but may be augmented by optimization flags.

For the monolithic version, there is only a single executable to run.
For the modular code, the 8 executable files  
must be run in the order listed: \module{rdinp}, \module{pot}, 
\module{ldos}, \module{xsph}, \module{fms}, \module{path}, 
\module{genfmt}, \module{ff2x}, so that the necessary input files
for each successive module are produced.
We suggest that you write a small script (named \file{feff8}),
that executes all modules on your OS, if you use the modular code. 
Samples are available from the authors. Parallel versions of the
modules and appropriate compile and run scripts are also available
and require a working version of the MPI libraries. Please contact
the authors for details.

  Typically the monolithic {\feffcur} requires about 512 MB of RAM to run for
clusters of up to 175 atoms. To adjust the required memory to your
computer, you should change the \texttt{nclusx} parameter {\it globally}.
The required memory scales approximately as $\mathtt{nclusx}^2$.
For larger clusters, you may wish to reduce the maximum angular
momentum \texttt{lx} to keep the total size reasonable, e.g., set
$\mathtt{nclusx}=300$, $\mathtt{lx}=2$ globally in all subroutines.

{\feffcur} will also run on older \file{feff.inp} files for {\feff}7
(and also {\feff}6) and will yield results for EXAFS and XANES comparable
to older versions of {\feff}. The first module of {\feff}7 has now
been split into 3 modules and therefore {\feffcur} will use the first
value in {\feff}7 CONTROL and PRINT cards for the first 3 modules of
{\feffcur}. But we suggest that users make use of the SCF, FMS,
LDOS and other cards to take advantage of {\feffcur}'s new capabilities.

The {\feff} code is written in ANSI Fortran 77, except that
\texttt{complex*16} variables are required. Since data type
\texttt{complex*16} is not part of the ANSI standard, minor
compiler-dependent modification may be necessary. We have used the
VAX extensions to ANSI Fortran 77 since they seem to be the most
portable. The non-standard statements and intrinsic functions used
are: \texttt{complex*16} variables and arrays; \texttt{dimag(arg)}
returns a double precision imaginary part of it argument;
\texttt{dcmplx(arg)} returns a \texttt{complex*16} version of its
argument; \texttt{DBLE(arg)} returns a double precision real part of
its argument; \texttt{sqrt}, \texttt{exp}, \texttt{abs} and other
generic math functions are assumed to accept \texttt{complex*16}
arguments and return double precision or \texttt{complex*16} results.

Files are opened with the \texttt{open} statement. As the ANSI
definition gives some leeway in how the \texttt{open} statement
interacts with the operating system, we have chosen file names and
conventions that work on UNIX, VAX/VMS, IBM PCs (and clones) with MS
FORTRAN, CRAY, MAC's and CDC machines. It may be necessary to
modify the open statements on other systems.

\section{UNIX}
\label{sec:UNIX-machines}
We have endeavored to make {\feff} portable to all UNIX (including
HP, AIX, LINUX, Alpha, BSD and CRAY) machines without any modification. 
If your machine does not reproduce the test output files \file{xmu.dat}
and/or \file{chi.dat} to high accuracy,
please let us know. Also, please report any compiler problems or warning
messages to the authors, as this will help us achieve full
portability.

On SGI machines a significant increase in speed may be achieved with
the following optimization flags
\begin{center}
  \command{f77 -Ofast -LNO:opt=0 -IPA:INLINE=OFF module.f -o module}
\end{center}
 Inlining is a potentially dangerous operation which modifies the
source code, so the output (\file{xmu.dat}) should be checked.
Switching off inlining may slow down the code, as we found
for the \module{fms} module, but some other modules would not operate properly
with inlining.

On many UNIX systems it may be necessary to increase the memory stack
size to allow calculations on large clusters. For example, for 200
atom clusters, you should execute the following command before running
{\feffcur} for the \program{csh} or one of its derivatives
\begin{center}
  \command{limit stacksize 170000}
\end{center}
\noindent or, if you use the Bourne shell or one of its
derivatives, the following
\begin{center}
  \command{ulimit -s 170000}
\end{center}

If you use the GNU g77 compiler, for example, on LINUX, BSD, and
other systems try for example:
\begin{center}
  \command{g77 -O2 -ffast-math -m486 -Wall -g -fno-silent}
\end{center}

or (since the compile flags often change ) simply
\begin{center}
  \command{g77 -O2 }
\end{center}
\noindent Do not use the \command{-pedantic} flag, although a casual
reading of the g77 document would suggest it is a good idea.
\command{-pedantic} does not allow the use of double complex which
is essential in {\feff}.

On some AIX machines, the intrinsic real functions need to be promoted 
to double precision (e.g. -qautodbl=dbl option on RS6000). 


\section{CRAY, SGI-CRAY, and CDC UNIX}
\label{sec:CRAYusers}

 For CRAY, SGI-CRAY and CDC  UNIX, please keep in mind the following
points: Floating point calculations in {\feff} are usually done to 64 bit
precision. Thus for 32 bit word machines, the code uses double precision
variables throughout, i.e.,
\texttt{real*8} for real numbers and \texttt{complex*16} for complex
numbers. If your machine uses 8 bytes (64 bits) for single precision floating
point numbers and integers (for example, CRAYs and some CDC machines), you
should use the CRAY  FORTRAN compiler option to ignore double precision
statements in the code. The compile flags depend on machine vintage
(see the cf77 or f90 man pages for details) and are of the form:
\begin{center}
  \command{f90 -c -dp}
or
  \command{cf77 -c -Wf"-dp"}
\end{center}

\section{MS-DOS, WIN-NT,9X,ME,2K, etc}
\label{sec:Win32-users}

Because of the awkwardness of DOS, many users do not have 
FORTRAN compilers and many of those compilers are difficult 
to use with large codes. Thus we have made executable versions 
of {\feff} for PCs available. These versions should run on any 
32-bit Microsoft OS on an IA-32 (Pentium compatible) machine
with enough memory. Please contact the authors if you encounter 
any difficulties, or if you require a compatible executable.

If you prefer your own compiler (e.g., Compaq Visual Fortran or 
the free GNU g77 for Win32) or are using an operating system other 
than DOS, simply compile the source code using your FORTRAN compiler 
and linker as you would for any other machine.

You will need at least a Pentium (or compatible) CPU, and approximately 
500 MB of RAM. Machines with older processors (e.g., a 486 with math 
coprocessor) may be compatible, but usually support considerably less 
memory than this version of {\feff} requires. Less than 500 MB of RAM 
is not recommended for running {\feff}8.4, particularly for more intensive 
calculations (e.g., large cluster XANES calculations), but the code has 
been tested for small clusters on Windows machines with as little as 256 
MB of physical memory installed. 



\section{Macintosh}
\label{sec:MAC-users}

{\feff} is often difficult to compile on Macintosh machines with
Mac OS 9 and below, but
executable versions of {\feff} for Macintosh computers including
the G4 are available from the {\feff} Project.

For Mac OS X UNIX use the following options with Absoft's \program{f}77 compiler
\begin{center}
  \command{f77 -N113 -N11 -f -O  module.f}
\end{center}
\command{-f} makes \program{f}77 case insensitive. \command{-N113} 
 promotes intrinsic routines from real to double precision.
\command{-N11} allows 32 bit operations, and \command{-O} makes basic
optimizations.

There is another option for Mac OS X UNIX. At least one user has found that
f2c and the cc compiler can be made to work.

\section{Other Machines: VMS, NEXT, etc}
\label{sec:VMS-machines}

To compile {\feffcur} on VMS (6.0 to 6.2 versions) machine we had to increase
virtual memory using \program{sysgen} from a SYSTEM account.
\begin{center}
  \begin{minipage}[h]{0.7\linewidth}
    \begin{flushleft}
      \command{\$mc sysgen}\\
      \command{\quad  sysgen> use current}\\
      \command{\quad  sysgen>show virtualpagecnt}\\
      \command{\quad  sysgen>set virtualpagecnt  (value + 25\%)}\\
      \command{\quad  sysgen>write current}\\
      \command{\quad  sysgen>exit}\\
      \command{\$reboot}
    \end{flushleft}
  \end{minipage}
\end{center}

If the code still does not compile one should further increase virtual
memory. It may be impossible to compile the full code on old VAX
stations. To run {\feffcur} on VMS machines, you may need to increase
quotas (\command{pgflquo=500,000}) for the users using
\program{authorize} from a SYSTEM account.
\begin{center}
  \begin{minipage}[h]{0.7\linewidth}
    \begin{flushleft}
      \command{\$run authorize}\\
      \command{\quad authorize> modify  username /pgflquo=500000}\\
      \command{\quad authorize>exit}\\
      \command{\$reboot}
    \end{flushleft}
  \end{minipage}
\end{center}


Use the following options with Absoft's \program{f}77 for NeXT
\begin{center}
  \command{f77 -N53 -f -s -O  module.f}
\end{center}
\command{-f} makes \program{f}77 case insensitive. \command{-s} makes
a code for units larger than 512K. \command{-N53} uses the 68030/68040
processors with 68881/2 math coprocessor. \command{-O} is an
optimization flag.


\chapter{References}
\label{sec:Append-C-Refer}

Please cite at least one of the following articles if
{\feff} is used in published work.

\begin{Reflist}
\item[{\feff}8] {\it Main {\feff}8 reference} A.L.\ Ankudinov, B.\ Ravel,
  J.J.\ Rehr, and S.D.\ Conradson, \emph{Real Space Multiple Scattering
    Calculation of XANES}, Phys.\ Rev.\ B \textbf{58}, 7565 (1998).
  %%
\item[{\feff}8.1] A.L.\ Ankudinov, and J.J.\ Rehr, \emph{Theory of solid state contributions to the x-ray
  elastic scattering amplitude}, Phys.\ Rev.\ B \textbf{62}, 2437 (2000).
  %%
\item[{\feff}8.2] A.L.\ Ankudinov, C.\ Bouldin, J.J.\ Rehr, J.\ Sims, H.\ Hung,
   \emph{Parallel calculation of electron multiple scattering 
   using Lanczos algorithms}, Phys.\ Rev.\ B \textbf{65}, 104107 (2002).
  %%
\item[{\feff}8.4] A.L.\ Ankudinov, A.I.\ Nesvizhskii, and J.J.\ Rehr, \emph{Dynamic 
  screening effects in x-ray absorption spectra}, Phys.\ Rev.\ B 67, 115120 (2003); 
  this contains information about TDLDA calculations in {\feff}.
  %%
  M.S.\ Moreno, K.\ Jorissen, and J.J.\ Rehr, \emph{Practical aspects of electron energy-loss 
  spectroscopy (EELS) calculations using FEFF8}, Micron, in press (2006); this paper
  has information on EELS calculations using {\feff}8.4.

  %%  
\item[{\feff}7] A.L.\ Ankudinov and J.J.\ Rehr, \emph{Relativistic
    Spin-dependent X-ray Absorption Theory}, Phys.\ Rev.\ B \textbf{56},
  R1712 (1997).
  %%
  A.L.\ Ankudinov, PhD Thesis, \emph{Relativistic Spin-dependent
    X-ray Absorption Theory}, University of Washington, (1996); this
  contains a review of x-ray absorption theory, a whole chapter
  of information about {\feff} for expert users, example
  applications, and the full {\feff}7 program tree.
  %%
\item[{\feff}6] S.I.\ Zabinsky, J.J.\ Rehr, A.\ Ankudinov, R.C.\
  Albers and M.J.\ Eller, \emph{Multiple Scattering Calculations of
    X-ray Absorption Spectra}, Phys.\ Rev.\ B \textbf{52}, 2995 (1995).
  %%
\item[{\feff}5] J.J.\ Rehr, S.I.\ Zabinsky and R.C.\ Albers,
  \emph{High-order multiple scattering calculations of
    x-ray-absorption fine structure}, Phys.\ Rev.\ Lett.\ \textbf{69},
  3397 (1992).
  %%
\item[{\feff}3 and {\feff}4] J.\ Mustre de Leon, J.J.\ Rehr, S.I.\
  Zabinsky, and R.C.\ Albers, \emph{Ab initio curved-wave
    x-ray-absorption fine structure}, Phys.\ Rev.\ B \textbf{44}, 4146
  (1991).
  %%
\item[{\feff}3] J.J.\ Rehr, J.\ Mustre de Leon, S.I.\ Zabinsky, and
  R.C.\ Albers, \emph{Theoretical X-ray Absorption Fine Structure
    Standards}, J.\ Am.\ Chem.\ Soc.\ \textbf{113}, 5135 (1991).
  %%
\item[{\feff} Review] J.J.\ Rehr and R.C.\ Albers, \emph{Modern
Theory of XAFS}, Rev.\ Mod.\ Phys.\  \textbf{72}, 621 (2000).
  %%
\item[ Sum rule normalization procedure in {\feff}8.2]
A.I.\ Nesvizhskii, A.L.\ Ankudinov, and J.J.\ Rehr,
  \emph{Normalization and convergence of x-ray absorption sum
  rules}, Phys.\ Rev.\ B \textbf{63}, 094412 (2001).
  %%
\item[Multiple Scattering theory in {\feff}] J.J.\ Rehr and R.C.\ Albers,
  \emph{Scattering-matrix formulation of curved-wave
    multiple-scattering theory: Application to x-ray-absorption fine
    structure}, Phys.\ Rev.\ B \textbf{41}, 8139 (1990).
  %%
\item[Dirac--Fock atom code] A.L.\ Ankudinov, S.I.\ Zabinsky and J.J.\
  Rehr, \emph{Single configuration Dirac-Fock atom code}, Comp.\ Phys.\
  Comm.\ \textbf{98}, 359 (1996).

\end{Reflist}

\chapter{Code Variables and Dimensions}
\label{sec:Append-D-Code}

The array names in {\feff} are a bit cryptic due to the six character
limit in standard FORTRAN --- the comments given
 in the source code explain what the names mean. If you need
to run larger problems than the dimension statements in the code
allow, simply change the dimensions in all the relevant parameter
statements and recompile. The main parameters to change are \texttt{nclusx},
which specifies the maximum cluster size for full multiple scattering,
and \texttt{lx}, which specifies the maximum angular momentum in SCF potentials.
These and other user changeable parameters are listed in \file{dim.h},
which is now incorporated explicitly in the code. If you need help to
modify the {\feff} code, please contact the authors.

\begin{verbatim}

c      maximum number of atoms for FMS. Reduce nclusx if you need
c      smaller executable.
       parameter (nclusx=175)
c      max number of spins: 1 for spin average; 2 for spin-dep
       parameter (nspx=1)
c      max number of atoms in problem for the pathfinder
       parameter (natx =1000)
c      max number of atoms in problem for the rdinp and ffsort
       parameter (nattx =10000)
c      max orbital momentum for FMS module.
       parameter (lx=3)
c      max number of unique potentials (potph) (nphx must be ODD to 
c      avoid compilation warnings about alignment in COMMON blocks)
       parameter (nphx = 7)
c      max number of ang mom (arrays 1:ltot+1)
       parameter (ltot = 24)
c      Loucks r grid used through overlap and in phase work arrays
       parameter (nrptx = 1251)
c      Number of energy points genfmt, etc.
       parameter (nex = 450)
c      Max number of distinct lambda's for genfmt
c      15 handles iord 2 and exact ss
       parameter (lamtot=15)
c      vary mmax and nmax independently
       parameter (mtot=4, ntot=2)
c      max number of path atoms, used in path finder, NOT in genfmt
       parameter (npatx = 8)
c      matches path finder, used in GENFMT
       parameter (legtot=npatx+1)
c      max number of overlap shells (OVERLAP card)
       parameter (novrx=8)
c      max number of header lines
       parameter (nheadx=30)
       
\end{verbatim}

It should also be noted here that there is an internal limit on the 
number of paths (set to 1200) that will be read from \file{feff.bin}. 
This limit was chosen to handle any reasonable problem without using 
an excessive amount of memory. If you must use more paths, change the 
parameter \texttt{npx} in the {\feff} source in subroutine \texttt{ff2x} 
to whatever you need. This will require more memory. We have not had 
a case where the filter criteria were not able to solve the problem 
with fewer than 1200 paths.


\chapter{Changes From Previous Versions of FEFF}
\label{sec:Append-E-Changes}

{\feff}8.50 is an extension of {\feff}8.40. It adds automated
EELS calculations (ELNES/EXELFS and MAGIC cards), convolution of 
regular {\feff} XAS output with a many body spectral function 
(SO2CONV card), and calculations of a screened core-hole (NOHOLE 
2 card) and multiple pole self energy (PLASMON card).

{\feff}8.40 automates spin-dependent calculations, simplifying 
calculation of spin-polarized absorption spectra (SPXAS, SPEXAFS)
and XMCD, and introduces TDLDA calculations to account for core-hole 
and local field screening effects. Calculations have been added 
using TDDFT and PMBSE to account for additional core-hole effects, 
but these are still under development and are not reliable in this 
release.

{\feff}8.20  extends the calculation of quadrupolar transitions
and x-ray emission spectra calculations, and also permits
faster XANES calculations using iterative Lanczos FMS algorithms.
Improved potentials for $f$-electron materials are also included.
The code has been restructured to simplify future developments and 
is also available as separate modules which can be
run on parallel machines.

{\feff}8.10 fixes a few bugs
(notably that for polarization dependent
calculations for initial states other than $s$-character; i.e.,
L2, L3 edges,etc) and adds some new capabilities. The code 
has been extended to calculate elastic scattering
amplitude and x-ray natural dichroism. An additional output file, \file{ratio.dat}, has been added for use in our procedure for sum-rule normalization.

{\feff}8 potentials can now be calculated self-consistently (SCF
card) which also gives a more accurate Fermi level position and
accounts for the charge transfer. Full multiple scattering capability
was also added (FMS card). This is essential for SCF potentials,
L-projected density of states (LDOS also is a new card) and often
XANES. All these new cards are not essential for EXAFS calculations,
but the SCF potential can be used to reduce number of EXAFS fitting
parameters by calculating the Fermi level and non-integral charge
counts on each site. The possibility of calculating
multiple-scattering Debye--Waller factors from force constants and/or
dynamical matrices has also been added. The possibility of
configurational averages (CFAVERAGE card) of EXAFS (or XANES) over
different absorbers of the same type has been added. The CONTROL
structure has been changed to accommodate the new cards, but backward
compatibility has been maintained. Also several cards (e.g.\ EXAFS,
XANES and POTENTIALS) now have additional optional fields.

\chapter{Trouble-Shooting FEFF Problems and Bug Reports}
\label{sec:Append-F-Trouble}

{\feffcur} has been extensively tested on many different architectures,
but occasionally new bugs show up. In an effort to maintain portable
and trouble-free codes, we take all bug reports seriously. Please
let us know if you encounter any compilation error or warning messages.
Often we receive reports by users of older
versions of {\feff} of bugs that have been fixed in more recent
releases. Other code failures can often be traced to input file
errors, sometimes quite subtle, and some are compiler bugs, for which
we try to find a workaround.

To  report a bug, please tell us the version of the code you are using
and which operating system and compiler you have. Please include a
\file{feff.inp} if the problem occurs after compilation
and enough detail concerning the warning or error messages or
other difficulties you have so that we can attempt to reproduce the problem.

Some known and commonly encountered difficulties are:
\begin{itemize}
\item Non-physical, widely spaced distributions of atoms. Symptoms of
  this common problem are very large muffin-tin radii (see the header
  of any \file{.dat} file) and possibly a failure of the phase-shift
  program to converge. This gives error message \texttt{hard test
    fails in fovrg}.
\item An error in assigning potential indices; the first atom with a
  given potential index must have the geometry representative of this
  potential type. This is sometimes fixed by using a somewhat larger
  cluster; in fact it is usually desirable to have a larger cluster
  for potential construction than that used in the XAFS calculation
  due to errors in the potentials at surfaces. Unless the atom
  distribution is physically possible, you can expect the code to have
  problems.
\item Hash collision in the pathfinder. This is now rare, but can
  usually be corrected simply by changing distances in the fourth
  decimal place.
\item For the $M_{\mathit{IV}}$ and higher edges you may receive the
  error message like: \texttt{Lambda array overfilled}. The
  calculations should be repeated with IORDER -70202 card.
\end{itemize}

\end{latexonly} % begins before chapter 3

\end{document}



%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
