\section{Atom\-Constraint  Class Reference}
\label{class_AtomConstraint}\index{AtomConstraint@{Atom\-Constraint}}
{\tt \#include $<$atom\_\-constraint.h$>$}

Inheritance diagram for Atom\-Constraint\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=55pt]{class_AtomConstraint_inherit_graph}
\end{center}
\end{figure}
Collaboration diagram for Atom\-Constraint:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=376pt]{class_AtomConstraint_coll_graph}
\end{center}
\end{figure}
\subsection*{Public Methods}
\begin{CompactItemize}
\item 
{\bf Atom\-Constraint} ({\bf Constraint\-Manager} \&cm)
\item 
{\bf Atom\-Constraint} ({\bf Constraint\-Manager} \&cm, int atom\_\-i)
\item 
{\bf $\sim$Atom\-Constraint} ()
\item 
double {\bf compute\-Stress} () const
\item 
double {\bf compute\-Stress} (int k, const {\bf j\-Vector} \&pos) const
\item 
{\bf j\-Vector} {\bf d\-Stress} (int i, const {\bf j\-Vector} \&pos\_\-k) const
\item 
int {\bf Compare} (const Atom\-Constraint \&dc) const
\item 
{\bf MAKECOMPARISONS\_\-WITH\_\-COMPARE} (Atom\-Constraint)
\item 
int {\bf Output} (ostream \&os) const
\item 
int {\bf Output\-Binary} (ostream \&os) const
\end{CompactItemize}
\subsection*{Static Public Attributes}
\begin{CompactItemize}
\item 
{\bf Dyn\-String} {\bf Identifier} = "atm:"
\end{CompactItemize}
\subsection*{Protected Methods}
\begin{CompactItemize}
\item 
int {\bf Read} (istream \&is)
\item 
int {\bf Read\-Binary} (istream \&is)
\begin{CompactList}\small\item\em Same scenerio as {\bf Read}() {\rm (p.\,\pageref{class_AtomConstraint_b0})} only binary version.\item\end{CompactList}\item 
void {\bf notify\-Valid} ({\bf Constraint} $\ast$child, bool validity=true)
\item 
void {\bf notify\-Remove} (void)
\begin{CompactList}\small\item\em I'm about to be removed from the constraint graph.\item\end{CompactList}\end{CompactItemize}


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

{\bf atom\_\-constraint.h}

This constraint class is really a wrapper class for the atom class so that it can be massaged into a {\bf Constraint\-Manager} {\rm (p.\,\pageref{class_ConstraintManager})}'s constraint graphs.

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



Definition at line 21 of file atom\_\-constraint.h.

\subsection{Constructor \& Destructor Documentation}
\index{AtomConstraint@{Atom\-Constraint}!AtomConstraint@{AtomConstraint}}
\index{AtomConstraint@{AtomConstraint}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Atom\-Constraint::Atom\-Constraint ({\bf Constraint\-Manager} \& {\em cm})}\label{class_AtomConstraint_a0}




Definition at line 3 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00004   : Constraint(cm,IntVec(0))
00005   {
00006 
00007 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!AtomConstraint@{AtomConstraint}}
\index{AtomConstraint@{AtomConstraint}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Atom\-Constraint::Atom\-Constraint ({\bf Constraint\-Manager} \& {\em cm}, int {\em i})}\label{class_AtomConstraint_a1}




Definition at line 9 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00010   : Constraint(cm, IntVec(0))
00011   {
00012     myID = i;
00013 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!~AtomConstraint@{$\sim$AtomConstraint}}
\index{~AtomConstraint@{$\sim$AtomConstraint}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Atom\-Constraint::$\sim$Atom\-Constraint ()\hspace{0.3cm}{\tt  [inline]}}\label{class_AtomConstraint_a2}




Definition at line 29 of file atom\_\-constraint.h.\footnotesize\begin{verbatim}00029                     {}
00030 \end{verbatim}\normalsize 


