\section{Molecule  Class Reference}
\label{class_Molecule}\index{Molecule@{Molecule}}
{\tt \#include $<$molecule.h$>$}

Collaboration diagram for Molecule:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=330pt]{class_Molecule_coll_graph}
\end{center}
\end{figure}
\subsection*{Public Methods}
\begin{CompactItemize}
\item 
{\bf Molecule} ()
\item 
{\bf Molecule} (int num\_\-atoms)
\begin{CompactList}\small\item\em Constructs an atomic structure.\item\end{CompactList}\item 
{\bf Molecule} (const {\bf Atom} $\ast$atoms, int num\_\-atoms)
\item 
{\bf Molecule} (const {\bf j\-Vector} $\ast$points\_\-3d, int num\_\-pos)
\item 
{\bf Molecule} (const Molecule \&mol)
\item 
{\bf $\sim$Molecule} ()
\item 
int {\bf Number} () const
\begin{CompactList}\small\item\em Reports the number of atoms in the molecule.\item\end{CompactList}\item 
int {\bf Num\-Res} () const
\begin{CompactList}\small\item\em Reports the number of residues in the molecule.\item\end{CompactList}\item 
const Molecule\& {\bf operator=} (const Molecule \&mol)
\begin{CompactList}\small\item\em Assignment (calls the {\bf Copy}() {\rm (p.\,\pageref{class_Molecule_b3})} function).\item\end{CompactList}\item 
const {\bf Atom}\& {\bf get\-Atom} (int i) const
\begin{CompactList}\small\item\em access to an atom.\item\end{CompactList}\item 
void {\bf set\-Atom} (int i, const {\bf Atom} \&a)
\begin{CompactList}\small\item\em make atom a the i'th atom.\item\end{CompactList}\item 
const {\bf Grid}\& {\bf get\-Grid} () const
\begin{CompactList}\small\item\em talk to the grid (note const).\item\end{CompactList}\item 
const {\bf Atom}\& {\bf operator[$\,$]} (int i) const
\begin{CompactList}\small\item\em Access an atom in the molecule by the atom id. Note, the id and index of an atom are the same.\item\end{CompactList}\item 
{\bf Atom}\& {\bf operator[$\,$]} (int i)
\begin{CompactList}\small\item\em Set an atom in the molecule by the atom id. Note, the id and index of an atom are the same.\item\end{CompactList}\item 
{\bf DLList}$<$int$>$ {\bf approx\_\-neighbor\_\-i} (const {\bf j\-Vector} \&p, double distance) const
\begin{CompactList}\small\item\em grid interface to neighbor atoms (Approx, fast).\item\end{CompactList}\item 
{\bf DLList}$<$int$>$ {\bf neighbor\_\-i} (const {\bf j\-Vector} \&p, double distance) const
\begin{CompactList}\small\item\em grid interface to neighbor atoms (Exact, same as above, but checked).\item\end{CompactList}\item 
const {\bf j\-Vector}\& {\bf operator()} (int i) const
\begin{CompactList}\small\item\em returns position of atom i.\item\end{CompactList}\item 
const {\bf j\-Vector}\& {\bf get\-Position} (int i) const
\begin{CompactList}\small\item\em returns position of atom i.\item\end{CompactList}\item 
void {\bf set\-Position} (int i, const {\bf j\-Vector} \&new\-Pos)
\begin{CompactList}\small\item\em sets position of atom i.\item\end{CompactList}\item 
{\bf j\-Vector} {\bf get\-COM} () const
\begin{CompactList}\small\item\em return center of mass.\item\end{CompactList}\item 
double {\bf VDW} (int i) const
\begin{CompactList}\small\item\em VDW for atom i`.\item\end{CompactList}\item 
const {\bf Int\-Vec}\& {\bf Get\-Bonds} (int atom) const
\begin{CompactList}\small\item\em returns list of bonds in an atom.\item\end{CompactList}\item 
double {\bf MSD} (int a1, int a2) const
\begin{CompactList}\small\item\em return physical Minimum Separation Distance between two atoms.\item\end{CompactList}\item 
int {\bf Output} (ostream \&os) const
\item 
int {\bf Input} (istream \&is)
\item 
int {\bf Output\-Binary} (ostream \&os) const
\item 
int {\bf Input\-Binary} (istream \&is)
\item 
istream\& {\bf Dyn\-Read} (istream \&is)
\item 
int {\bf set\-Random} (void)
\begin{CompactList}\small\item\em Generates random positions for Num' atoms.\item\end{CompactList}\item 
int {\bf read\-Xmol} (istream \&is)
\begin{CompactList}\small\item\em Reads in a molecule from an xyz formatted file. Returns the number of atoms read in.\item\end{CompactList}\item 
int {\bf read\-Fasta} (istream \&is)
\begin{CompactList}\small\item\em Reads in a molecule from an xyz formatted file. Returns the number of atoms read in.\item\end{CompactList}\item 
void {\bf write\-Xmol} (ostream \&os) const
\begin{CompactList}\small\item\em Writes a file in xmol xyz format. This version puts the atom int atom number as the first Xmol field.\item\end{CompactList}\item 
void {\bf write\-Xmol\-Data} (ostream \&os, int $\ast$data, {\bf Dyn\-String} comment) const
\begin{CompactList}\small\item\em Writes a client specified integer for each atom in the output Xmol formatted file.\item\end{CompactList}\item 
void {\bf write\-Xmol\-Data} (ostream \&os, double $\ast$data, {\bf Dyn\-String} comment) const
\begin{CompactList}\small\item\em Writes a client specified double for each atom in the output Xmol formatted file.\item\end{CompactList}\item 
void {\bf Bounds} (double \&minx, double \&miny, double \&minz,$\backslash$double \&maxx, double \&maxy, double \&maxz) const
\begin{CompactList}\small\item\em writes the upper and lower bounds in 3 dimensions by reference.\item\end{CompactList}\item 
{\bf MAKECOMPARISONS\_\-NO\_\-COMPARE} (Molecule)
\item 
{\bf MAKE\_\-IO\_\-STREAM\_\-OPERATORS} (Molecule)
\item 
{\bf MAKE\_\-BIN\_\-STREAM\_\-OPERATORS} (Molecule)
\end{CompactItemize}
\subsection*{Static Public Methods}
\begin{CompactItemize}
\item 
void {\bf skip\-Xmol} (istream \&is)
\begin{CompactList}\small\item\em skip a frame in a xmol format file stream.\item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Attributes}
\begin{CompactItemize}
\item 
double {\bf grid\_\-delta} = 3.7
\begin{CompactList}\small\item\em expected inter-atomic width.\item\end{CompactList}\item 
double {\bf grid\_\-max\_\-radius} = 250
\begin{CompactList}\small\item\em expected max molecule size.\item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Methods}
\begin{CompactItemize}
\item 
void {\bf Allocate} (int n)
\begin{CompactList}\small\item\em Allocates space for n atoms.\item\end{CompactList}\item 
void {\bf Deallocate} ()
\begin{CompactList}\small\item\em Deallocates the space.\item\end{CompactList}\item 
void {\bf Reallocate} (int n)
\begin{CompactList}\small\item\em Destroys the currently allocated space if n!=N and creates space for n atoms.\item\end{CompactList}\item 
void {\bf Copy} (const Molecule \&mol)
\begin{CompactList}\small\item\em Copies a molecule...\item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
{\bf Dyn\-String} {\bf label}
\begin{CompactList}\small\item\em label for the molecule.\item\end{CompactList}\item 
int {\bf N}
\begin{CompactList}\small\item\em The number of atoms in the structure.\item\end{CompactList}\item 
int {\bf P}
\begin{CompactList}\small\item\em The number of residues in the structure.\item\end{CompactList}\item 
{\bf Atom}$\ast$ {\bf A}
\begin{CompactList}\small\item\em A is a vector of atoms in the molecule (0-$>$ N-1).\item\end{CompactList}\item 
{\bf Residue}$\ast$ {\bf R}
\begin{CompactList}\small\item\em R is a vector of residues in the molecule (0-$>$ P-1).\item\end{CompactList}\item 
{\bf Grid}$\ast$ {\bf My\-Grid}
\begin{CompactList}\small\item\em My own grid to keep track of atom positions.\item\end{CompactList}\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf Residue}
\end{CompactItemize}


\subsection{Detailed Description}
//////////////////////////////////////////////////////////

File: Molecule.h

This class manages molecules. A separate class called atom is used to represent the data for particular atoms.

////////////////////////////////////////////////////////// 



Definition at line 32 of file molecule.h.

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




Definition at line 3 of file molecule.C.\footnotesize\begin{verbatim}00004   { N = 0; A = 0; R = 0;MyGrid =0; }
00005 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!Molecule@{Molecule}}
\index{Molecule@{Molecule}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Molecule::Molecule (int {\em num\_\-atoms})}\label{class_Molecule_a1}


Constructs an atomic structure.

\index{Molecule@{Molecule}!Molecule@{Molecule}}
\index{Molecule@{Molecule}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Molecule::Molecule (const {\bf Atom} $\ast$ {\em atoms}, int {\em num\_\-pos})}\label{class_Molecule_a2}




Definition at line 18 of file molecule.C.\footnotesize\begin{verbatim}00019   {
00020     N=0; A=0;
00021     Allocate(num_pos);
00022     for(int i=0; i<N; ++i)
00023         A[i] = atoms[i];
00024     R = 0;
00025 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!Molecule@{Molecule}}
\index{Molecule@{Molecule}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Molecule::Molecule (const {\bf j\-Vector} $\ast$ {\em points\_\-3d}, int {\em num\_\-pos})}\label{class_Molecule_a3}




Definition at line 6 of file molecule.C.\footnotesize\begin{verbatim}00006                                                          {
00007   N=0; A=0;
00008   Allocate(num_pos);
00009   for(int i=0; i<N; ++i)
00010     {
00011       //     A[i].position() = points_3d[i];
00012       MyGrid->setPosition(i, points_3d[i]);
00013       A[i].ID() = i;
00014     }
00015 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!Molecule@{Molecule}}
\index{Molecule@{Molecule}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Molecule::Molecule (const Molecule \& {\em mol})}\label{class_Molecule_a4}




Definition at line 27 of file molecule.C.\footnotesize\begin{verbatim}00028   {
00029     N=0; A=0;
00030     Copy(mol);
00031 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!~Molecule@{$\sim$Molecule}}
\index{~Molecule@{$\sim$Molecule}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Molecule::$\sim$Molecule ()}\label{class_Molecule_a5}




Definition at line 33 of file molecule.C.\footnotesize\begin{verbatim}00034   { Deallocate(); }
00035 \end{verbatim}\normalsize 


\subsection{Member Function Documentation}
\index{Molecule@{Molecule}!Allocate@{Allocate}}
\index{Allocate@{Allocate}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::Allocate (int {\em n})\hspace{0.3cm}{\tt  [protected]}}\label{class_Molecule_b0}


Allocates space for n atoms.



Definition at line 36 of file molecule.C.

Referenced by Molecule(), and Reallocate().\footnotesize\begin{verbatim}00036                              {
00037   N = (n < 1) ? 0 : n;
00038   A = 0;
00039   if(N)
00040     {
00041       if(!(A = new Atom[N]))
00042         N = 0;
00043       else
00044         for(int i=0; i<N; ++i)
00045           A[i].ID() = i;
00046     }
00047 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!Bounds@{Bounds}}
\index{Bounds@{Bounds}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::Bounds (double \& {\em minx}, double \& {\em miny}, double \& {\em minz}, $\backslash$double \& {\em maxx}, double \& {\em maxy}, double \& {\em maxz}) const}\label{class_Molecule_a34}


writes the upper and lower bounds in 3 dimensions by reference.



Definition at line 92 of file molecule.C.

Referenced by Envelope::Build().\footnotesize\begin{verbatim}00093                                                                        {
00094   
00095   //  minx = miny  = minz = INF;
00096   //  maxx = maxy  = maxz = (-1) * INF;
00097   jVector temp;
00098 
00099   temp = MyGrid->getPosition(0);
00100   minx = maxx = temp[0];
00101   miny = maxy = temp[1];
00102   minz = maxz = temp[2];
00103 
00104   
00105   for (int i = 1; i < N ; i++){    
00106     // assumes 2 atoms
00107     temp = MyGrid->getPosition(i);
00108 
00109     if (temp[0] < minx)
00110       minx = temp[0];
00111     else
00112       if (temp[0] > maxx)
00113         maxx = temp[0];
00114 
00115     if (temp[1] < miny)
00116       miny = temp[1];
00117     else
00118       if (temp[1] > maxy)
00119         maxy = temp[1];
00120 
00121     if (temp[2] < minz)
00122       minz = temp[2];
00123     else
00124       if (temp[2] > maxz)
00125         maxz = temp[2];           
00126     
00127   }
00128 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!Copy@{Copy}}
\index{Copy@{Copy}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::Copy (const Molecule \& {\em mol})\hspace{0.3cm}{\tt  [protected]}}\label{class_Molecule_b3}


Copies a molecule...



Definition at line 77 of file molecule.C.

Referenced by Molecule(), and operator=().\footnotesize\begin{verbatim}00077                                         {
00078   Reallocate(mol.N);
00079   for(int i=0; i<N; ++i){
00080     A[i] = mol.A[i];
00081     MyGrid->setPosition(i, mol.MyGrid->getPosition(i));    
00082   }
00083   if (mol.R){ // if mol is using residues
00084     P = mol.P;
00085     R = new Residue[P];
00086     for(int i=0; i<P; ++i){
00087       R[i] = mol.R[i];
00088     }
00089   }
00090 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!Deallocate@{Deallocate}}
\index{Deallocate@{Deallocate}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::Deallocate ()\hspace{0.3cm}{\tt  [protected]}}\label{class_Molecule_b1}


Deallocates the space.



Definition at line 51 of file molecule.C.

Referenced by Reallocate(), and $\sim$Molecule().\footnotesize\begin{verbatim}00051                          {
00052   if (A) delete[] A;
00053   if (R) delete[] R;
00054 
00055   
00056   if (MyGrid) delete MyGrid;
00057   N = 0;
00058   A = 0;
00059   R = 0;
00060 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!DynRead@{DynRead}}
\index{DynRead@{DynRead}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}istream \& Molecule::Dyn\-Read (istream \& {\em is})}\label{class_Molecule_a27}




Definition at line 259 of file molecule.C.\footnotesize\begin{verbatim}00260   {
00261     DLList<jVector> L;
00262     jVector input_vec(3);
00263 
00264     while(input_vec.dynread(is))
00265         L.AddToBack(input_vec);
00266 
00267     Reallocate(L.Number());
00268 
00269     for(int i=0; L; ++i)
00270         MyGrid->setPosition(i, L.RemoveFromFront());
00271 
00272     return is;
00273 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!GetBonds@{GetBonds}}
\index{GetBonds@{GetBonds}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf Int\-Vec} \& Molecule::Get\-Bonds (int {\em atom}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a21}


returns list of bonds in an atom.



Definition at line 235 of file molecule.h.\footnotesize\begin{verbatim}00236 { return A[atom].Bonds;}
00237 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!Input@{Input}}
\index{Input@{Input}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::Input (istream \& {\em is})}\label{class_Molecule_a24}




Definition at line 218 of file molecule.C.\footnotesize\begin{verbatim}00219   {
00220     int n=0;
00221     is >> n;
00222 
00223     if(n<1)
00224       return 0;
00225 
00226     Reallocate(n);
00227 
00228     jVector tempPos;
00229     for(int i=0; i<n; ++i){
00230       is >> tempPos ;
00231       MyGrid->setPosition(i, tempPos);
00232     }
00233 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!InputBinary@{InputBinary}}
\index{InputBinary@{InputBinary}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::Input\-Binary (istream \& {\em is})}\label{class_Molecule_a26}




Definition at line 246 of file molecule.C.\footnotesize\begin{verbatim}00247   {
00248     // Read in the number of atoms:
00249     is >= N;
00250     Reallocate(N);
00251     jVector tempPos;
00252     for(int i=0; i<N; ++i){
00253       is >= tempPos;
00254       MyGrid->setPosition(i,tempPos);
00255     }
00256 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!MAKECOMPARISONS_NO_COMPARE@{MAKECOMPARISONS\_\-NO\_\-COMPARE}}
\index{MAKECOMPARISONS_NO_COMPARE@{MAKECOMPARISONS\_\-NO\_\-COMPARE}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Molecule::MAKECOMPARISONS\_\-NO\_\-COMPARE (Molecule)}\label{class_Molecule_a35}


\index{Molecule@{Molecule}!MAKE_BIN_STREAM_OPERATORS@{MAKE\_\-BIN\_\-STREAM\_\-OPERATORS}}
\index{MAKE_BIN_STREAM_OPERATORS@{MAKE\_\-BIN\_\-STREAM\_\-OPERATORS}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Molecule::MAKE\_\-BIN\_\-STREAM\_\-OPERATORS (Molecule)}\label{class_Molecule_a37}


\index{Molecule@{Molecule}!MAKE_IO_STREAM_OPERATORS@{MAKE\_\-IO\_\-STREAM\_\-OPERATORS}}
\index{MAKE_IO_STREAM_OPERATORS@{MAKE\_\-IO\_\-STREAM\_\-OPERATORS}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Molecule::MAKE\_\-IO\_\-STREAM\_\-OPERATORS (Molecule)}\label{class_Molecule_a36}


\index{Molecule@{Molecule}!MSD@{MSD}}
\index{MSD@{MSD}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Molecule::MSD (int {\em a1}, int {\em a2}) const}\label{class_Molecule_a22}


return physical Minimum Separation Distance between two atoms.



Definition at line 154 of file molecule.C.\footnotesize\begin{verbatim}00154                                          {
00155   double d = 1;
00156 
00157   
00158   //  cerr << "msd: a1 " << a1 << "msd: a2 " << a2 << endl;
00159 //   if (A[a1].Bonded(a2)){
00160 //     d=  A[a1].cov_dist()+A[a2].cov_dist();
00161 //     cerr << "BONDED: a1=" ;
00162 //   } else {
00163 //        d = A[a1].VDW()+A[a2].VDW();
00164 //     //    cerr << "NONBONDED: a1=" ;
00165 //   }
00166 // //   cerr << A[a1].Label() << ", a2=" << A[a2].Label() << ", msd=" << d << endl;
00167 // //   cerr << "atom " << a1 <<  " bonds: " << GetBonds(a1) << endl;
00168 // //   cerr << "atom " << a2 <<  " bonds: " << GetBonds(a2) << endl;
00169 // //   cerr << endl;
00170 
00171 
00172   int r1 = A[a1].residue_number;
00173   int r2 = A[a2].residue_number;
00174 
00175   
00176   if ((R[r1].N_chain_atom == a1) &&
00177       (R[r2].N_chain_atom == a2))
00178     {
00179             d=  2.6;
00180             //d= 2.7;
00181     }
00182   else if ((R[r1].CA_chain_atom == a1) &&
00183            (R[r2].CA_chain_atom == a2))
00184     {      
00185             d = 3.6;
00186             //d= 3.7;
00187     }
00188   else if ((R[r1].O_chain_atom == a1) &&
00189            (R[r2].O_chain_atom == a2))
00190     {      
00191       d = 2.8;
00192     }
00193   else if ((R[r1].C_chain_atom == a1) &&
00194            (R[r2].C_chain_atom == a2))
00195     {      
00196             d = 2.8;
00197             //d= 2.9;
00198     }
00199   else if ((R[r1].CB_chain_atom == a1) &&
00200            (R[r2].CB_chain_atom == a2))
00201     {      
00202       d = 3.5;
00203     }
00204 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!NumRes@{NumRes}}
\index{NumRes@{NumRes}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::Num\-Res () const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a7}


Reports the number of residues in the molecule.



Definition at line 199 of file molecule.h.\footnotesize\begin{verbatim}00200 { return P; }
00201 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!Number@{Number}}
\index{Number@{Number}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::Number () const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a6}


Reports the number of atoms in the molecule.



Definition at line 196 of file molecule.h.

Referenced by Envelope::Build(), Constraint\-Manager::Constraint\-Manager(), Constraint\-Manager::Random\-Perturb(), Constraint\-Manager::Turn\-Atom\-On(), Constraint\-Manager::Turn\-Atoms\-Off(), Envelope::Write\-Density(), Constraint\-Manager::clear\-Constraints(), Constraint\-Manager::get\-Assoc\-Atoms(), Constraint\-Manager::get\-Stress\-List(), Constraint\-Manager::num\-Atoms(), Constraint\-Manager::reset\-Moved(), Constraint\-Manager::set\-Molecule(), Constraint\-Manager::set\-Position(), and Constraint\-Manager::stress().\footnotesize\begin{verbatim}00197 { return N; }
00198 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!Output@{Output}}
\index{Output@{Output}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::Output (ostream \& {\em os}) const}\label{class_Molecule_a23}




Definition at line 211 of file molecule.C.\footnotesize\begin{verbatim}00212   {
00213     os << N << '\n';
00214     for(int i=0; i<N; ++i)
00215         os << MyGrid->getPosition(i) << '\n';
00216     return N;
00217 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!OutputBinary@{OutputBinary}}
\index{OutputBinary@{OutputBinary}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::Output\-Binary (ostream \& {\em os}) const}\label{class_Molecule_a25}




Definition at line 236 of file molecule.C.\footnotesize\begin{verbatim}00236                                            {
00237     // Write the number of atoms in the molecule:
00238     os <= N;
00239 
00240     // Write out all the positions:
00241     for(int i=0; i<N; ++i)
00242         os <= MyGrid->getPosition(i);
00243     return N;
00244 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!Reallocate@{Reallocate}}
\index{Reallocate@{Reallocate}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::Reallocate (int {\em n})\hspace{0.3cm}{\tt  [protected]}}\label{class_Molecule_b2}


Destroys the currently allocated space if n!=N and creates space for n atoms.



Definition at line 62 of file molecule.C.

Referenced by Copy(), Dyn\-Read(), Input(), Input\-Binary(), read\-Fasta(), and read\-Xmol().\footnotesize\begin{verbatim}00062                                {
00063   if(N == n)
00064     return;
00065   if (R) {    
00066     WARN ("ACK! LOSING RESIDUE INFORMATION");
00067     cerr << "Reallocating from " << N << " atoms to " << n << " atoms." << endl;
00068   }
00069 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!VDW@{VDW}}
\index{VDW@{VDW}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Molecule::VDW (int {\em i}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a20}


VDW for atom i`.



