| 1 |
#ifndef _SRI_H_ |
| 2 |
#define _SRI_H_ |
| 3 |
|
| 4 |
#include <iostream> |
| 5 |
|
| 6 |
#include "Atom.hpp" |
| 7 |
#include "AbstractClasses.hpp" |
| 8 |
|
| 9 |
// a little home-made vector structure |
| 10 |
|
| 11 |
struct vect{ |
| 12 |
double x; |
| 13 |
double y; |
| 14 |
double z; |
| 15 |
double length; |
| 16 |
}; |
| 17 |
|
| 18 |
/************************************************************************ |
| 19 |
* |
| 20 |
* This section describes the base bond, bend, and torsion |
| 21 |
* classes. later these classes will be extended to good/evil ends. |
| 22 |
* |
| 23 |
************************************************************************/ |
| 24 |
|
| 25 |
class Bond : public SRI{ |
| 26 |
|
| 27 |
public: |
| 28 |
Bond(); |
| 29 |
virtual ~Bond(); |
| 30 |
|
| 31 |
void calc_forces(); |
| 32 |
int is_constrained() {return c_is_constrained;} |
| 33 |
Constraint *get_constraint() {return c_constraint;} |
| 34 |
void constrain(double bond_distance); |
| 35 |
|
| 36 |
protected: |
| 37 |
virtual double bond_force(double r_ab) = 0; |
| 38 |
void set_atoms( Atom &, Atom & ); |
| 39 |
|
| 40 |
int c_is_constrained; |
| 41 |
Constraint *c_constraint; |
| 42 |
Atom * c_p_a; /* atom a */ |
| 43 |
Atom * c_p_b; /* atom b */ |
| 44 |
}; |
| 45 |
|
| 46 |
|
| 47 |
class Bend : public SRI{ |
| 48 |
|
| 49 |
public: |
| 50 |
Bend() {} |
| 51 |
virtual ~Bend() {} |
| 52 |
|
| 53 |
void calc_forces(); |
| 54 |
int is_constrained() {return 0;} |
| 55 |
Constraint *get_constraint() {return NULL;} |
| 56 |
void constrain(double bond_distance){} /*meaningless for bends */ |
| 57 |
|
| 58 |
protected: |
| 59 |
virtual double bend_force(double theta) = 0; |
| 60 |
void set_atoms( Atom &, Atom &, Atom & ); |
| 61 |
|
| 62 |
Atom * c_p_a; /* atom a */ |
| 63 |
Atom * c_p_b; /* atom b */ |
| 64 |
Atom * c_p_c; /* atom c */ |
| 65 |
}; |
| 66 |
|
| 67 |
class Torsion : public SRI{ |
| 68 |
|
| 69 |
public: |
| 70 |
Torsion() {} |
| 71 |
virtual ~Torsion() {} |
| 72 |
|
| 73 |
void calc_forces(); |
| 74 |
int is_constrained() {return 0;} |
| 75 |
Constraint *get_constraint() {return NULL;} |
| 76 |
void constrain(double bond_distance){} /*meaningless for torsions */ |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
protected: |
| 81 |
|
| 82 |
void set_atoms(Atom &, Atom &, Atom &, Atom &); |
| 83 |
virtual double torsion_force(double cos_phi) = 0; |
| 84 |
|
| 85 |
Atom * c_p_a; |
| 86 |
Atom * c_p_b; |
| 87 |
Atom * c_p_c; |
| 88 |
Atom * c_p_d; |
| 89 |
}; |
| 90 |
|
| 91 |
/********************************************************************** |
| 92 |
* |
| 93 |
* These next classes are extensions of the base classes. These are |
| 94 |
* the actual objects which will be used in the simulation. |
| 95 |
* |
| 96 |
**********************************************************************/ |
| 97 |
|
| 98 |
class ConstrainedBond : public Bond{ |
| 99 |
|
| 100 |
public: |
| 101 |
ConstrainedBond( Atom &a, Atom &b, double constraint ); |
| 102 |
~ConstrainedBond() {} |
| 103 |
|
| 104 |
void printMe( void ){ |
| 105 |
std::cerr << c_p_a->getType() << " - " << c_p_b->getType() |
| 106 |
<< ", d0 = " << d0 << "\n"; |
| 107 |
} |
| 108 |
|
| 109 |
private: |
| 110 |
double bond_force( double r_ab ){ return 0.0; } |
| 111 |
double d0; |
| 112 |
}; |
| 113 |
|
| 114 |
class QuadraticBend : public Bend{ |
| 115 |
|
| 116 |
public: |
| 117 |
QuadraticBend( Atom &a, Atom &b, Atom &c ); |
| 118 |
~QuadraticBend(){} |
| 119 |
|
| 120 |
void setConstants( double the_c1, double the_c2, double the_c3, |
| 121 |
double the_Th0 ); |
| 122 |
void printMe( void ){ |
| 123 |
std::cerr << c_p_a->getType() << " - " << c_p_b->getType() << " - " |
| 124 |
<< c_p_c->getType() << " : " |
| 125 |
<< c_p_a->getIndex() << " - " << c_p_b->getIndex() << " - " |
| 126 |
<< c_p_c->getIndex() |
| 127 |
<<", k1 = " << c1 << "; k2 = " << c2 |
| 128 |
<< "; k3 = " << c3 << "; theta0 =" << theta0 << "\n"; |
| 129 |
} |
| 130 |
|
| 131 |
private: |
| 132 |
double bend_force( double theta ); |
| 133 |
|
| 134 |
double c1, c2, c3; |
| 135 |
double theta0; |
| 136 |
}; |
| 137 |
|
| 138 |
class CubicTorsion : public Torsion{ |
| 139 |
|
| 140 |
public: |
| 141 |
CubicTorsion( Atom &a, Atom &b, Atom &c, Atom &d ); |
| 142 |
~CubicTorsion() {} |
| 143 |
|
| 144 |
void setConstants( double the_k1, double the_k2, double the_k3, |
| 145 |
double the_k4 ); |
| 146 |
void printMe( void ){ |
| 147 |
std::cerr << c_p_a->getType() << " - " << c_p_b->getType() << " - " |
| 148 |
<< c_p_c->getType() << " - " << c_p_d->getType() |
| 149 |
<< ", k1 = " << k1 << "; k2 = " << k2 |
| 150 |
<< "; k3 = " << k3 << "; k4 =" << k4 << "\n"; |
| 151 |
} |
| 152 |
|
| 153 |
private: |
| 154 |
|
| 155 |
double torsion_force( double cos_phi ); |
| 156 |
|
| 157 |
double k1, k2, k3, k4; |
| 158 |
}; |
| 159 |
|
| 160 |
#endif |