MTK++ Latest version: 0.2.0

ring.h
Go to the documentation of this file.
00001 
00033 #ifndef RING_h
00034 #define RING_h
00035 
00036 #include <iostream>
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 #include <algorithm>
00041 #include <cmath>
00042 
00043 // #include "Utils/diagonalize.h"
00044 #include <Eigen/Dense>
00045 using namespace Eigen;
00046 
00047 namespace MTKpp
00048 {
00049 
00050 class molecule;
00051 class atom;
00052 class Bond;
00053 class vector3d;
00054 
00055 // ============================================================
00056 // Struct : ring
00057 // ------------------------------------------------------------
00064 // ============================================================
00065 struct ring
00066 {
00068     int index;
00069 
00071     std::vector<atom*> atoms;
00072 
00074     int size;
00075 
00081     int planar;
00082 
00088     int aromatic;
00089 
00095     int hetero;
00096 
00098     int nHetero;
00099 
00101     int nNitrogen;
00102 
00104     int nOxygen;
00105 
00107     int nSulfur;
00108 
00110     std::vector<atom*> connPts;
00111 
00113     //ublas::vector<double> centroid;
00114     Eigen::VectorXd centroid;
00115 
00117 
00118     //ublas::matrix<double, ublas::column_major> planeNormal;
00119     Eigen::MatrixXd planeNormal;
00120 
00121 };
00122 
00123 // ============================================================
00124 // Class : rings()
00125 // ------------------------------------------------------------
00274 // ============================================================
00275 class rings
00276 {
00277 public:
00282     rings(molecule *parent = 0);
00283 
00285     virtual ~rings();
00286 
00288     void determine();
00289 
00294     void kekulize(ring* r);
00295 
00300     int getPlaneNormal(ring* r);
00301 
00306     void calcCentroid(ring* r);
00307 
00308 protected: // functions
00309 
00311     void removeHydrogenAtoms();
00312 
00314     void removeHydrogenBonds();
00315 
00317     void removeOpenAcyclic();
00318 
00320     void removeOpenAcyclicBonds();
00321 
00323     void findNeighbors();
00324 
00330     void findNeighbors(std::vector<atom*> a, std::vector< std::vector<int> > &b);
00331 
00339     void getBonds(std::vector<atom*> a, std::vector<Bond*> b, std::vector<Bond*> &c, std::vector<int> &d);
00340 
00342     void removeClosedAcyclic();
00343 
00349     int pickRootAtom(std::vector<atom*> a);
00350 
00354     void separateBlocks();
00355 
00359     void findSSSR();
00360 
00361     void decomposeBlock(std::vector<atom*> block);
00362     void getIrreducibleClosedPath(std::vector<atom*> block, int root, std::vector<atom*>& path);
00363     int numberRingsInBlock(std::vector<atom*> block);
00364     void getNewPath(std::vector<atom*> &path, std::vector<atom*> curPath, bool &done);
00365     void eliminateReducibleAtoms(std::vector<atom*> block, std::vector<atom*> path);
00366     void checkPath(std::vector<atom*> &path, bool &ok);
00367 
00384     void dfs_visit(int curAtom, int rootAtom,
00385 //                   std::vector<atom*> vertexes, std::vector<Bond*> edges,
00386 //                   std::vector< std::vector<int> > neighbours,
00387                    std::vector<atom*> &vertexes, std::vector<Bond*> edges,
00388                    std::vector< std::vector<int> > &neighbours,
00389                    std::vector<int> &vertexesColor, std::vector<int> &edgesColor,
00390                    bool &loop,int &t,
00391                    std::vector<atom*> &curPath,
00392                    std::vector< std::vector<atom*> > &paths);
00393 
00394     void dfs_visitNEW(int curAtom, int rootAtom, bool first, bool &loop,
00395 //                      std::vector<atom*> vertexes, std::vector<Bond*> edges,
00396 //                      std::vector< std::vector<int> > neighbors,
00397                       std::vector<atom*> &vertexes, std::vector<Bond*> edges,
00398                       std::vector< std::vector<int> > &neighbors,
00399                       std::vector<int> &vertexesColor, std::vector<int> &edgesColor,
00400                       std::vector<atom*> &path);
00401 
00402 protected: // data
00404     molecule*                pParent;
00405 
00407     std::vector<atom*>       molAtomList;
00408 
00410     std::map<int, Bond*>     molBondMap;
00411 
00413     typedef std::map<int, Bond*>::iterator BondMapIterator;
00414 
00416     std::vector<atom*>       hydrogens;
00417 
00419     std::vector<atom*>       acyclicAtoms;
00420 
00422     std::vector<atom*>       cyclicAtoms;
00423 
00425     std::vector<Bond*>       cyclicBonds;
00426 
00428     std::vector< std::vector<int> >    neighbors;
00429 
00431     std::vector< std::vector<atom*> >  blocks;
00432 
00434     std::vector<atom*>::iterator atomIterator;
00435 
00436     // Bond iterator
00437     std::vector<Bond*>::iterator bondIterator;
00438 
00440     atom*                    pAtom;
00441 
00443     atom*                    pAtom2;
00444 
00446     Bond*                    pBond;
00447 
00448     std::vector<atom*>       finalPath;
00449 };
00450 
00451 } // MTKpp namespace
00452 
00453 #endif // RING_h

Generated on Fri Dec 23 2011 09:28:51 for MTK++ by Doxygen 1.7.5.1