aromaticityProcessor.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 //
00005 
00006 #ifndef BALL_QSAR_AROMATICITYPROCESSOR_H
00007 #define BALL_QSAR_AROMATICITYPROCESSOR_H
00008 
00009 #ifndef BALL_KERNEL_ATOMCONTAINER_H
00010 # include <BALL/KERNEL/atomContainer.h>
00011 #endif
00012 
00013 #ifndef BALL_DATATYPE_OPTIONS_H
00014   #include <BALL/DATATYPE/options.h>
00015 #endif
00016 
00017 namespace BALL
00018 {
00024   class BALL_EXPORT AromaticityProcessor
00025     : public UnaryProcessor<AtomContainer>
00026   {
00027     public:
00028 
00032 
00033     struct BALL_EXPORT Option
00034     { 
00037       static const char* OVERWRITE_BOND_ORDERS; 
00038     };
00039 
00041     struct BALL_EXPORT Default
00042     {
00043       static const bool OVERWRITE_BOND_ORDERS;
00044     };
00046 
00050     BALL_CREATE(AromaticityProcessor)
00051 
00052     //@{
00055     AromaticityProcessor();
00056   
00059     AromaticityProcessor(const AromaticityProcessor& aro);
00060 
00063     virtual ~AromaticityProcessor();
00064 
00066 
00069 
00072     AromaticityProcessor& operator = (const AromaticityProcessor& aro);
00074 
00078 
00079     Options options;
00080 
00083     void setDefaultOptions();
00085 
00089 
00096     void aromatize(const vector<vector<Atom*> >& sssr, AtomContainer& ac);
00097 
00105     void aromatizeSimple(vector<vector<Atom*> >& sssr);
00106     
00108 
00111     
00113     Processor::Result operator () (AtomContainer& ac);
00114     
00116     virtual bool start();
00118 
00119 
00120     protected:
00121 
00125     bool isValid_(const AtomContainer& ac);
00127 
00128 
00129     private:
00130 
00131     /*_ simple criterion if a ring can be aromatic
00132     */
00133     bool simpleCanBeAromatic_(const HashSet<Atom*>& ring);
00134 
00135     /*_ simple criterion if a ring can be aromatic, with weaker condition
00136         double bonds not need to be alternating inside the ring
00137     */
00138     bool simpleCanBeAromaticWeaker_(const HashSet<Atom*>& ring);
00139 
00140     /*_ Tries to extend an aromatic system. Main method that tries to extend 
00141         the aromaticity to intersecting rings.
00142         @param SSSR ring set as vector<HashSet<Atom*> >, (vector of rings in HashSet<Atom*>)
00143         @param ring as HashSet<Atom*>, the ring to extended
00144     */    
00145     void extendAromaticSystem_(vector<HashSet<Atom*> >& sssr, HashSet<Atom*> ring);
00146       
00147     /*_ Predicate that return true if the ring has conjugated double bonds. The criterion 
00148         is very weak, beacuse the predicate only considers carbon atoms, no hetero atoms
00149         are counted.
00150         @param ring as HashSet<Atom*>, to be tested
00151     */
00152     bool hasConjugatedDoubleBonds_(HashSet<Atom*> ring);
00153       
00154     /*_ This mthod return the number of pi electrons in the ring (aromatic system)
00155         @param ring as HashSet<Atom*>, from which the number of pi electrons to count
00156     */
00157     Size countPiElectrons_(HashSet<Atom*>& ring);
00158 
00162     bool overwrite_bond_orders_;
00163   };
00164 } // namespace BALL
00165 
00166 #endif // BALL_QSAR_AROMATICITYPROCESSOR_H