ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/SRI.hpp
Revision: 707
Committed: Wed Aug 20 19:42:31 2003 UTC (20 years, 10 months ago) by mmeineke
File size: 4880 byte(s)
Log Message:
updated the Changelog.

added some bug fixes for setting the random number generator seed value.

fixed a bug where ghostbend atom b was not being set. ( recent bug from SimState conversion)

File Contents

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