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:
63  typedef RuleMatchList::const_iterator ConstMatchIterator;
64 
69 
75 
80  void findUniqueMappingsOnly(bool unique);
81 
86  bool findUniqueMappingsOnly() const;
87 
92  void findAllRuleMappings(bool all);
93 
98  bool findAllRuleMappings() const;
99 
104  void stopAtFirstMatchingRule(bool stop);
105 
111 
117 
123 
128  std::size_t getNumMatches() const;
129 
136  const TorsionRuleMatch& getMatch(std::size_t idx) const;
137 
143 
149 
155 
161 
169  bool findMatches(const Chem::Bond& bond, const Chem::MolecularGraph& molgraph, bool append = false);
170 
171  private:
172  bool findMatchingRules(const TorsionCategory& tor_cat, const Chem::Bond& bond, const Chem::MolecularGraph& molgraph);
173  bool getRuleMatches(const TorsionRule& rule, const Chem::Bond& bond, const Chem::MolecularGraph& molgraph);
174  bool matchesCategory(const TorsionCategory& tor_cat, const Chem::Bond& bond, const Chem::MolecularGraph& molgraph);
175 
176  void outputMatch(const Chem::AtomBondMapping& ab_mapping, const Chem::Bond& bond, const TorsionRule& rule);
177 
178  std::size_t getCentralBondIndex(const Chem::MolecularGraph& ptn) const;
179 
181  Chem::SubstructureSearch subSearch;
182  bool uniqueMappingsOnly;
183  bool stopAtFirstRule;
184  RuleMatchList matches;
185  };
186  } // namespace ConfGen
187 } // namespace CDPL
188 
189 #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:58
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 ConfGen::TorsionLibrary instance that match 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 torsion library for rules that match the bond bond of the molecular graph mol...
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:63
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.