ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/FAS/src/fasatom.cpp
Revision: 66
Committed: Tue Aug 13 16:02:26 2002 UTC (21 years, 10 months ago) by tim
File size: 4017 byte(s)
Log Message:
flexible atom selection

File Contents

# Content
1 #include <iostream>
2 #include <vector>
3 #include "fasatom.h"
4
5 using namespace std;
6
7 void TFASAtom::Clear()
8 {
9 _index = 0;
10 _atomicNum = 0;
11 _nameIndex = 0;
12 _typeIndex = 0;
13 _resid = 0;
14 _residIndex = 0;
15 _resnameIndex = 0;
16 _chainIndex = 0;
17 _segnameIndex = 0;
18 _atomProp = TAtomProp::apNormal;
19 _mass = 0;
20 _charge = 0;
21 _covRadius = 0;
22 _vdwRadius = 0;
23 _maxBonds = 0;
24 _pcharge = 0;
25 _hyb = 0;
26 _impval = 0;
27 _pseudo = false;
28 _residue = NULL;
29 _mol = NULL;
30 _model = NULL;
31 _bondList.clear();
32
33 }
34
35 TFASAtom::TFASAtom(int index)
36 {
37 Clear();
38 _index = index;
39 }
40
41 TFASAtom::~TFASAtom()
42 {
43
44 }
45
46 unsigned int TFASAtom::GetHvyValence()
47 {
48 unsigned int count;
49 vector<TFASBond *>::iterator i;
50 TFASAtom *atom;
51 count=0;
52
53 for(atom = BeginNbrAtom(i); atom != NULL; atom = NextNbrAtom(i))
54 if(!atom->IsHydrogen()) count++;
55
56 return count;
57 }
58
59 void TFASAtom::AddBond(TFASBond * bond)
60 {
61 if (bond==NULL)
62 {
63
64 }
65 else
66 {
67 _bondList.push_back(bond);
68 back(bond);
69 }
70 }
71
72 void TFASAtom::DeleteBond(TFASBond *bond)
73 {
74 vector<TFASBond *>::iterator i;
75 i = find(_bondList.begin(), _bondList.end(), bond);
76 if (i != _bondList.end())
77 {
78 _bondList.erase(i);
79 }
80 else
81 {
82
83 }
84 }
85
86 TFASBond * TFASAtom::GetBond(TFASAtom *nbrAtom)
87 {
88 TFASBond *bond;
89 vector<TFASBond *>::iterator i;
90 if(nbrAtom == NULL)
91 {
92
93 }
94 else
95 {
96
97 for(bond = BeginBond(i); bond != NULL; bond = NextBond(i))
98 {
99 if (bond->GetNbrAtom(this) == nbrAtom) return bond;
100 }
101 return NULL;
102 }
103 }
104
105 TFASBond * TFASAtom::BeginBond(vector<TFASBond *>::iterator &i)
106 {
107 i = _bondList.begin();
108 return (i == _bondList.end()) ? NULL : *i;
109 }
110
111 TFASBond * TFASAtom::NextBond(vector<TFASBond *>::iterator &i)
112 {
113 i++;
114 return (i == _bondList.end()) ? NULL : *i;
115 }
116
117 TFASAtom * TFASAtom::BeginNbrAtom(vector<TFASBond *>::iterator &i)
118 {
119 TFASBond * bond = BeginBond(i);
120
121 if(bond != NULL)
122 {
123 return bond->GetNbrAtom(this);
124 }
125 else
126 {
127
128 }
129 }
130
131 TFASAtom * TFASAtom::NextNbrAtom(vector<TFASBond *>::iterator &i)
132 {
133 TFASBond * bond = NextBond(i);
134
135 if(bond != NULL)
136 {
137 return bond->GetNbrAtom(this);
138 }
139 else
140 {
141
142 }
143 }
144
145 bool TFASAtom::IsConnected(TFASAtom *atom)
146 {
147 vector<TFASBond *>::iterator i;
148 TFASAtom *nbrAtom;
149
150 for(nbrAtom = BeginNbrAtom(i); nbrAtom != NULL; nbrAtom = NextNbrAtom(i))
151 {
152 if (atom == nbrAtom)
153 {
154 return true;
155 }
156 }
157
158 return false;
159 }
160
161 bool TFASAtom::IsOneThree(TFASAtom *atom)
162 {
163 TFASAtom *thisNbr;
164 TFASAtom *atomNbr;
165 vector<TFASBond *>::iterator i;
166 vector<TFASBond *>::iterator j;
167
168 for(thisNbr = this->BeginNbrAtom(i); thisNbr != NULL; thisNbr = this->NextNbrAtom(i))
169 for(atomNbr = atom->BeginNbrAtom(j); thisNbr != NULL; atomNbr = atom->NextNbrAtom(j))
170 if (atomNbr == thisNbr) return true;
171
172 return false;
173
174 }
175
176 bool TFASAtom::IsOneFour(TFASAtom *atom)
177 {
178 TFASAtom *thisNbr;
179 TFASAtom *atomNbr;
180 vector<TFASBond *>::iterator i;
181 vector<TFASBond *>::iterator j;
182
183 for(thisNbr = this->BeginNbrAtom(i); thisNbr != NULL; thisNbr = this->NextNbrAtom(i))
184 for(atomNbr = atom->BeginNbrAtom(j); atomNbr != NULL; atomNbr = atom->NextNbrAtom(j))
185 if (thisNbr->IsConnected(atomNbr)) return true;
186
187 return false;
188
189 }
190
191 bool TFASAtom::IsCarboxylOxygen()
192 {
193 if (!IsOxygen()) return false;
194 if (GetHvyValence() != 1) return false;
195
196 TFASAtom *atom;
197 vector<TFASBond *>::iterator i;
198
199 for(atom=BeginNbrAtom(i); atom != NULL; atom = NextNbrAtom(i))
200 if (atom->IsCarbon()) break;
201
202 if (atom == NULL) return false;
203
204
205 }
206
207 bool TFASAtom::IsPhosphateOxygen()
208 {
209
210 }
211
212 bool TFASAtom::IsSulfateOxygen()
213 {
214
215 }
216
217 bool TFASAtom::IsNitroOxygen()
218 {
219
220 }
221
222 bool TFASAtom::IsAmideNitrogen()
223 {
224
225 }
226
227 bool TFASAtom::IsPolarHydrogen()
228 {
229
230 }
231
232 bool TFASAtom::IsNonPolarHydrogen()
233 {
234
235 }
236
237 bool TFASAtom::IsInRing()
238 {
239
240 }
241
242 bool TFASAtom::IsInRingSize(int ringSize)
243 {
244
245 }
246
247 bool TFASAtom::IsAromatic()
248 {
249
250 }
251
252 bool TFASAtom::IsAromaticNOxide()
253 {
254
255 }
256
257 bool TFASAtom::IsChiral()
258 {
259
260 }
261
262 bool TFASAtom::IsAxial()
263 {
264
265 }
266
267 bool TFASAtom::HasAlphaBetaUnsat(bool includePandS=true)
268 {
269
270 }
271
272 bool TFASAtom::HasBondOfOrder(int order)
273 {
274
275 }
276
277 int TFASAtom::CountBondsOfOrder(int order)
278 {
279
280 }
281