Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

simple.h

00001 
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 // ////////////////////////////////////////////////////////////////////////
00041 
00081 class SimpleCo : public IntCoor {
00082   protected:
00083     int natoms_;
00084     int *atoms;
00085 
00086   public:
00087     SimpleCo();
00092     SimpleCo(int,const char* =0);
00094     SimpleCo(const Ref<KeyVal>&,int natom);
00095 
00096     virtual ~SimpleCo();
00097 
00099     int natoms() const;
00101     int operator[](int i) const;
00102 
00103     void save_data_state(StateOut&);
00104     SimpleCo(StateIn&);
00105 
00106     virtual int operator==(SimpleCo&);
00107     int operator!=(SimpleCo&u);
00108 
00109     // these IntCoor members are implemented in term of
00110     // the calc_force_con and calc_intco members.
00112     double force_constant(Ref<Molecule>&);
00115     void update_value(const Ref<Molecule>&);
00117     void bmat(const Ref<Molecule>&,RefSCVector&bmat,double coef = 1.0);
00118 
00120     virtual double calc_force_con(Molecule&) = 0;
00125     virtual double calc_intco(Molecule&, double* =0, double =1) = 0;
00126 
00128     void print_details(const Ref<Molecule> &,
00129                        std::ostream& = ExEnv::out()) const;
00130     
00133     int equivalent(Ref<IntCoor>&);
00134   };
00135 
00136 
00137 
00138 // ///////////////////////////////////////////////////////////////////////
00139 
00140 #define SimpleCo_DECLARE(classname)                                           \
00141   public:                                                                     \
00142     virtual classname& operator=(const classname&);                           \
00143     SimpleCo& operator=(const SimpleCo&);                                     \
00144     double calc_force_con(Molecule&);                                         \
00145     double calc_intco(Molecule&, double* =0, double =1);                      \
00146     classname(StateIn&);                                                      \
00147     void save_data_state(StateOut&);                                          \
00148   private:
00149 
00150 #define SimpleCo_IMPL_eq(classname)                                           \
00151 SimpleCo& classname::operator=(const SimpleCo& c)                             \
00152 {                                                                             \
00153   classname *cp = dynamic_cast<classname*>((SimpleCo*)&c);                            \
00154   if(cp) {                                                                    \
00155       *this=*cp;                                                              \
00156     }                                                                         \
00157   else {                                                                      \
00158       natoms_ = 0;                                                            \
00159       atoms = 0;                                                              \
00160     }                                                                         \
00161                                                                               \
00162   return *this;                                                               \
00163   }
00164 
00165 #define SimpleCo_IMPL_StateIn(classname)                                      \
00166 classname::classname(StateIn&si):                                             \
00167   SimpleCo(si)                                                                \
00168 {                                                                             \
00169 }
00170 
00171 #define SimpleCo_IMPL_save_data_state(classname)                              \
00172 void classname::save_data_state(StateOut&so)                                  \
00173 {                                                                             \
00174   SimpleCo::save_data_state(so);                                              \
00175 }
00176 
00177 #define SimpleCo_IMPL(classname)                \
00178         SimpleCo_IMPL_eq(classname)             \
00179         SimpleCo_IMPL_StateIn(classname)        \
00180         SimpleCo_IMPL_save_data_state(classname)
00181 
00182 // ///////////////////////////////////////////////////////////////////////
00183 
00192 class StreSimpleCo : public SimpleCo {
00193 SimpleCo_DECLARE(StreSimpleCo)
00194   public:
00195     StreSimpleCo();
00196     StreSimpleCo(const StreSimpleCo&);
00200     StreSimpleCo(const char*, int, int);
00203     StreSimpleCo(const Ref<KeyVal>&);
00204 
00205     ~StreSimpleCo();
00206 
00208     const char * ctype() const;
00209 
00211     double bohr() const;
00213     double angstrom() const;
00215     double preferred_value() const;
00216   };
00217 
00218 typedef StreSimpleCo Stre;
00219 
00220 // ///////////////////////////////////////////////////////////////////////
00221 
00222 static const double rtd = 180.0/3.14159265358979323846;
00223 
00237 class BendSimpleCo : public SimpleCo { 
00238 SimpleCo_DECLARE(BendSimpleCo)
00239   public:
00240     BendSimpleCo();
00241     BendSimpleCo(const BendSimpleCo&);
00245     BendSimpleCo(const char*, int, int, int);
00248     BendSimpleCo(const Ref<KeyVal>&);
00249 
00250     ~BendSimpleCo();
00251 
00253     const char * ctype() const;
00254     
00256     double radians() const;
00258     double degrees() const;
00260     double preferred_value() const;
00261   };
00262 
00263 typedef BendSimpleCo Bend;
00264 
00265 // ///////////////////////////////////////////////////////////////////////
00266 
00295 class TorsSimpleCo : public SimpleCo { 
00296 SimpleCo_DECLARE(TorsSimpleCo)
00297   public:
00298     TorsSimpleCo();
00299     TorsSimpleCo(const TorsSimpleCo&);
00303     TorsSimpleCo(const char *refr, int, int, int, int);
00306     TorsSimpleCo(const Ref<KeyVal>&);
00307 
00308     ~TorsSimpleCo();
00309 
00311     const char * ctype() const;
00312     
00314     double radians() const;
00316     double degrees() const;
00318     double preferred_value() const;
00319   };
00320 
00321 typedef TorsSimpleCo Tors;
00322 
00323 // ///////////////////////////////////////////////////////////////////////
00324 
00356 class ScaledTorsSimpleCo : public SimpleCo { 
00357 SimpleCo_DECLARE(ScaledTorsSimpleCo)
00358   private:
00359     double old_torsion_;
00360   public:
00361     ScaledTorsSimpleCo();
00362     ScaledTorsSimpleCo(const ScaledTorsSimpleCo&);
00366     ScaledTorsSimpleCo(const char *refr, int, int, int, int);
00369     ScaledTorsSimpleCo(const Ref<KeyVal>&);
00370 
00371     ~ScaledTorsSimpleCo();
00372 
00374     const char * ctype() const;
00375     
00377     double radians() const;
00379     double degrees() const;
00381     double preferred_value() const;
00382   };
00383 
00384 typedef ScaledTorsSimpleCo ScaledTors;
00385 
00386 // ///////////////////////////////////////////////////////////////////////
00387 
00388 /*
00389 The OutSimpleCo class describes an out-of-plane internal coordinate
00390 of a molecule.  The input is described in the documentation of its parent
00391 class SimpleCo.
00392 
00393 Designating the four atoms as \f$a\f$, \f$b\f$, \f$c\f$, and \f$d\f$ and
00394 their cartesian positions as \f$\bar{r}_a\f$, \f$\bar{r}_b\f$,
00395 \f$\bar{r}_c\f$, and \f$\bar{r}_d\f$, the value of the coordinate,
00396 \f$\tau\f$, is given by
00397 
00398 \f[ \bar{u}_{ab} = \frac{\bar{r}_a - \bar{r}_b}{\| \bar{r}_a - \bar{r}_b \|}\f]
00399 \f[ \bar{u}_{cb} = \frac{\bar{r}_b - \bar{r}_c}{\| \bar{r}_c - \bar{r}_b \|}\f]
00400 \f[ \bar{u}_{db} = \frac{\bar{r}_c - \bar{r}_d}{\| \bar{r}_c - \bar{r}_b \|}\f]
00401 \f[ \bar{n}_{bcd}= \frac{\bar{u}_{cb} \times \bar{u}_{db}}
00402                      {\| \bar{u}_{cb} \times \bar{u}_{db} \|}\f]
00403 \f[ \phi         = \arcsin ( \bar{u}_{ab} \cdot \bar{n}_{bcd} )\f]
00404 
00405 */
00406 class OutSimpleCo : public SimpleCo { 
00407 SimpleCo_DECLARE(OutSimpleCo)
00408   public:
00409     OutSimpleCo();
00410     OutSimpleCo(const OutSimpleCo&);
00415     OutSimpleCo(const char *refr, int, int, int, int);
00418     OutSimpleCo(const Ref<KeyVal>&);
00419 
00420     ~OutSimpleCo();
00421 
00423     const char * ctype() const;
00424     
00426     double radians() const;
00428     double degrees() const;
00430     double preferred_value() const;
00431   };
00432 
00433 typedef OutSimpleCo Out;
00434 
00435 // ///////////////////////////////////////////////////////////////////////
00436 
00458 class LinIPSimpleCo : public SimpleCo { 
00459 SimpleCo_DECLARE(LinIPSimpleCo)
00460   private:
00461     SCVector3 u2;
00462   public:
00463     LinIPSimpleCo();
00464     LinIPSimpleCo(const LinIPSimpleCo&);
00470     LinIPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
00473     LinIPSimpleCo(const Ref<KeyVal>&);
00474 
00475     ~LinIPSimpleCo();
00476 
00478     const char * ctype() const;
00479 
00481     double radians() const;
00483     double degrees() const;
00485     double preferred_value() const;
00486   };
00487 
00488 typedef LinIPSimpleCo LinIP;
00489 
00490 // ///////////////////////////////////////////////////////////////////////
00491 
00516 class LinOPSimpleCo : public SimpleCo { 
00517 SimpleCo_DECLARE(LinOPSimpleCo)
00518   private:
00519     SCVector3 u2;
00520   public:
00521     LinOPSimpleCo();
00522     LinOPSimpleCo(const LinOPSimpleCo&);
00528     LinOPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
00531     LinOPSimpleCo(const Ref<KeyVal>&);
00532 
00533     ~LinOPSimpleCo();
00534 
00536     const char * ctype() const;
00537 
00539     double radians() const;
00541     double degrees() const;
00543     double preferred_value() const;
00544   };
00545 
00546 typedef LinOPSimpleCo LinOP;
00547 
00548 #endif /* _intco_simple_h */
00549 
00550 // Local Variables:
00551 // mode: c++
00552 // c-file-style: "CLJ"
00553 // End:

Generated at Thu Oct 4 18:08:47 2001 for MPQC 2.0.0 using the documentation package Doxygen 1.2.5.