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