Definition at line 223 of file molecule.h.

Referenced by Constraint\-Manager::get\-Radius().\footnotesize\begin{verbatim}00224 { return A[i].VDW();}
00225 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!approx_neighbor_i@{approx\_\-neighbor\_\-i}}
\index{approx_neighbor_i@{approx\_\-neighbor\_\-i}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ int $>$ Molecule::approx\_\-neighbor\_\-i (const {\bf j\-Vector} \& {\em p}, double {\em distance}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a14}


grid interface to neighbor atoms (Approx, fast).



Definition at line 229 of file molecule.h.

Referenced by Constraint\-Manager::approx\_\-neighbor\_\-i().\footnotesize\begin{verbatim}00230 { return MyGrid->approx_neighbor_i(p,distance); }
00231 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!getAtom@{getAtom}}
\index{getAtom@{getAtom}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf Atom} \& Molecule::get\-Atom (int {\em i}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a9}


access to an atom.



Definition at line 202 of file molecule.h.

Referenced by Envelope::Build().\footnotesize\begin{verbatim}00203 { return A[i]; }
00204 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!getCOM@{getCOM}}
\index{getCOM@{getCOM}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} Molecule::get\-COM () const}\label{class_Molecule_a19}


return center of mass.



Definition at line 141 of file molecule.C.\footnotesize\begin{verbatim}00142 {
00143   jVector rv(3,0);
00144 
00145   for(int i=0; i<N; ++i){    
00146     rv += MyGrid->getPosition(i);    
00147   }
00148 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!getGrid@{getGrid}}
\index{getGrid@{getGrid}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf Grid} \& Molecule::get\-Grid () const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a11}


