\section{ocount.C File Reference}
\label{ocount_C}\index{ocount.C@{ocount.C}}
{\tt \#include $<$fstream.h$>$}\par
{\tt \#include "dynstring.h"}\par
{\tt \#include "dllist.h"}\par
{\tt \#include "constraint\_\-manager.h"}\par
{\tt \#include "constraint\_\-registry.h"}\par
{\tt \#include "globals.h"}\par
{\tt \#include "error\_\-handler.h"}\par


Include dependency graph for ocount.C:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=208pt]{ocount_C_incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf print\_\-usage} (ostream \&os)
\begin{CompactList}\small\item\em Prints information about usage.\item\end{CompactList}\item 
void {\bf print\_\-help} (ostream \&os)
\begin{CompactList}\small\item\em Prints full help.\item\end{CompactList}\item 
int {\bf main} (int argc, char $\ast$$\ast$argv)
\end{CompactItemize}


\subsection{Function Documentation}
\index{ocount.C@{ocount.C}!main@{main}}
\index{main@{main}!ocount.C@{ocount.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int main (int {\em argc}, char $\ast$$\ast$ {\em argv})}\label{ocount_C_a2}




Definition at line 17 of file ocount.C.\footnotesize\begin{verbatim}00017                                  {
00018   if(argc < 2)
00019     {            
00020       print_usage(cout);
00021       return 0;
00022     }
00023   
00024   cerr << "Begin: ";
00025   for (int i =0; i < argc; i++){
00026     cerr << argv[i]<<" ";
00027   }
00028   cerr << endl;
00029   
00030   DLList<DynString> ArgList;
00031   // List of command line (and parameter file originating) arguments.
00032 
00033   Molecule * predictedMolecule=0;
00034   // now the molecule is a private member of CM'
00035   
00036   // Iterate through all the command line arguments:
00037   DynString arg;
00038   // Command-line argument.
00039   ifstream * input=0;
00040   // Parameter input stream.
00041   int argStart = 1;
00042 
00043   // default output filenamestart string
00044   DynString BaseFN = "ocount-output";
00045         
00046   
00047   // See if the user has specified a parameter file.  It is a 
00048   // parameter file if the first argument does *not* start with
00049   // a dash, '-' (i.e. it is not a flag).
00050   //  
00051   
00052   if(argv[1][0] != '-')
00053     {
00054       // Read in the arguments from the parameter file.  This file should
00055       // contain flags (including their dashes) followed immediately by
00056       // the values associated with them.  Warning: this processing step
00057       // ignores white space!
00058       //
00059       input = new ifstream(argv[1]);
00060       if(!(input->good()))
00061         {
00062           cerr << "Could not open/find parameter file, " << argv[1]
00063                << ", quitting. Try -help option.\n";
00064           return 1;
00065         }
00066       while(input->good())
00067         {
00068           *input >> arg;
00069           cerr << arg << " ";
00070           if(arg[0] == '#')
00071             arg.EatLine(*input);          
00072           // Ignore lines that begin with a pound, '#', sign:
00073           else
00074             ArgList.AddToBack(arg);
00075         }
00076       cerr << endl;
00077       ArgList.RemoveFromBack();  // Get rid of the eof character.
00078       delete input; input=0;
00079       argStart=2;
00080     }
00081 
00082   // Copy the arguments from the command line onto our argument list:
00083   //
00084   for(int a=argStart; a<argc; ++a)
00085     ArgList.AddToBack(DynString(argv[a]));
00086 
00087   while(ArgList)
00088     {
00089       arg = ArgList.RemoveFromFront();
00090 
00091       // Initial molecule file is being specified.
00092       //
00093 
00094       if((arg == DynString("-initial")) ||
00095          (arg == DynString("-init")) ||
00096          (arg == DynString("-i")))
00097         {
00098           // Check to see if we've already read in a molecule:
00099           if(predictedMolecule)
00100             {
00101               cerr << "Warning: More than one file has been supplied for "
00102                    << "the initial molecule.\nWill use the molecule "
00103                    << "specified in the file listed last.\n";
00104               delete predictedMolecule; predictedMolecule=0;
00105             }
00106 
00107           arg = ArgList.RemoveFromFront();  // Get the name of the xmol file.
00108           if((input = new ifstream(arg.GetData())))
00109             {
00110               predictedMolecule = new Molecule;
00111               if(predictedMolecule->readXmol(*input)<1)
00112                 {
00113                   cerr << "Error reading initial molecule.\n";
00114                   delete predictedMolecule; predictedMolecule=0;
00115                 }
00116               delete input; input=0;
00117             }
00118           else
00119             {
00120               cerr << "Could not open initial molecule file, " << arg
00121                    << ", will try default location.\n";
00122             }
00123         }
00124       
00125       else if(arg == DynString("-f") ||
00126               arg == DynString("-filebase"))
00127         {
00128             arg = ArgList.RemoveFromFront();
00129             if (arg[0] != '-'){
00130               BaseFN = arg;
00131             } else {
00132               DIE("Confused by filename ");
00133             }
00134         }
00135 
00136 
00137       else if(arg == DynString("-w") ||
00138               arg == DynString("-width"))
00139         {
00140           double width;
00141           if (ArgList.IsEmpty()) {
00142             DIE("Error while parsing the vdw arguments. Try -help option.");
00143           }
00144           arg = ArgList.RemoveFromFront();
00145           width = arg.ToDbl();
00146           jdOcc_Count::cube_width = width;
00147         }
00148 
00149       else if(arg == DynString("-help"))
00150         {
00151           print_help(cout);
00152           return 0;
00153             
00154         }
00155 
00156       // Ignore the bogus parameter.
00157       //
00158       else
00159         {
00160           cerr << "Unknown argument, " << arg << ", given, ignoring.\n";
00161         }
00162     }
00163 
00164   // If we havent read in an initial molecule, we'll check the default
00165   // location for one:
00166   //
00167   if(!predictedMolecule)
00168     {
00169       cerr << "No initial molecule specified, quitting. Try -help option.\n";
00170       return 3;
00171     }
00172 \end{verbatim}\normalsize 
\index{ocount.C@{ocount.C}!print_help@{print\_\-help}}
\index{print_help@{print\_\-help}!ocount.C@{ocount.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void print\_\-help (ostream \& {\em os})}\label{ocount_C_a1}


Prints full help.



Definition at line 197 of file ocount.C.\footnotesize\begin{verbatim}00198 {
00199   os    << "\nHELP for using GRAPE\n\n";
00200   print_usage(os);
00201   os    << "Additional Options:\n"
00202         << "  {-w | -width n}
00203 \end{verbatim}\normalsize 
\index{ocount.C@{ocount.C}!print_usage@{print\_\-usage}}
\index{print_usage@{print\_\-usage}!ocount.C@{ocount.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void print\_\-usage (ostream \& {\em os})}\label{ocount_C_a0}


Prints information about usage.



Definition at line 188 of file ocount.C.\footnotesize\begin{verbatim}00189 {
00190   os    << "\nUsage: ocount <-help> [optionfilename | options] \n\n"
00191         << "Required options:\n"
00192         << "  {-initial | -init | -i} <filename> }
00193 \end{verbatim}\normalsize 
