simple.h
/* simple.h -- definition of the simple internal coordinate classes
*
* THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
* "UNITED STATES GOVERNMENT WORK". IT WAS WRITTEN AS A PART OF THE
* AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE. THIS MEANS IT
* CANNOT BE COPYRIGHTED. THIS SOFTWARE IS FREELY AVAILABLE TO THE
* PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
* RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
*
* Author:
* E. T. Seidl
* Bldg. 12A, Rm. 2033
* Computer Systems Laboratory
* Division of Computer Research and Technology
* National Institutes of Health
* Bethesda, Maryland 20892
* Internet: seidl@alw.nih.gov
* February, 1993
*/
#ifndef _intco_simple_h
#define _intco_simple_h
#ifdef __GNUC__
#pragma interface
#endif
#include <iostream>
#include <util/class/class.h>
#include <util/state/state.h>
#include <util/keyval/keyval.h>
#include <chemistry/molecule/molecule.h>
#include <chemistry/molecule/coor.h>
#include <math/scmat/vector3.h>
namespace sc {
// ////////////////////////////////////////////////////////////////////////
class SimpleCo : public IntCoor {
protected:
int natoms_;
int *atoms;
public:
SimpleCo();
SimpleCo(int,const char* =0);
SimpleCo(const Ref<KeyVal>&,int natom);
virtual ~SimpleCo();
int natoms() const;
int operator[](int i) const;
void save_data_state(StateOut&);
SimpleCo(StateIn&);
virtual int operator==(SimpleCo&);
int operator!=(SimpleCo&u);
// these IntCoor members are implemented in term of
// the calc_force_con and calc_intco members.
double force_constant(Ref<Molecule>&);
void update_value(const Ref<Molecule>&);
void bmat(const Ref<Molecule>&,RefSCVector&bmat,double coef = 1.0);
virtual double calc_force_con(Molecule&) = 0;
virtual double calc_intco(Molecule&, double* =0, double =1) = 0;
void print_details(const Ref<Molecule> &,
std::ostream& = ExEnv::out0()) const;
int equivalent(Ref<IntCoor>&);
};
// ///////////////////////////////////////////////////////////////////////
#define SimpleCo_DECLARE(classname) \
public: \
virtual classname& operator=(const classname&); \
SimpleCo& operator=(const SimpleCo&); \
double calc_force_con(Molecule&); \
double calc_intco(Molecule&, double* =0, double =1); \
classname(StateIn&); \
void save_data_state(StateOut&)
#define SimpleCo_IMPL_eq(classname) \
SimpleCo& classname::operator=(const SimpleCo& c) \
{ \
classname *cp = dynamic_cast<classname*>((SimpleCo*)&c); \
if(cp) { \
*this=*cp; \
} \
else { \
natoms_ = 0; \
atoms = 0; \
} \
\
return *this; \
}
#define SimpleCo_IMPL_StateIn(classname) \
classname::classname(StateIn&si): \
SimpleCo(si) \
{ \
}
#define SimpleCo_IMPL_save_data_state(classname) \
void classname::save_data_state(StateOut&so) \
{ \
SimpleCo::save_data_state(so); \
}
#define SimpleCo_IMPL(classname) \
SimpleCo_IMPL_eq(classname) \
SimpleCo_IMPL_StateIn(classname) \
SimpleCo_IMPL_save_data_state(classname)
// ///////////////////////////////////////////////////////////////////////
class StreSimpleCo : public SimpleCo {
SimpleCo_DECLARE(StreSimpleCo);
public:
StreSimpleCo();
StreSimpleCo(const StreSimpleCo&);
StreSimpleCo(const char*, int, int);
StreSimpleCo(const Ref<KeyVal>&);
~StreSimpleCo();
const char * ctype() const;
double bohr() const;
double angstrom() const;
double preferred_value() const;
};
typedef StreSimpleCo Stre;
// ///////////////////////////////////////////////////////////////////////
static const double rtd = 180.0/M_PI;
class BendSimpleCo : public SimpleCo {
SimpleCo_DECLARE(BendSimpleCo);
public:
BendSimpleCo();
BendSimpleCo(const BendSimpleCo&);
BendSimpleCo(const char*, int, int, int);
BendSimpleCo(const Ref<KeyVal>&);
~BendSimpleCo();
const char * ctype() const;
double radians() const;
double degrees() const;
double preferred_value() const;
};
typedef BendSimpleCo Bend;
// ///////////////////////////////////////////////////////////////////////
class TorsSimpleCo : public SimpleCo {
SimpleCo_DECLARE(TorsSimpleCo);
public:
TorsSimpleCo();
TorsSimpleCo(const TorsSimpleCo&);
TorsSimpleCo(const char *refr, int, int, int, int);
TorsSimpleCo(const Ref<KeyVal>&);
~TorsSimpleCo();
const char * ctype() const;
double radians() const;
double degrees() const;
double preferred_value() const;
};
typedef TorsSimpleCo Tors;
// ///////////////////////////////////////////////////////////////////////
class ScaledTorsSimpleCo : public SimpleCo {
SimpleCo_DECLARE(ScaledTorsSimpleCo);
private:
double old_torsion_;
public:
ScaledTorsSimpleCo();
ScaledTorsSimpleCo(const ScaledTorsSimpleCo&);
ScaledTorsSimpleCo(const char *refr, int, int, int, int);
ScaledTorsSimpleCo(const Ref<KeyVal>&);
~ScaledTorsSimpleCo();
const char * ctype() const;
double radians() const;
double degrees() const;
double preferred_value() const;
};
typedef ScaledTorsSimpleCo ScaledTors;
// ///////////////////////////////////////////////////////////////////////
/*
The OutSimpleCo class describes an out-of-plane internal coordinate
of a molecule. The input is described in the documentation of its parent
class SimpleCo.
Designating the four atoms as \f$a\f$, \f$b\f$, \f$c\f$, and \f$d\f$ and
their cartesian positions as \f$\bar{r}_a\f$, \f$\bar{r}_b\f$,
\f$\bar{r}_c\f$, and \f$\bar{r}_d\f$, the value of the coordinate,
\f$\tau\f$, is given by
\f[ \bar{u}_{ab} = \frac{\bar{r}_a - \bar{r}_b}{\| \bar{r}_a - \bar{r}_b \|}\f]
\f[ \bar{u}_{cb} = \frac{\bar{r}_b - \bar{r}_c}{\| \bar{r}_c - \bar{r}_b \|}\f]
\f[ \bar{u}_{db} = \frac{\bar{r}_c - \bar{r}_d}{\| \bar{r}_c - \bar{r}_b \|}\f]
\f[ \bar{n}_{bcd}= \frac{\bar{u}_{cb} \times \bar{u}_{db}}
{\| \bar{u}_{cb} \times \bar{u}_{db} \|}\f]
\f[ \phi = \arcsin ( \bar{u}_{ab} \cdot \bar{n}_{bcd} )\f]
*/
class OutSimpleCo : public SimpleCo {
SimpleCo_DECLARE(OutSimpleCo);
public:
OutSimpleCo();
OutSimpleCo(const OutSimpleCo&);
OutSimpleCo(const char *refr, int, int, int, int);
OutSimpleCo(const Ref<KeyVal>&);
~OutSimpleCo();
const char * ctype() const;
double radians() const;
double degrees() const;
double preferred_value() const;
};
typedef OutSimpleCo Out;
// ///////////////////////////////////////////////////////////////////////
class LinIPSimpleCo : public SimpleCo {
SimpleCo_DECLARE(LinIPSimpleCo);
private:
SCVector3 u2;
public:
LinIPSimpleCo();
LinIPSimpleCo(const LinIPSimpleCo&);
LinIPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
LinIPSimpleCo(const Ref<KeyVal>&);
~LinIPSimpleCo();
const char * ctype() const;
double radians() const;
double degrees() const;
double preferred_value() const;
};
typedef LinIPSimpleCo LinIP;
// ///////////////////////////////////////////////////////////////////////
class LinOPSimpleCo : public SimpleCo {
SimpleCo_DECLARE(LinOPSimpleCo);
private:
SCVector3 u2;
public:
LinOPSimpleCo();
LinOPSimpleCo(const LinOPSimpleCo&);
LinOPSimpleCo(const char *refr, int, int, int, const SCVector3 &u);
LinOPSimpleCo(const Ref<KeyVal>&);
~LinOPSimpleCo();
const char * ctype() const;
double radians() const;
double degrees() const;
double preferred_value() const;
};
typedef LinOPSimpleCo LinOP;
}
#endif /* _intco_simple_h */
// Local Variables:
// mode: c++
// c-file-style: "CLJ"
// End: