00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ATOM_H
00029 #define ATOM_H
00030
00031 #include <map>
00032 #include <string>
00033 #include <iostream>
00034 #include <sstream>
00035 #include <queue>
00036
00037 #include <vector>
00038
00039 #include <node.h>
00040 #include <bond.h>
00041 #include <ring.h>
00042
00043 using namespace std;
00044
00085 class Atom : public Node {
00086
00087 friend class Elements;
00088 friend class Bond;
00089 friend class Molecule;
00090
00095 public :
00096
00098
00099
00102 Atom();
00103
00106 Atom( const Atom& anAtom );
00107
00110 Atom( string aLabel );
00111
00114 ~Atom();
00115
00118 Atom& operator=( const Atom& anAtom );
00119
00122 Bond* addBond( Bond *aBond ) throw ( CError );
00123
00125
00127
00128
00131 int getId() const { return( id ); }
00132
00135 string getIdString();
00136
00139 int getIdInMolecule() const { return( idInMolecule ); }
00140
00143 void setIdInMolecule( int anId );
00144
00147 int getType() const { return( type ); }
00148
00152 string getName(){ return( getStringDescriptor( "name" )->getValue() ); }
00153
00157 string getSymbol(){ return( getStringDescriptor( "Symbol" )->getValue() ); }
00158
00163 string getElementSymbol(){ return( getStringDescriptor( "ElementSymbol" )->getValue() ); }
00164
00167 void setElementSymbol( string anElement );
00168
00171 int getAN() const { return ( an ); }
00172
00175 bool isGeneric(){ return genericAtomType; }
00176
00181 bool isCSkeleton();
00182
00185 bool hasCoordinates();
00186
00189 float getX(){ return( x ); }
00190
00193 float getY(){ return( y ); }
00194
00197 float getZ(){ return( z ); }
00198
00201 void setCoordinates( float aX, float aY, float aZ );
00202
00205 int numBonds(){ return ( bonds.size() ); }
00206
00209 int numHiddenBonds(){ return ( hiddenBonds.size() ); }
00210
00213 int getNumAromaticBonds();
00214
00217 int degree(){ return ( bonds.size() ); }
00218
00221 bool wasVisited(){ return visited;}
00222
00225 void setVisited(){ visited = true;}
00226
00229 void unsetVisited(){ visited = false;}
00230
00233 int getMorganIndex( int order );
00234
00238 int getUniqueMorganIndex( bool silentError = false ) throw( CError );
00239
00242 void setMorganLabel(string aLabel);
00243
00247 void setMorganLabel( int anOrder );
00248
00251 string getMorganLabel( bool silentError = false ) throw( CError );
00252
00256 void setPerretLabel() throw( CError );
00257
00261 string getPerretLabel( bool silentError = false ) throw( CError );
00262
00265 void addRing( Ring* aRing ){ if( !hasRing( aRing ) ){ rings.push_back( aRing ); } }
00266
00269 bool hasRing( Ring* aRing );
00270
00273 bool hasRing(){ if( numRings() > 0 ){ return( true ); }else{ return( false );};}
00274
00277 int numRings(){ return( rings.size() ); }
00278
00282 double getKashimaPT( Atom* anAtom );
00283
00286 vector<Atom*>* getBFSVector(){ return( &BFSVector ); }
00287
00290 vector<Bond*>* getBFSBondVector(){ return( &BFSBondVector ); }
00291
00294 int getBFSVectorSize(){ return( BFSVector.size() ); }
00295
00298 void resetBFSVector(){ BFSVector.clear(); BFSBondVector.clear(); }
00299
00300
00301
00303
00304
00306
00307
00309 void eraseCoordinates();
00310
00313 void hideBond( map< Atom*, Bond* >::iterator aBondI );
00314
00317 void hideBond( Bond* aBond );
00318
00321 Bond* hideBond( Atom* aTarget );
00322
00325 int hideHydrogenBonds();
00326
00329 void hideAllToFromBonds();
00330
00334 Bond* hideToFromBonds( Atom* aTarget );
00335
00339 Bond* hideToFromFirstBond();
00340
00343 int restoreHiddenBonds();
00344
00347 void restoreHiddenBond( Bond* aBond ) throw( CError );
00348
00351 void restoreHiddenBond( Atom* aTarget ) throw( CError );
00352
00355 void deleteBonds();
00356
00359 void deleteHiddenBonds();
00360
00363 bool bondExists( Bond* aBond );
00364
00367 long bondSum();
00368
00371 void unsetBondFlags();
00372
00375 void unsetBondFlagsOriginal();
00376
00380 void setUniqueMorganIndex( int anOrder );
00381
00384 int getSumOfNeighboorMorganIndex( int anOrder );
00385
00388 void resetMorganIndex();
00389
00392 void setPartialCharge(double aValue);
00393
00397 void setMorganChargeLabel(double threshold);
00398
00399
00402 Bond* getBondWithTarget( Atom* otherAtom ) throw( CError );
00403
00407 Atom* nextUnvisitedAtom() throw( CError );
00408
00413 Ring* getRingBFS( vector<Atom*>* toVisit, vector<Bond*>* toVisitBond ) throw( CError );
00414
00417 void pushBFSVector( vector<Atom*>* aPath, vector<Bond*>* aBondPath );
00419
00420
00422
00423
00426 map<Atom*, Bond*>& getBonds(){ return( bonds ); }
00429 map<Atom*, Bond*>::iterator beginBond(){ return( bonds.begin() ); }
00432 map<Atom*, Bond*>::iterator endBond(){ return( bonds.end() ); }
00433
00436 vector<Ring*>::iterator beginRing(){ return( rings.begin() ); }
00437
00440 vector<Ring*>::iterator endRing(){ return( rings.end() ); }
00441
00444 map<Atom*, Bond*>::iterator getBondIteratorWithTarget( Atom* otherAtom );
00445
00446
00447
00449
00450
00452
00453
00455 string toString();
00456
00459 string toStringShort();
00460
00461
00462
00465 void describe() throw( CError );
00466
00469 void describeShort();
00470
00473 string toStringBFSVector();
00474
00476
00477
00478
00481 friend ostream& operator<<(ostream& os, const Atom& anAtom);
00482
00485 static void getVectorIntersect( vector<Atom*>* v1, vector<Atom*>* v2, vector<Atom*>* result);
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00502
00505
00506
00509
00512
00513
00514
00515
00519
00523
00524
00525
00526
00527
00528 private :
00531 int id;
00532
00535 int idInMolecule;
00536
00540 int type;
00541
00546 int an;
00547
00548
00551 float x;
00552
00555 float y;
00556
00559 float z;
00560
00563 bool flagHasCoordinates;
00564
00567 static int counter;
00568
00571 map<Atom*, Bond*> bonds;
00572
00575 map<Atom*, Bond*> hiddenBonds;
00576
00580
00581
00582
00586 vector<Ring*> rings;
00587
00588
00591 bool visited;
00592
00595 bool genericAtomType;
00596
00597
00598 protected :
00599
00602 void setAN( int a ) { an = a; }
00603
00606 static void resetCounter() { counter = 0; }
00607
00610 void setType( int aType ) { type = aType; }
00611
00614
00615
00618
00619
00622
00623
00626 map< int, int > morganIndex;
00627
00630 string morganLabel;
00631
00634 string perretLabel;
00635
00639 int uniqueMorganIndex;
00640
00641
00645 vector<Atom*> BFSVector;
00646
00650 vector<Bond*> BFSBondVector;
00651
00654 double partialCharge;
00655
00656
00657 };
00658
00659
00660
00661 #endif