Chemical Data Processing Library C++ API - Version 1.4.0
TorsionRuleMatcher.hpp
Go to the documentation of this file.
1 /*
2  * TorsionRuleMatcher.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_CONFGEN_TORSIONRULEMATCHER_HPP
30 #define CDPL_CONFGEN_TORSIONRULEMATCHER_HPP
31 
32 #include <vector>
33 
38 
39 
40 namespace CDPL
41 {
42 
43  namespace ConfGen
44  {
45 
55  {
56 
57  typedef std::vector<TorsionRuleMatch> RuleMatchList;
58 
59  public:
61  typedef RuleMatchList::const_iterator ConstMatchIterator;
62 
67 
73 
78  void findUniqueMappingsOnly(bool unique);
79 
84  bool findUniqueMappingsOnly() const;
85 
90  void findAllRuleMappings(bool all);
91 
96  bool findAllRuleMappings() const;
97 
102  void stopAtFirstMatchingRule(bool stop);
103 
109 
115 
121 
126  std::size_t getNumMatches() const;
127 
134  const TorsionRuleMatch& getMatch(std::size_t idx) const;
135 
141 
147 
153 
159 
167  bool findMatches(const Chem::Bond& bond, const Chem::MolecularGraph& molgraph, bool append = false);
168 
169  private:
170  bool findMatchingRules(const TorsionCategory& tor_cat, const Chem::Bond& bond, const Chem::MolecularGraph& molgraph);
171  bool getRuleMatches(const TorsionRule& rule, const Chem::Bond& bond, const Chem::MolecularGraph& molgraph);
172  bool matchesCategory(const TorsionCategory& tor_cat, const Chem::Bond& bond, const Chem::MolecularGraph& molgraph);
173 
174  void outputMatch(const Chem::AtomBondMapping& ab_mapping, const Chem::Bond& bond, const TorsionRule& rule);
175 
176  std::size_t getCentralBondIndex(const Chem::MolecularGraph& ptn) const;
177 
179  Chem::SubstructureSearch subSearch;
180  bool uniqueMappingsOnly;
181  bool stopAtFirstRule;
182  RuleMatchList matches;
183  };
184  } // namespace ConfGen
185 } // namespace CDPL
186 
187 #endif // CDPL_CONFGEN_TORSIONRULEMATCHER_HPP
Definition of the preprocessor macro CDPL_CONFGEN_API.
#define CDPL_CONFGEN_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of class CDPL::Chem::SubstructureSearch.
Definition of class CDPL::ConfGen::TorsionLibrary.
Definition of class CDPL::ConfGen::TorsionRuleMatch.
Data structure for the common storage of related atom to atom and bond to bond mappings.
Definition: AtomBondMapping.hpp:55
Abstract base class representing a chemical bond between two Chem::Atom instances.
Definition: Bond.hpp:54
Abstract base class for representations of a chemical structure as a graph of bonded atoms.
Definition: MolecularGraph.hpp:57
Subgraph-isomorphism search of a query molecular graph against a target molecular graph,...
Definition: SubstructureSearch.hpp:74
Represents a node of a hierarchical torsion library.
Definition: TorsionCategory.hpp:54
std::shared_ptr< TorsionLibrary > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated TorsionLibrary instances.
Definition: TorsionLibrary.hpp:56
A single match of a ConfGen::TorsionRule against a rotatable bond: the rule, the bond and the four at...
Definition: TorsionRuleMatch.hpp:58
Finds torsion rules from a TorsionLibrary that apply to a given rotatable bond.
Definition: TorsionRuleMatcher.hpp:55
ConstMatchIterator getMatchesBegin() const
Returns a constant iterator pointing to the beginning of the stored torsion rule matches.
ConstMatchIterator getMatchesEnd() const
Returns a constant iterator pointing to the end of the stored torsion rule matches.
const TorsionRuleMatch & getMatch(std::size_t idx) const
Returns a const reference to the stored torsion rule match object at index idx.
TorsionRuleMatcher()
Constructs the TorsionRuleMatcher instance without an associated torsion library.
bool findAllRuleMappings() const
Tells whether all matching rules are reported during matching.
bool findMatches(const Chem::Bond &bond, const Chem::MolecularGraph &molgraph, bool append=false)
Searches the associated TorsionLibrary for rules that apply to the bond bond of molgraph.
void findUniqueMappingsOnly(bool unique)
Specifies whether only unique substructure mappings shall be reported during matching.
void setTorsionLibrary(const TorsionLibrary::SharedPointer &lib)
Sets the torsion library to query.
void stopAtFirstMatchingRule(bool stop)
Specifies whether the matching process shall stop at the first rule that produces matches.
RuleMatchList::const_iterator ConstMatchIterator
A constant iterator over the stored torsion rule matches.
Definition: TorsionRuleMatcher.hpp:61
ConstMatchIterator end() const
Returns a constant iterator pointing to the end of the stored torsion rule matches.
TorsionRuleMatcher(const TorsionLibrary::SharedPointer &lib)
Constructs the TorsionRuleMatcher instance and associates it with lib.
bool stopAtFirstMatchingRule() const
Tells whether matching stops at the first rule that produces matches.
ConstMatchIterator begin() const
Returns a constant iterator pointing to the beginning of the stored torsion rule matches.
void findAllRuleMappings(bool all)
Specifies whether all matching rules shall be reported (instead of just the most-specific one).
const TorsionLibrary::SharedPointer & getTorsionLibrary() const
Returns the currently associated torsion library.
std::size_t getNumMatches() const
Returns the number of stored torsion rule matches found by calls to findMatches().
bool findUniqueMappingsOnly() const
Tells whether only unique substructure mappings are reported during matching.
Data structure for the representation of single torsion library rules.
Definition: TorsionRule.hpp:53
The namespace of the Chemical Data Processing Library.