\section{Grid  Class Reference}
\label{class_Grid}\index{Grid@{Grid}}
{\tt \#include $<$grid.h$>$}

Collaboration diagram for Grid:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=180pt]{class_Grid_coll_graph}
\end{center}
\end{figure}
\subsection*{Public Methods}
\begin{CompactItemize}
\item 
{\bf Grid} ()
\item 
{\bf Grid} ({\bf point\-List} plist, int num\-P, double {\bf delta}, double {\bf Length}=0)
\item 
{\bf Grid} (int in\_\-num\-Points, double in\_\-delta, double in\_\-Length)
\item 
{\bf Grid} (const Grid \&G)
\item 
{\bf $\sim$Grid} ()
\item 
double {\bf get\-Bounds} (void) const
\item 
double {\bf get\-Delta} (void) const
\item 
int {\bf get\-Num\-Points} (void) const
\item 
const {\bf point\-List} {\bf get\-Points} (void) const
\item 
const {\bf Grid\-Number}$\ast$ {\bf get\-Grids} (void) const
\item 
{\bf Grid\-Number} {\bf get\-Grid} (int point\_\-index) const
\item 
{\bf Grid\-Number} {\bf get\-Grid\-Dimension} () const
\item 
double {\bf get\-Distance} (int point1\_\-index, int point2\_\-index) const
\item 
double {\bf get\-Distance} (int point1\_\-index, const {\bf j\-Vector} \&p) const
\item 
double {\bf get\-Distance} (const {\bf j\-Vector} \&p, int point2\_\-index) const
\item 
const {\bf j\-Vector}\& {\bf get\-Position} (int point\_\-index) const
\item 
bool {\bf JVoverlap} (const {\bf j\-Vector} \&point) const
\item 
bool {\bf GNoverlap} ({\bf Grid\-Number} GN) const
\item 
{\bf DLList}$<$double$>$ {\bf neighbor\_\-d} (int index, double distance) const
\item 
{\bf DLList}$<$double$>$ {\bf neighbor\_\-d} (const {\bf j\-Vector} \&p, double distance) const
\item 
{\bf DLList}$<${\bf j\-Vector}$>$ {\bf neighbor\_\-p} (int index, double distance) const
\item 
{\bf DLList}$<${\bf j\-Vector}$>$ {\bf neighbor\_\-p} (const {\bf j\-Vector} \&p, double distance) const
\item 
{\bf DLList}$<${\bf j\-Vector}$>$ {\bf approx\_\-neighbor\_\-p} (int index, double distance) const
\item 
{\bf DLList}$<${\bf j\-Vector}$>$ {\bf approx\_\-neighbor\_\-p} (const {\bf j\-Vector} \&p, double distance) const
\item 
{\bf DLList}$<$int$>$ {\bf neighbor\_\-i} (int index, double distance) const
\item 
{\bf DLList}$<$int$>$ {\bf neighbor\_\-i} (const {\bf j\-Vector} \&p, double distance) const
\item 
{\bf DLList}$<$int$>$ {\bf approx\_\-neighbor\_\-i} (int index, double distance) const
\item 
{\bf DLList}$<$int$>$ {\bf approx\_\-neighbor\_\-i} (const {\bf j\-Vector} \&p, double distance) const
\item 
double {\bf min\_\-neighbor\_\-d} (const {\bf j\-Vector} \&p, double distance) const
\item 
void {\bf Re\-Grid} ({\bf point\-List} plist, int num\-P, double in\_\-delta, double in\_\-Length=0)
\item 
void {\bf Re\-Size} (int num\-P, double in\_\-delta, double in\_\-Length)
\item 
void {\bf set\-Position} (int index\_\-num, const {\bf j\-Vector} \&New\-Position)
\item 
int {\bf add\-Points} ({\bf point\-List} p\-List, int num\-P)
\item 
int {\bf add\-Point} (const {\bf j\-Vector} \&Position)
\item 
int {\bf delete\-Point} (int index\_\-num)
\item 
void {\bf clear} (void)
\end{CompactItemize}
\subsection*{Private Methods}
\begin{CompactItemize}
\item 
void {\bf Initialize} ({\bf point\-List} p\-List, int num\-P)
\item 
void {\bf setup\-Neighbor\-Lists} ()
\item 
double {\bf calc\-Distance3} (const {\bf j\-Vector} \&j1, const {\bf j\-Vector} \&j2) const
\item 
{\bf Grid\-Number} {\bf create\-Hash} (const {\bf j\-Vector} \&P) const
\end{CompactItemize}
\subsection*{Private Attributes}
\begin{CompactItemize}
\item 
double {\bf Length}
\item 
double {\bf Twice\-Length}
\item 
double {\bf N1Dist}
\item 
double {\bf N2Dist}
\item 
double {\bf delta}
\item 
int {\bf num\-Points}
\item 
{\bf point\-List} {\bf my\-Points}
\item 
{\bf hashmap\_\-type} {\bf Grid\-Hash\-Map}
\item 
{\bf DLList}$<${\bf Grid\-Number}$>$ {\bf Neighbor\-Grid\-List}
\item 
{\bf DLList}$<$int$>$ {\bf Point\-Index\-List}
\item 
{\bf Grid\-Number}$\ast$ {\bf Point\-To\-Grid\-Num\-Array}
\item 
{\bf Grid\-Number} {\bf Grid\-Dimension}
\item 
{\bf Grid\-Number} {\bf Grid\-Dimension\-Sq}
\item 
hashmap\_\-type::iterator$\ast$$\ast$ {\bf Point\-To\-Hash\-Iter}
\item 
{\bf Grid\-Number} {\bf Neighbor1} [27]
\item 
{\bf Grid\-Number} {\bf Neighbor2} [125]
\end{CompactItemize}


\subsection{Constructor \& Destructor Documentation}
\index{Grid@{Grid}!Grid@{Grid}}
\index{Grid@{Grid}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Grid::Grid ()}\label{class_Grid_a0}




