<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>simple.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Mon Oct 14 14:16:38 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>simple.h</h1><div class="fragment"><pre>00001 00002 <font class="comment">/* simple.h -- definition of the simple internal coordinate classes</font> 00003 <font class="comment"> *</font> 00004 <font class="comment"> * THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A</font> 00005 <font class="comment"> * "UNITED STATES GOVERNMENT WORK". IT WAS WRITTEN AS A PART OF THE</font> 00006 <font class="comment"> * AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE. THIS MEANS IT</font> 00007 <font class="comment"> * CANNOT BE COPYRIGHTED. THIS SOFTWARE IS FREELY AVAILABLE TO THE</font> 00008 <font class="comment"> * PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO</font> 00009 <font class="comment"> * RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.</font> 00010 <font class="comment"> *</font> 00011 <font class="comment"> * Author:</font> 00012 <font class="comment"> * E. T. Seidl</font> 00013 <font class="comment"> * Bldg. 12A, Rm. 2033</font> 00014 <font class="comment"> * Computer Systems Laboratory</font> 00015 <font class="comment"> * Division of Computer Research and Technology</font> 00016 <font class="comment"> * National Institutes of Health</font> 00017 <font class="comment"> * Bethesda, Maryland 20892</font> 00018 <font class="comment"> * Internet: seidl@alw.nih.gov</font> 00019 <font class="comment"> * February, 1993</font> 00020 <font class="comment"> */</font> 00021 00022 <font class="preprocessor">#ifndef _intco_simple_h</font> 00023 <font class="preprocessor"></font><font class="preprocessor">#define _intco_simple_h</font> 00024 <font class="preprocessor"></font> 00025 <font class="preprocessor">#ifdef __GNUC__</font> 00026 <font class="preprocessor"></font><font class="preprocessor">#pragma interface</font> 00027 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00028 <font class="preprocessor"></font> 00029 00030 <font class="preprocessor">#include <iostream></font> 00031 00032 <font class="preprocessor">#include <util/class/class.h></font> 00033 <font class="preprocessor">#include <util/state/state.h></font> 00034 <font class="preprocessor">#include <util/keyval/keyval.h></font> 00035 <font class="preprocessor">#include <chemistry/molecule/molecule.h></font> 00036 <font class="preprocessor">#include <chemistry/molecule/coor.h></font> 00037 00038 <font class="preprocessor">#include <math/scmat/vector3.h></font> 00039 00040 <font class="keyword">namespace </font>sc { 00041 00042 <font class="comment">// ////////////////////////////////////////////////////////////////////////</font> 00043 <a name="l00083"></a><a class="code" href="class_sc__SimpleCo.html">00083</a> <font class="keyword">class </font>SimpleCo : <font class="keyword">public</font> IntCoor { 00084 <font class="keyword">protected</font>: 00085 <font class="keywordtype">int</font> natoms_; 00086 <font class="keywordtype">int</font> *atoms; 00087 00088 <font class="keyword">public</font>: 00089 <a class="code" href="class_sc__SimpleCo.html#a1">SimpleCo</a>(); 00094 <a class="code" href="class_sc__SimpleCo.html#a1">SimpleCo</a>(<font class="keywordtype">int</font>,<font class="keyword">const</font> <font class="keywordtype">char</font>* =0); 00096 <a class="code" href="class_sc__SimpleCo.html#a1">SimpleCo</a>(<font class="keyword">const</font> Ref<KeyVal>&,<font class="keywordtype">int</font> natom); 00097 00098 <font class="keyword">virtual</font> ~SimpleCo(); 00099 00101 <font class="keywordtype">int</font> <a class="code" href="class_sc__SimpleCo.html#a4">natoms</a>() <font class="keyword">const</font>; 00103 <font class="keywordtype">int</font> <a class="code" href="class_sc__SimpleCo.html#a5">operator[]</a>(<font class="keywordtype">int</font> i) <font class="keyword">const</font>; 00104 00105 <font class="keywordtype">void</font> <a class="code" href="class_sc__SimpleCo.html#a6">save_data_state</a>(StateOut&); 00106 <a class="code" href="class_sc__SimpleCo.html#a1">SimpleCo</a>(StateIn&); 00107 00108 <font class="keyword">virtual</font> <font class="keywordtype">int</font> operator==(SimpleCo&); 00109 <font class="keywordtype">int</font> operator!=(SimpleCo&u); 00110 00111 <font class="comment">// these IntCoor members are implemented in term of</font> 00112 <font class="comment">// the calc_force_con and calc_intco members.</font> 00114 <font class="comment"> double force_constant(Ref<Molecule>&);</font> 00117 <font class="comment"></font> <font class="keywordtype">void</font> <a class="code" href="class_sc__SimpleCo.html#a11">update_value</a>(<font class="keyword">const</font> Ref<Molecule>&); 00119 <font class="keywordtype">void</font> <a class="code" href="class_sc__SimpleCo.html#a12">bmat</a>(<font class="keyword">const</font> Ref<Molecule>&,RefSCVector&bmat,<font class="keywordtype">double</font> coef = 1.0); 00120 00122 <font class="keyword">virtual</font> <font class="keywordtype">double</font> <a class="code" href="class_sc__SimpleCo.html#a13">calc_force_con</a>(Molecule&) = 0; 00127 <font class="keyword">virtual</font> <font class="keywordtype">double</font> <a class="code" href="class_sc__SimpleCo.html#a14">calc_intco</a>(Molecule&, <font class="keywordtype">double</font>* =0, <font class="keywordtype">double</font> =1) = 0; 00128 00130 <font class="keywordtype">void</font> <a class="code" href="class_sc__SimpleCo.html#a15">print_details</a>(<font class="keyword">const</font> Ref<Molecule> &, 00131 std::ostream& = ExEnv::out0()) <font class="keyword">const</font>; 00132 00135 <font class="keywordtype">int</font> <a class="code" href="class_sc__SimpleCo.html#a16">equivalent</a>(Ref<IntCoor>&); 00136 }; 00137 00138 00139 00140 <font class="comment">// ///////////////////////////////////////////////////////////////////////</font> 00141 00142 <font class="preprocessor">#define SimpleCo_DECLARE(classname) \</font> 00143 <font class="preprocessor"> public: \</font> 00144 <font class="preprocessor"> virtual classname& operator=(const classname&); \</font> 00145 <font class="preprocessor"> SimpleCo& operator=(const SimpleCo&); \</font> 00146 <font class="preprocessor"> double calc_force_con(Molecule&); \</font> 00147 <font class="preprocessor"> double calc_intco(Molecule&, double* =0, double =1); \</font> 00148 <font class="preprocessor"> classname(StateIn&); \</font> 00149 <font class="preprocessor"> void save_data_state(StateOut&); \</font> 00150 <font class="preprocessor"> private:</font> 00151 <font class="preprocessor"></font> 00152 <font class="preprocessor">#define SimpleCo_IMPL_eq(classname) \</font> 00153 <font class="preprocessor">SimpleCo& classname::operator=(const SimpleCo& c) \</font> 00154 <font class="preprocessor">{ \</font> 00155 <font class="preprocessor"> classname *cp = dynamic_cast<classname*>((SimpleCo*)&c); \</font> 00156 <font class="preprocessor"> if(cp) { \</font> 00157 <font class="preprocessor"> *this=*cp; \</font> 00158 <font class="preprocessor"> } \</font> 00159 <font class="preprocessor"> else { \</font> 00160 <font class="preprocessor"> natoms_ = 0; \</font> 00161 <font class="preprocessor"> atoms = 0; \</font> 00162 <font class="preprocessor"> } \</font> 00163 <font class="preprocessor"> \</font> 00164 <font class="preprocessor"> return *this; \</font> 00165 <font class="preprocessor"> }</font> 00166 <font class="preprocessor"></font> 00167 <font class="preprocessor">#define SimpleCo_IMPL_StateIn(classname) \</font> 00168 <font class="preprocessor">classname::classname(StateIn&si): \</font> 00169 <font class="preprocessor"> SimpleCo(si) \</font> 00170 <font class="preprocessor">{ \</font> 00171 <font class="preprocessor">}</font> 00172 <font class="preprocessor"></font> 00173 <font class="preprocessor">#define SimpleCo_IMPL_save_data_state(classname) \</font> 00174 <font class="preprocessor">void classname::save_data_state(StateOut&so) \</font> 00175 <font class="preprocessor">{ \</font> 00176 <font class="preprocessor"> SimpleCo::save_data_state(so); \</font> 00177 <font class="preprocessor">}</font> 00178 <font class="preprocessor"></font> 00179 <font class="preprocessor">#define SimpleCo_IMPL(classname) \</font> 00180 <font class="preprocessor"> SimpleCo_IMPL_eq(classname) \</font> 00181 <font class="preprocessor"> SimpleCo_IMPL_StateIn(classname) \</font> 00182 <font class="preprocessor"> SimpleCo_IMPL_save_data_state(classname)</font> 00183 <font class="preprocessor"></font> 00184 <font class="comment">// ///////////////////////////////////////////////////////////////////////</font> 00185 <a name="l00194"></a><a class="code" href="class_sc__StreSimpleCo.html">00194</a> <font class="keyword">class </font>StreSimpleCo : <font class="keyword">public</font> SimpleCo { 00195 SimpleCo_DECLARE(StreSimpleCo) 00196 <font class="keyword">public</font>: 00197 StreSimpleCo(); 00198 StreSimpleCo(<font class="keyword">const</font> StreSimpleCo&); 00202 StreSimpleCo(<font class="keyword">const</font> <font class="keywordtype">char</font>*, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>); 00205 StreSimpleCo(<font class="keyword">const</font> Ref<KeyVal>&); 00206 00207 ~StreSimpleCo(); 00208 00210 <font class="keyword">const</font> <font class="keywordtype">char</font> * <a class="code" href="class_sc__IntCoor.html#a10">ctype</a>() <font class="keyword">const</font>; 00211 00213 <font class="keywordtype">double</font> bohr() <font class="keyword">const</font>; 00215 <font class="keywordtype">double</font> angstrom() <font class="keyword">const</font>; 00217 <font class="keywordtype">double</font> <a class="code" href="class_sc__IntCoor.html#a9">preferred_value</a>() <font class="keyword">const</font>; 00218 }; 00219 00220 <font class="keyword">typedef</font> StreSimpleCo Stre; 00221 00222 <font class="comment">// ///////////////////////////////////////////////////////////////////////</font> 00223 00224 <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">double</font> rtd = 180.0/3.14159265358979323846; 00225 <a name="l00239"></a><a class="code" href="class_sc__BendSimpleCo.html">00239</a> <font class="keyword">class </font>BendSimpleCo : <font class="keyword">public</font> SimpleCo { 00240 SimpleCo_DECLARE(BendSimpleCo) 00241 <font class="keyword">public</font>: 00242 BendSimpleCo(); 00243 BendSimpleCo(<font class="keyword">const</font> BendSimpleCo&); 00247 BendSimpleCo(<font class="keyword">const</font> <font class="keywordtype">char</font>*, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>); 00250 BendSimpleCo(<font class="keyword">const</font> Ref<KeyVal>&); 00251 00252 ~BendSimpleCo(); 00253 00255 <font class="keyword">const</font> <font class="keywordtype">char</font> * <a class="code" href="class_sc__IntCoor.html#a10">ctype</a>() <font class="keyword">const</font>; 00256 00258 <font class="keywordtype">double</font> radians() <font class="keyword">const</font>; 00260 <font class="keywordtype">double</font> degrees() <font class="keyword">const</font>; 00262 <font class="keywordtype">double</font> <a class="code" href="class_sc__IntCoor.html#a9">preferred_value</a>() <font class="keyword">const</font>; 00263 }; 00264 00265 <font class="keyword">typedef</font> BendSimpleCo Bend; 00266 00267 <font class="comment">// ///////////////////////////////////////////////////////////////////////</font> 00268 <a name="l00297"></a><a class="code" href="class_sc__TorsSimpleCo.html">00297</a> <font class="keyword">class </font>TorsSimpleCo : <font class="keyword">public</font> SimpleCo { 00298 SimpleCo_DECLARE(TorsSimpleCo) 00299 <font class="keyword">public</font>: 00300 TorsSimpleCo(); 00301 TorsSimpleCo(<font class="keyword">const</font> TorsSimpleCo&); 00305 TorsSimpleCo(<font class="keyword">const</font> <font class="keywordtype">char</font> *refr, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>); 00308 TorsSimpleCo(<font class="keyword">const</font> Ref<KeyVal>&); 00309 00310 ~TorsSimpleCo(); 00311 00313 <font class="keyword">const</font> <font class="keywordtype">char</font> * <a class="code" href="class_sc__IntCoor.html#a10">ctype</a>() <font class="keyword">const</font>; 00314 00316 <font class="keywordtype">double</font> radians() <font class="keyword">const</font>; 00318 <font class="keywordtype">double</font> degrees() <font class="keyword">const</font>; 00320 <font class="keywordtype">double</font> <a class="code" href="class_sc__IntCoor.html#a9">preferred_value</a>() <font class="keyword">const</font>; 00321 }; 00322 00323 <font class="keyword">typedef</font> TorsSimpleCo Tors; 00324 00325 <font class="comment">// ///////////////////////////////////////////////////////////////////////</font> 00326 <a name="l00358"></a><a class="code" href="class_sc__ScaledTorsSimpleCo.html">00358</a> <font class="keyword">class </font>ScaledTorsSimpleCo : <font class="keyword">public</font> SimpleCo { 00359 SimpleCo_DECLARE(ScaledTorsSimpleCo) 00360 <font class="keyword">private</font>: 00361 <font class="keywordtype">double</font> old_torsion_; 00362 <font class="keyword">public</font>: 00363 ScaledTorsSimpleCo(); 00364 ScaledTorsSimpleCo(<font class="keyword">const</font> ScaledTorsSimpleCo&); 00368 ScaledTorsSimpleCo(<font class="keyword">const</font> <font class="keywordtype">char</font> *refr, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>); 00371 ScaledTorsSimpleCo(<font class="keyword">const</font> Ref<KeyVal>&); 00372 00373 ~ScaledTorsSimpleCo(); 00374 00376 <font class="keyword">const</font> <font class="keywordtype">char</font> * <a class="code" href="class_sc__IntCoor.html#a10">ctype</a>() <font class="keyword">const</font>; 00377 00379 <font class="keywordtype">double</font> radians() <font class="keyword">const</font>; 00381 <font class="keywordtype">double</font> degrees() <font class="keyword">const</font>; 00383 <font class="keywordtype">double</font> <a class="code" href="class_sc__IntCoor.html#a9">preferred_value</a>() <font class="keyword">const</font>; 00384 }; 00385 00386 <font class="keyword">typedef</font> ScaledTorsSimpleCo ScaledTors; 00387 00388 <font class="comment">// ///////////////////////////////////////////////////////////////////////</font> 00389 00390 <font class="comment">/*</font> 00391 <font class="comment">The OutSimpleCo class describes an out-of-plane internal coordinate</font> 00392 <font class="comment">of a molecule. The input is described in the documentation of its parent</font> 00393 <font class="comment">class SimpleCo.</font> 00394 <font class="comment"></font> 00395 <font class="comment">Designating the four atoms as \f$a\f$, \f$b\f$, \f$c\f$, and \f$d\f$ and</font> 00396 <font class="comment">their cartesian positions as \f$\bar{r}_a\f$, \f$\bar{r}_b\f$,</font> 00397 <font class="comment">\f$\bar{r}_c\f$, and \f$\bar{r}_d\f$, the value of the coordinate,</font> 00398 <font class="comment">\f$\tau\f$, is given by</font> 00399 <font class="comment"></font> 00400 <font class="comment">\f[ \bar{u}_{ab} = \frac{\bar{r}_a - \bar{r}_b}{\| \bar{r}_a - \bar{r}_b \|}\f]</font> 00401 <font class="comment">\f[ \bar{u}_{cb} = \frac{\bar{r}_b - \bar{r}_c}{\| \bar{r}_c - \bar{r}_b \|}\f]</font> 00402 <font class="comment">\f[ \bar{u}_{db} = \frac{\bar{r}_c - \bar{r}_d}{\| \bar{r}_c - \bar{r}_b \|}\f]</font> 00403 <font class="comment">\f[ \bar{n}_{bcd}= \frac{\bar{u}_{cb} \times \bar{u}_{db}}</font> 00404 <font class="comment"> {\| \bar{u}_{cb} \times \bar{u}_{db} \|}\f]</font> 00405 <font class="comment">\f[ \phi = \arcsin ( \bar{u}_{ab} \cdot \bar{n}_{bcd} )\f]</font> 00406 <font class="comment"></font> 00407 <font class="comment">*/</font> 00408 <font class="keyword">class </font>OutSimpleCo : <font class="keyword">public</font> SimpleCo { 00409 SimpleCo_DECLARE(OutSimpleCo) 00410 <font class="keyword">public</font>: 00411 OutSimpleCo(); 00412 OutSimpleCo(<font class="keyword">const</font> OutSimpleCo&); 00417 OutSimpleCo(<font class="keyword">const</font> <font class="keywordtype">char</font> *refr, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>); 00420 OutSimpleCo(<font class="keyword">const</font> Ref<KeyVal>&); 00421 00422 ~OutSimpleCo(); 00423 00425 <font class="keyword">const</font> <font class="keywordtype">char</font> * ctype() <font class="keyword">const</font>; 00426 00428 <font class="keywordtype">double</font> radians() <font class="keyword">const</font>; 00430 <font class="keywordtype">double</font> degrees() <font class="keyword">const</font>; 00432 <font class="keywordtype">double</font> preferred_value() <font class="keyword">const</font>; 00433 }; 00434 00435 <font class="keyword">typedef</font> OutSimpleCo Out; 00436 00437 <font class="comment">// ///////////////////////////////////////////////////////////////////////</font> 00438 00460 <font class="keyword">class </font>LinIPSimpleCo : <font class="keyword">public</font> SimpleCo { 00461 SimpleCo_DECLARE(LinIPSimpleCo) 00462 <font class="keyword">private</font>: 00463 SCVector3 u2; 00464 <font class="keyword">public</font>: 00465 LinIPSimpleCo(); 00466 LinIPSimpleCo(<font class="keyword">const</font> LinIPSimpleCo&); 00472 LinIPSimpleCo(<font class="keyword">const</font> <font class="keywordtype">char</font> *refr, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keyword">const</font> SCVector3 &u); 00475 LinIPSimpleCo(<font class="keyword">const</font> Ref<KeyVal>&); 00476 00477 ~LinIPSimpleCo(); 00478 00480 <font class="keyword">const</font> <font class="keywordtype">char</font> * <a class="code" href="class_sc__IntCoor.html#a10">ctype</a>() <font class="keyword">const</font>; 00481 00483 <font class="keywordtype">double</font> radians() <font class="keyword">const</font>; 00485 <font class="keywordtype">double</font> degrees() <font class="keyword">const</font>; 00487 <font class="keywordtype">double</font> <a class="code" href="class_sc__IntCoor.html#a9">preferred_value</a>() <font class="keyword">const</font>; 00488 }; 00489 00490 <font class="keyword">typedef</font> LinIPSimpleCo LinIP; 00491 00492 <font class="comment">// ///////////////////////////////////////////////////////////////////////</font> 00493 00518 <font class="keyword">class </font>LinOPSimpleCo : <font class="keyword">public</font> SimpleCo { 00519 SimpleCo_DECLARE(LinOPSimpleCo) 00520 <font class="keyword">private</font>: 00521 SCVector3 u2; 00522 <font class="keyword">public</font>: 00523 LinOPSimpleCo(); 00524 LinOPSimpleCo(<font class="keyword">const</font> LinOPSimpleCo&); 00530 LinOPSimpleCo(<font class="keyword">const</font> <font class="keywordtype">char</font> *refr, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keywordtype">int</font>, <font class="keyword">const</font> SCVector3 &u); 00533 LinOPSimpleCo(<font class="keyword">const</font> Ref<KeyVal>&); 00534 00535 ~LinOPSimpleCo(); 00536 00538 <font class="keyword">const</font> <font class="keywordtype">char</font> * <a class="code" href="class_sc__IntCoor.html#a10">ctype</a>() <font class="keyword">const</font>; 00539 00541 <font class="keywordtype">double</font> radians() <font class="keyword">const</font>; 00543 <font class="keywordtype">double</font> degrees() <font class="keyword">const</font>; 00545 <font class="keywordtype">double</font> <a class="code" href="class_sc__IntCoor.html#a9">preferred_value</a>() <font class="keyword">const</font>; 00546 }; 00547 00548 <font class="keyword">typedef</font> LinOPSimpleCo LinOP; 00549 00550 } 00551 00552 <font class="preprocessor">#endif </font><font class="comment">/* _intco_simple_h */</font> 00553 00554 <font class="comment">// Local Variables:</font> 00555 <font class="comment">// mode: c++</font> 00556 <font class="comment">// c-file-style: "CLJ"</font> 00557 <font class="comment">// End:</font> </div></pre><hr> <address> <small> Generated at Mon Oct 14 14:16:38 2002 for <a href="http://aros.ca.sandia.gov/~cljanss/mpqc">MPQC</a> 2.1.2 using the documentation package <a href="http://www.stack.nl/~dimitri/doxygen/index.html">Doxygen</a> 1.2.5. </small> </address> </body> </html>