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