Definition at line 9 of file grid.C.\footnotesize\begin{verbatim}00009           {  
00010     Length = 0;
00011     delta = 0.0;
00012     numPoints = 0;
00013 \end{verbatim}\normalsize 
\index{Grid@{Grid}!Grid@{Grid}}
\index{Grid@{Grid}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Grid::Grid ({\bf point\-List} {\em plist}, int {\em in\_\-num\-Points}, double {\em in\_\-delta}, double {\em in\_\-Length} = 0)}\label{class_Grid_a1}




Definition at line 16 of file grid.C.\footnotesize\begin{verbatim}00017 {
00018 
00019   numPoints = in_numPoints;
00020   delta = in_delta;
00021   Length = in_Length;
00022   Initialize(plist,numPoints);
00023 \end{verbatim}\normalsize 
\index{Grid@{Grid}!Grid@{Grid}}
\index{Grid@{Grid}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Grid::Grid (int {\em in\_\-num\-Points}, double {\em in\_\-delta}, double {\em in\_\-Length})}\label{class_Grid_a2}




Definition at line 34 of file grid.C.\footnotesize\begin{verbatim}00035 {
00036   jVector * tempList = new jVector [in_numPoints];
00037 
00038   // create dummy starting posistions
00039 
00040   for (int i=0; i<in_numPoints;i++){
00041     tempList[i].Resize(3);
00042     tempList[i].zero();
00043     //    tempPos = ((((.5)*i)/in_numPoints)+(0.25))*in_Length;
00044   }
00045 \end{verbatim}\normalsize 
\index{Grid@{Grid}!Grid@{Grid}}
\index{Grid@{Grid}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Grid::Grid (const Grid \& {\em G})}\label{class_Grid_a3}




Definition at line 25 of file grid.C.\footnotesize\begin{verbatim}00025                        {
00026 
00027   numPoints = G.getNumPoints();
00028   delta = G.getDelta();
00029   Length = G.getBounds();
00030   Initialize(G.getPoints(),numPoints);
00031   
00032 \end{verbatim}\normalsize 
\index{Grid@{Grid}!~Grid@{$\sim$Grid}}
\index{~Grid@{$\sim$Grid}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Grid::$\sim$Grid ()}\label{class_Grid_a4}




Definition at line 56 of file grid.C.\footnotesize\begin{verbatim}00057 {
00058   clear();
00059 \end{verbatim}\normalsize 


\subsection{Member Function Documentation}
\index{Grid@{Grid}!GNoverlap@{GNoverlap}}
\index{GNoverlap@{GNoverlap}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool Grid::GNoverlap ({\bf Grid\-Number} {\em GN}) const}\label{class_Grid_a17}




Definition at line 189 of file grid.C.

Referenced by JVoverlap().\footnotesize\begin{verbatim}00189                                         {
00190 
00191   pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;
00192   iter_pair = GridHashMap.equal_range(GN);  
00193   if (iter_pair.first != iter_pair.second){
00194     // an atom exits in this grid
00195     return true;
00196   }
00197 \end{verbatim}\normalsize 
\index{Grid@{Grid}!Initialize@{Initialize}}
\index{Initialize@{Initialize}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Grid::Initialize ({\bf point\-List} {\em plist}, int {\em num\-P})\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_c0}




Definition at line 61 of file grid.C.

Referenced by Grid(), and Re\-Grid().\footnotesize\begin{verbatim}00061                                               {
00062   
00063   // Reset bounding box width (length') if too small
00064   double temp;
00065   double tempLength  = 0;
00066   for(int i=0; i<numP; i++) {
00067     for(int j=0; j<3; j++) {
00068       //      if (plist[i]){ //sanity check-- make sure a jVecotr is there LEAKING
00069         temp = fabs(plist[i][j]);
00070         if (tempLength < temp ) tempLength = temp;
00071         //      }
00072     }
00073   }
00074   if (tempLength >= Length) {
00075     // minimum bounds condition
00076     Length = tempLength;
00077   }
00078   
00079   numPoints = numP; // different if resze or regrid is called.
00080   TwiceLength = 2 * Length;  //Commonly reused multiples, calculated once.
00081   N1Dist = delta;  
00082   N2Dist = 2 * delta;  
00083 
00084   GridDimension = (GridNumber) ((TwiceLength+delta)/delta);
00085 
00086   if (GridDimension > 1290) { // fix to check actual limit == (max long int) ^-3
00087     cerr << "You have attempted to create a Grid with more" << endl 
00088          << "than 1290 elements in each dimension.  This is" << endl 
00089          << "not allowed because of the limitations on the" << endl 
00090          << "of long integers used on this system." << endl;
00091     cerr << "The number of elements you tried to use was " 
00092          << GridDimension << " ." << endl << endl;
00093     exit(1);
00094   }
00095   
00096   GridDimensionSq =  GridDimension*GridDimension;
00097 
00098   setupNeighborLists();
00099   
00100   GridHashMap.clear();
00101   GridHashMap.resize(5*numP);  // MAGIC NUMBER (use this many hash buckets)
00102 
00103   PointToGridNumArray = new GridNumber[numP];
00104   myPoints = new jVector[numP];
00105   PointToHashIter = new hashmap_type::iterator * [numP];
00106   GridNumber TempGridNumber;
00107   
00108   // Go through all the input points
00109   for(int i=0; i<numP; i++) {
00110     // Save a copy of the location vector
00111     myPoints[i] = plist[i];
00112 
00113     // Create a long int to hash the filled grids
00114     TempGridNumber = createHash(myPoints[i]);
00115                                 
00116     // Add elements to the GridHashMap
00117     PointToHashIter[i] = new hashmap_type::iterator;
00118     *PointToHashIter[i] = GridHashMap.insert(hashmap_type::value_type(TempGridNumber, i));
00119     
00120     // Save the hash number for the grid
00121     PointToGridNumArray[i] = TempGridNumber;
00122   }
00123 \end{verbatim}\normalsize 
\index{Grid@{Grid}!JVoverlap@{JVoverlap}}
\index{JVoverlap@{JVoverlap}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool Grid::JVoverlap (const {\bf j\-Vector} \& {\em point}) const}\label{class_Grid_a16}




Definition at line 201 of file grid.C.\footnotesize\begin{verbatim}00201                                                {
00202 
00203   GridNumber boxNumber = createHash(point);  
00204   return GNoverlap(boxNumber);
00205   
00206 \end{verbatim}\normalsize 
\index{Grid@{Grid}!ReGrid@{ReGrid}}
\index{ReGrid@{ReGrid}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Grid::Re\-Grid ({\bf point\-List} {\em plist}, int {\em num\-P}, double {\em in\_\-delta}, double {\em in\_\-Length} = 0)}\label{class_Grid_a29}




Definition at line 158 of file grid.C.

Referenced by Re\-Size().\footnotesize\begin{verbatim}00158                                                                                   {
00159   // RE-allocate new Grid box containing all points in the list
00160   //  This should be  called if a point is moved outside the current
00161   //  bounds 
00162 
00163   clear();
00164   
00165   delta = in_delta;
00166   Length = in_Length;
00167   Initialize(plist, numP);
00168 
00169   
00170 \end{verbatim}\normalsize 
\index{Grid@{Grid}!ReSize@{ReSize}}
\index{ReSize@{ReSize}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Grid::Re\-Size (int {\em num\-P}, double {\em in\_\-delta}, double {\em in\_\-Length})}\label{class_Grid_a30}




Definition at line 172 of file grid.C.\footnotesize\begin{verbatim}00172                                                             {
00173 
00174   jVector * tempList = new jVector [numP];
00175 
00176   // create dummy starting posistions
00177 
00178   for (int i=0; i<numP;i++){
00179     tempList[i].Resize(3);
00180     tempList[i].zero();
00181   }
00182 \end{verbatim}\normalsize 
\index{Grid@{Grid}!addPoint@{addPoint}}
\index{addPoint@{addPoint}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Grid::add\-Point (const {\bf j\-Vector} \& {\em Position})\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a33}




Definition at line 150 of file grid.h.\footnotesize\begin{verbatim}00150                                         {/*not implemented yet*/return 0;}
00151 \end{verbatim}\normalsize 
\index{Grid@{Grid}!addPoints@{addPoints}}
\index{addPoints@{addPoints}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Grid::add\-Points ({\bf point\-List} {\em p\-List}, int {\em num\-P})\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a32}




Definition at line 142 of file grid.h.\footnotesize\begin{verbatim}00142                                            {/*Not yet*/ return 0;}
00143 \end{verbatim}\normalsize 
\index{Grid@{Grid}!approx_neighbor_i@{approx\_\-neighbor\_\-i}}
\index{approx_neighbor_i@{approx\_\-neighbor\_\-i}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ int $>$ Grid::approx\_\-neighbor\_\-i (const {\bf j\-Vector} \& {\em p}, double {\em distance}) const}\label{class_Grid_a27}




Definition at line 683 of file grid.C.\footnotesize\begin{verbatim}00683                                                                           {
00684 // returns a doublely-linked list of point **indicies** within all the
00685 // grids that are 'distance' away from point p.
00686 // All points in qualifying grids are returned.  This means it is a
00687 // correct list, yet may contain extra elements. 
00688   DLList<int> ReturnList;
00689   if (distance <= N1Dist) {
00690     // Go through 27 one-neighbor grids and add up contributions
00691     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00692     hashmap_type::const_iterator out_iter;
00693     GridNumber TempGridNumber = createHash(p);
00694     for (int i = 0; i < 27; i++){
00695       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor1[i]);
00696       if (iter_pair.first != iter_pair.second){
00697         // an atom exits in this grid
00698         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00699           ReturnList.AddToFront((*out_iter).second); // index
00700         }
00701       }  
00702     } // end of neighbor1 cycles
00703   } else if (distance <= N2Dist){
00704     // Go through 27 one-neighbor grids and add up contributions
00705     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00706     hashmap_type::const_iterator out_iter;
00707     GridNumber TempGridNumber = createHash(p);
00708     for (int i = 0; i < 125; i++){
00709       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor2[i]);
00710       if (iter_pair.first != iter_pair.second){
00711         // an atom exits in this grid
00712         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00713           ReturnList.AddToFront((*out_iter).second); // index
00714         }
00715       }  
00716     } // end of neighbor2 cycles
00717   } else { // outside near neighbors, return all
00718     for (int i = 0; i < numPoints; i++){
00719       ReturnList.AddToFront(i);                      // index
00720     }
00721   }
00722 \end{verbatim}\normalsize 
\index{Grid@{Grid}!approx_neighbor_i@{approx\_\-neighbor\_\-i}}
\index{approx_neighbor_i@{approx\_\-neighbor\_\-i}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ int $>$ Grid::approx\_\-neighbor\_\-i (int {\em index}, double {\em distance}) const}\label{class_Grid_a26}




Definition at line 633 of file grid.C.

Referenced by Molecule::approx\_\-neighbor\_\-i().\footnotesize\begin{verbatim}00633                                                                    {
00634   jVector p = myPoints[index];
00635 // returns a doublely-linked list of point **indicies** within all the
00636 // grids that are 'distance' away from point p.
00637 // All points in qualifying grids are returned.  This means it is a
00638 // correct list, yet may contain extra elements. 
00639   DLList<int> ReturnList;
00640   if (distance <= N1Dist) {
00641     // Go through 27 one-neighbor grids and add up contributions
00642     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00643     hashmap_type::const_iterator out_iter;
00644     GridNumber TempGridNumber = createHash(p);
00645     for (int i = 0; i < 27; i++){
00646       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor1[i]);
00647       if (iter_pair.first != iter_pair.second){
00648         // an atom exits in this grid
00649         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00650           if (out_iter != *(PointToHashIter[index])){
00651             ReturnList.AddToFront((*out_iter).second); // index
00652           }
00653         }
00654       }  
00655     } // end of neighbor1 cycles
00656   } else if (distance <= N2Dist){
00657     // Go through 27 one-neighbor grids and add up contributions
00658     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00659     hashmap_type::const_iterator out_iter;
00660     GridNumber TempGridNumber = createHash(p);
00661     for (int i = 0; i < 125; i++){
00662       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor2[i]);
00663       if (iter_pair.first != iter_pair.second){
00664         // an atom exits in this grid
00665         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00666           if (out_iter != *(PointToHashIter[index])){
00667             ReturnList.AddToFront((*out_iter).second); // index
00668           }
00669         }
00670       }  
00671     } // end of neighbor2 cycles
00672   } else { // outside near neighbors, return all
00673     for (int i = 0; i < numPoints; i++){
00674       if (i != index ) {
00675         ReturnList.AddToFront(i);                      // index
00676       }
00677     }
00678   }
00679 \end{verbatim}\normalsize 
\index{Grid@{Grid}!approx_neighbor_p@{approx\_\-neighbor\_\-p}}
\index{approx_neighbor_p@{approx\_\-neighbor\_\-p}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ {\bf j\-Vector} $>$ Grid::approx\_\-neighbor\_\-p (const {\bf j\-Vector} \& {\em p}, double {\em distance}) const}\label{class_Grid_a23}




Definition at line 491 of file grid.C.\footnotesize\begin{verbatim}00491                                                                               {
00492 // Returnsa an approximate list of **positions** to other points within
00493 // a given distance.  This is approximate because the distances are
00494 // not calculated here.  All points in qualifying grids are
00495 // returned.  This means it is a correct list, yet may contain extra
00496 // elements.
00497  
00498   DLList<jVector> ReturnList;
00499   if (distance <= N1Dist) {
00500     // Go through 27 one-neighbor grids and add up contributions
00501     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00502     hashmap_type::const_iterator out_iter;
00503     GridNumber TempGridNumber = createHash(p);
00504     for (int i = 0; i < 27; i++){
00505       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor1[i]);
00506       if (iter_pair.first != iter_pair.second){
00507         // an atom exits in this grid
00508         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00509           ReturnList.AddToFront(myPoints[(*out_iter).second]); // jVector position
00510         }
00511       }  
00512     } // end of neighbor1 cycles
00513   } else if (distance <= N2Dist){
00514     // Go through 27 one-neighbor grids and add up contributions
00515     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00516     hashmap_type::const_iterator out_iter;
00517     GridNumber TempGridNumber = createHash(p);
00518     for (int i = 0; i < 125; i++){
00519       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor2[i]);
00520       if (iter_pair.first != iter_pair.second){
00521         // an atom exits in this grid
00522         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00523           ReturnList.AddToFront(myPoints[(*out_iter).second]); // jVector position
00524         }
00525       }  
00526     } // end of neighbor2 cycles
00527   } else { // outside near neighbors, return all
00528     for (int i = 0; i < numPoints; i++){
00529       ReturnList.AddToFront(myPoints[i]); // jVector position
00530     }
00531   }
00532 \end{verbatim}\normalsize 
\index{Grid@{Grid}!approx_neighbor_p@{approx\_\-neighbor\_\-p}}
\index{approx_neighbor_p@{approx\_\-neighbor\_\-p}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ {\bf j\-Vector} $>$ Grid::approx\_\-neighbor\_\-p (int {\em index}, double {\em distance}) const}\label{class_Grid_a22}




Definition at line 438 of file grid.C.\footnotesize\begin{verbatim}00438                                                                        {
00439   jVector p = myPoints[index];
00440 // Returnsa an approximate list of **positions** to other points within
00441 // a given distance.  This is approximate because the distances are
00442 // not calculated here.  All points in qualifying grids are
00443 // returned.  This means it is a correct list, yet may contain extra
00444 // elements.
00445  
00446   DLList<jVector> ReturnList;
00447   if (distance <= N1Dist) {
00448     // Go through 27 one-neighbor grids and add up contributions
00449     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00450     hashmap_type::const_iterator out_iter;
00451     GridNumber TempGridNumber = createHash(p);
00452     for (int i = 0; i < 27; i++){
00453       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor1[i]);
00454       if (iter_pair.first != iter_pair.second){
00455         // an atom exits in this grid
00456         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00457           if (out_iter != *(PointToHashIter[index])){
00458             ReturnList.AddToFront(myPoints[(*out_iter).second]); // jVector position
00459           }
00460         }
00461       }  
00462     } // end of neighbor1 cycles
00463   } else if (distance <= N2Dist){
00464     // Go through 27 one-neighbor grids and add up contributions
00465     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00466     hashmap_type::const_iterator out_iter;
00467     GridNumber TempGridNumber = createHash(p);
00468     for (int i = 0; i < 125; i++){
00469       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor2[i]);
00470       if (iter_pair.first != iter_pair.second){
00471         // an atom exits in this grid
00472         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00473           if (out_iter != *(PointToHashIter[index])){
00474             ReturnList.AddToFront(myPoints[(*out_iter).second]); // jVector position
00475           }
00476         }
00477       }  
00478     } // end of neighbor2 cycles
00479   } else { // outside near neighbors, return all
00480     for (int i = 0; i < numPoints; i++){
00481       if (i != index){
00482         ReturnList.AddToFront(myPoints[i]); // jVector position
00483       }
00484     }
00485   }
00486 \end{verbatim}\normalsize 
\index{Grid@{Grid}!calcDistance3@{calcDistance3}}
\index{calcDistance3@{calcDistance3}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::calc\-Distance3 (const {\bf j\-Vector} \& {\em j1}, const {\bf j\-Vector} \& {\em j2}) const\hspace{0.3cm}{\tt  [inline, private]}}\label{class_Grid_c2}




