Chemical Data Processing Library C++ API - Version 1.2.0
StereoisomerGenerator.hpp
Go to the documentation of this file.
1 /*
2  * StereoisomerGenerator.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_STEREOISOMERGENERATOR_HPP
30 #define CDPL_CHEM_STEREOISOMERGENERATOR_HPP
31 
32 #include <memory>
33 #include <vector>
34 #include <cstddef>
35 #include <utility>
36 
37 #include "CDPL/Chem/APIPrefix.hpp"
41 #include "CDPL/Util/Array.hpp"
42 #include "CDPL/Util/BitSet.hpp"
43 
44 
45 namespace CDPL
46 {
47 
48  namespace Chem
49  {
50 
51  class MolecularGraph;
52 
58  {
59 
60  public:
61  typedef std::shared_ptr<StereoisomerGenerator> SharedPointer;
62 
64 
65  void setAtomPredicate(const AtomPredicate& pred);
66 
68 
69  void setBondPredicate(const BondPredicate& pred);
70 
72 
73  void enumerateAtomConfig(bool enumerate);
74 
75  bool atomConfigEnumerated() const;
76 
77  void enumerateBondConfig(bool enumerate);
78 
79  bool bondConfigEnumerated() const;
80 
81  void includeSpecifiedCenters(bool include);
82 
84 
85  void includeSymmetricCenters(bool include);
86 
88 
89  void includeBridgeheadAtoms(bool include);
90 
92 
93  void includeInvertibleNitrogens(bool include);
94 
96 
97  void includeRingBonds(bool include);
98 
99  bool ringBondsIncluded() const;
100 
101  void setMinRingSize(std::size_t min_size);
102 
103  std::size_t getMinRingSize() const;
104 
105  void setup(const MolecularGraph& molgraph);
106 
107  bool generate();
108 
110 
112 
113  private:
114  typedef std::pair<bool, std::size_t> StereoCenterID;
115 
116  bool isExcluded(const Atom& atom, const MolecularGraph& molgraph, bool has_config);
117  bool isExcluded(const Bond& bond, const MolecularGraph& molgraph, bool has_config) const;
118 
119  void findBridgeheadAtoms(const MolecularGraph& molgraph);
120 
121  void flipConfiguration(const StereoCenterID& ctr_id);
122 
123  typedef std::vector<StereoCenterID> StereoCenterIDList;
124 
125  AtomPredicate atomPred;
126  BondPredicate bondPred;
127  bool enumAtomConfig{true};
128  bool enumBondConfig{true};
129  bool incSpecifiedCtrs{false};
130  bool incSymmetricCtrs{false};
131  bool incBridgeheads{false};
132  bool incInvNitrogens{false};
133  bool incRingBonds{false};
134  std::size_t minRingSize{8};
135  StereoDescriptorArray atomDescrs;
136  StereoDescriptorArray bondDescrs;
137  StereoCenterIDList procCtrs;
138  Util::BitSet flipStates;
139  };
140  } // namespace Chem
141 } // namespace CDPL
142 
143 #endif // CDPL_CHEM_STEREOISOMERGENERATOR_HPP
Definition of the class CDPL::Util::Array.
Type definition of a generic wrapper class for storing user-defined Chem::Atom predicates.
Definition of the type CDPL::Util::BitSet.
Type definition of a generic wrapper class for storing user-defined Chem::Bond predicates.
Definition of the preprocessor macro CDPL_CHEM_API.
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of the type CDPL::Chem::StereoDescriptor.
Atom.
Definition: Atom.hpp:52
Bond.
Definition: Bond.hpp:50
MolecularGraph.
Definition: MolecularGraph.hpp:52
StereoisomerGenerator.
Definition: StereoisomerGenerator.hpp:58
std::size_t getMinRingSize() const
const StereoDescriptorArray & getBondDescriptors()
void setBondPredicate(const BondPredicate &pred)
void enumerateAtomConfig(bool enumerate)
void includeSymmetricCenters(bool include)
void setMinRingSize(std::size_t min_size)
void includeSpecifiedCenters(bool include)
void setAtomPredicate(const AtomPredicate &pred)
void includeBridgeheadAtoms(bool include)
void enumerateBondConfig(bool enumerate)
void setup(const MolecularGraph &molgraph)
Util::Array< StereoDescriptor > StereoDescriptorArray
Definition: StereoisomerGenerator.hpp:63
const BondPredicate & getBondPredicate() const
void includeInvertibleNitrogens(bool include)
const StereoDescriptorArray & getAtomDescriptors()
std::shared_ptr< StereoisomerGenerator > SharedPointer
Definition: StereoisomerGenerator.hpp:61
void includeRingBonds(bool include)
const AtomPredicate & getAtomPredicate() const
std::function< bool(const Chem::Atom &)> AtomPredicate
A generic wrapper class used to store a user-defined atom predicate.
Definition: AtomPredicate.hpp:41
std::function< bool(const Chem::Bond &)> BondPredicate
A generic wrapper class used to store a user-defined bond predicate.
Definition: BondPredicate.hpp:41
boost::dynamic_bitset BitSet
A dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.