ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-1.0/libmdtools/SRI.hpp
Revision: 1334
Committed: Fri Jul 16 18:58:03 2004 UTC (19 years, 11 months ago) by gezelter
File size: 4911 byte(s)
Log Message:
Initial import of OOPSE-1.0 source tree

File Contents

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