talk to the grid (note const).



Definition at line 205 of file molecule.h.\footnotesize\begin{verbatim}00206 { return *MyGrid; }
00207 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!getPosition@{getPosition}}
\index{getPosition@{getPosition}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf j\-Vector} \& Molecule::get\-Position (int {\em i}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a17}


returns position of atom i.



Definition at line 220 of file molecule.h.

Referenced by Output(), and Output\-Binary().\footnotesize\begin{verbatim}00221 { return MyGrid->getPosition(i); }
00222 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!neighbor_i@{neighbor\_\-i}}
\index{neighbor_i@{neighbor\_\-i}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf DLList}$<$ int $>$ Molecule::neighbor\_\-i (const {\bf j\-Vector} \& {\em p}, double {\em distance}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a15}


grid interface to neighbor atoms (Exact, same as above, but checked).



Definition at line 232 of file molecule.h.

Referenced by Constraint\-Manager::neighbor\_\-i().\footnotesize\begin{verbatim}00233 { return MyGrid->neighbor_i(p,distance); }
00234 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!operator()@{operator()}}
\index{operator()@{operator()}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf j\-Vector} \& Molecule::operator() (int {\em i}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a16}


returns position of atom i.



Definition at line 217 of file molecule.h.\footnotesize\begin{verbatim}00218 { return MyGrid->getPosition(i); }
00219 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!operator=@{operator=}}
\index{operator=@{operator=}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const Molecule \& Molecule::operator= (const Molecule \& {\em mol})}\label{class_Molecule_a8}


