\section{Envelope\-Constraint  Class Reference}
\label{class_EnvelopeConstraint}\index{EnvelopeConstraint@{Envelope\-Constraint}}
{\tt \#include $<$envelope\_\-constraint.h$>$}

Inheritance diagram for Envelope\-Constraint\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=62pt]{class_EnvelopeConstraint_inherit_graph}
\end{center}
\end{figure}
Collaboration diagram for Envelope\-Constraint:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=371pt]{class_EnvelopeConstraint_coll_graph}
\end{center}
\end{figure}
\subsection*{Public Methods}
\begin{CompactItemize}
\item 
{\bf Envelope\-Constraint} ({\bf Constraint\-Manager} \&cm)
\begin{CompactList}\small\item\em constructor.\item\end{CompactList}\item 
{\bf $\sim$Envelope\-Constraint} ()
\item 
{\bf j\-Vector} {\bf d\-Stress} (int k, const {\bf j\-Vector} \&pos) const
\item 
double {\bf get\-Density} (const {\bf j\-Vector} \&J) const
\begin{CompactList}\small\item\em return the density at {\bf j\-Vector} {\rm (p.\,\pageref{class_jVector})} J.\item\end{CompactList}\item 
{\bf j\-Vector} {\bf get\-Gradient} (const {\bf j\-Vector} \&J) const
\begin{CompactList}\small\item\em return the gradient at {\bf j\-Vector} {\rm (p.\,\pageref{class_jVector})} J.\item\end{CompactList}\item 
int {\bf Compare} (const Envelope\-Constraint \&ec) const
\item 
{\bf MAKECOMPARISONS\_\-WITH\_\-COMPARE} (Envelope\-Constraint)
\item 
int {\bf Output} (ostream \&os) const
\item 
int {\bf Output\-Binary} (ostream \&os) const
\item 
int {\bf Write\-VRML\_\-Orig\-Data} (ostream \&out\-Stream) const
\begin{CompactList}\small\item\em write VRML 1.0 format for initial envelope data (env\_\-A).\item\end{CompactList}\item 
void {\bf Move\-Modelby\-Grad} (double d) const
\begin{CompactList}\small\item\em move model distance d according to gradient of atoms outsie E[0].\item\end{CompactList}\item 
void {\bf Align\-Modelto\-COM} () const
\begin{CompactList}\small\item\em calling this translates \& rotates all atoms in the model.\item\end{CompactList}\item 
void {\bf Find\-Envelope\-Eigenvectors} ({\bf Matrix} \&Eig\-Vec, {\bf Matrix} \&Eig\-Val) const
\begin{CompactList}\small\item\em Determine the Eigen\-Vectors for the ""A"" envelope.\item\end{CompactList}\item 
{\bf Matrix} {\bf Find\-Model\-Rotation} () const
\begin{CompactList}\small\item\em Determine the roation matrix.\item\end{CompactList}\item 
void {\bf Align\-Princ\-Comp} (void) const
\begin{CompactList}\small\item\em Rotate current model via pricipal components.\item\end{CompactList}\item 
{\bf j\-Vector} {\bf Find\-Model\-Translation\-To\-COM} () const
\begin{CompactList}\small\item\em Determine the translation of model points to COM of envelope.\item\end{CompactList}\item 
double {\bf compute\-Stress} () const
\begin{CompactList}\small\item\em returns stress on constraint.\item\end{CompactList}\item 
double {\bf compute\-Stress} (int k, const {\bf j\-Vector} \&pos) const
\begin{CompactList}\small\item\em returns stress on constraint if atom k' were in position pos'.\item\end{CompactList}\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_EnvelopeConstraint_a18})} only binary version.\item\end{CompactList}\item 
int {\bf Read\-Avs\-Txt} (istream \&in)
\begin{CompactList}\small\item\em read text-converted AVS density format.\item\end{CompactList}\item 
void {\bf Pre\-Setup} ()
\begin{CompactList}\small\item\em aligns the grid.\item\end{CompactList}\item 
void {\bf Post\-Setup} ()
\end{CompactItemize}
\subsection*{Public Attributes}
\begin{CompactItemize}
\item 
{\bf Envelope}$\ast$$\ast$ {\bf E}
\begin{CompactList}\small\item\em Array of envelope pointers. [0] points to read-in data, rest are blurred copies.\item\end{CompactList}\item 
double {\bf K}
\begin{CompactList}\small\item\em factor used to combine E[0], E[1], etc. when they overlap.\item\end{CompactList}\item 
{\bf Bin\-Envelope\-Constraint}$\ast$$\ast$ {\bf BEC\_\-List}
\begin{CompactList}\small\item\em array of pointers to BEC's; for access.\item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Attributes}
\begin{CompactItemize}
\item 
{\bf Dyn\-String} {\bf Identifier} = "envelope:"
\item 
int {\bf num\_\-evelopes} = 2
\begin{CompactList}\small\item\em Number of envelopes to use. 0 is original data, 1..n-1 are blurred versions.\item\end{CompactList}\item 
double {\bf translation\_\-threshold} = 0.5
\begin{CompactList}\small\item\em If the translate vector nrm() $>$ this, then a translation occurs.\item\end{CompactList}\item 
double {\bf rotation\_\-threshold} = 0.08
\begin{CompactList}\small\item\em If the sum(abs(Rotation Matrix)) $>$ this, then a rotation occurs.\item\end{CompactList}\item 
double {\bf density\_\-threshold} = 0.125
\begin{CompactList}\small\item\em greater than this =$>$ atom fits envelope.\item\end{CompactList}\item 
int {\bf blur\_\-kernel\-Size} = 2
\begin{CompactList}\small\item\em size of blur kernel.\item\end{CompactList}\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf Bin\-Envelope\-Constraint}
\end{CompactItemize}


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


constructor.



Definition at line 4 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00005   : Constraint(cm,IntVec(cm.numAtoms(),0,1)) // range constructor for intvec
00006   : Constraint(cm)
00007   // NOTE NO SUPPORTS -- will support all the BinEnvConstratints after they're added
00008 {
00009   
00010   E = new Envelope*[EnvelopeConstraint::num_evelopes];
00011   
00012   E[0] = new Envelope;
00013   for(int i =1;i<EnvelopeConstraint::num_evelopes;i++)
00014     E[i] =0;
00015 
00016   BEC_List = 0;
00017   K = 1;  
00018 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!~EnvelopeConstraint@{$\sim$EnvelopeConstraint}}
\index{~EnvelopeConstraint@{$\sim$EnvelopeConstraint}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Envelope\-Constraint::$\sim$Envelope\-Constraint ()}\label{class_EnvelopeConstraint_a1}




Definition at line 22 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00022                                        {
00023 
00024   for(int i =0;i<EnvelopeConstraint::num_evelopes;i++){
00025     if (E[i])
00026       delete E[i];
00027   }
00028 \end{verbatim}\normalsize 


\subsection{Member Function Documentation}
\index{EnvelopeConstraint@{Envelope\-Constraint}!AlignModeltoCOM@{AlignModeltoCOM}}
\index{AlignModeltoCOM@{AlignModeltoCOM}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Envelope\-Constraint::Align\-Modelto\-COM (void) const}\label{class_EnvelopeConstraint_a11}


calling this translates \& rotates all atoms in the model.



Definition at line 167 of file envelope\_\-constraint.C.

Referenced by compute\-Stress().\footnotesize\begin{verbatim}00167                                                    {
00168 
00171   
00172   // Translate to COM
00173   jVector T = FindModelTranslationToCOM();
00174   if (T.nrm() > translation_threshold){
00175     CM->TranslateModel(T);  
00176 #ifdef NOISY_CONSTRAINTS
00177     cerr << "finished translate by " << T << endl;
00178   } else {
00179     WARN ("not translated -- too close");
00180 #endif
00181   }
00182 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!AlignPrincComp@{AlignPrincComp}}
\index{AlignPrincComp@{AlignPrincComp}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Envelope\-Constraint::Align\-Princ\-Comp (void) const}\label{class_EnvelopeConstraint_a14}


Rotate current model via pricipal components.



Definition at line 85 of file envelope\_\-constraint.C.

Referenced by Align\-Modelto\-COM().\footnotesize\begin{verbatim}00085                                                   {
00086 
00087   jVector tempV1;
00088   jVector tempV2;
00089   int num = CM->numAtoms();
00090 
00091   
00092   // Rotate
00093   Matrix Rot(3,3);
00094   Rot = FindModelRotation();
00095 
00096   Matrix I(3,3);
00097   I.identity();
00098 
00099   if ((Rot - I).SumAbsoluteValue() > rotation_threshold){
00100 
00101     for (int a = 0; a < num; a++){
00102       if (CM->constraintON(a)){
00103         for (int i =0;i<3;i++){   //matrix multiply into a jVector
00104 
00105           tempV1 = CM->getPosition(a);
00106 
00107           //    tempV2[i] =0;
00108           //    for (int j =0;j<3;j++){
00109           //      tempV2[i] += Rot(i+1,j+1)*tempV1[j];
00110           //    }
00111         
00112           tempV2[i]  = Rot(i+1,1)*tempV1[0];
00113           tempV2[i] += Rot(i+1,2)*tempV1[1];
00114           tempV2[i] += Rot(i+1,3)*tempV1[2];
00115         
00116         }  // end matrix multiply
00117         CM->setPosition(a, tempV2);
00118       }
00119     } // end loop on num' atoms
00120 
00121     
00122     //   } else {
00123     // do not move if matrix is almost Identitiy
00124     //     cerr << "Rotate Aborted -- too close to Identity." << endl;
00125 
00126   }
00127 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!Compare@{Compare}}
\index{Compare@{Compare}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Envelope\-Constraint::Compare (const Envelope\-Constraint \& {\em ec}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_EnvelopeConstraint_a5}




Definition at line 154 of file envelope\_\-constraint.h.\footnotesize\begin{verbatim}00155 {
00156   DIE("Envelope Compare not Implemented");
00157   
00158   return 0;
00159 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!FindEnvelopeEigenvectors@{FindEnvelopeEigenvectors}}
\index{FindEnvelopeEigenvectors@{FindEnvelopeEigenvectors}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Envelope\-Constraint::Find\-Envelope\-Eigenvectors ({\bf Matrix} \& {\em Eig\-Val}, {\bf Matrix} \& {\em Eig\-Vec}) const}\label{class_EnvelopeConstraint_a12}


Determine the Eigen\-Vectors for the ""A"" envelope.



Definition at line 324 of file envelope\_\-constraint.C.

Referenced by Find\-Model\-Rotation().\footnotesize\begin{verbatim}00324                                                                                       {
00325   
00326   E[0]->Get_Eigenvectors(EigVal, EigVec);
00327   
00328 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!FindModelRotation@{FindModelRotation}}
\index{FindModelRotation@{FindModelRotation}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Matrix} Envelope\-Constraint::Find\-Model\-Rotation (void) const}\label{class_EnvelopeConstraint_a13}


Determine the roation matrix.



Definition at line 352 of file envelope\_\-constraint.C.

Referenced by Align\-Princ\-Comp().\footnotesize\begin{verbatim}00352                                                 {
00353   
00354   Matrix Spread(3,3); //lower triangular matrix of 3x3
00355 
00356   Matrix R; //rotation matrix
00357   
00358   jVector tempV;
00359 
00360   int in_Points = CM->numAtomsON();
00361   
00362   // Calc spread
00363   double dx, dy, dz = 0;
00364   double meanx = 0, meany = 0, meanz = 0;
00365 
00366   for (int a = 0; a < in_Points; a++){
00367     if (CM->constraintON(a)){
00368       tempV = CM->getPosition(a);
00369 
00370       meanx += tempV[0];
00371       meany += tempV[1];
00372       meanz += tempV[2];
00373     }
00374   }
00375   meanx /= in_Points;
00376   meany /= in_Points;
00377   meanz /= in_Points;
00378 
00379   // calc dx dy dz
00380   
00381   Spread.zero();
00382   
00383   
00384   for (int a = 0; a < in_Points; a++){
00385     tempV = CM->getPosition(a);
00386     dx = tempV[0] - meanx;
00387     dy = tempV[1] - meany;
00388     dz = tempV[2] - meanz;
00389   
00390     Spread (1,1) += dx*dx/in_Points;
00391     Spread (2,1) += dx*dy/in_Points;
00392     Spread (2,2) += dy*dy/in_Points;
00393     Spread (3,1) += dx*dz/in_Points;
00394     Spread (3,2) += dy*dz/in_Points;
00395     Spread (3,3) += dz*dz/in_Points;
00396   }
00397 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!FindModelTranslationToCOM@{FindModelTranslationToCOM}}
\index{FindModelTranslationToCOM@{FindModelTranslationToCOM}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} Envelope\-Constraint::Find\-Model\-Translation\-To\-COM (void) const}\label{class_EnvelopeConstraint_a15}


Determine the translation of model points to COM of envelope.



Definition at line 331 of file envelope\_\-constraint.C.

Referenced by Align\-Modelto\-COM().\footnotesize\begin{verbatim}00331                                                         {
00332   jVector rv;
00333   jVector model_center = CM->molecule_center();
00334 
00335   rv[0] = E[0]->r_cm_x - model_center[0];
00336   rv[1] = E[0]->r_cm_y - model_center[1];
00337   rv[2] = E[0]->r_cm_z - model_center[2];
00338 
00339 #ifdef NOISY_CONSTRAINTS
00340   cerr <<"Model COM: "<< model_center << endl;
00341 
00342   cerr <<"Env COM: " << E[0]->r_cm_x <<" " << E[0]->r_cm_y <<" "<< E[0]->r_cm_z << endl;
00343 
00344   cerr << "Translation vector: "  << rv << " (mag=" << rv.mag() << ")" <<endl<< endl;
00345 #endif
00346   return rv;
00347   
00348 
00349 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!MAKECOMPARISONS_WITH_COMPARE@{MAKECOMPARISONS\_\-WITH\_\-COMPARE}}
\index{MAKECOMPARISONS_WITH_COMPARE@{MAKECOMPARISONS\_\-WITH\_\-COMPARE}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Envelope\-Constraint::MAKECOMPARISONS\_\-WITH\_\-COMPARE (Envelope\-Constraint)}\label{class_EnvelopeConstraint_a6}


\index{EnvelopeConstraint@{Envelope\-Constraint}!MoveModelbyGrad@{MoveModelbyGrad}}
\index{MoveModelbyGrad@{MoveModelbyGrad}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Envelope\-Constraint::Move\-Modelby\-Grad (double {\em d}) const}\label{class_EnvelopeConstraint_a10}


move model distance d according to gradient of atoms outsie E[0].



Definition at line 132 of file envelope\_\-constraint.C.

Referenced by Align\-Modelto\-COM().\footnotesize\begin{verbatim}00132                                                        {
00133 
00136 
00137   jVector dir; dir.zero();
00138   // cycle over my BEC, asking them if their atom is outside
00139   // if so, take position of point, determine gradient there,
00140   // and += to dir.
00141   //  move model by d*dir.unit();
00142 
00143   jVector pos;
00144   int num = CM->numAtoms(); // ASSUMES all atoms in CM are in env. <?>
00145   for (int i = 0; i < num; i++){ 
00146     if (CM->constraintON(i)){
00147       //    cerr << "atom = " << i << endl;
00148       //      pos = CM->getPosition(BEC_List[i]->Atom_id);
00149       pos = CM->getPosition(i);
00150       if ((*E[0])(pos) <= EnvelopeConstraint::density_threshold) {// outside orig data
00151         //      cerr << "location = " << pos << endl;
00152         //      cerr << "gradient = " << getGradient(pos) << endl;
00153         dir += getGradient(pos);      
00154       }
00155     }
00156   }
00157 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!Output@{Output}}
\index{Output@{Output}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Envelope\-Constraint::Output (ostream \& {\em os}) const\hspace{0.3cm}{\tt  [virtual]}}\label{class_EnvelopeConstraint_a7}




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

Definition at line 439 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00440 {
00441   /*
00442     os << supportA[0] << ' ' << supportA[1] << ' '
00443     << measured << ' ' << variance;
00444     return 2;
00445   */
00446   return 0;
00447 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!OutputBinary@{OutputBinary}}
\index{OutputBinary@{OutputBinary}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Envelope\-Constraint::Output\-Binary (ostream \& {\em os}) const\hspace{0.3cm}{\tt  [virtual]}}\label{class_EnvelopeConstraint_a8}




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

Definition at line 458 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00459 {
00460   //  os <= supportA <= measured <= variance;
00461   return 2;
00462 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!PostSetup@{PostSetup}}
\index{PostSetup@{PostSetup}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Envelope\-Constraint::Post\-Setup (void)\hspace{0.3cm}{\tt  [virtual]}}\label{class_EnvelopeConstraint_a22}


constraints get their ID when added to the constraint graph. this addition is done in the Input function between the pre- and post setup functions. constraint setup that needs to occur with an ID and an added constraint go in post setup. (like adding parent constraints, etc.) 

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

