Chemical Data Processing Library C++ API - Version 1.1.1
AromaticSubstructure.hpp
Go to the documentation of this file.
1 /*
2  * AromaticSubstructure.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_CHEM_AROMATICSUBSTRUCTURE_HPP
30 #define CDPL_CHEM_AROMATICSUBSTRUCTURE_HPP
31 
32 #include <vector>
33 #include <set>
34 #include <utility>
35 #include <memory>
36 
37 #include "CDPL/Chem/APIPrefix.hpp"
38 #include "CDPL/Chem/Fragment.hpp"
39 #include "CDPL/Util/BitSet.hpp"
40 
41 
42 namespace CDPL
43 {
44 
45  namespace Chem
46  {
47 
52  {
53 
54  public:
58  typedef std::shared_ptr<AromaticSubstructure> SharedPointer;
59 
64 
71 
77  void perceive(const MolecularGraph& molgraph);
78 
79  private:
80  class RingDescriptor
81  {
82 
83  public:
84  typedef std::shared_ptr<RingDescriptor> SharedPointer;
85 
86  RingDescriptor(const Fragment::SharedPointer&, const MolecularGraph&);
87  RingDescriptor(const Fragment::SharedPointer&, Util::BitSet&, const RingDescriptor&, const RingDescriptor&);
88 
89  const Fragment& getRing() const;
90 
91  const Util::BitSet& getBondMask() const;
92 
93  bool containsSubRing(const RingDescriptor&) const;
94 
95  private:
97  const RingDescriptor* subRing1;
98  const RingDescriptor* subRing2;
99  Util::BitSet bondMask;
100  };
101 
103 
104  AromaticSubstructure& operator=(const AromaticSubstructure&);
105 
106  void freeMemory();
107 
108  typedef std::vector<RingDescriptor::SharedPointer> RingDescriptorList;
109  typedef std::vector<std::pair<RingDescriptorList, std::size_t> > RingDescriptorListTable;
110  typedef std::set<Util::BitSet> BondMaskSet;
111 
112  void init(const MolecularGraph&);
113 
114  void findAromaticSubstructure();
115  bool findAromaticRings(RingDescriptorListTable::value_type&);
116 
117  void fuseRings();
118  void fuseRings(const RingDescriptor&, const RingDescriptor&, RingDescriptorList&);
119 
120  bool isAromatic(const RingDescriptor::SharedPointer&);
121 
122  Util::BitSet aromBondMask;
123  Util::BitSet ringBondMask;
124  Util::BitSet tmpBondMask;
125  const MolecularGraph* molGraph;
126  RingDescriptorListTable ringDescrListTable;
127  BondMaskSet uniqueRingSet;
128  bool finished;
129  };
130  } // namespace Chem
131 } // namespace CDPL
132 
133 #endif // CDPL_CHEM_AROMATICSUBSTRUCTURE_HPP
APIPrefix.hpp
Definition of the preprocessor macro CDPL_CHEM_API.
CDPL_CHEM_API
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Util::BitSet
boost::dynamic_bitset BitSet
A dynamic bitset class.
Definition: BitSet.hpp:46
CDPL::Chem::Fragment
Fragment.
Definition: Fragment.hpp:52
CDPL::Chem::MolecularGraph
MolecularGraph.
Definition: MolecularGraph.hpp:52
BitSet.hpp
Definition of the type CDPL::Util::BitSet.
CDPL::Chem::Fragment::SharedPointer
std::shared_ptr< Fragment > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated Fragment instances.
Definition: Fragment.hpp:61
Fragment.hpp
Definition of the class CDPL::Chem::Fragment.
CDPL::Chem::AromaticSubstructure::AromaticSubstructure
AromaticSubstructure()
Constructs an empty AromaticSubstructure instance.
Definition: AromaticSubstructure.hpp:63
CDPL::Chem::AromaticSubstructure::SharedPointer
std::shared_ptr< AromaticSubstructure > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated AromaticSubstructure instances.
Definition: AromaticSubstructure.hpp:58
CDPL::Chem::isAromatic
CDPL_CHEM_API bool isAromatic(const Fragment &ring, const MolecularGraph &molgraph, const Util::BitSet &arom_bond_mask)
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Chem::AromaticSubstructure::AromaticSubstructure
AromaticSubstructure(const MolecularGraph &molgraph)
Construct a AromaticSubstructure instance that consists of the aromatic atoms and bonds of the molecu...
CDPL::Chem::AromaticSubstructure
Implements the perception of aromatic atoms and bonds in a molecular graph.
Definition: AromaticSubstructure.hpp:52
CDPL::Chem::AromaticSubstructure::perceive
void perceive(const MolecularGraph &molgraph)
Replaces the currently stored atoms and bonds by the set of aromatic atoms and bonds of the molecular...