Assignment (calls the {\bf Copy}() {\rm (p.\,\pageref{class_Molecule_b3})} function).



Definition at line 138 of file molecule.C.\footnotesize\begin{verbatim}00139   { Copy(mol); return *this; }
00140 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!operator[]@{operator[]}}
\index{operator[]@{operator[]}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Atom} \& Molecule::operator[$\,$] (int {\em i})\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a13}


Set an atom in the molecule by the atom id. Note, the id and index of an atom are the same.



Definition at line 214 of file molecule.h.\footnotesize\begin{verbatim}00215 { return A[i]; }
00216 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!operator[]@{operator[]}}
\index{operator[]@{operator[]}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf Atom} \& Molecule::operator[$\,$] (int {\em i}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a12}


Access an atom in the molecule by the atom id. Note, the id and index of an atom are the same.



Definition at line 211 of file molecule.h.\footnotesize\begin{verbatim}00212 { return A[i]; }
00213 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!readFasta@{readFasta}}
\index{readFasta@{readFasta}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::read\-Fasta (istream \& {\em is})}\label{class_Molecule_a30}


Reads in a molecule from an xyz formatted file. Returns the number of atoms read in.



Definition at line 302 of file molecule.C.

Referenced by main().\footnotesize\begin{verbatim}00303 {
00304   int res_count = 0;
00305   int tot_residues = 0;
00306   int atom_count = 0;
00307   int res_type_temp = UNINITIALIZED_RES_ID;
00308   DLList<DynString *> ResList;
00309   DLList<DynString *>::ConstIterator it;
00310   DynString * DynPtr;
00311   
00312   DynString str,previous; // strings
00313   // ASSUMES CODE_1 SERIES
00314   previous.ReadLine(is); // read comment line
00315   label = previous;
00316 
00317   
00318   while(is.good()){
00319     str.Clear();
00320     str.GetChar(is);
00321     str.ToUpper();
00322     res_type_temp = ResidueRegistry::CheckType_code_1(str);
00323     if (res_type_temp > -1) {// its a real residue code
00324       res_count++;
00325       atom_count += ResidueRegistry::numAtoms[res_type_temp];
00326       DynPtr = new DynString(str);
00327       ResList.Add(DynPtr);      
00328     }
00329   }
00330 
00331   // set up molecule
00332   Reallocate(atom_count);
00333   P = res_count;
00334   R = new Residue[P];
00335     
00336   tot_residues = res_count;
00337   res_count = 0;
00338   atom_count = 0;
00339 
00340   // iterate over list, create molecule
00341   for(it = ResList.GetConstIterator(); it; ++it){
00342     DynPtr = ($\ast$it);
00343     R[res_count].ID() = res_count;
00344     ResidueRegistry::SetType_code_1(R[res_count], *DynPtr);
00345     if (tot_residues == 1)
00346       R[res_count].Setup(*this, atom_count,0,0); // this configures atoms
00347     else if (res_count == 0)
00348       atom_count = R[res_count].Setup(*this, atom_count,0,&(R[1]));
00349     else if (res_count == tot_residues-1)
00350       atom_count = R[res_count].Setup(*this, atom_count, \
00351                                       &(R[tot_residues-2]),0); 
00352     else
00353       // this configures atoms      
00354       atom_count = R[res_count].Setup \
00355         (*this, atom_count,&(R[res_count-1]),&(R[res_count+1]));
00356 
00357     res_count++;
00358   }
00359     
00360   // delete the DynStrings
00361   while (ResList.Number()){
00362     DynPtr = ResList.Remove();
00363     delete DynPtr;
00364   }
00365 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!readXmol@{readXmol}}
\index{readXmol@{readXmol}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::read\-Xmol (istream \& {\em is})}\label{class_Molecule_a29}