Definition at line 247 of file grid.h.

Referenced by get\-Distance().\footnotesize\begin{verbatim}00247                                                                              {
00248 \end{verbatim}\normalsize 
\index{Grid@{Grid}!clear@{clear}}
\index{clear@{clear}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Grid::clear (void)}\label{class_Grid_a35}




Definition at line 728 of file grid.C.

Referenced by Re\-Grid(), and $\sim$Grid().\footnotesize\begin{verbatim}00729 {
00730   // Empties the Grid, deletes and zeros all dynamic memory.
00731   
00732   GridHashMap.clear();
00733   
00734   for (int i = 0; i< numPoints; i++){
00735     delete PointToHashIter[i];
00736   }
00737 \end{verbatim}\normalsize 
\index{Grid@{Grid}!createHash@{createHash}}
\index{createHash@{createHash}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Grid\-Number} Grid::create\-Hash (const {\bf j\-Vector} \& {\em P}) const\hspace{0.3cm}{\tt  [inline, private]}}\label{class_Grid_c3}




Definition at line 223 of file grid.h.

Referenced by Initialize(), JVoverlap(), approx\_\-neighbor\_\-i(), approx\_\-neighbor\_\-p(), neighbor\_\-d(), neighbor\_\-i(), neighbor\_\-p(), and set\-Position().\footnotesize\begin{verbatim}00223                                                         {      
00224     GridNumber Hashx, Hashy, Hashz;
00225     Hashx = (GridNumber) (((P[0] + Length)/TwiceLength)*(GridDimension-1));
00226     Hashy = (GridNumber) (((P[1] + Length)/TwiceLength)*(GridDimension-1));
00227     Hashz = (GridNumber) (((P[2] + Length)/TwiceLength)*(GridDimension-1));     
00228     return Hashx + GridDimension * Hashy + GridDimensionSq * Hashz;
00229 \end{verbatim}\normalsize 
\index{Grid@{Grid}!deletePoint@{deletePoint}}
\index{deletePoint@{deletePoint}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Grid::delete\-Point (int {\em index\_\-num})\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a34}




Definition at line 156 of file grid.h.\footnotesize\begin{verbatim}00156                                   {/*not implemented yet*/return 0;}
00157 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getBounds@{getBounds}}
\index{getBounds@{getBounds}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::get\-Bounds (void) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a5}




Definition at line 261 of file grid.h.

Referenced by Grid().\footnotesize\begin{verbatim}00262     { return Length; }
00263 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getDelta@{getDelta}}
\index{getDelta@{getDelta}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::get\-Delta (void) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a6}