Definition at line 57 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00057                                    {
00058 
00059   BinEnvelopeConstraint * BECptr;  
00060 
00061   int num = CM->numAtoms(); // ASSUMES all atoms in CM are in env. <?> FIX
00062   BEC_List = new BinEnvelopeConstraint * [num];
00063   
00064   for (int i = 0; i < num; i++){ 
00065 
00066     BECptr = new BinEnvelopeConstraint(*CM,i,this);
00067     // to be deleted by ~ConstraintManager
00068 
00069     BEC_List[i] = BECptr; // record it.
00070     
00071     BECptr->Input(cin); // INPUT STREAM NOT USED (is there a null stream?)
00072 
00073     // each bin_envelope is supported by the envelope_constraint
00074     // When the envelope_constraint is "valid" the atoms have been
00075     // aligned ok against the envelope.  Asserting the highlevel EnvelopeConstraint
00076     // invalid will force further alignment
00077     
00078   }
00079 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!PreSetup@{PreSetup}}
\index{PreSetup@{PreSetup}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Envelope\-Constraint::Pre\-Setup (void)\hspace{0.3cm}{\tt  [virtual]}}\label{class_EnvelopeConstraint_a21}


aligns the grid.



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

Definition at line 36 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00036                                   {
00037 
00038   // create blurred envelopes
00039 
00040   if (E[0]->numPoints > 1) {
00041 
00042     for(int i =1;i<EnvelopeConstraint::num_evelopes;i++){
00043       E[i] = new Envelope(*E[i-1]); // copy
00044       E[i]->Blur(1);                // FIX -- make a variable in globals
00045       E[i]->Upsize(2);
00046     }
00047     
00048   } else {
00049     cerr << " Envelope setup failed.  Envelope has " << E[0]->numPoints << " points." << endl;
00050     DIE("");
00051   }
00052 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!Read@{Read}}
\index{Read@{Read}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Envelope\-Constraint::Read (istream \& {\em is})\hspace{0.3cm}{\tt  [virtual]}}\label{class_EnvelopeConstraint_a18}


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_EnvelopeConstraint_a18})} function (and not the {\bf Input}() {\rm (p.\,\pageref{class_Constraint_a12})} function).

In the {\bf Read}() {\rm (p.\,\pageref{class_EnvelopeConstraint_a18})} 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 449 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00450 {
00451   // tell A to read away!
00452   int rv = E[0]->Read(is); 
00453   E[0]->Center();
00454   return rv;
00455   
00456 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!ReadAvsTxt@{ReadAvsTxt}}
\index{ReadAvsTxt@{ReadAvsTxt}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Envelope\-Constraint::Read\-Avs\-Txt (istream \& {\em in})}\label{class_EnvelopeConstraint_a20}


read text-converted AVS density format.

\index{EnvelopeConstraint@{Envelope\-Constraint}!ReadBinary@{ReadBinary}}
\index{ReadBinary@{ReadBinary}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Envelope\-Constraint::Read\-Binary (istream \& {\em is})\hspace{0.3cm}{\tt  [virtual]}}\label{class_EnvelopeConstraint_a19}


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



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

Definition at line 464 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00465 {
00466   //  is >= supportA[0] >= supportA[1] >= measured >= variance;
00467   return 2;
00468 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!WriteVRML_OrigData@{WriteVRML\_\-OrigData}}
\index{WriteVRML_OrigData@{WriteVRML\_\-OrigData}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Envelope\-Constraint::Write\-VRML\_\-Orig\-Data (ostream \& {\em out\-Stream}) const\hspace{0.3cm}{\tt  [inline]}}\label{class_EnvelopeConstraint_a9}


write VRML 1.0 format for initial envelope data (env\_\-A).



Definition at line 162 of file envelope\_\-constraint.h.

Referenced by jd\-Err\_\-Eval::run().\footnotesize\begin{verbatim}00162                                                                            {
00163   return E[0]->WriteVRML(outStream);
00164 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!computeStress@{computeStress}}
\index{computeStress@{computeStress}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Envelope\-Constraint::compute\-Stress (int {\em k}, const {\bf j\-Vector} \& {\em pos\_\-k}) const\hspace{0.3cm}{\tt  [virtual]}}\label{class_EnvelopeConstraint_a17}


returns stress on constraint if atom k' were in position pos'.



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

Definition at line 225 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00226 {
00227 
00228   DIE("");
00229     return 0;
00230     
00231 
00232 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!computeStress@{computeStress}}
\index{computeStress@{computeStress}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Envelope\-Constraint::compute\-Stress () const\hspace{0.3cm}{\tt  [virtual]}}\label{class_EnvelopeConstraint_a16}


returns stress on constraint.



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

Definition at line 210 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00210                                         {
00211 
00212   // align centroid
00213 
00214   // calc rotation matirix
00215 
00216   // rotate atoms
00217   
00218   AlignModeltoCOM();
00219   return 0;
00220   
00221 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!dStress@{dStress}}
\index{dStress@{dStress}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} Envelope\-Constraint::d\-Stress (int {\em k}, const {\bf j\-Vector} \& {\em pos\_\-k}) const\hspace{0.3cm}{\tt  [virtual]}}\label{class_EnvelopeConstraint_a2}


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 235 of file envelope\_\-constraint.C.\footnotesize\begin{verbatim}00236 {
00237 
00238   //  DIE("");
00239   return JVzero3;
00240   
00241 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!getDensity@{getDensity}}
\index{getDensity@{getDensity}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Envelope\-Constraint::get\-Density (const {\bf j\-Vector} \& {\em J}) const}\label{class_EnvelopeConstraint_a3}


return the density at {\bf j\-Vector} {\rm (p.\,\pageref{class_jVector})} J.



Definition at line 244 of file envelope\_\-constraint.C.

Referenced by Bin\-Envelope\-Constraint::compute\-Stress(), and Bin\-Envelope\-Constraint::d\-Stress().\footnotesize\begin{verbatim}00244                                                             {
00245 
00246 
00247   double D = (*E[0])(J) ;
00248   //  cerr << D << " = E[0] density \n" ;
00249   if (D >  EnvelopeConstraint::density_threshold)
00250     return MAX_ENV_DEN;
00251   
00252   int i = 1;
00253   while ((i < EnvelopeConstraint::num_evelopes) && (D < EnvelopeConstraint::density_threshold))
00254     {
00255       D = (*E[i])(J) ;
00256       //      cerr << "next, " << D << " = E[" <<i<<"] density \n" ;
00257       i++;
00258 
00259     }
00260 
00261 // else {
00262 //   //  double rv = (1/(1+K))*(((*E[0])(J))+(K*((*env_B)(J))));
00263 //     rv = util_max( a_density , K*(*env_B)(J) );
00264 //     }
00265 //   // DEBUG
00266 // //   cerr << endl << "EC::getDensity: pos{" << J[0] << ", " << J[1]
00267 // //        << ", " << J[2] << "}
00268 \end{verbatim}\normalsize 
\index{EnvelopeConstraint@{Envelope\-Constraint}!getGradient@{getGradient}}
\index{getGradient@{getGradient}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} Envelope\-Constraint::get\-Gradient (const {\bf j\-Vector} \& {\em J}) const}\label{class_EnvelopeConstraint_a4}


return the gradient at {\bf j\-Vector} {\rm (p.\,\pageref{class_jVector})} J.



Definition at line 274 of file envelope\_\-constraint.C.

Referenced by Move\-Modelby\-Grad(), and Bin\-Envelope\-Constraint::d\-Stress().\footnotesize\begin{verbatim}00274                                                                {
00275 
00276   double D = (*E[0])(J);
00277   jVector G = E[0]->gradient(J) ;
00278   //  cerr << D << " = E[0] density " ;
00279   if (D >  EnvelopeConstraint::density_threshold)
00280     return G;
00281   
00282   int i = 1;
00283   while ((i < EnvelopeConstraint::num_evelopes) && (D < EnvelopeConstraint::density_threshold))
00284     {
00285       D = (*E[i])(J) ;
00286       G = E[i]->gradient(J);
00287       //  cerr << D << " = E[" <<i<<"] density " ;
00288       i++;
00289     }
00290 
00291    //   
00292 //   jVector G;
00293 //   double p = (*E[0])(J); 
00294 //   if ( p >= EnvelopeConstraint::density_threshold ) {
00295 //     if ( p >= K*(*env_B)(J) ) {
00296 //       //    cerr << p <<"(A),  ";
00297 //       G = E[0]->gradient(J);    
00298 //     }  else {
00299 //       G = env_B->gradient(J);
00300 //     }
00301 //   } else {
00302 //     G = JVzero;
00303 //   }
00304 \end{verbatim}\normalsize 


\subsection{Friends And Related Function Documentation}
\index{EnvelopeConstraint@{Envelope\-Constraint}!BinEnvelopeConstraint@{BinEnvelopeConstraint}}
\index{BinEnvelopeConstraint@{BinEnvelopeConstraint}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}class Bin\-Envelope\-Constraint\hspace{0.3cm}{\tt  [friend]}}\label{class_EnvelopeConstraint_l0}




