MPQC  3.0.0-alpha
simple.h
1 /* simple.h -- definition of the simple internal coordinate classes
2  *
3  * THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
4  * "UNITED STATES GOVERNMENT WORK". IT WAS WRITTEN AS A PART OF THE
5  * AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE. THIS MEANS IT
6  * CANNOT BE COPYRIGHTED. THIS SOFTWARE IS FREELY AVAILABLE TO THE
7  * PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
8  * RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
9  *
10  * Author:
11  * E. T. Seidl
12  * Bldg. 12A, Rm. 2033
13  * Computer Systems Laboratory
14  * Division of Computer Research and Technology
15  * National Institutes of Health
16  * Bethesda, Maryland 20892
17  * Internet: seidl@alw.nih.gov
18  * February, 1993
19  */
20 
21 #ifndef _intco_simple_h
22 #define _intco_simple_h
23 
24 
25 #include <iostream>
26 
27 #include <util/class/class.h>
28 #include <util/state/state.h>
29 #include <util/keyval/keyval.h>
30 #include <chemistry/molecule/molecule.h>
31 #include <chemistry/molecule/coor.h>
32 
33 #include <math/scmat/vector3.h>
34 
35 namespace sc {
36 
37 // ////////////////////////////////////////////////////////////////////////
38 
41 
81 class SimpleCo : public IntCoor {
82  protected:
83  int natoms_;
84  int *atoms;
85 
86  public:
87  SimpleCo();
92  SimpleCo(int,const char* =0);
94  SimpleCo(const Ref<KeyVal>&,int natom);
95 
96  virtual ~SimpleCo();
97 
99  int natoms() const;
101  int operator[](int i) const;
102 
103  void save_data_state(StateOut&);
104  SimpleCo(StateIn&);
105 
106  virtual int operator==(SimpleCo&);
107  int operator!=(SimpleCo&u);
108 
109  // these IntCoor members are implemented in term of
110  // the calc_force_con and calc_intco members.
112  double force_constant(Ref<Molecule>&);
115  void update_value(const Ref<Molecule>&);
117  void bmat(const Ref<Molecule>&,RefSCVector&bmat,double coef = 1.0);
118 
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 #define SimpleCo_DECLARE(classname) \
141  public: \
142  virtual classname& operator=(const classname&); \
143  SimpleCo& operator=(const SimpleCo&); \
144  double calc_force_con(Molecule&); \
145  double calc_intco(Molecule&, double* =0, double =1); \
146  classname(StateIn&); \
147  void save_data_state(StateOut&)
148 
149 #define SimpleCo_IMPL_eq(classname) \
150 SimpleCo& classname::operator=(const SimpleCo& c) \
151 { \
152  classname *cp = dynamic_cast<classname*>((SimpleCo*)&c); \
153  if(cp) { \
154  *this=*cp; \
155  } \
156  else { \
157  natoms_ = 0; \
158  atoms = 0; \
159  } \
160  \
161  return *this; \
162  }
163 
164 #define SimpleCo_IMPL_StateIn(classname) \
165 classname::classname(StateIn&si): \
166  SimpleCo(si) \
167 { \
168 }
169 
170 #define SimpleCo_IMPL_save_data_state(classname) \
171 void classname::save_data_state(StateOut&so) \
172 { \
173  SimpleCo::save_data_state(so); \
174 }
175 
176 #define SimpleCo_IMPL(classname) \
177  SimpleCo_IMPL_eq(classname) \
178  SimpleCo_IMPL_StateIn(classname) \
179  SimpleCo_IMPL_save_data_state(classname)
180 
181 // ///////////////////////////////////////////////////////////////////////
182 
191 class StreSimpleCo : public SimpleCo {
192  SimpleCo_DECLARE(StreSimpleCo);
193  public:
194  StreSimpleCo();
195  StreSimpleCo(const StreSimpleCo&);
199  StreSimpleCo(const char*, int, int);
202  StreSimpleCo(const Ref<KeyVal>&);
203 
204  ~StreSimpleCo();
205 
207  const char * ctype() const;
208 
210  double bohr() const;
212  double angstrom() const;
214  double preferred_value() const;
215  };
216 
217 typedef StreSimpleCo Stre;
218 
219 // ///////////////////////////////////////////////////////////////////////
220 
221 static const double rtd = 180.0/M_PI;
222 
236 class BendSimpleCo : public SimpleCo {
237  SimpleCo_DECLARE(BendSimpleCo);
238  public:
239  BendSimpleCo();
240  BendSimpleCo(const BendSimpleCo&);
244  BendSimpleCo(const char*, int, int, int);
247  BendSimpleCo(const Ref<KeyVal>&);
248 
249  ~BendSimpleCo();
250 
252  const char * ctype() const;
253 
255  double radians() const;
257  double degrees() const;
259  double preferred_value() const;
260  };
261 
262 typedef BendSimpleCo Bend;
263 
264 // ///////////////////////////////////////////////////////////////////////
265 
294 class TorsSimpleCo : public SimpleCo {
295  SimpleCo_DECLARE(TorsSimpleCo);
296  public:
297  TorsSimpleCo();
298  TorsSimpleCo(const TorsSimpleCo&);
302  TorsSimpleCo(const char *refr, int, int, int, int);
305  TorsSimpleCo(const Ref<KeyVal>&);
306 
307  ~TorsSimpleCo();
308 
310  const char * ctype() const;
311 
313  double radians() const;
315  double degrees() const;
317  double preferred_value() const;
318  };
319 
320 typedef TorsSimpleCo Tors;
321 
322 // ///////////////////////////////////////////////////////////////////////
323 
355 class ScaledTorsSimpleCo : public SimpleCo {
356  SimpleCo_DECLARE(ScaledTorsSimpleCo);
357  private:
358  double old_torsion_;
359  public:
365  ScaledTorsSimpleCo(const char *refr, int, int, int, int);
369 
371 
373  const char * ctype() const;
374 
376  double radians() const;
378  double degrees() const;
380  double preferred_value() const;
381  };
382 
384 
385 // ///////////////////////////////////////////////////////////////////////
386 
387 /*
388 The OutSimpleCo class describes an out-of-plane internal coordinate
389 of a molecule. The input is described in the documentation of its parent
390 class SimpleCo.
391 
392 Designating the four atoms as \f$a\f$, \f$b\f$, \f$c\f$, and \f$d\f$ and
393 their cartesian positions as \f$\bar{r}_a\f$, \f$\bar{r}_b\f$,
394 \f$\bar{r}_c\f$, and \f$\bar{r}_d\f$, the value of the coordinate,
395 \f$\tau\f$, is given by
396 
397 \f[ \bar{u}_{ab} = \frac{\bar{r}_a - \bar{r}_b}{\| \bar{r}_a - \bar{r}_b \|}\f]
398 \f[ \bar{u}_{cb} = \frac{\bar{r}_b - \bar{r}_c}{\| \bar{r}_c - \bar{r}_b \|}\f]
399 \f[ \bar{u}_{db} = \frac{\bar{r}_c - \bar{r}_d}{\| \bar{r}_c - \bar{r}_b \|}\f]
400 \f[ \bar{n}_{bcd}= \frac{\bar{u}_{cb} \times \bar{u}_{db}}
401  {\| \bar{u}_{cb} \times \bar{u}_{db} \|}\f]
402 \f[ \phi = \arcsin ( \bar{u}_{ab} \cdot \bar{n}_{bcd} )\f]
403 
404 */
405 class OutSimpleCo : public SimpleCo {
406  SimpleCo_DECLARE(OutSimpleCo);
407  public:
408  OutSimpleCo();
409  OutSimpleCo(const OutSimpleCo&);
414  OutSimpleCo(const char *refr, int, int, int, int);
417  OutSimpleCo(const Ref<KeyVal>&);
418 
419  ~OutSimpleCo();
420 
422  const char * ctype() const;
423 
425  double radians() const;
427  double degrees() const;
429  double preferred_value() const;
430  };
431 
432 typedef OutSimpleCo Out;
433 
434 // ///////////////////////////////////////////////////////////////////////
435 
457 class LinIPSimpleCo : public SimpleCo {
458  SimpleCo_DECLARE(LinIPSimpleCo);
459  private:
460  SCVector3 u2;
461  public:
462  LinIPSimpleCo();
469  LinIPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
472  LinIPSimpleCo(const Ref<KeyVal>&);
473 
474  ~LinIPSimpleCo();
475 
477  const char * ctype() const;
478 
480  double radians() const;
482  double degrees() const;
484  double preferred_value() const;
485  };
486 
487 typedef LinIPSimpleCo LinIP;
488 
489 // ///////////////////////////////////////////////////////////////////////
490 
515 class LinOPSimpleCo : public SimpleCo {
516  SimpleCo_DECLARE(LinOPSimpleCo);
517  private:
518  SCVector3 u2;
519  public:
520  LinOPSimpleCo();
527  LinOPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
530  LinOPSimpleCo(const Ref<KeyVal>&);
531 
532  ~LinOPSimpleCo();
533 
535  const char * ctype() const;
536 
538  double radians() const;
540  double degrees() const;
542  double preferred_value() const;
543  };
544 
545 typedef LinOPSimpleCo LinOP;
546 
548 // end of addtogroup ChemistryMolecule
549 
550 }
551 
552 #endif /* _intco_simple_h */
553 
554 // Local Variables:
555 // mode: c++
556 // c-file-style: "CLJ"
557 // 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:294
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:191
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:149
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:361
sc::ScaledTorsSimpleCo
The ScaledTorsSimpleCo class describes an scaled torsion internal coordinate of a molecule.
Definition: simple.h:355
sc::LinOPSimpleCo
The LinOPSimpleCo class describes an out-of-plane component of a linear bend internal coordinate of a...
Definition: simple.h:515
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
Definition: statein.h:79
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:405
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
Definition: stateout.h:71
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:81
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:457
sc::SCVector3
a 3-element version of SCVector
Definition: vector3.h:43
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:45
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:236
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
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
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:23:57 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.