Definition at line 264 of file grid.h.

Referenced by Grid().\footnotesize\begin{verbatim}00265   { return delta; }
00266 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getDistance@{getDistance}}
\index{getDistance@{getDistance}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::get\-Distance (const {\bf j\-Vector} \& {\em p}, int {\em point2\_\-index}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a14}




Definition at line 257 of file grid.h.\footnotesize\begin{verbatim}00257                                                                        {
00258 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getDistance@{getDistance}}
\index{getDistance@{getDistance}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::get\-Distance (int {\em point1\_\-index}, const {\bf j\-Vector} \& {\em p}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a13}




Definition at line 254 of file grid.h.\footnotesize\begin{verbatim}00254                                                                        {
00255 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getDistance@{getDistance}}
\index{getDistance@{getDistance}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::get\-Distance (int {\em point1\_\-index}, int {\em point2\_\-index}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a12}




Definition at line 72 of file grid.h.

Referenced by neighbor\_\-d(), neighbor\_\-i(), and neighbor\_\-p().\footnotesize\begin{verbatim}00072                                                               {
00073 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getGrid@{getGrid}}
\index{getGrid@{getGrid}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Grid\-Number} Grid::get\-Grid (int {\em point\_\-index}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a10}




Definition at line 276 of file grid.h.\footnotesize\begin{verbatim}00276                                                     {
00277     return PointToGridNumArray[point_index];
00278 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getGridDimension@{getGridDimension}}
\index{getGridDimension@{getGridDimension}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Grid\-Number} Grid::get\-Grid\-Dimension () const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a11}




Definition at line 281 of file grid.h.\footnotesize\begin{verbatim}00281                                               {
00282     return GridDimension;
00283 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getGrids@{getGrids}}
\index{getGrids@{getGrids}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf Grid\-Number} $\ast$ Grid::get\-Grids (void) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a9}




Definition at line 273 of file grid.h.\footnotesize\begin{verbatim}00274   { return PointToGridNumArray; }
00275 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getNumPoints@{getNumPoints}}
\index{getNumPoints@{getNumPoints}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Grid::get\-Num\-Points (void) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a7}




Definition at line 267 of file grid.h.

Referenced by Grid().\footnotesize\begin{verbatim}00268   { return numPoints; }
00269 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getPoints@{getPoints}}
\index{getPoints@{getPoints}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf point\-List} Grid::get\-Points (void) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a8}




Definition at line 270 of file grid.h.

Referenced by Grid().\footnotesize\begin{verbatim}00271   { return myPoints; }
00272 \end{verbatim}\normalsize 
\index{Grid@{Grid}!getPosition@{getPosition}}
\index{getPosition@{getPosition}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf j\-Vector} \& Grid::get\-Position (int {\em point\_\-index}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Grid_a15}




Definition at line 250 of file grid.h.

Referenced by Molecule::Bounds(), Molecule::Copy(), Molecule::get\-COM(), Molecule::get\-Position(), Molecule::operator()(), Molecule::write\-Xmol(), and Molecule::write\-Xmol\-Data().\footnotesize\begin{verbatim}00250                                                               {
00251 \end{verbatim}\normalsize 
\index{Grid@{Grid}!min_neighbor_d@{min\_\-neighbor\_\-d}}
\index{min_neighbor_d@{min\_\-neighbor\_\-d}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::min\_\-neighbor\_\-d (const {\bf j\-Vector} \& {\em p}, double {\em distance}) const}\label{class_Grid_a28}




Definition at line 726 of file grid.C.\footnotesize\begin{verbatim}00726                                                                    {/*not yet*/return 0.0;}
00727 \end{verbatim}\normalsize 
\index{Grid@{Grid}!neighbor_d@{neighbor\_\-d}}
\index{neighbor_d@{neighbor\_\-d}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ double $>$ Grid::neighbor\_\-d (const {\bf j\-Vector} \& {\em p}, double {\em distance}) const}\label{class_Grid_a19}




Definition at line 298 of file grid.C.\footnotesize\begin{verbatim}00298                                                                       {
00299 // Returns a list of **distances** to other points within a given
00300 // distance to the first point.
00301   DLList<double> ReturnList;
00302   double d;
00303   if (distance <= N1Dist) {
00304     // Go through 27 one-neighbor grids and add up contributions
00305     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00306     hashmap_type::const_iterator out_iter;
00307     GridNumber TempGridNumber = createHash(p);
00308     for (int i = 0; i < 27; i++){
00309       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor1[i]);
00310       if (iter_pair.first != iter_pair.second){
00311         // an atom exits in this grid
00312         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00313           d = getDistance((*out_iter).second,p); // distance
00314           if (d < distance) ReturnList.AddToFront(d);
00315         }
00316       }  
00317     } // end of neighbor1 cycles
00318   } else if (distance <= N2Dist){
00319     // Go through 27 one-neighbor grids and add up contributions
00320     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00321     hashmap_type::const_iterator out_iter;
00322     GridNumber TempGridNumber = createHash(p);
00323     for (int i = 0; i < 125; i++){
00324       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor2[i]);
00325       if (iter_pair.first != iter_pair.second){
00326         // an atom exits in this grid
00327         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00328           d = getDistance((*out_iter).second,p); // distance
00329           if (d < distance) ReturnList.AddToFront(d);
00330         }
00331       }  
00332     } // end of neighbor2 cycles
00333   } else { // outside near neighbors, return all
00334     for (int i = 0; i < numPoints; i++){
00335       d = getDistance(i,p); // distance
00336       if (d < distance) ReturnList.AddToFront(d);
00337     }
00338   }
00339 \end{verbatim}\normalsize 
\index{Grid@{Grid}!neighbor_d@{neighbor\_\-d}}
\index{neighbor_d@{neighbor\_\-d}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ double $>$ Grid::neighbor\_\-d (int {\em index}, double {\em distance}) const}\label{class_Grid_a18}