Definition at line 32 of file envelope\_\-constraint.h.

Referenced by Post\-Setup().

\subsection{Member Data Documentation}
\index{EnvelopeConstraint@{Envelope\-Constraint}!BEC_List@{BEC\_\-List}}
\index{BEC_List@{BEC\_\-List}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Bin\-Envelope\-Constraint} $\ast$$\ast$ Envelope\-Constraint::BEC\_\-List}\label{class_EnvelopeConstraint_m2}


array of pointers to BEC's; for access.



Definition at line 75 of file envelope\_\-constraint.h.\index{EnvelopeConstraint@{Envelope\-Constraint}!E@{E}}
\index{E@{E}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Envelope} $\ast$$\ast$ Envelope\-Constraint::E}\label{class_EnvelopeConstraint_m0}


Array of envelope pointers. [0] points to read-in data, rest are blurred copies.



Definition at line 69 of file envelope\_\-constraint.h.\index{EnvelopeConstraint@{Envelope\-Constraint}!Identifier@{Identifier}}
\index{Identifier@{Identifier}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Dyn\-String} Envelope\-Constraint::Identifier = "envelope:"\hspace{0.3cm}{\tt  [static]}}\label{class_EnvelopeConstraint_p0}




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

Definition at line 105 of file globals.C.\index{EnvelopeConstraint@{Envelope\-Constraint}!K@{K}}
\index{K@{K}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Envelope\-Constraint::K}\label{class_EnvelopeConstraint_m1}


factor used to combine E[0], E[1], etc. when they overlap.



Definition at line 72 of file envelope\_\-constraint.h.\index{EnvelopeConstraint@{Envelope\-Constraint}!blur_kernelSize@{blur\_\-kernelSize}}
\index{blur_kernelSize@{blur\_\-kernelSize}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Envelope\-Constraint::blur\_\-kernel\-Size = 2\hspace{0.3cm}{\tt  [static]}}\label{class_EnvelopeConstraint_p5}


size of blur kernel.



Definition at line 110 of file globals.C.\index{EnvelopeConstraint@{Envelope\-Constraint}!density_threshold@{density\_\-threshold}}
\index{density_threshold@{density\_\-threshold}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Envelope\-Constraint::density\_\-threshold = 0.125\hspace{0.3cm}{\tt  [static]}}\label{class_EnvelopeConstraint_p4}


greater than this =$>$ atom fits envelope.



Definition at line 107 of file globals.C.\index{EnvelopeConstraint@{Envelope\-Constraint}!num_evelopes@{num\_\-evelopes}}
\index{num_evelopes@{num\_\-evelopes}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Envelope\-Constraint::num\_\-evelopes = 2\hspace{0.3cm}{\tt  [static]}}\label{class_EnvelopeConstraint_p1}


Number of envelopes to use. 0 is original data, 1..n-1 are blurred versions.



Definition at line 106 of file globals.C.\index{EnvelopeConstraint@{Envelope\-Constraint}!rotation_threshold@{rotation\_\-threshold}}
\index{rotation_threshold@{rotation\_\-threshold}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Envelope\-Constraint::rotation\_\-threshold = 0.08\hspace{0.3cm}{\tt  [static]}}\label{class_EnvelopeConstraint_p3}


If the sum(abs(Rotation Matrix)) $>$ this, then a rotation occurs.



Definition at line 108 of file globals.C.\index{EnvelopeConstraint@{Envelope\-Constraint}!translation_threshold@{translation\_\-threshold}}
\index{translation_threshold@{translation\_\-threshold}!EnvelopeConstraint@{Envelope\-Constraint}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Envelope\-Constraint::translation\_\-threshold = 0.5\hspace{0.3cm}{\tt  [static]}}\label{class_EnvelopeConstraint_p2}


If the translate vector nrm() $>$ this, then a translation occurs.



Definition at line 109 of file globals.C.

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