00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00112
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
00124 virtual double calc_force_con(Molecule&) = 0;
00129 virtual double calc_intco(Molecule&, double* =0, double =1) = 0;
00130
00132 void print_details(const Ref<Molecule> &,
00133 std::ostream& = ExEnv::out0()) const;
00134
00137 int equivalent(Ref<IntCoor>&);
00138 };
00139
00140
00141
00142
00143
00144 #define SimpleCo_DECLARE(classname) \
00145 public: \
00146 virtual classname& operator=(const classname&); \
00147 SimpleCo& operator=(const SimpleCo&); \
00148 double calc_force_con(Molecule&); \
00149 double calc_intco(Molecule&, double* =0, double =1); \
00150 classname(StateIn&); \
00151 void save_data_state(StateOut&)
00152
00153 #define SimpleCo_IMPL_eq(classname) \
00154 SimpleCo& classname::operator=(const SimpleCo& c) \
00155 { \
00156 classname *cp = dynamic_cast<classname*>((SimpleCo*)&c); \
00157 if(cp) { \
00158 *this=*cp; \
00159 } \
00160 else { \
00161 natoms_ = 0; \
00162 atoms = 0; \
00163 } \
00164 \
00165 return *this; \
00166 }
00167
00168 #define SimpleCo_IMPL_StateIn(classname) \
00169 classname::classname(StateIn&si): \
00170 SimpleCo(si) \
00171 { \
00172 }
00173
00174 #define SimpleCo_IMPL_save_data_state(classname) \
00175 void classname::save_data_state(StateOut&so) \
00176 { \
00177 SimpleCo::save_data_state(so); \
00178 }
00179
00180 #define SimpleCo_IMPL(classname) \
00181 SimpleCo_IMPL_eq(classname) \
00182 SimpleCo_IMPL_StateIn(classname) \
00183 SimpleCo_IMPL_save_data_state(classname)
00184
00185
00186
00195 class StreSimpleCo : public SimpleCo {
00196 SimpleCo_DECLARE(StreSimpleCo);
00197 public:
00198 StreSimpleCo();
00199 StreSimpleCo(const StreSimpleCo&);
00203 StreSimpleCo(const char*, int, int);
00206 StreSimpleCo(const Ref<KeyVal>&);
00207
00208 ~StreSimpleCo();
00209
00211 const char * ctype() const;
00212
00214 double bohr() const;
00216 double angstrom() const;
00218 double preferred_value() const;
00219 };
00220
00221 typedef StreSimpleCo Stre;
00222
00223
00224
00225 static const double rtd = 180.0/M_PI;
00226
00240 class BendSimpleCo : public SimpleCo {
00241 SimpleCo_DECLARE(BendSimpleCo);
00242 public:
00243 BendSimpleCo();
00244 BendSimpleCo(const BendSimpleCo&);
00248 BendSimpleCo(const char*, int, int, int);
00251 BendSimpleCo(const Ref<KeyVal>&);
00252
00253 ~BendSimpleCo();
00254
00256 const char * ctype() const;
00257
00259 double radians() const;
00261 double degrees() const;
00263 double preferred_value() const;
00264 };
00265
00266 typedef BendSimpleCo Bend;
00267
00268
00269
00298 class TorsSimpleCo : public SimpleCo {
00299 SimpleCo_DECLARE(TorsSimpleCo);
00300 public:
00301 TorsSimpleCo();
00302 TorsSimpleCo(const TorsSimpleCo&);
00306 TorsSimpleCo(const char *refr, int, int, int, int);
00309 TorsSimpleCo(const Ref<KeyVal>&);
00310
00311 ~TorsSimpleCo();
00312
00314 const char * ctype() const;
00315
00317 double radians() const;
00319 double degrees() const;
00321 double preferred_value() const;
00322 };
00323
00324 typedef TorsSimpleCo Tors;
00325
00326
00327
00359 class ScaledTorsSimpleCo : public SimpleCo {
00360 SimpleCo_DECLARE(ScaledTorsSimpleCo);
00361 private:
00362 double old_torsion_;
00363 public:
00364 ScaledTorsSimpleCo();
00365 ScaledTorsSimpleCo(const ScaledTorsSimpleCo&);
00369 ScaledTorsSimpleCo(const char *refr, int, int, int, int);
00372 ScaledTorsSimpleCo(const Ref<KeyVal>&);
00373
00374 ~ScaledTorsSimpleCo();
00375
00377 const char * ctype() const;
00378
00380 double radians() const;
00382 double degrees() const;
00384 double preferred_value() const;
00385 };
00386
00387 typedef ScaledTorsSimpleCo ScaledTors;
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409 class OutSimpleCo : public SimpleCo {
00410 SimpleCo_DECLARE(OutSimpleCo);
00411 public:
00412 OutSimpleCo();
00413 OutSimpleCo(const OutSimpleCo&);
00418 OutSimpleCo(const char *refr, int, int, int, int);
00421 OutSimpleCo(const Ref<KeyVal>&);
00422
00423 ~OutSimpleCo();
00424
00426 const char * ctype() const;
00427
00429 double radians() const;
00431 double degrees() const;
00433 double preferred_value() const;
00434 };
00435
00436 typedef OutSimpleCo Out;
00437
00438
00439
00461 class LinIPSimpleCo : public SimpleCo {
00462 SimpleCo_DECLARE(LinIPSimpleCo);
00463 private:
00464 SCVector3 u2;
00465 public:
00466 LinIPSimpleCo();
00467 LinIPSimpleCo(const LinIPSimpleCo&);
00473 LinIPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
00476 LinIPSimpleCo(const Ref<KeyVal>&);
00477
00478 ~LinIPSimpleCo();
00479
00481 const char * ctype() const;
00482
00484 double radians() const;
00486 double degrees() const;
00488 double preferred_value() const;
00489 };
00490
00491 typedef LinIPSimpleCo LinIP;
00492
00493
00494
00519 class LinOPSimpleCo : public SimpleCo {
00520 SimpleCo_DECLARE(LinOPSimpleCo);
00521 private:
00522 SCVector3 u2;
00523 public:
00524 LinOPSimpleCo();
00525 LinOPSimpleCo(const LinOPSimpleCo&);
00531 LinOPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
00534 LinOPSimpleCo(const Ref<KeyVal>&);
00535
00536 ~LinOPSimpleCo();
00537
00539 const char * ctype() const;
00540
00542 double radians() const;
00544 double degrees() const;
00546 double preferred_value() const;
00547 };
00548
00549 typedef LinOPSimpleCo LinOP;
00550
00551 }
00552
00553 #endif
00554
00555
00556
00557
00558