1 |
mmeineke |
377 |
#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 |
|
|
virtual 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 |
mmeineke |
435 |
<< ": " << c_p_a->getIndex() << " - " |
107 |
|
|
<< c_p_b->getIndex() |
108 |
mmeineke |
377 |
<< ", d0 = " << d0 << "\n"; |
109 |
|
|
} |
110 |
|
|
|
111 |
|
|
private: |
112 |
|
|
double bond_force( double r_ab ){ return 0.0; } |
113 |
|
|
double d0; |
114 |
|
|
}; |
115 |
|
|
|
116 |
|
|
class QuadraticBend : public Bend{ |
117 |
|
|
|
118 |
|
|
public: |
119 |
|
|
QuadraticBend( Atom &a, Atom &b, Atom &c ); |
120 |
|
|
~QuadraticBend(){} |
121 |
|
|
|
122 |
|
|
void setConstants( double the_c1, double the_c2, double the_c3, |
123 |
|
|
double the_Th0 ); |
124 |
|
|
void printMe( void ){ |
125 |
|
|
std::cerr << c_p_a->getType() << " - " << c_p_b->getType() << " - " |
126 |
|
|
<< c_p_c->getType() << " : " |
127 |
|
|
<< c_p_a->getIndex() << " - " << c_p_b->getIndex() << " - " |
128 |
|
|
<< c_p_c->getIndex() |
129 |
|
|
<<", k1 = " << c1 << "; k2 = " << c2 |
130 |
|
|
<< "; k3 = " << c3 << "; theta0 =" << theta0 << "\n"; |
131 |
|
|
} |
132 |
|
|
|
133 |
|
|
private: |
134 |
|
|
double bend_force( double theta ); |
135 |
|
|
|
136 |
|
|
double c1, c2, c3; |
137 |
|
|
double theta0; |
138 |
|
|
}; |
139 |
|
|
|
140 |
|
|
class GhostBend : public Bend{ |
141 |
|
|
|
142 |
|
|
public: |
143 |
|
|
GhostBend( Atom &a, Atom &b ); |
144 |
|
|
~GhostBend(){} |
145 |
|
|
|
146 |
|
|
void calc_forces( void ); |
147 |
|
|
|
148 |
|
|
void setConstants( double the_c1, double the_c2, double the_c3, |
149 |
|
|
double the_Th0 ); |
150 |
|
|
void printMe( void ){ |
151 |
|
|
std::cerr << c_p_a->getType() << " - " << c_p_b->getType() |
152 |
|
|
<< " : " |
153 |
|
|
<< c_p_a->getIndex() << " - " << c_p_b->getIndex() << " - " |
154 |
|
|
<<", k1 = " << c1 << "; k2 = " << c2 |
155 |
|
|
<< "; k3 = " << c3 << "; theta0 =" << theta0 << "\n"; |
156 |
|
|
} |
157 |
|
|
|
158 |
|
|
private: |
159 |
|
|
double bend_force( double theta ); |
160 |
|
|
|
161 |
|
|
double c1, c2, c3; |
162 |
|
|
double theta0; |
163 |
|
|
|
164 |
|
|
DirectionalAtom* atomB; |
165 |
|
|
}; |
166 |
|
|
|
167 |
|
|
class CubicTorsion : public Torsion{ |
168 |
|
|
|
169 |
|
|
public: |
170 |
|
|
CubicTorsion( Atom &a, Atom &b, Atom &c, Atom &d ); |
171 |
|
|
~CubicTorsion() {} |
172 |
|
|
|
173 |
|
|
void setConstants( double the_k1, double the_k2, double the_k3, |
174 |
|
|
double the_k4 ); |
175 |
|
|
void printMe( void ){ |
176 |
|
|
std::cerr << c_p_a->getType() << " - " << c_p_b->getType() << " - " |
177 |
mmeineke |
435 |
<< c_p_c->getType() << " - " << c_p_d->getType() << ": " |
178 |
|
|
<< c_p_a->getIndex() << " - " << c_p_b->getIndex() << " - " |
179 |
|
|
<< c_p_c->getIndex() << " - " << c_p_d->getIndex() |
180 |
mmeineke |
377 |
<< ", k1 = " << k1 << "; k2 = " << k2 |
181 |
|
|
<< "; k3 = " << k3 << "; k4 =" << k4 << "\n"; |
182 |
|
|
} |
183 |
|
|
|
184 |
|
|
private: |
185 |
|
|
|
186 |
|
|
double torsion_force( double cos_phi ); |
187 |
|
|
|
188 |
|
|
double k1, k2, k3, k4; |
189 |
|
|
}; |
190 |
|
|
|
191 |
|
|
#endif |