MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
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
35namespace sc {
36
37// ////////////////////////////////////////////////////////////////////////
38
41
81class 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
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.
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
131 std::ostream& = ExEnv::out0()) const;
132
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) \
150SimpleCo& 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) \
165classname::classname(StateIn&si): \
166 SimpleCo(si) \
167{ \
168}
169
170#define SimpleCo_IMPL_save_data_state(classname) \
171void 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
191class StreSimpleCo : public SimpleCo {
192 SimpleCo_DECLARE(StreSimpleCo);
193 public:
194 StreSimpleCo();
199 StreSimpleCo(const char*, int, int);
203
205
207 const char * ctype() const;
208
210 double bohr() const;
212 double angstrom() const;
214 double preferred_value() const;
215 };
216
217typedef StreSimpleCo Stre;
218
219// ///////////////////////////////////////////////////////////////////////
220
221static const double rtd = 180.0/M_PI;
222
236class BendSimpleCo : public SimpleCo {
237 SimpleCo_DECLARE(BendSimpleCo);
238 public:
239 BendSimpleCo();
244 BendSimpleCo(const char*, int, int, int);
248
250
252 const char * ctype() const;
253
255 double radians() const;
257 double degrees() const;
259 double preferred_value() const;
260 };
261
262typedef BendSimpleCo Bend;
263
264// ///////////////////////////////////////////////////////////////////////
265
294class TorsSimpleCo : public SimpleCo {
295 SimpleCo_DECLARE(TorsSimpleCo);
296 public:
297 TorsSimpleCo();
302 TorsSimpleCo(const char *refr, int, int, int, int);
306
308
310 const char * ctype() const;
311
313 double radians() const;
315 double degrees() const;
317 double preferred_value() const;
318 };
319
320typedef TorsSimpleCo Tors;
321
322// ///////////////////////////////////////////////////////////////////////
323
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/*
388The OutSimpleCo class describes an out-of-plane internal coordinate
389of a molecule. The input is described in the documentation of its parent
390class SimpleCo.
391
392Designating the four atoms as \f$a\f$, \f$b\f$, \f$c\f$, and \f$d\f$ and
393their 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*/
405class OutSimpleCo : public SimpleCo {
406 SimpleCo_DECLARE(OutSimpleCo);
407 public:
408 OutSimpleCo();
409 OutSimpleCo(const OutSimpleCo&);
414 OutSimpleCo(const char *refr, int, int, int, int);
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
432typedef OutSimpleCo Out;
433
434// ///////////////////////////////////////////////////////////////////////
435
457class LinIPSimpleCo : public SimpleCo {
458 SimpleCo_DECLARE(LinIPSimpleCo);
459 private:
460 SCVector3 u2;
461 public:
469 LinIPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
473
475
477 const char * ctype() const;
478
480 double radians() const;
482 double degrees() const;
484 double preferred_value() const;
485 };
486
487typedef LinIPSimpleCo LinIP;
488
489// ///////////////////////////////////////////////////////////////////////
490
515class LinOPSimpleCo : public SimpleCo {
516 SimpleCo_DECLARE(LinOPSimpleCo);
517 private:
518 SCVector3 u2;
519 public:
527 LinOPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
531
533
535 const char * ctype() const;
536
538 double radians() const;
540 double degrees() const;
542 double preferred_value() const;
543 };
544
545typedef 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:
The BendSimpleCo class describes an bend internal coordinate of a molecule.
Definition simple.h:236
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:45
The LinIPSimpleCo class describes an in-plane component of a linear bend internal coordinate of a mol...
Definition simple.h:457
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:515
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:153
Definition simple.h:405
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:361
a 3-element version of SCVector
Definition vector3.h:44
The ScaledTorsSimpleCo class describes an scaled torsion internal coordinate of a molecule.
Definition simple.h:355
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:81
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 fundamental and user-defined types from images created with StateOut.
Definition statein.h:79
Serializes fundamental and user-defined types.
Definition stateout.h:71
The StreSimpleCo class describes an stretch internal coordinate of a molecule.
Definition simple.h:191
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:294
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.
Contains all MPQC code up to version 3.
Definition mpqcin.h:14

Generated at Wed Sep 25 2024 02:45:29 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.