Definition at line 246 of file grid.C.\footnotesize\begin{verbatim}00246                                                                {
00247   jVector p = myPoints[index];
00248 // Returns a list of **distances** to other points within a given
00249 // distance to the first point.
00250   DLList<double> ReturnList;
00251   double d;
00252   if (distance <= N1Dist) {
00253     // Go through 27 one-neighbor grids and add up contributions
00254     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00255     hashmap_type::const_iterator out_iter;
00256     GridNumber TempGridNumber = createHash(p);
00257     for (int i = 0; i < 27; i++){
00258       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor1[i]);
00259       if (iter_pair.first != iter_pair.second){
00260         // an atom exits in this grid
00261         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00262           if (out_iter != *(PointToHashIter[index])){
00263             d = getDistance((*out_iter).second,p); // distance
00264             if (d < distance) ReturnList.AddToFront(d);
00265           }
00266         }
00267       }  
00268     } // end of neighbor1 cycles
00269   } else if (distance <= N2Dist){
00270     // Go through 27 one-neighbor grids and add up contributions
00271     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00272     hashmap_type::const_iterator out_iter;
00273     GridNumber TempGridNumber = createHash(p);
00274     for (int i = 0; i < 125; i++){
00275       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor2[i]);
00276       if (iter_pair.first != iter_pair.second){
00277         // an atom exits in this grid
00278         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00279           if (out_iter != *(PointToHashIter[index])){
00280             d = getDistance((*out_iter).second,p); // distance
00281             if (d < distance) ReturnList.AddToFront(d);
00282           }
00283         }
00284       }  
00285     } // end of neighbor2 cycles
00286   } else { // outside near neighbors, return all
00287     for (int i = 0; i < numPoints; i++){
00288       if (i != index){
00289         d = getDistance(i,p); // distance
00290         if (d < distance) ReturnList.AddToFront(d);
00291       }
00292     }
00293   }
00294 \end{verbatim}\normalsize 
\index{Grid@{Grid}!neighbor_i@{neighbor\_\-i}}
\index{neighbor_i@{neighbor\_\-i}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ int $>$ Grid::neighbor\_\-i (const {\bf j\-Vector} \& {\em p}, double {\em distance}) const}\label{class_Grid_a25}




Definition at line 588 of file grid.C.\footnotesize\begin{verbatim}00588                                                                    {
00589   // returns a doublely-linked list of point **indicies** within all the
00590   // grids that are 'distance' away from point p. NB this calclulates
00591   // and discards distances. (SLOW) 
00592   DLList<int> ReturnList;
00593   double d;
00594   if (distance <= N1Dist) {
00595     // Go through 27 one-neighbor grids and add up contributions
00596     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00597     hashmap_type::const_iterator out_iter;
00598     GridNumber TempGridNumber = createHash(p);
00599     for (int i = 0; i < 27; i++){
00600       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor1[i]);
00601       if (iter_pair.first != iter_pair.second){
00602         // an atom exits in this grid
00603         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00604           d = getDistance((*out_iter).second,p); // distance
00605           if (d< distance) ReturnList.AddToFront((*out_iter).second); // index
00606         }
00607       }  
00608     } // end of neighbor1 cycles
00609   } else if (distance <= N2Dist){
00610     // Go through 27 one-neighbor grids and add up contributions
00611     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00612     hashmap_type::const_iterator out_iter;
00613     GridNumber TempGridNumber = createHash(p);
00614     for (int i = 0; i < 125; i++){
00615       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor2[i]);
00616       if (iter_pair.first != iter_pair.second){
00617         // an atom exits in this grid
00618         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00619           d = getDistance((*out_iter).second,p); // distance
00620           if (d< distance) ReturnList.AddToFront((*out_iter).second); // index
00621         }
00622       }  
00623     } // end of neighbor2 cycles
00624   } else { // outside near neighbors, return all
00625     for (int i = 0; i < numPoints; i++){
00626       d = getDistance(i,p); // distance
00627       if (d < distance) ReturnList.AddToFront(i); // index
00628     }
00629   }
00630 \end{verbatim}\normalsize 
\index{Grid@{Grid}!neighbor_i@{neighbor\_\-i}}
\index{neighbor_i@{neighbor\_\-i}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ int $>$ Grid::neighbor\_\-i (int {\em index}, double {\em distance}) const}\label{class_Grid_a24}




Definition at line 535 of file grid.C.

