\section{err\_\-eval.C File Reference}
\label{err_eval_C}\index{err_eval.C@{err\_\-eval.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 err\_\-eval.C:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=211pt]{err_eval_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{err_eval.C@{err\_\-eval.C}!main@{main}}
\index{main@{main}!err_eval.C@{err\_\-eval.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int main (int {\em argc}, char $\ast$$\ast$ {\em argv})}\label{err_eval_C_a2}




Definition at line 17 of file err\_\-eval.C.\footnotesize\begin{verbatim}00017                                  {
00018   if(argc < 2)
00019     {            
00020       print_usage(cout);
00021       return 1;
00022     }
00023   
00024   cerr << "Begin: ";
00025   for (int i =0; i < argc; i++){
00026     cerr << argv[i]<<" ";
00027   }
00028   cerr << endl;
00029   
00031   DLList<DynString> ArgList;
00032 
00034   DLList<DynString> ConstraintFileList;
00035 
00037   Molecule * predictedMolecule=0;
00038   
00040   DynString arg;
00041 
00042   DynString positionFile = "";
00043 
00045   ifstream * XmolInputFile=0;
00046 
00047 
00049   ifstream * input=0;
00050 
00052   int argStart = 1;
00053 
00055   DynString BaseFN = "evalenv-output";
00056 
00057   int skip = 1;
00058   
00059   // See if the user has specified a parameter file.  It is a 
00060   // parameter file if the first argument does *not* start with
00061   // a dash, '-' (i.e. it is not a flag).
00062   //  
00063   
00064   if(argv[1][0] != '-')
00065     {
00066       // Read in the arguments from the parameter file.  This file should
00067       // contain flags (including their dashes) followed immediately by
00068       // the values associated with them.  Warning: this processing step
00069       // ignores white space!
00070       //
00071       if(!(input = new ifstream(argv[1])))
00072         {
00073           cerr << "Could not open/find parameter file, " << argv[1]
00074                << ", quitting. Try -help option.\n";
00075           return 2;
00076         }
00077       while(!input->eof() && !input->bad())
00078         {
00079           *input >> arg;
00080 
00081           if(arg[0] == '#')
00082             arg.EatLine(*input);
00083           // Ignore lines that begin with a pound, '#', sign:
00084           else
00085             ArgList.AddToBack(arg);
00086         }
00087       ArgList.RemoveFromBack();  // Get rid of the eof character.
00088 
00089       delete input; input=0;
00090       argStart=2;
00091     }
00092 
00093   // Copy the arguments from the command line onto our argument list:
00094   //
00095   for(int a=argStart; a<argc; ++a)
00096     ArgList.AddToBack(DynString(argv[a]));
00097 
00098   while(ArgList)
00099     {
00100       arg = ArgList.RemoveFromFront();
00101       
00102       if((arg == DynString("-residues")) ||
00103               (arg == DynString("-res"))) {
00104           
00105         // Check to see if we've already read in a molecule:
00106           if(predictedMolecule)
00107             {
00108               cerr << "Warning: More than one file has been supplied for "
00109                    << "the initial molecule.\nWill use the molecule "
00110                    << "specified in the file listed last.\n";
00111               delete predictedMolecule; predictedMolecule=0;
00112             }
00113           arg = ArgList.RemoveFromFront();  // Get number of atoms
00114           if((input = new ifstream(arg.GetData())))
00115             {     
00116               predictedMolecule = new Molecule;
00117           
00118               if(predictedMolecule->readFasta(*input)<2)
00119                 {
00120                   cerr << "Error generating molecule from residue sequence.\n";
00121                   delete predictedMolecule; predictedMolecule=0;
00122                 }
00123               delete input;input = 0;
00124             } else {
00125               cerr << "Could not open initial FASTA file, " << arg
00126                    << ", will try default location.\n";
00127               
00128             }     
00129       }
00130 
00131       // Initial atom positions
00132       //
00133       else if((arg == DynString("-initial")) ||
00134               (arg == DynString("-init")) ||
00135               (arg == DynString("-i"))) {
00136 
00137         positionFile = ArgList.RemoveFromFront();  // Get the name of the xmol file.
00138 
00139       }
00140 
00141 
00142 //   while(ArgList)
00143 //     {
00144 //       arg = ArgList.RemoveFromFront();
00145 // 
00146 //       // Initial molecule file is being specified.
00147 //       //
00148 // 
00149 //       if((arg == DynString("-initial")) ||
00150 //       (arg == DynString("-init")) ||
00151 //       (arg == DynString("-i")))
00152 //      {
00153 //        // Check to see if we've already read in a molecule:
00154 //        if(predictedMolecule)
00155 //          {
00156 //            cerr << "Warning: More than one file has been supplied for "
00157 //                 << "the initial molecule.\nWill use the molecule "
00158 //                 << "specified in the file listed last.\n";
00159 //            delete predictedMolecule; predictedMolecule=0;
00160 //          }
00161 // 
00162 //        arg = ArgList.RemoveFromFront();  // Get the name of the xmol file.
00163 //        if((XmolInputFile = new ifstream(arg.GetData())))
00164 //          {
00165 //            predictedMolecule = new Molecule;
00166 //            if(predictedMolecule->readXmol(*XmolInputFile)<1)
00167 //              {
00168 //                cerr << "Error reading initial molecule.\n";
00169 //                delete predictedMolecule; predictedMolecule=0;
00170 //              }
00171 //          }
00172 //        else
00173 //          {
00174 //            cerr << "Could not open initial molecule file, " << arg
00175 //                 << ", will try default location.\n";
00176 //          }
00177 //      }
00178       
00179       else if(arg == DynString("-f") ||
00180               arg == DynString("-filebase"))
00181         {
00182             arg = ArgList.RemoveFromFront();
00183             if (arg[0] != '-'){
00184               BaseFN = arg;
00185             } else {
00186               DIE("Confused by filename ");
00187             }
00188         }
00189 
00190       else if(arg == DynString("-skip"))
00191         {
00192           arg = ArgList.RemoveFromFront();
00193           if (arg[0] != '-'){
00194             skip = arg.ToInt();
00195           } else {
00196             DIE("Confused by filename ");
00197           }
00198         }
00199 
00200       else if((arg == DynString("-constraint")) ||
00201               (arg == DynString("-constraints")) ||
00202               (arg == DynString("-c")))
00203         {
00204           // Just add this file to the list of files that contain
00205           // constraints for right now.  We'll read these in once 
00206           // we're sure we have an initial molecule.
00207           //
00208           arg = ArgList.RemoveFromFront();
00209           ConstraintFileList.AddToBack(arg);
00210         }
00211 
00212 
00213       else if(arg == DynString("-help"))
00214         {
00215           print_help(cout);
00216           return 1;
00217             
00218         }
00219 
00220       // Ignore the bogus parameter.
00221       //
00222       else
00223         {
00224           cerr << "Unknown argument, " << arg << ", given, ignoring.\n";
00225         }
00226     }
00227 
00228   // If we havent read in an initial molecule, we'll check the default
00229   // location for one:
00230   //
00231   if(!predictedMolecule)
00232     {
00233       cerr << "No initial molecule specified (-residues), quitting. Try -help option.\n";
00234       return 3;
00235     }
00236 
00237 
00238   if (positionFile != "") {
00239     
00240     if((XmolInputFile = new ifstream(positionFile.GetData())))
00241       {
00242         if(predictedMolecule->readXmol(*XmolInputFile)<2)
00243           {
00244             cerr << "Error reading initial positions from " << positionFile << ".  Check the file.\n";
00245             delete predictedMolecule; predictedMolecule=0;
00246             return 4;
00247           }
00248       } else    {
00249         cerr << "Could not open initial molecule position file: " << positionFile << ".\n";
00250         return 5;
00251       }
00252 
00253   } else {
00254     cerr << " You must use -i to specify initial positions" << endl;
00255     return 6;
00256   }
00257   
00258   // Now that we've got an actual molecule, we can create a constraint
00259   // manager and read in the constraints:
00260   //
00261 
00262   ConstraintManager CM(*predictedMolecule);
00263 
00264   //
00265   //  cerr << " WARNING WARNING WARNING -- perturbing inputs \n\n" << endl;
00266   //  CM.RandomPerturb(.2);
00267   //
00268   
00269   int num_read = 0;
00270   
00271   while(ConstraintFileList)
00272     {
00273       // Get the filename and then open the file and then read the
00274       // constraints in using the constraint manager.
00275       arg = ConstraintFileList.RemoveFromFront();
00276       input = new ifstream(arg.GetData());
00277       if(input->good())
00278         {
00279           // Use the registry's routine to read in constraints and
00280           // append them to the constraint manager.
00281           //
00282 
00283           num_read += ConstraintRegistry::readConstraints(*input,CM);
00284           delete input; input=0;
00285         } else {
00286           cerr << "\n\nWhile reading file: " << arg.GetData() << endl;
00287           DIE ("Cannot open file");
00288         }
00289 
00290     }
00291 
00292   if (num_read == 0) {
00293     WARN ("You have no constraints");
00294   }
00295 
00296 
00297   jdErr_Eval myeval(CM, XmolInputFile, skip);
00298   myeval.BaseFN = BaseFN;
00299   myeval.run();
00300   
00301   if (predictedMolecule)
00302     delete predictedMolecule;
00303   if (XmolInputFile)
00304     {delete XmolInputFile;XmolInputFile =0;}
00305 \end{verbatim}\normalsize 
\index{err_eval.C@{err\_\-eval.C}!print_help@{print\_\-help}}
\index{print_help@{print\_\-help}!err_eval.C@{err\_\-eval.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void print\_\-help (ostream \& {\em os})}\label{err_eval_C_a1}


Prints full help.



Definition at line 321 of file err\_\-eval.C.\footnotesize\begin{verbatim}00322 {
00323   os    << "\nHELP\n\n";
00324   print_usage(os);
00325   os    << "Additional Options:\n"
00326         << "  \n"
00327         << "  \n";
00328 
00329 \end{verbatim}\normalsize 
\index{err_eval.C@{err\_\-eval.C}!print_usage@{print\_\-usage}}
\index{print_usage@{print\_\-usage}!err_eval.C@{err\_\-eval.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void print\_\-usage (ostream \& {\em os})}\label{err_eval_C_a0}


Prints information about usage.



Definition at line 310 of file err\_\-eval.C.\footnotesize\begin{verbatim}00311 {
00312   os    << "\nUsage: evalenv <-help> [optionfilename | options] \n\n"
00313         << "Required options:\n"
00314         << "  {-initial | -init | -i} <filename> }\n"
00315         << "     Initial molecule: xmol file\n"
00316         << "  {-constraints | -c}
00317 \end{verbatim}\normalsize 