Reads in a molecule from an xyz formatted file. Returns the number of atoms read in.



Definition at line 373 of file molecule.C.

Referenced by main(), and Constraint\-Manager::read\-New\-Molecule\-Xmol().\footnotesize\begin{verbatim}00374 {
00375   
00376   DynString str,previous; // strings
00377   jVector tempPos(3); // 3 element vector
00378   char cJunk[256];
00379 
00380     
00381   previous.ReadLine(is); // read num atoms
00382   Reallocate(previous.ToInt()); // make me a molecule with this many atoms available
00383     
00384   str.ReadLine(is); // read comment
00385   label = str;
00386 
00387     //    cerr << "Read: " << label << endl;
00388     
00389     // Read in the atoms (the number of atoms is specified on
00390     // the line before the -- line:
00391     //
00392     
00393   for(int i=0; i<N; i++)
00394     {
00395       if(!is.good())
00396         {
00397           cerr << "Warning: read in " << i << ", not " 
00398                << N << " atoms.\n";
00399           DIE("this is a fatal error; check file");
00400         }
00401         
00402       //        is >> A[i].Type() >> tempPos ;
00403       // label removed from front -- now at the end
00404       is >> str >> tempPos ;
00405       is.getline(cJunk,256); //scrap rest -o- line!
00406       MyGrid->setPosition(i, tempPos);  
00407       //      cerr << "setting type on atom " << i << " to " << str << endl;
00408       AtomRegistry::SetType(A[i],str, str);
00409     }
00410 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!setAtom@{setAtom}}
\index{setAtom@{setAtom}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::set\-Atom (int {\em i}, const {\bf Atom} \& {\em a})\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a10}