\subsection{Member Function Documentation}
\index{AtomConstraint@{Atom\-Constraint}!Compare@{Compare}}
\index{Compare@{Compare}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Atom\-Constraint::Compare (const Atom\-Constraint \& {\em ac}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_AtomConstraint_a6}




Definition at line 55 of file atom\_\-constraint.h.\footnotesize\begin{verbatim}00056 {
00057   
00058   if (myID == ac.ID()) return 0;
00059   if (myID < ac.ID()) return -1;
00060   return 1;
00061   
00062   //
00063   //  if(atomIndex[0] == dc.atomIndex[0] && atomIndex[1] == dc.atomIndex[1])
00064   //    return 0;
00065   //  if(atomIndex[0]<dc.atomIndex[0])
00066   //    return -1;
00067   //  if(atomIndex[0]>dc.atomIndex[0])
00068   //    return 1;
00069   //  if(atomIndex[1]<dc.atomIndex[1])
00070   //    return -1;
00071   //  return 1;
00072 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!MAKECOMPARISONS_WITH_COMPARE@{MAKECOMPARISONS\_\-WITH\_\-COMPARE}}
\index{MAKECOMPARISONS_WITH_COMPARE@{MAKECOMPARISONS\_\-WITH\_\-COMPARE}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Atom\-Constraint::MAKECOMPARISONS\_\-WITH\_\-COMPARE (Atom\-Constraint)}\label{class_AtomConstraint_a7}


\index{AtomConstraint@{Atom\-Constraint}!Output@{Output}}
\index{Output@{Output}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Atom\-Constraint::Output (ostream \& {\em os}) const\hspace{0.3cm}{\tt  [virtual]}}\label{class_AtomConstraint_a8}




Reimplemented from {\bf Constraint} {\rm (p.\,\pageref{class_Constraint_a11})}.

Definition at line 75 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00076 {
00077   os << myID;
00078   return 1;
00079 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!OutputBinary@{OutputBinary}}
\index{OutputBinary@{OutputBinary}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Atom\-Constraint::Output\-Binary (ostream \& {\em os}) const\hspace{0.3cm}{\tt  [virtual]}}\label{class_AtomConstraint_a9}




Reimplemented from {\bf Constraint} {\rm (p.\,\pageref{class_Constraint_a13})}.

Definition at line 87 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00088 {
00089   os <= myID;
00090   return 1;
00091 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!Read@{Read}}
\index{Read@{Read}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Atom\-Constraint::Read (istream \& {\em is})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{class_AtomConstraint_b0}


Derived classes need to define here how to read  themselves in. Notice that the base class defines {\bf Input}() {\rm (p.\,\pageref{class_Constraint_a12})} as a wrapper around this virtual function. Subclasses should typically overwrite just the {\bf Read}() {\rm (p.\,\pageref{class_AtomConstraint_b0})} function (and not the {\bf Input}() {\rm (p.\,\pageref{class_Constraint_a12})} function).

In the {\bf Read}() {\rm (p.\,\pageref{class_AtomConstraint_b0})} function, the derived class should $\ast$not$\ast$ log itself with the constraint manager since this is taken care of in the base classes {\bf Input}() {\rm (p.\,\pageref{class_Constraint_a12})} function. 

Reimplemented from {\bf Constraint} {\rm (p.\,\pageref{class_Constraint_b4})}.

Definition at line 81 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00082 {
00083   is >> myID;
00084   return 1;
00085 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!ReadBinary@{ReadBinary}}
\index{ReadBinary@{ReadBinary}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Atom\-Constraint::Read\-Binary (istream \& {\em is})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{class_AtomConstraint_b1}


Same scenerio as {\bf Read}() {\rm (p.\,\pageref{class_AtomConstraint_b0})} only binary version.



Reimplemented from {\bf Constraint} {\rm (p.\,\pageref{class_Constraint_b5})}.

Definition at line 106 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00107 {
00108   is >= myID;
00109   return 1;
00110 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!computeStress@{computeStress}}
\index{computeStress@{computeStress}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Atom\-Constraint::compute\-Stress (int {\em k}, const {\bf j\-Vector} \& {\em pos\_\-k}) const\hspace{0.3cm}{\tt  [virtual]}}\label{class_AtomConstraint_a4}


Returns the stress on this constraint after "pretending" the atom with index a' moved to position pos\_\-a'. This also must be overwitten by all constraints that inherit from this class 

Reimplemented from {\bf Constraint} {\rm (p.\,\pageref{class_Constraint_a27})}.

Definition at line 42 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00043 {
00044   if (myID != k)
00045     DIE("Tried to computeStress' on atom constraint for an atom other than the one pointed to by the constraint"); 
00046   double returnVal = 0;
00047   int numCyc = supportC.Length();  
00048   for (int i =0; i < numCyc; i++)
00049     //min variance goes here
00050     returnVal += CM->getConstraint(supportC[i])->stress(myID,pos_k);
00051   
00052   return returnVal;
00053 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!computeStress@{computeStress}}
\index{computeStress@{computeStress}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Atom\-Constraint::compute\-Stress () const\hspace{0.3cm}{\tt  [virtual]}}\label{class_AtomConstraint_a3}


One of the only functions that $\ast$must$\ast$ be overwritten by subclasses. Returns a value reflecting how dissatisfied this constraint is with the current molecule residing in CM'. 

Reimplemented from {\bf Constraint} {\rm (p.\,\pageref{class_Constraint_a26})}.

Definition at line 20 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00021 {
00022   // Return the sum of stress of constraints that are "on" me.
00023   // We're not sure we want to do it like this yet.  It violates
00024   // the DAG semantics of constraint use in the constraint graph.
00025   // I.e. Constraints are parents of the constraints whose values they
00026   // use to obtain their stress() value.
00027   //
00028   double returnVal = 0;
00029   int numCyc = supportC.Length();
00030  
00031   for (int i =0; i < numCyc; i++){        
00032     returnVal += CM->getConstraint(supportC[i])->stress();
00033 //     cerr << "I'm atom_constraint " << myID << ", Added stress "
00034 //       << CM->getConstraint(supportC[i])->stress() << " from "
00035 //       << supportC[i] <<"("<< CM->getConstraint(supportC[i])->Label()
00036 //       << "), total = " << returnVal << endl;
00037   }
00038 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!dStress@{dStress}}
\index{dStress@{dStress}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} Atom\-Constraint::d\-Stress (int {\em k}, const {\bf j\-Vector} \& {\em pos\_\-k}) const\hspace{0.3cm}{\tt  [virtual]}}\label{class_AtomConstraint_a5}


asking constraint number k for its 12 element d\-Stress vector we pass in pos\_\-a vector -- corresponding to the atom position if the constraint is an atom, and corresponding to the position of the atom k in question if the call is to a non-atom constraint. EG for a distance constraint atom 12 needs the d\-Stress from the d-constraint, so it will call d\-Stress on the d-constraint(12, atom\_\-pos) so the d\_\-constr can answer the question if atom 12 were in atom\_\-pos, I would say my d\-Stress is blah. 

Reimplemented from {\bf Constraint} {\rm (p.\,\pageref{class_Constraint_a6})}.

Definition at line 55 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00056 {
00057   if (myID != k)
00058     DIE("Tried to call dStress on atom constraint for an atom other than the one pointed to by its constraint");
00059   //  jVector ReturnVal = jVector(12,0);
00060   jVector ReturnVal = jVector(3,0);
00061 
00062   
00063   int numCyc = supportC.Length();
00064   
00065   for (int i =0; i < numCyc; i++)
00066     //min variance goes here
00067     if (CM->constraintON(supportC[i])){
00068       //      cerr << "adding to dstress from constraint " << supportC[i] << endl;
00069       ReturnVal += CM->getConstraint(supportC[i])->dStress(myID,pos_k);
00070     }
00071 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!notifyRemove@{notifyRemove}}
\index{notifyRemove@{notifyRemove}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Atom\-Constraint::notify\-Remove (void)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{class_AtomConstraint_b3}


I'm about to be removed from the constraint graph.



Reimplemented from {\bf Constraint} {\rm (p.\,\pageref{class_Constraint_b3})}.

Definition at line 113 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00114   {
00115     DIE(" Atoms cannot be removed.");
00116 \end{verbatim}\normalsize 
\index{AtomConstraint@{Atom\-Constraint}!notifyValid@{notifyValid}}
\index{notifyValid@{notifyValid}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Atom\-Constraint::notify\-Valid ({\bf Constraint} $\ast$ {\em child}, bool {\em validity} = true)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{class_AtomConstraint_b2}


Informs me that one of my supports now contains valid/invalid  information depending on the validity' flag. 

Reimplemented from {\bf Constraint} {\rm (p.\,\pageref{class_Constraint_b2})}.

Definition at line 93 of file atom\_\-constraint.C.\footnotesize\begin{verbatim}00094 {
00095 
00096   // this is used to tell the atom that a constraint on which it
00097   // depends (supportC -- up in the graph) has become invalid.
00098 
00099   if (validity){  
00100     DIE(" Called notifyValid(true) on an Atom constraint.");
00101   }
00102 \end{verbatim}\normalsize 


\subsection{Member Data Documentation}
\index{AtomConstraint@{Atom\-Constraint}!Identifier@{Identifier}}
\index{Identifier@{Identifier}!AtomConstraint@{Atom\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Dyn\-String} Atom\-Constraint::Identifier = "atm:"\hspace{0.3cm}{\tt  [static]}}\label{class_AtomConstraint_p0}




Reimplemented from {\bf Constraint} {\rm (p.\,\pageref{class_Constraint_p0})}.

Definition at line 94 of file globals.C.

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