%
% $Id$
%
\label{sec:ccsd}

The NWChem coupled cluster energy module is primarily the work of
Alistair Rendell and Rika Kobayashi, with contributions from David
Bernholdt.

The coupled cluster code can perform calculations with full iterative
treatment of single and double excitations and non-iterative inclusion
of triple excitation effects.  It is presently limited to closed-shell
(RHF) references.

{\em Note that symmetry is not used within most of the CCSD(T) code.}
This can have a profound impact on performance since the speed-up from
symmetry is roughly the square of the number of irreducible
representations.  In the absence of symmetry, the performance of this
code is competitive with other programs.

The operation of the coupled cluster code is controlled by the input
block
\begin{verbatim}
  CCSD
    [MAXITER <integer maxiter default 20>]
    [THRESH  <real thresh default 10e-6>]
    [TOL2E <real tol2e default min(10e-12 , 0.01*$thresh$)>]
    [DIISBAS  <integer diisbas default 5>]
    [NODISK]
    [FREEZE [[core] (atomic || <integer nfzc default 0>)] \
            [virtual <integer nfzv default 0>]]
    [IPRT  <integer IPRT default 0>]
    [PRINT ...]
    [NOPRINT ...]
    [NODISK]
  END
\end{verbatim}
Note that the keyword \verb+CCSD+ is used for the input block
regardless of the actual level of theory desired (specified with the
\verb+TASK+ directive).  The following directives are recognized
within the \verb+CCSD+ group.

\section{{\tt MAXITER} --- Maximum number of iterations}

The maximum number of iterations is set to 20 by default.  This should
be quite enough for most calculations, although particularly
troublesome cases may require more.

\begin{verbatim}
  MAXITER  <integer maxiter default 20>
\end{verbatim}

\section{{\tt THRESH} --- Convergence threshold}

Controls the convergence threshold for the iterative part of the
calculation.  Both the RMS error in the amplitudes {\em and} the
change in energy must be less than {\tt thresh}.

\begin{verbatim}
  THRESH  <real thresh default 10e-6>
\end{verbatim}

\section{{\tt TOL2E} --- integral screening threshold}

\begin{verbatim}
  TOL2E <real tol2e default min(10e-12 , 0.01*$thresh$)>
\end{verbatim}

The variable \verb+tol2e+ is used in determining the integral
screening threshold for the evaluation of the energy and related
quantities.

{\em CAUTION!}  At the present time, the \verb+tol2e+ parameter only
affects the three- and four-virtual contributions, and the triples,
all of which are done ``on the fly''. The transformations
used for the other parts of the code currently have a hard-wired
threshold of $10^{-12}$.  The default for \verb+tol2e+ is set to match
this, and since user input can only make the threshold smaller,
setting this parameter can only make calculations take longer.

\section{{\tt DIISBAS} --- DIIS subspace dimension}

Specifies the maximum size of the subspace used in DIIS convergence
acceleration.  Note that DIIS requires the amplitudes and errors be
stored for each iteration in the subspace.  Obviously this can
significantly increase memory requirements, and could force the user
to reduce \verb+DIISBAS+ for large calculations.

{\em Measures to alleviate this problem, including more compact
storage of the quantities involved, and the possibility of disk
storage are being considered, but have not yet been implemented.}

\begin{verbatim}
  DIISBAS  <integer diisbas default 5>
\end{verbatim}

\section{{\tt NODISK} --- disable integral caching}

Disables integral caching on disk during the CCSD iterations.  The effect
of this keywork upon performance varies with the chemical system, basis
set and hardware parameters.  If the time for the first CCSD iteration 
exceeds the time for subsequent iterations, this may be indication that
writing to disk is not useful and that \verb+NODISK+ will improve 
performance.

\begin{verbatim}
 NODISK
\end{verbatim}

\section{{\tt FREEZE} --- Freezing orbitals}

\begin{verbatim}
    [FREEZE [[core] (atomic || <integer nfzc default 0>)] \
            [virtual <integer nfzv default 0>]]
\end{verbatim}

This directive is idential to that used in the MP2 module, Section
\ref{mp2:core}.

\section{{\tt IPRT} --- Debug printing}

This directive controls the level of output from the code, mostly to
facilitate debugging and the like.  The larger the value, the more
output printed.  From looking at the source code, the interesting
values seem to be \verb+IPRT+ $>$ 5, 10, and 50.

\begin{verbatim}
  IPRT  <integer IPRT default 0>
\end{verbatim}

\section{PRINT and NOPRINT}

The coupled cluster module supports the standard NWChem print control
keywords, although very little in the code is actually hooked into
this mechanism yet.

\begin{tabular}{lll}
\hline\hline
Item                    & Print Level   & Description \\
\hline
``reference''             & high          & Wavefunction information\\
``guess pair energies'' & debug & MP2 pair energies\\
``byproduct energies'' & default & Intermediate energies   \\
``term debugging switches'' & debug & Switches for individual terms \\
\hline\hline
\end{tabular}

\section{NODISK}

Turns off disk based storing of 2-electron integrals during CCSD
iterations (on by default).

\section{Methods (Tasks) Recognized}

Currently available methods are
\begin{itemize}
\item \verb+CCSD+ -- Full iterative inclusion of single and double
excitations
\item \verb=CCSD+T(CCSD)= -- The fourth order triples contribution computed with
converged singles and doubles amplitudes
\item \verb=CCSD(T)= -- The linearized triples approximation due to
  Raghavachari.
\end{itemize}

The calculation is invoked using the the \verb+TASK+ directive, so to
perform a CCSD+T(CCSD) calculation, for example, the input file should
include the directive
\begin{verbatim}
  TASK CCSD+T(CCSD)
\end{verbatim}

Lower-level results which come as by-products (such as MP3/MP4) of the
requested calculation are generally also printed in the output file
and stored on the run-time database, but the method specified in the
\verb+TASK+ directive is considered the primary result.

\section{Debugging and Development Aids}

The information in this section is intended for use by experts (both
with the methodology and with the code), primarily for debugging and
development work.  Messing with stuff in listed in this section will
probably make your calculation quantitatively {\em\bf wrong}\/!
Consider yourself warned!

\subsection{Switching On and Off Terms}

The \verb+/DEBUG/+ common block contains a number of arrays which
control the calculation of particular terms in the program.  These are
15-element integer arrays (although from the code only a few elements
actually effect anything) which can be set from the input deck.  See
the code for details of how the arrays are interpreted.  

Printing of this data at run-time is controlled by the
\verb+"term debugging switches"+ print option.  The values are checked against
the defaults at run-time and a warning is printed to draw attention to
the fact that the calculation does not correspond precisely to the
requested method.

\begin{verbatim}
  DOA  <integer array default 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2>
  DOB  <integer array default 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2>
  DOG  <integer array default 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1>
  DOH  <integer array default 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1>
  DOJK <integer array default 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2>
  DOS  <integer array default 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1>
  DOD  <integer array default 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1>
\end{verbatim}