Referenced by Molecule::neighbor\_\-i().\footnotesize\begin{verbatim}00535                                                             {
00536   jVector p = myPoints[index];
00537   // returns a doublely-linked list of point **indicies** within all the
00538   // grids that are 'distance' away from point p. NB this calclulates
00539   // and discards distances. (SLOW) 
00540   DLList<int> ReturnList;
00541   double d;
00542   if (distance <= N1Dist) {
00543     // Go through 27 one-neighbor grids and add up contributions
00544     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00545     hashmap_type::const_iterator out_iter;
00546     GridNumber TempGridNumber = createHash(p);
00547     for (int i = 0; i < 27; i++){
00548       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor1[i]);
00549       if (iter_pair.first != iter_pair.second){
00550         // an atom exits in this grid
00551         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00552           if (out_iter != *(PointToHashIter[index])){
00553             d = getDistance((*out_iter).second,p); // distance
00554             if (d< distance) ReturnList.AddToFront((*out_iter).second); // index
00555           }
00556         }
00557       }  
00558     } // end of neighbor1 cycles
00559   } else if (distance <= N2Dist){
00560     // Go through 27 one-neighbor grids and add up contributions
00561     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00562     hashmap_type::const_iterator out_iter;
00563     GridNumber TempGridNumber = createHash(p);
00564     for (int i = 0; i < 125; i++){
00565       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor2[i]);
00566       if (iter_pair.first != iter_pair.second){
00567         // an atom exits in this grid
00568         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00569           if (out_iter != *(PointToHashIter[index])){
00570             d = getDistance((*out_iter).second,p); // distance
00571             if (d< distance) ReturnList.AddToFront((*out_iter).second); // index
00572           }
00573         }
00574       }  
00575     } // end of neighbor2 cycles
00576   } else { // outside near neighbors, return all
00577     for (int i = 0; i < numPoints; i++){
00578       if (i != index){
00579         d = getDistance(i,p); // distance
00580         if (d < distance) ReturnList.AddToFront(i); // index
00581       }
00582     }
00583   }
00584 \end{verbatim}\normalsize 
\index{Grid@{Grid}!neighbor_p@{neighbor\_\-p}}
\index{neighbor_p@{neighbor\_\-p}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ {\bf j\-Vector} $>$ Grid::neighbor\_\-p (const {\bf j\-Vector} \& {\em p}, double {\em distance}) const}\label{class_Grid_a21}




Definition at line 394 of file grid.C.\footnotesize\begin{verbatim}00394                                                                        {
00395   // Returns a list of **positions** to other points within a given
00396   // distance NB this calclulates and discards distances. (SLOW)
00397   DLList<jVector> ReturnList;
00398   double d;
00399   if (distance <= N1Dist) {
00400     // Go through 27 one-neighbor grids and add up contributions
00401     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00402     hashmap_type::const_iterator out_iter;
00403     GridNumber TempGridNumber = createHash(p);
00404     for (int i = 0; i < 27; i++){
00405       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor1[i]);
00406       if (iter_pair.first != iter_pair.second){
00407         // an atom exits in this grid
00408         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00409           d = getDistance((*out_iter).second,p); // distance
00410           if (d< distance) ReturnList.AddToFront(myPoints[(*out_iter).second]); // jVector position
00411         }
00412       }  
00413     } // end of neighbor1 cycles
00414   } else if (distance <= N2Dist){
00415     // Go through 27 one-neighbor grids and add up contributions
00416     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00417     hashmap_type::const_iterator out_iter;
00418     GridNumber TempGridNumber = createHash(p);
00419     for (int i = 0; i < 125; i++){
00420       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor2[i]);
00421       if (iter_pair.first != iter_pair.second){
00422         // an atom exits in this grid
00423         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00424           d = getDistance((*out_iter).second,p); // distance
00425           if (d< distance) ReturnList.AddToFront(myPoints[(*out_iter).second]); // jVector position
00426         }
00427       }  
00428     } // end of neighbor2 cycles
00429   } else { // outside near neighbors, return all
00430     for (int i = 0; i < numPoints; i++){
00431       d = getDistance(i,p); // distance
00432       if (d < distance) ReturnList.AddToFront(myPoints[i]); // jVector position
00433     }
00434   }
00435 \end{verbatim}\normalsize 
\index{Grid@{Grid}!neighbor_p@{neighbor\_\-p}}
\index{neighbor_p@{neighbor\_\-p}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ {\bf j\-Vector} $>$ Grid::neighbor\_\-p (int {\em index}, double {\em distance}) const}\label{class_Grid_a20}




Definition at line 342 of file grid.C.\footnotesize\begin{verbatim}00342                                                                 {
00343   jVector p = myPoints[index];
00344     // Returns a list of **positions** to other points within a given
00345   // distance NB this calclulates and discards distances. (SLOW)
00346   DLList<jVector> ReturnList;
00347   double d;
00348   if (distance <= N1Dist) {
00349     // Go through 27 one-neighbor grids and add up contributions
00350     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00351     hashmap_type::const_iterator out_iter;
00352     GridNumber TempGridNumber = createHash(p);
00353     for (int i = 0; i < 27; i++){
00354       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor1[i]);
00355       if (iter_pair.first != iter_pair.second){
00356         // an atom exits in this grid
00357         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00358           if (out_iter != *(PointToHashIter[index])){
00359             d = getDistance((*out_iter).second,p); // distance
00360             if (d< distance) ReturnList.AddToFront(myPoints[(*out_iter).second]); // jVector position
00361           }
00362         }
00363       }  
00364     } // end of neighbor1 cycles
00365   } else if (distance <= N2Dist){
00366     // Go through 27 one-neighbor grids and add up contributions
00367     pair<hashmap_type::const_iterator, hashmap_type::const_iterator> iter_pair;  
00368     hashmap_type::const_iterator out_iter;
00369     GridNumber TempGridNumber = createHash(p);
00370     for (int i = 0; i < 125; i++){
00371       iter_pair = GridHashMap.equal_range(TempGridNumber-Neighbor2[i]);
00372       if (iter_pair.first != iter_pair.second){
00373         // an atom exits in this grid
00374         for (out_iter = iter_pair.first; out_iter != iter_pair.second; ++out_iter){
00375           if (out_iter != *(PointToHashIter[index])){
00376             d = getDistance((*out_iter).second,p); // distance
00377             if (d< distance) ReturnList.AddToFront(myPoints[(*out_iter).second]); // jVector position
00378           }
00379         }
00380       }  
00381     } // end of neighbor2 cycles
00382   } else { // outside near neighbors, return all
00383     for (int i = 0; i < numPoints; i++){
00384       if (i != index){
00385         d = getDistance(i,p); // distance
00386         if (d < distance) ReturnList.AddToFront(myPoints[i]); // jVector position
00387       }
00388     }
00389   }
00390 \end{verbatim}\normalsize 
\index{Grid@{Grid}!setPosition@{setPosition}}
\index{setPosition@{setPosition}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Grid::set\-Position (int {\em index\_\-num}, const {\bf j\-Vector} \& {\em New\-Position})}\label{class_Grid_a31}




Definition at line 208 of file grid.C.

