MPQC 2.3.1

- Main Page
- Related Pages
- Classes
- Files

- File List

simple.h
1
2 /* simple.h -- definition of the simple internal coordinate classes
3 *
4 * THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
5 * "UNITED STATES GOVERNMENT WORK". IT WAS WRITTEN AS A PART OF THE
6 * AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE. THIS MEANS IT
7 * CANNOT BE COPYRIGHTED. THIS SOFTWARE IS FREELY AVAILABLE TO THE
8 * PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
9 * RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
10 *
11 * Author:
12 * E. T. Seidl
13 * Bldg. 12A, Rm. 2033
14 * Computer Systems Laboratory
15 * Division of Computer Research and Technology
16 * National Institutes of Health
17 * Bethesda, Maryland 20892
18 * Internet: seidl@alw.nih.gov
19 * February, 1993
20 */
21
22 #ifndef _intco_simple_h
23 #define _intco_simple_h
24
25 #ifdef __GNUC__
26 #pragma interface
27 #endif
28
29
30 #include <iostream>
31
32 #include <util/class/class.h>
33 #include <util/state/state.h>
34 #include <util/keyval/keyval.h>
35 #include <chemistry/molecule/molecule.h>
36 #include <chemistry/molecule/coor.h>
37
38 #include <math/scmat/vector3.h>
39
40 namespace sc {
41
42 // ////////////////////////////////////////////////////////////////////////
43
83 class SimpleCo : public IntCoor {
84 protected:
85 int natoms_;
86 int *atoms;
87
88 public:
89 SimpleCo();
94 SimpleCo(int,const char* =0);
96 SimpleCo(const Ref<KeyVal>&,int natom);
97
98 virtual ~SimpleCo();
99
101 int natoms() const;
103 int operator[](int i) const;
104
105 void save_data_state(StateOut&);
106 SimpleCo(StateIn&);
107
108 virtual int operator==(SimpleCo&);
109 int operator!=(SimpleCo&u);
110
111 // these IntCoor members are implemented in term of
112 // the calc_force_con and calc_intco members.
114 double force_constant(Ref<Molecule>&);
117 void update_value(const Ref<Molecule>&);
119 void bmat(const Ref<Molecule>&,RefSCVector&bmat,double coef = 1.0);
120
122 virtual double calc_force_con(Molecule&) = 0;
127 virtual double calc_intco(Molecule&, double* =0, double =1) = 0;
128
130 void print_details(const Ref<Molecule> &,
131 std::ostream& = ExEnv::out0()) const;
132
135 int equivalent(Ref<IntCoor>&);
136 };
137
138
139
140 // ///////////////////////////////////////////////////////////////////////
141
142 #define SimpleCo_DECLARE(classname) \
143 public: \
144 virtual classname& operator=(const classname&); \
145 SimpleCo& operator=(const SimpleCo&); \
146 double calc_force_con(Molecule&); \
147 double calc_intco(Molecule&, double* =0, double =1); \
148 classname(StateIn&); \
149 void save_data_state(StateOut&)
150
151 #define SimpleCo_IMPL_eq(classname) \
152 SimpleCo& classname::operator=(const SimpleCo& c) \
153 { \
154 classname *cp = dynamic_cast<classname*>((SimpleCo*)&c); \
155 if(cp) { \
156 *this=*cp; \
157 } \
158 else { \
159 natoms_ = 0; \
160 atoms = 0; \
161 } \
162 \
163 return *this; \
164 }
165
166 #define SimpleCo_IMPL_StateIn(classname) \
167 classname::classname(StateIn&si): \
168 SimpleCo(si) \
169 { \
170 }
171
172 #define SimpleCo_IMPL_save_data_state(classname) \
173 void classname::save_data_state(StateOut&so) \
174 { \
175 SimpleCo::save_data_state(so); \
176 }
177
178 #define SimpleCo_IMPL(classname) \
179 SimpleCo_IMPL_eq(classname) \
180 SimpleCo_IMPL_StateIn(classname) \
181 SimpleCo_IMPL_save_data_state(classname)
182
183 // ///////////////////////////////////////////////////////////////////////
184
193 class StreSimpleCo : public SimpleCo {
194 SimpleCo_DECLARE(StreSimpleCo);
195 public:
196 StreSimpleCo();
197 StreSimpleCo(const StreSimpleCo&);
201 StreSimpleCo(const char*, int, int);
204 StreSimpleCo(const Ref<KeyVal>&);
205
206 ~StreSimpleCo();
207
209 const char * ctype() const;
210
212 double bohr() const;
214 double angstrom() const;
216 double preferred_value() const;
217 };
218
219 typedef StreSimpleCo Stre;
220
221 // ///////////////////////////////////////////////////////////////////////
222
223 static const double rtd = 180.0/M_PI;
224
238 class BendSimpleCo : public SimpleCo {
239 SimpleCo_DECLARE(BendSimpleCo);
240 public:
241 BendSimpleCo();
242 BendSimpleCo(const BendSimpleCo&);
246 BendSimpleCo(const char*, int, int, int);
249 BendSimpleCo(const Ref<KeyVal>&);
250
251 ~BendSimpleCo();
252
254 const char * ctype() const;
255
257 double radians() const;
259 double degrees() const;
261 double preferred_value() const;
262 };
263
264 typedef BendSimpleCo Bend;
265
266 // ///////////////////////////////////////////////////////////////////////
267
296 class TorsSimpleCo : public SimpleCo {
297 SimpleCo_DECLARE(TorsSimpleCo);
298 public:
299 TorsSimpleCo();
300 TorsSimpleCo(const TorsSimpleCo&);
304 TorsSimpleCo(const char *refr, int, int, int, int);
307 TorsSimpleCo(const Ref<KeyVal>&);
308
309 ~TorsSimpleCo();
310
312 const char * ctype() const;
313
315 double radians() const;
317 double degrees() const;
319 double preferred_value() const;
320 };
321
322 typedef TorsSimpleCo Tors;
323
324 // ///////////////////////////////////////////////////////////////////////
325
357 class ScaledTorsSimpleCo : public SimpleCo {
358 SimpleCo_DECLARE(ScaledTorsSimpleCo);
359 private:
360 double old_torsion_;
361 public:
362 ScaledTorsSimpleCo();
363 ScaledTorsSimpleCo(const ScaledTorsSimpleCo&);
367 ScaledTorsSimpleCo(const char *refr, int, int, int, int);
370 ScaledTorsSimpleCo(const Ref<KeyVal>&);
371
372 ~ScaledTorsSimpleCo();
373
375 const char * ctype() const;
376
378 double radians() const;
380 double degrees() const;
382 double preferred_value() const;
383 };
384
385 typedef ScaledTorsSimpleCo ScaledTors;
386
387 // ///////////////////////////////////////////////////////////////////////
388
389 /*
390 The OutSimpleCo class describes an out-of-plane internal coordinate
391 of a molecule. The input is described in the documentation of its parent
392 class SimpleCo.
393
394 Designating the four atoms as \f$a\f$, \f$b\f$, \f$c\f$, and \f$d\f$ and
395 their cartesian positions as \f$\bar{r}_a\f$, \f$\bar{r}_b\f$,
396 \f$\bar{r}_c\f$, and \f$\bar{r}_d\f$, the value of the coordinate,
397 \f$\tau\f$, is given by
398
399 \f[ \bar{u}_{ab} = \frac{\bar{r}_a - \bar{r}_b}{\| \bar{r}_a - \bar{r}_b \|}\f]
400 \f[ \bar{u}_{cb} = \frac{\bar{r}_b - \bar{r}_c}{\| \bar{r}_c - \bar{r}_b \|}\f]
401 \f[ \bar{u}_{db} = \frac{\bar{r}_c - \bar{r}_d}{\| \bar{r}_c - \bar{r}_b \|}\f]
402 \f[ \bar{n}_{bcd}= \frac{\bar{u}_{cb} \times \bar{u}_{db}}
403 {\| \bar{u}_{cb} \times \bar{u}_{db} \|}\f]
404 \f[ \phi = \arcsin ( \bar{u}_{ab} \cdot \bar{n}_{bcd} )\f]
405
406 */
407 class OutSimpleCo : public SimpleCo {
408 SimpleCo_DECLARE(OutSimpleCo);
409 public:
410 OutSimpleCo();
411 OutSimpleCo(const OutSimpleCo&);
416 OutSimpleCo(const char *refr, int, int, int, int);
419 OutSimpleCo(const Ref<KeyVal>&);
420
421 ~OutSimpleCo();
422
424 const char * ctype() const;
425
427 double radians() const;
429 double degrees() const;
431 double preferred_value() const;
432 };
433
434 typedef OutSimpleCo Out;
435
436 // ///////////////////////////////////////////////////////////////////////
437
459 class LinIPSimpleCo : public SimpleCo {
460 SimpleCo_DECLARE(LinIPSimpleCo);
461 private:
462 SCVector3 u2;
463 public:
464 LinIPSimpleCo();
465 LinIPSimpleCo(const LinIPSimpleCo&);
471 LinIPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
474 LinIPSimpleCo(const Ref<KeyVal>&);
475
476 ~LinIPSimpleCo();
477
479 const char * ctype() const;
480
482 double radians() const;
484 double degrees() const;
486 double preferred_value() const;
487 };
488
489 typedef LinIPSimpleCo LinIP;
490
491 // ///////////////////////////////////////////////////////////////////////
492
517 class LinOPSimpleCo : public SimpleCo {
518 SimpleCo_DECLARE(LinOPSimpleCo);
519 private:
520 SCVector3 u2;
521 public:
522 LinOPSimpleCo();
523 LinOPSimpleCo(const LinOPSimpleCo&);
529 LinOPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
532 LinOPSimpleCo(const Ref<KeyVal>&);
533
534 ~LinOPSimpleCo();
535
537 const char * ctype() const;
538
540 double radians() const;
542 double degrees() const;
544 double preferred_value() const;
545 };
546
547 typedef LinOPSimpleCo LinOP;
548
549 }
550
551 #endif /* _intco_simple_h */
552
553 // Local Variables:
554 // mode: c++
555 // c-file-style: "CLJ"
556 // End: