\documentstyle [12pt]{article}

\setlength{\topmargin}{-0.75in}
\setlength{\textheight}{9.70in}
\setlength{\textwidth}{7.50in}
\setlength{\oddsidemargin}{-0.51in}

\pagestyle{empty}

\begin{document}

\begin{center}
\large{{\underline {\bf Installation of the DeFT Software Package}}} \\

\vspace{0.15in}

Alain St-Amant, August 27, 1998 \\

\end{center}

\vspace{0.50in}

DeFT was written using standard FORTRAN.  I can compile the program, as is,
on my Pentium using g77 under Linux, my IBM RISC using xlf, and a Cray T3E
using f90.  Warning messages are, however, issued by the Cray T3E.  The
Cray T3E's f90 compiler will say that it cannot accomodate the double precision
constants in the DATA statements.  This is of course not a problem as the T3E
is a 64 bit machine.  These warning messages can be supressed with an f90
compiler option.  The g77 compiler may also issue warnings objecting to
different argument types in separate calls to MPI subroutines (which is fine:
for example, the {\bf mpi\_send} command can be used for reals or integers).
In the following discussion, I assume that you are working in the
{\bf ./source} subdirectory.

\vspace{0.25in}

Before compiling, you will have to decide whether or not you wish to run under
MPI (i.e., in parallel).  If you do, then you should replace DeFT's supplied
{\bf mpif.h} file with the appropriate {\bf mpif.h} file for your system
(either a copy or a soft link to the appropriate {\bf mpif.h} file will
suffice).  If not running under MPI, retain the {\bf mpif.h} file supplied with
DeFT.  The system's own {\bf mpif.h} file {\em is not appropriate} if you will
not be using MPI.  DeFT supplies a set of dummy ``MPI-like" routines in
{\bf mpi.f} that mimic an MPI environment when running on a single processor
and true MPI is not being used.  These dummy ``MPI-like" routines can only
function properly with the supplied {\bf mpif.h} file.  If running under MPI,
the {\bf mpi.f} file should be deleted.  If not running under MPI, the
{\bf mpi.f} file should be retained.  Though perhaps confusing, this use of
dummy ``MPI-like" routines allows us to get away with maintaining a single
copy of DeFT that runs on machines ranging from single processor Pentiums
to massively parallel Cray T3E's.

\vspace{0.25in}

One can now proceed to the compilation of the FORTRAN files.  To compile the
FORTRAN files on the Pentium, IBM RISC, and Cray T3E, I use the following
commands, respectively:
\begin{tabbing}
{\bf \hspace{1.00in}
     g77 -c -malign-double -O *.f }  \\
{\bf \hspace{1.00in}
     xlf -c -v -qmaxmem=-1 -NT99999 -ND99999 -NQ99999 -O2 *.f }  \\
{\bf \hspace{1.00in}
     f90 -c *.f }  \\
\end{tabbing}

\vspace{0.25in}

To link the object files and create the DeFT executable, I use the following
commands on the Pentium, IBM RISC, and Cray T3E, respectively:
\begin{tabbing}
{\bf \hspace{1.00in}
     g77 -o DeFT *.o }  \\
{\bf \hspace{1.00in}
     xlf -o DeFT *.o } \\
{\bf \hspace{1.00in}
     f90 -o DeFT -Xm *.o -L/opt/ctl/mpt/mpt/lib -lmpi } \\
\end{tabbing}

\vspace{-0.20in}

\noindent
Note that the command used for the Cray T3E invokes the MPI library.  If for
some reason you do not want to use MPI on the Cray T3E, then a command similar
to that used for either the Pentium or IBM RISC would suffice (i.e., replacing
either {\bf g77} or {\bf xlf} with {\bf f90}).

\vspace{0.25in}

To run DeFT, I use the following script on my IBM (you may need to alter it
for your particular system --- you will definitely need to change it to
reflect the structure of your file system):

\newpage
\begin{tabbing}
\bf{ \hspace{1.00in} \# }  \\
\bf{ \hspace{1.00in} \# here is the shell for running DeFT }  \\
\bf{ \hspace{1.00in} \# }  \\
                           \\
\bf{ \hspace{1.00in} setenv my\_directory \$HOME/DeFT\_2.2/examples }  \\
\bf{ \hspace{1.00in} setenv DeFT\_directory \$HOME/DeFT\_2.2 }  \\
\bf{ \hspace{1.00in} setenv temp\_directory /scratch/tmp\$\$ }  \\
                           \\
\bf{ \hspace{1.00in} mkdir \$temp\_directory }  \\
\bf{ \hspace{1.00in} cd \$temp\_directory }  \\
                           \\
\bf{ \hspace{1.00in} touch \$my\_directory/\$1.rst }  \\
\bf{ \hspace{1.00in} touch \$my\_directory/\$1.pts }  \\
                           \\
\bf{ \hspace{1.00in} cp \$my\_directory/\$1.rst  old\_restart }  \\
\bf{ \hspace{1.00in} cp \$my\_directory/\$1.pts  esppts }  \\
\bf{ \hspace{1.00in} cp \$my\_directory/\$1.dft  input }  \\
\bf{ \hspace{1.00in} cp \$DeFT\_directory/bases bases }  \\
                           \\
\bf{ \hspace{1.00in} chmod u+w \$temp\_directory/* }  \\
                           \\
\bf{ \hspace{1.00in} cp \$DeFT\_directory/source/DeFT             DeFT }  \\
                           \\
\bf{ \hspace{1.00in} time DeFT $<$ input $>$\& \$my\_directory/\$1.out }  \\
                           \\
\bf{ \hspace{1.00in} cp new\_restart \$my\_directory/\$1.rst }  \\
\bf{ \hspace{1.00in} cp espf        \$my\_directory/\$1.espf }  \\

\bf{ \hspace{1.00in}
 touch core DeFT bases input hessian esppts espf frozen *\_restart fort.* }  \\
\bf{ \hspace{1.00in}
 chmod u+w core DeFT bases input hessian
 esppts espf frozen *\_restart fort.* }  \\
\bf{ \hspace{1.00in}
 rm core DeFT bases input hessian esppts espf frozen *\_restart fort.* }  \\
\bf{ \hspace{1.00in} cd }  \\
\bf{ \hspace{1.00in} rmdir \$temp\_directory }  \\
\end{tabbing}

\noindent
This file is included in the {\bf ./examples} subdirectory, as {\bf DeFT}.
Provided that you have installed DeFT in {\bf \$HOME/DeFT\_2.2}, you need only
redefine the environment variable {\bf my\_directory} which contains the
input file you wish to run.  It is also assumed that the input file has the
{\bf .dft} extension.  To run a job whose input deck is in {\bf molecule.dft},
you need only type in {\bf DeFT molecule} in the directory containing it.

\vspace{0.25in}

The parameters defining the maximum size of the arrays in DeFT are found in
{\bf ./source/params.h}, and the two limitations of interest to the user are
500 orbital basis functions and 100 atoms.  These can be increased by the user,
and only the {\bf ./source/main.f} and {\bf ./source/mpi.f} (if not using
true MPI) FORTRAN files need be recompiled as all arguments are passed to
subroutines through their calls (i.e., no COMMON blocks are used).  Other
parameters in {\bf ./source/params.h} may need to be increased, most notably
{\bf nreal} and {\bf ninteger}.  The program will notify the user if these
have become too small.

\end{document}
