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 |
virtual 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 GhostBend : public Bend{ |
139 |
|
140 |
public: |
141 |
GhostBend( Atom &a, Atom &b ); |
142 |
~GhostBend(){} |
143 |
|
144 |
void calc_forces( void ); |
145 |
|
146 |
void setConstants( double the_c1, double the_c2, double the_c3, |
147 |
double the_Th0 ); |
148 |
void printMe( void ){ |
149 |
std::cerr << c_p_a->getType() << " - " << c_p_b->getType() |
150 |
<< " : " |
151 |
<< c_p_a->getIndex() << " - " << c_p_b->getIndex() << " - " |
152 |
<<", k1 = " << c1 << "; k2 = " << c2 |
153 |
<< "; k3 = " << c3 << "; theta0 =" << theta0 << "\n"; |
154 |
} |
155 |
|
156 |
private: |
157 |
double bend_force( double theta ); |
158 |
|
159 |
double c1, c2, c3; |
160 |
double theta0; |
161 |
|
162 |
DirectionalAtom* atomB; |
163 |
}; |
164 |
|
165 |
class CubicTorsion : public Torsion{ |
166 |
|
167 |
public: |
168 |
CubicTorsion( Atom &a, Atom &b, Atom &c, Atom &d ); |
169 |
~CubicTorsion() {} |
170 |
|
171 |
void setConstants( double the_k1, double the_k2, double the_k3, |
172 |
double the_k4 ); |
173 |
void printMe( void ){ |
174 |
std::cerr << c_p_a->getType() << " - " << c_p_b->getType() << " - " |
175 |
<< c_p_c->getType() << " - " << c_p_d->getType() |
176 |
<< ", k1 = " << k1 << "; k2 = " << k2 |
177 |
<< "; k3 = " << k3 << "; k4 =" << k4 << "\n"; |
178 |
} |
179 |
|
180 |
private: |
181 |
|
182 |
double torsion_force( double cos_phi ); |
183 |
|
184 |
double k1, k2, k3, k4; |
185 |
}; |
186 |
|
187 |
#endif |