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
40namespace sc {
41
42// ////////////////////////////////////////////////////////////////////////
43
83class 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
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.
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
131 std::ostream& = ExEnv::out0()) const;
132
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) \
152SimpleCo& 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) \
167classname::classname(StateIn&si): \
168 SimpleCo(si) \
169{ \
170}
171
172#define SimpleCo_IMPL_save_data_state(classname) \
173void 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
193class StreSimpleCo : public SimpleCo {
194 SimpleCo_DECLARE(StreSimpleCo);
195 public:
196 StreSimpleCo();
201 StreSimpleCo(const char*, int, int);
205
207
209 const char * ctype() const;
210
212 double bohr() const;
214 double angstrom() const;
216 double preferred_value() const;
217 };
218
219typedef StreSimpleCo Stre;
220
221// ///////////////////////////////////////////////////////////////////////
222
223static const double rtd = 180.0/M_PI;
224
238class BendSimpleCo : public SimpleCo {
239 SimpleCo_DECLARE(BendSimpleCo);
240 public:
241 BendSimpleCo();
246 BendSimpleCo(const char*, int, int, int);
250
252
254 const char * ctype() const;
255
257 double radians() const;
259 double degrees() const;
261 double preferred_value() const;
262 };
263
264typedef BendSimpleCo Bend;
265
266// ///////////////////////////////////////////////////////////////////////
267
296class TorsSimpleCo : public SimpleCo {
297 SimpleCo_DECLARE(TorsSimpleCo);
298 public:
299 TorsSimpleCo();
304 TorsSimpleCo(const char *refr, int, int, int, int);
308
310
312 const char * ctype() const;
313
315 double radians() const;
317 double degrees() const;
319 double preferred_value() const;
320 };
321
322typedef TorsSimpleCo Tors;
323
324// ///////////////////////////////////////////////////////////////////////
325
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/*
390The OutSimpleCo class describes an out-of-plane internal coordinate
391of a molecule. The input is described in the documentation of its parent
392class SimpleCo.
393
394Designating the four atoms as \f$a\f$, \f$b\f$, \f$c\f$, and \f$d\f$ and
395their 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*/
407class OutSimpleCo : public SimpleCo {
408 SimpleCo_DECLARE(OutSimpleCo);
409 public:
410 OutSimpleCo();
411 OutSimpleCo(const OutSimpleCo&);
416 OutSimpleCo(const char *refr, int, int, int, int);
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
434typedef OutSimpleCo Out;
435
436// ///////////////////////////////////////////////////////////////////////
437
459class LinIPSimpleCo : public SimpleCo {
460 SimpleCo_DECLARE(LinIPSimpleCo);
461 private:
462 SCVector3 u2;
463 public:
471 LinIPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
475
477
479 const char * ctype() const;
480
482 double radians() const;
484 double degrees() const;
486 double preferred_value() const;
487 };
488
489typedef LinIPSimpleCo LinIP;
490
491// ///////////////////////////////////////////////////////////////////////
492
517class LinOPSimpleCo : public SimpleCo {
518 SimpleCo_DECLARE(LinOPSimpleCo);
519 private:
520 SCVector3 u2;
521 public:
529 LinOPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
533
535
537 const char * ctype() const;
538
540 double radians() const;
542 double degrees() const;
544 double preferred_value() const;
545 };
546
547typedef LinOPSimpleCo LinOP;
548
549}
550
551#endif /* _intco_simple_h */
552
553// Local Variables:
554// mode: c++
555// c-file-style: "CLJ"
556// End:
The BendSimpleCo class describes an bend internal coordinate of a molecule.
Definition simple.h:238
const char * ctype() const
Always returns the string "BEND".
double preferred_value() const
Returns the value of the angle abc in degrees.
BendSimpleCo(const Ref< KeyVal > &)
The KeyVal constructor.
double degrees() const
Returns the value of the angle abc in degrees.
BendSimpleCo(const char *, int, int, int)
This constructor takes a string containing a label, and three integers a, b, and c which give the ind...
double radians() const
Returns the value of the angle abc in radians.
static std::ostream & out0()
Return an ostream that writes from node 0.
The IntCoor abstract class describes an internal coordinate of a molecule.
Definition coor.h:46
The LinIPSimpleCo class describes an in-plane component of a linear bend internal coordinate of a mol...
Definition simple.h:459
LinIPSimpleCo(const Ref< KeyVal > &)
The KeyVal constructor.
double radians() const
Returns the value of the angle abc in radians.
const char * ctype() const
Always returns the string "LINIP".
double degrees() const
Returns the value of the angle abc in degrees.
double preferred_value() const
Returns the value of the angle abc in degrees.
LinIPSimpleCo(const char *refr, int, int, int, const SCVector3 &u)
This constructor takes a string containing a label, and three integers a, b, and d which give the ind...
The LinOPSimpleCo class describes an out-of-plane component of a linear bend internal coordinate of a...
Definition simple.h:517
double degrees() const
Returns the value of the angle abc in degrees.
double preferred_value() const
Returns the value of the angle abc in degrees.
LinOPSimpleCo(const Ref< KeyVal > &)
The KeyVal constructor.
LinOPSimpleCo(const char *refr, int, int, int, const SCVector3 &u)
This constructor takes a string containing a label, and three integers a, b, and c which give the ind...
const char * ctype() const
Always returns the string "LINIP".
double radians() const
Returns the value of the angle abc in radians.
The Molecule class contains information about molecules.
Definition molecule.h:128
Definition simple.h:407
double degrees() const
Returns the value of the angle abc in degrees.
OutSimpleCo(const Ref< KeyVal > &)
The KeyVal constructor.
double radians() const
Returns the value of the angle abc in radians.
OutSimpleCo(const char *refr, int, int, int, int)
This constructor takes a string containing a label, and four integers a, b, c, and d which give the i...
double preferred_value() const
Returns the value of the angle abc in degrees.
const char * ctype() const
Always returns the string "OUT".
The RefSCVector class is a smart pointer to an SCVector specialization.
Definition matrix.h:55
A template class that maintains references counts.
Definition ref.h:332
Definition vector3.h:46
The ScaledTorsSimpleCo class describes an scaled torsion internal coordinate of a molecule.
Definition simple.h:357
double preferred_value() const
Returns the value of the angle abc in degrees.
double radians() const
Returns the value of the angle abc in radians.
const char * ctype() const
Always returns the string "TORS".
ScaledTorsSimpleCo(const char *refr, int, int, int, int)
This constructor takes a string containing a label, and four integers a, b, c, and d which give the i...
ScaledTorsSimpleCo(const Ref< KeyVal > &)
The KeyVal constructor.
double degrees() const
Returns the value of the angle abc in degrees.
The SimpleCo abstract class describes a simple internal coordinate of a molecule.
Definition simple.h:83
virtual double calc_intco(Molecule &, double *=0, double=1)=0
Calculate the value of the coordinate based on what's in Molecule.
double force_constant(Ref< Molecule > &)
Returns an approximate force constant (a la Almlof).
void update_value(const Ref< Molecule > &)
Recalculates the value of the coordinate based on the geometry in the Molecule.
SimpleCo(int, const char *=0)
This constructor takes an integer argument which is the number of atoms needed to describe the coordi...
void print_details(const Ref< Molecule > &, std::ostream &=ExEnv::out0()) const
Print the coordinate.
SimpleCo(const Ref< KeyVal > &, int natom)
The KeyVal constructor requires the number of atoms.
void bmat(const Ref< Molecule > &, RefSCVector &bmat, double coef=1.0)
Fill in a row of the B matrix.
virtual double calc_force_con(Molecule &)=0
Calculates an approximate force constant and returns it's value.
int natoms() const
Returns the number of atoms in the coordinate.
int operator[](int i) const
Returns the index of the i'th atom in the coordinate.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
int equivalent(Ref< IntCoor > &)
Tests to see if two coordinates are equivalent to each other.
Restores objects that derive from SavableState.
Definition statein.h:70
Serializes objects that derive from SavableState.
Definition stateout.h:61
The StreSimpleCo class describes an stretch internal coordinate of a molecule.
Definition simple.h:193
double bohr() const
Returns the distance between the two atoms in atomic units.
StreSimpleCo(const char *, int, int)
This constructor takes a string containing a label, and two integers which are the indices of the ato...
StreSimpleCo(const Ref< KeyVal > &)
The KeyVal constructor.
double angstrom() const
Returns the distance between the two atoms in angstrom units.
const char * ctype() const
Always returns the string "STRE".
double preferred_value() const
Returns the distance between the two atoms in angstrom units.
The TorsSimpleCo class describes an torsion internal coordinate of a molecule.
Definition simple.h:296
double preferred_value() const
Returns the value of the angle abc in degrees.
const char * ctype() const
Always returns the string "TORS".
double degrees() const
Returns the value of the angle abc in degrees.
TorsSimpleCo(const char *refr, int, int, int, int)
This constructor takes a string containing a label, and four integers a, b, c, and d which give the i...
double radians() const
Returns the value of the angle abc in radians.
TorsSimpleCo(const Ref< KeyVal > &)
The KeyVal constructor.

Generated at Wed Mar 13 2024 18:30:16 for MPQC 2.3.1 using the documentation package Doxygen 1.9.8.