ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/FAS/src/fasatom.h
Revision: 77
Committed: Wed Aug 14 23:27:28 2002 UTC (21 years, 10 months ago) by tim
Content type: text/plain
File size: 8144 byte(s)
Log Message:
*** empty log message ***

File Contents

# Content
1 /**********************************************************************
2 * Copyright (C) 2002-2003 by Gezelter's Group
3 *This program is free software; you can redistribute it and/or modify
4 *it under the terms of the GNU General Public License as published by
5 *the Free Software Foundation version 2 of the License.
6 *
7 *This program is distributed in the hope that it will be useful,
8 *but WITHOUT ANY WARRANTY; without even the implied warranty of
9 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 *GNU General Public License for more details.
11 *
12 ************************************************************************
13 *Author: Teng Lin Email: tlin@nd.edu
14 *Date: 08/13/2002 Version: 1.0
15 *
16 ************************************************************************
17 *Description:
18 *
19 ***********************************************************************/
20 #ifndef FASATOM_H
21 #define FASATOM_H
22 #include <iostream>
23 #include <vector>
24 #include "fasbond.h"
25 using namespace std;
26
27 class TFASModel;
28 class TFASBond;
29 class TFASResidue;
30 class TFASMolecule;
31
32 //ATOM Property Macros
33 #define FAS_NORMAL_ATOM (1<<1)
34 #define FAS_PROTEINBACK_ATOM (1<<2)
35 #define FAS_NUCLEIC_ATOM (1<<3)
36 #define FAS_AROMATIC_ATOM (1<<4)
37 #define FAS_RING_ATOM (1<<5)
38 #define FAS_CSTEREO_ATOM (1<<6)
39 #define FAS_ACSTEREO_ATOM (1<<7)
40 #define FAS_DONOR_ATOM (1<<8)
41 #define FAS_ACCEPTOR_ATOM (1<<9)
42 #define FAS_CHIRAL_ATOM (1<<10)
43
44 namespace TAtomProp
45 {
46 const int apNormal = FAS_NORMAL_ATOM;
47 const int apProtein = FAS_PROTEINBACK_ATOM;
48 const int apNucleic = FAS_NUCLEIC_ATOM;
49 const int apAromatic = FAS_AROMATIC_ATOM;
50 const int apRing = FAS_RING_ATOM;
51 const int apCStereo = FAS_CSTEREO_ATOM;
52 const int apACStereo = FAS_ACSTEREO_ATOM;
53 const int apDonor = FAS_DONOR_ATOM;
54 const int apAcceptor = FAS_ACCEPTOR_ATOM;
55 const int apChiral = FAS_CHIRAL_ATOM;
56 };
57
58 class TFASAtom
59 {
60 protected:
61 unsigned int _index;
62 unsigned int _atomicNum;
63 unsigned int _nameIndex;
64 unsigned int _typeIndex;
65 unsigned int _resid;
66 unsigned int _residIndex;
67 unsigned int _resnameIndex;
68 unsigned int _chainIndex;
69 unsigned int _segnameIndex;
70 int _atomProp;
71
72 //actually we can put these properties on an element table, but we may want to change them sometime, who
73 //knows, anyway it is a trade off between space and speed
74 float _mass;
75 float _charge;
76 float _covRadius;
77 float _bondRadius;
78 float _vdwRadius;
79 float _maxBonds;
80 float _pcharge;
81 unsigned int _hyb;
82 unsigned int _impval;
83
84 TFASResidue *_residue;
85 TFASMolecule *_mol;
86 TFASModel * _model;
87 vector<TFASBond *> _bondList;
88 bool _pseudo;
89
90 void SetAtomProp(int atomProp) { _atomProp |= atomProp;}
91 void Clear();
92 public:
93 TFASAtom(int index);
94 ~TFASAtom();
95
96 //methods to set atomic information
97 void SetIndex(unsigned int index) { _index = index;}
98 void SetAtomicNum(unsigned int atomicNum) { _atomicNum = atomicNum;}
99 void SetNameIndex(unsigned int nameIndex) { _nameIndex = nameIndex;}
100 void SetTypeIndex(unsigned int typeIndex) { _typeIndex = typeIndex;}
101 void SetResid(unsigned int resid) { _resid=resid;}
102 void SetResidIndex(unsigned int residIndex) { _residIndex = residIndex;}
103 void SetResnameIndex(unsigned int resnameIndex) { _resnameIndex = resnameIndex;}
104 void SetChainIndex(unsigned int chainIndex) { _chainIndex = chainIndex;}
105 void SetSegnameIndex(unsigned int segnameIndex) { _segnameIndex = segnameIndex;}
106 void SetResidue(TFASResidue *residue) { _residue = residue;}
107 void SetMolecule(TFASMolecule *mol) { _mol = mol;}
108 void SetModel(TFASModel *model) { _model = model;}
109 void SetPseudo(bool pseudo) { _pseudo = pseudo;}
110 void SetMass(float mass) { _mass = mass;}
111 void SetCharge(float charge) { _charge = charge;}
112 void SetPartialCharge(float pcharge) { _pcharge = pcharge;}
113 void SetCovalentRadius(float covRadius) { _covRadius = covRadius;}
114 void SetBondRadius(float bondRadius) { _bondRadius = bondRadius;}
115 void SetVdwRadius(float vdwRadius) { _vdwRadius = vdwRadius;}
116 void SetMaxBonds(float maxBonds) { _maxBonds=maxBonds;}
117 void SetHyb(unsigned int hyb) { _hyb = hyb;}
118 void SetImplicitValence (unsigned int impval) { _impval = impval;}
119
120 //methods to get atomic information
121 unsigned int GetIndex() { return _index;}
122 unsigned int GetAtomicNum() { return _atomicNum;}
123 unsigned int GetNameIndex() { return _nameIndex;}
124 unsigned int GetTypeIndex() { return _typeIndex;}
125 unsigned int GetResid() { return _resid;}
126 unsigned int GetResidIndex() { return _residIndex;}
127 unsigned int GetResnameIndex() { return _resnameIndex;}
128 unsigned int GetChainIndex() { return _chainIndex;}
129 unsigned int GetSegnameIndex() { return _segnameIndex;}
130
131 TFASResidue *GetResidue() { return _residue;}
132 TFASMolecule *GetMolecule() { return _mol;}
133 TFASModel *GetModel() { return _model;}
134 bool IsPseudo() { return _pseudo;}
135
136 float GetMass() { return _mass;}
137 float GetCharge() { return _charge;}
138 float GetPartialCharge() { return _pcharge;}
139 float GetCovalentRadius() { return _covRadius;}
140 float GetBondRadius() { return _bondRadius;}
141 float GetVdwRadius() { return _vdwRadius;}
142 float GetMaxBonds() { return _maxBonds;}
143 unsigned int GetHyb() { return _hyb;}
144 unsigned int GetImplicitValence() { return _impval;}
145 unsigned int GetHvyValence();
146 unsigned int GetValence() {return (unsigned int)_bondList.size();}
147
148 //meothds to manipulate bond
149 void AddBond(TFASBond * bond);
150 void DeleteBond(TFASBond *bond);
151 TFASBond *BeginBond(vector<TFASBond *>::iterator &i);
152 TFASBond *NextBond(vector<TFASBond *>::iterator &i);
153 TFASBond *GetBond(TFASAtom *nbrAtom);
154 //methods to traverse neighbor atoms
155 TFASAtom *BeginNbrAtom(vector<TFASBond *>::iterator &i);
156 TFASAtom *NextNbrAtom(vector<TFASBond *>::iterator &i);
157
158 //
159
160 int GetAtomProp() { return _atomProp;}
161 bool HasAtomProp(int atomProp) { return _atomProp & atomProp;}
162 void SetAromatic() { SetAtomProp(TAtomProp::apAromatic);}
163 void UnSetAromatic() { _atomProp &= ~TAtomProp::apAromatic;}
164
165 void SetClockwiseStereo()
166 {
167 _atomProp &= ~TAtomProp::apACStereo;
168 SetAtomProp(TAtomProp::apCStereo|TAtomProp::apChiral);
169 }
170
171 void SetAntiClockwiseStereo()
172 {
173 _atomProp &= ~TAtomProp::apCStereo;
174 SetAtomProp(TAtomProp::apACStereo|TAtomProp::apChiral);
175 }
176
177 void UnSetStereo()
178 {
179 _atomProp &= ~TAtomProp::apCStereo;
180 _atomProp &= ~TAtomProp::apACStereo;
181 _atomProp &= ~TAtomProp::apChiral;
182 }
183
184 void SetNormal()
185 {
186 _atomProp &= ~TAtomProp::apProtein;
187 _atomProp &= ~TAtomProp::apNucleic;
188 }
189
190 void SetProtein()
191 {
192 _atomProp &= ~TAtomProp::apNormal;
193 _atomProp &= ~TAtomProp::apNucleic;
194
195 }
196
197 void SetNucleic()
198 {
199 _atomProp &= ~TAtomProp::apNormal;
200 _atomProp &= ~TAtomProp::apProtein;
201
202 }
203
204 bool HasResidue() { return(_residue != NULL);}
205 bool IsHydrogen() { return(_atomicNum == 1);}
206 bool IsCarbon() { return(_atomicNum == 6);}
207 bool IsNitrogen() { return(_atomicNum == 7);}
208 bool IsOxygen() { return(_atomicNum == 8);}
209 bool IsSulfur() { return(_atomicNum == 16);}
210 bool IsPhosphorus() { return(_atomicNum == 15);}
211 bool IsConnected(TFASAtom *atom);
212 bool IsOneThree(TFASAtom *atom);
213 bool IsOneFour(TFASAtom *atom);
214 bool IsCarboxylOxygen();
215 bool IsPhosphateOxygen();
216 bool IsSulfateOxygen();
217 bool IsNitroOxygen();
218 bool IsAmideNitrogen();
219 bool IsPolarHydrogen();
220 bool IsNonPolarHydrogen();
221 bool IsInRing();
222 bool IsInRingSize(int ringSize);
223 bool IsAromatic();
224 bool IsAromaticNOxide();
225 bool IsChiral();
226 bool IsAxial();
227 bool IsClockwise() { return HasAtomProp(TAtomProp::apCStereo);}
228 bool IsAntiClockwise() { return HasAtomProp(TAtomProp::apACStereo);}
229 bool HasChiralitySpecified() { return IsClockwise()|IsAntiClockwise(); }
230 bool HasAlphaBetaUnsat(bool includePandS=true);
231 bool HasBondOfOrder(int order);
232 int CountBondsOfOrder(int order);
233 bool HasSingleBond() { return(HasBondOfOrder(1)); }
234 bool HasDoubleBond() { return(HasBondOfOrder(2)); }
235 bool HasAromaticBond() { return(HasBondOfOrder(4)); }
236 };
237 #endif