Referenced by Molecule::Copy(), Molecule::Dyn\-Read(), Molecule::Input(), Molecule::Input\-Binary(), Molecule::Molecule(), Molecule::read\-Xmol(), Molecule::set\-Position(), and Molecule::set\-Random().\footnotesize\begin{verbatim}00208                                                                 {
00209   // Moves the point with index == index_num to the new position
00210   // spoecified by NewPosition  This has to maintain the
00211   
00212   myPoints[index_num] = NewPosition;
00213 
00214 
00215   // DEBUG 
00216   // bounds check
00217   if ( (fabs(NewPosition[0]) > Length) ||
00218        (fabs(NewPosition[1]) > Length) ||
00219        (fabs(NewPosition[2]) > Length) ){
00220     cerr << "Grid::setPostion moved out of bounds: MaxGridLength = "
00221          << Length
00222          << " New Position = "
00223          << NewPosition
00224          << endl;
00225     raise (SIGQUIT);
00226   }
00227   
00228   // Should check bounds here.  Not done now.  May cause errors if
00229   // max(fabs(NewPosition[0,1,2])) > Length.
00230   // need to call regrid if bounds are not OK.
00231   
00232   GridNumber TempGridNumber = createHash(NewPosition);  
00233   if (TempGridNumber !=  PointToGridNumArray[index_num]){
00234     // only unpdate hash if point moves to new grid.
00235     // delete old point in hash
00236     GridHashMap.erase(*(PointToHashIter[index_num]));
00237 
00238     // add point in new grid to hash
00239     *PointToHashIter[index_num] = GridHashMap.insert(hashmap_type::value_type(TempGridNumber, index_num));
00240 
00241     PointToGridNumArray[index_num] = TempGridNumber;
00242   }
00243 \end{verbatim}\normalsize 
\index{Grid@{Grid}!setupNeighborLists@{setupNeighborLists}}
\index{setupNeighborLists@{setupNeighborLists}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Grid::setup\-Neighbor\-Lists (void)\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_c1}




Definition at line 125 of file grid.C.

Referenced by Initialize().\footnotesize\begin{verbatim}00126 {
00127   register long x,y,z;
00128   int index = 0;
00129   for (z = -1; z < 2; z++){
00130     for (y = -1; y < 2; y++){
00131       for (x = -1; x < 2; x++){
00132         Neighbor1[index++] = z*GridDimensionSq + y*GridDimension + x;
00133       }
00134     }
00135   }
00136 
00137   index = 0;  
00138   for (z = -2; z < 3; z++){
00139     for (y = -2; y < 3; y++){
00140       for (x = -2; x < 3; x++){
00141         Neighbor2[index++] = z*GridDimensionSq + y*GridDimension + x;
00142       }
00143     }
00144   }
00145 \end{verbatim}\normalsize 


\subsection{Member Data Documentation}
\index{Grid@{Grid}!GridDimension@{GridDimension}}
\index{GridDimension@{GridDimension}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Grid\-Number} Grid::Grid\-Dimension\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o11}




Definition at line 191 of file grid.h.\index{Grid@{Grid}!GridDimensionSq@{GridDimensionSq}}
\index{GridDimensionSq@{GridDimensionSq}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Grid\-Number} Grid::Grid\-Dimension\-Sq\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o12}




Definition at line 192 of file grid.h.\index{Grid@{Grid}!GridHashMap@{GridHashMap}}
\index{GridHashMap@{GridHashMap}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf hashmap\_\-type} Grid::Grid\-Hash\-Map\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o7}




Definition at line 180 of file grid.h.\index{Grid@{Grid}!Length@{Length}}
\index{Length@{Length}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::Length\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o0}




Definition at line 170 of file grid.h.\index{Grid@{Grid}!N1Dist@{N1Dist}}
\index{N1Dist@{N1Dist}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::N1Dist\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o2}




Definition at line 172 of file grid.h.\index{Grid@{Grid}!N2Dist@{N2Dist}}
\index{N2Dist@{N2Dist}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::N2Dist\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o3}




Definition at line 173 of file grid.h.\index{Grid@{Grid}!Neighbor1@{Neighbor1}}
\index{Neighbor1@{Neighbor1}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Grid\-Number} Grid::Neighbor1[27]\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o14}




Definition at line 213 of file grid.h.\index{Grid@{Grid}!Neighbor2@{Neighbor2}}
\index{Neighbor2@{Neighbor2}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Grid\-Number} Grid::Neighbor2[125]\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o15}




Definition at line 214 of file grid.h.\index{Grid@{Grid}!NeighborGridList@{NeighborGridList}}
\index{NeighborGridList@{NeighborGridList}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ {\bf Grid\-Number} $>$ Grid::Neighbor\-Grid\-List\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o8}




Definition at line 185 of file grid.h.\index{Grid@{Grid}!PointIndexList@{PointIndexList}}
\index{PointIndexList@{PointIndexList}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ int $>$ Grid::Point\-Index\-List\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o9}




Definition at line 186 of file grid.h.\index{Grid@{Grid}!PointToGridNumArray@{PointToGridNumArray}}
\index{PointToGridNumArray@{PointToGridNumArray}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Grid\-Number} $\ast$ Grid::Point\-To\-Grid\-Num\-Array\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o10}




Definition at line 188 of file grid.h.\index{Grid@{Grid}!PointToHashIter@{PointToHashIter}}
\index{PointToHashIter@{PointToHashIter}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}hashmap\_\-type::iterator $\ast$$\ast$ Grid::Point\-To\-Hash\-Iter\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o13}




Definition at line 196 of file grid.h.\index{Grid@{Grid}!TwiceLength@{TwiceLength}}
\index{TwiceLength@{TwiceLength}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::Twice\-Length\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o1}




Definition at line 171 of file grid.h.\index{Grid@{Grid}!delta@{delta}}
\index{delta@{delta}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Grid::delta\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o4}




Definition at line 174 of file grid.h.\index{Grid@{Grid}!myPoints@{myPoints}}
\index{myPoints@{myPoints}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf point\-List} Grid::my\-Points\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o6}




Definition at line 177 of file grid.h.\index{Grid@{Grid}!numPoints@{numPoints}}
\index{numPoints@{numPoints}!Grid@{Grid}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Grid::num\-Points\hspace{0.3cm}{\tt  [private]}}\label{class_Grid_o5}




Definition at line 175 of file grid.h.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
{\bf grid.h}\item 
{\bf grid.C}\end{CompactItemize}
