MPQC  2.3.1
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:
367  ScaledTorsSimpleCo(const char *refr, int, int, int, int);
371 
373 
375  const char * ctype() const;
376 
378  double radians() const;
380  double degrees() const;
382  double preferred_value() const;
383  };
384 
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();
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();
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:
sc::LinIPSimpleCo::preferred_value
double preferred_value() const
Returns the value of the angle abc in degrees.
sc::LinIPSimpleCo::degrees
double degrees() const
Returns the value of the angle abc in degrees.
sc::ScaledTorsSimpleCo::radians
double radians() const
Returns the value of the angle abc in radians.
sc::TorsSimpleCo
The TorsSimpleCo class describes an torsion internal coordinate of a molecule.
Definition: simple.h:296
sc::SimpleCo::bmat
void bmat(const Ref< Molecule > &, RefSCVector &bmat, double coef=1.0)
Fill in a row of the B matrix.
sc::OutSimpleCo::radians
double radians() const
Returns the value of the angle abc in radians.
sc::ScaledTorsSimpleCo::preferred_value
double preferred_value() const
Returns the value of the angle abc in degrees.
sc::StreSimpleCo
The StreSimpleCo class describes an stretch internal coordinate of a molecule.
Definition: simple.h:193
sc::TorsSimpleCo::radians
double radians() const
Returns the value of the angle abc in radians.
sc::ScaledTorsSimpleCo::ctype
const char * ctype() const
Always returns the string "TORS".
sc::Molecule
The Molecule class contains information about molecules.
Definition: molecule.h:127
sc::BendSimpleCo::ctype
const char * ctype() const
Always returns the string "BEND".
sc::BendSimpleCo::preferred_value
double preferred_value() const
Returns the value of the angle abc in degrees.
sc::LinOPSimpleCo::preferred_value
double preferred_value() const
Returns the value of the angle abc in degrees.
sc::LinOPSimpleCo::ctype
const char * ctype() const
Always returns the string "LINIP".
sc::Ref
A template class that maintains references counts.
Definition: ref.h:332
sc::ScaledTorsSimpleCo
The ScaledTorsSimpleCo class describes an scaled torsion internal coordinate of a molecule.
Definition: simple.h:357
sc::LinOPSimpleCo
The LinOPSimpleCo class describes an out-of-plane component of a linear bend internal coordinate of a...
Definition: simple.h:517
sc::OutSimpleCo::preferred_value
double preferred_value() const
Returns the value of the angle abc in degrees.
sc::StreSimpleCo::ctype
const char * ctype() const
Always returns the string "STRE".
sc::LinOPSimpleCo::radians
double radians() const
Returns the value of the angle abc in radians.
sc::SimpleCo::operator[]
int operator[](int i) const
Returns the index of the i'th atom in the coordinate.
sc::BendSimpleCo::radians
double radians() const
Returns the value of the angle abc in radians.
sc::StreSimpleCo::angstrom
double angstrom() const
Returns the distance between the two atoms in angstrom units.
sc::BendSimpleCo::degrees
double degrees() const
Returns the value of the angle abc in degrees.
sc::StateIn
Restores objects that derive from SavableState.
Definition: statein.h:70
sc::SimpleCo::update_value
void update_value(const Ref< Molecule > &)
Recalculates the value of the coordinate based on the geometry in the Molecule.
sc::OutSimpleCo
Definition: simple.h:407
sc::ScaledTorsSimpleCo::degrees
double degrees() const
Returns the value of the angle abc in degrees.
sc::LinIPSimpleCo::ctype
const char * ctype() const
Always returns the string "LINIP".
sc::OutSimpleCo::degrees
double degrees() const
Returns the value of the angle abc in degrees.
sc::TorsSimpleCo::ctype
const char * ctype() const
Always returns the string "TORS".
sc::TorsSimpleCo::preferred_value
double preferred_value() const
Returns the value of the angle abc in degrees.
sc::SimpleCo::print_details
void print_details(const Ref< Molecule > &, std::ostream &=ExEnv::out0()) const
Print the coordinate.
sc::RefSCVector
The RefSCVector class is a smart pointer to an SCVector specialization.
Definition: matrix.h:55
sc::StateOut
Serializes objects that derive from SavableState.
Definition: stateout.h:61
sc::LinOPSimpleCo::degrees
double degrees() const
Returns the value of the angle abc in degrees.
sc::SimpleCo::equivalent
int equivalent(Ref< IntCoor > &)
Tests to see if two coordinates are equivalent to each other.
sc::SimpleCo
The SimpleCo abstract class describes a simple internal coordinate of a molecule.
Definition: simple.h:83
sc::StreSimpleCo::bohr
double bohr() const
Returns the distance between the two atoms in atomic units.
sc::LinIPSimpleCo
The LinIPSimpleCo class describes an in-plane component of a linear bend internal coordinate of a mol...
Definition: simple.h:459
sc::SCVector3
Definition: vector3.h:45
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc::StreSimpleCo::preferred_value
double preferred_value() const
Returns the distance between the two atoms in angstrom units.
sc::IntCoor
The IntCoor abstract class describes an internal coordinate of a molecule.
Definition: coor.h:46
sc::SimpleCo::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::BendSimpleCo
The BendSimpleCo class describes an bend internal coordinate of a molecule.
Definition: simple.h:238
sc::SimpleCo::calc_intco
virtual double calc_intco(Molecule &, double *=0, double=1)=0
Calculate the value of the coordinate based on what's in Molecule.
sc::SimpleCo::calc_force_con
virtual double calc_force_con(Molecule &)=0
Calculates an approximate force constant and returns it's value.
sc::OutSimpleCo::ctype
const char * ctype() const
Always returns the string "OUT".
sc::LinIPSimpleCo::radians
double radians() const
Returns the value of the angle abc in radians.
sc::SimpleCo::force_constant
double force_constant(Ref< Molecule > &)
Returns an approximate force constant (a la Almlof).
sc::SimpleCo::natoms
int natoms() const
Returns the number of atoms in the coordinate.
sc::TorsSimpleCo::degrees
double degrees() const
Returns the value of the angle abc in degrees.

Generated at Sun Jan 26 2020 23:33:04 for MPQC 2.3.1 using the documentation package Doxygen 1.8.16.