make atom a the i'th atom.



Definition at line 208 of file molecule.h.\footnotesize\begin{verbatim}00209 { A[i] = a; }
00210 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!setPosition@{setPosition}}
\index{setPosition@{setPosition}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::set\-Position (int {\em i}, const {\bf j\-Vector} \& {\em new\-Pos})\hspace{0.3cm}{\tt  [inline]}}\label{class_Molecule_a18}


sets position of atom i.



Definition at line 226 of file molecule.h.

Referenced by Constraint\-Manager::set\-Position().\footnotesize\begin{verbatim}00227 { MyGrid->setPosition(i, newPos); }
00228 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!setRandom@{setRandom}}
\index{setRandom@{setRandom}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::set\-Random (void)}\label{class_Molecule_a28}


Generates random positions for Num' atoms.



Definition at line 275 of file molecule.C.

Referenced by main().\footnotesize\begin{verbatim}00275                        {
00276   // Generates random positions for Num' atoms
00277   //  RanInt randomPosition((-1)*Num/3, Num/3);
00278 
00279   RanInt randomPosition(-50, 50);
00280   // actually want double, but int is reproducible across systems
00281   jVector tempPos(3); // 3 element vector
00282 
00283   ofstream out("random_start.xmol");
00284   out << N << endl;
00285   out << "Random Start: "<< label << endl;
00286 
00287   for(int i=0; i<N; i++)
00288     {
00289       tempPos[0] = randomPosition.Get();
00290       tempPos[1] = randomPosition.Get();
00291       tempPos[2] = randomPosition.Get();
00292 
00293       MyGrid->setPosition(i, tempPos);  
00294 
00295       out << A[i].type << tempPos << "\t  9" << endl;
00296     }
00297 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!skipXmol@{skipXmol}}
\index{skipXmol@{skipXmol}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::skip\-Xmol (istream \& {\em is})\hspace{0.3cm}{\tt  [static]}}\label{class_Molecule_d0}


skip a frame in a xmol format file stream.



Definition at line 444 of file molecule.C.

Referenced by jd\-Err\_\-Eval::run().\footnotesize\begin{verbatim}00445 {
00446 
00447     DynString previous; // strings
00448     char cJunk[256];
00449 
00450     
00451     previous.ReadLine(is); // read num atoms
00452     int lines = previous.ToInt();
00453     is.getline(cJunk,256); // pull \n
00454     
00455     is.getline(cJunk,256); //scrap comment
00456     
00457     for(int i=0; i<lines; i++)
00458       {
00459         if(!is.good())
00460           {
00461             cerr << "Warning: skipXmol: read in " << i << ", not " 
00462                  << lines << " atoms.\n";
00463             DIE("this is a fatal error; check file");
00464           }
00465         
00466         is.getline(cJunk,256); //scrap each line
00467 
00468       }
00469 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!writeXmol@{writeXmol}}
\index{writeXmol@{writeXmol}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::write\-Xmol (ostream \& {\em os}) const}\label{class_Molecule_a31}


Writes a file in xmol xyz format. This version puts the atom int atom number as the first Xmol field.



Definition at line 413 of file molecule.C.

Referenced by main().\footnotesize\begin{verbatim}00413                                            {
00414   os << N << '\n';
00415   os << label << "\n";
00416   for(int i=0; i<N; ++i)
00417     os  << A[i].type << " " << MyGrid->getPosition(i) << " 9"  << endl;
00418 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!writeXmolData@{writeXmolData}}
\index{writeXmolData@{writeXmolData}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::write\-Xmol\-Data (ostream \& {\em os}, double $\ast$ {\em data}, {\bf Dyn\-String} {\em new\_\-comment}) const}\label{class_Molecule_a33}


Writes a client specified double for each atom in the output Xmol formatted file.



Definition at line 432 of file molecule.C.\footnotesize\begin{verbatim}00433 {
00434   // Warning. using wrong data array can cause seg fault, cf above.
00435   
00436   os << N << '\n';
00437   os << new_comment << "\n";
00438   for(int i=0; i<N; ++i)
00439     os << A[i].type  <<" "<< MyGrid->getPosition(i) << ' ' << data[i] << '\n';    
00440   
00441 \end{verbatim}\normalsize 
\index{Molecule@{Molecule}!writeXmolData@{writeXmolData}}
\index{writeXmolData@{writeXmolData}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Molecule::write\-Xmol\-Data (ostream \& {\em os}, int $\ast$ {\em data}, {\bf Dyn\-String} {\em new\_\-comment}) const}\label{class_Molecule_a32}


Writes a client specified integer for each atom in the output Xmol formatted file.



Definition at line 420 of file molecule.C.\footnotesize\begin{verbatim}00420                                                                                 {
00421   // Warning.  This assumes that data points to at least N integers
00422   // I'm not sure a good way to make this safer. -jd
00423   
00424   os << N << '\n';
00425   os << new_comment << "\n";
00426   for(int i=0; i<N; ++i)
00427     os << A[i].type <<" "<< MyGrid->getPosition(i) << ' ' << data[i] << endl;
00428   
00429 \end{verbatim}\normalsize 


\subsection{Friends And Related Function Documentation}
\index{Molecule@{Molecule}!Residue@{Residue}}
\index{Residue@{Residue}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}class Residue\hspace{0.3cm}{\tt  [friend]}}\label{class_Molecule_l0}




Definition at line 35 of file molecule.h.

\subsection{Member Data Documentation}
\index{Molecule@{Molecule}!A@{A}}
\index{A@{A}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Atom} $\ast$ Molecule::A\hspace{0.3cm}{\tt  [protected]}}\label{class_Molecule_n3}


A is a vector of atoms in the molecule (0-$>$ N-1).



Definition at line 170 of file molecule.h.\index{Molecule@{Molecule}!MyGrid@{MyGrid}}
\index{MyGrid@{MyGrid}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Grid} $\ast$ Molecule::My\-Grid\hspace{0.3cm}{\tt  [protected]}}\label{class_Molecule_n5}


My own grid to keep track of atom positions.



Definition at line 176 of file molecule.h.\index{Molecule@{Molecule}!N@{N}}
\index{N@{N}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::N\hspace{0.3cm}{\tt  [protected]}}\label{class_Molecule_n1}


The number of atoms in the structure.



Definition at line 164 of file molecule.h.\index{Molecule@{Molecule}!P@{P}}
\index{P@{P}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Molecule::P\hspace{0.3cm}{\tt  [protected]}}\label{class_Molecule_n2}


The number of residues in the structure.



Definition at line 167 of file molecule.h.\index{Molecule@{Molecule}!R@{R}}
\index{R@{R}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Residue} $\ast$ Molecule::R\hspace{0.3cm}{\tt  [protected]}}\label{class_Molecule_n4}


R is a vector of residues in the molecule (0-$>$ P-1).



Definition at line 173 of file molecule.h.\index{Molecule@{Molecule}!grid_delta@{grid\_\-delta}}
\index{grid_delta@{grid\_\-delta}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Molecule::grid\_\-delta = 3.7\hspace{0.3cm}{\tt  [static]}}\label{class_Molecule_p0}


expected inter-atomic width.



Definition at line 78 of file globals.C.\index{Molecule@{Molecule}!grid_max_radius@{grid\_\-max\_\-radius}}
\index{grid_max_radius@{grid\_\-max\_\-radius}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Molecule::grid\_\-max\_\-radius = 250\hspace{0.3cm}{\tt  [static]}}\label{class_Molecule_p1}


expected max molecule size.



Definition at line 79 of file globals.C.\index{Molecule@{Molecule}!label@{label}}
\index{label@{label}!Molecule@{Molecule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Dyn\-String} Molecule::label\hspace{0.3cm}{\tt  [protected]}}\label{class_Molecule_n0}


label for the molecule.



Definition at line 161 of file molecule.h.

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