Chemical Data Processing Library C++ API - Version 1.4.0
TorsionRule.hpp
Go to the documentation of this file.
1 /*
2  * TorsionRule.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_TORSIONRULE_HPP
30 #define CDPL_CONFGEN_TORSIONRULE_HPP
31 
32 #include <vector>
33 #include <cstddef>
34 #include <string>
35 
38 
39 
40 namespace CDPL
41 {
42 
43  namespace ConfGen
44  {
45 
53  {
54 
55  public:
56  class AngleEntry;
57 
58  private:
59  typedef std::vector<AngleEntry> AngleEntryList;
60 
61  public:
65  class AngleEntry
66  {
67 
68  public:
76  AngleEntry(double ang, double tol1 = 0.0, double tol2 = 0.0, double score = 0.0):
77  angle(ang), tolerance1(tol1), tolerance2(tol2), score(score) {}
78 
83  double getAngle() const
84  {
85  return angle;
86  }
87 
92  double getTolerance1() const
93  {
94  return tolerance1;
95  }
96 
101  double getTolerance2() const
102  {
103  return tolerance2;
104  }
105 
110  double getScore() const
111  {
112  return score;
113  }
114 
115  private:
116  double angle;
117  double tolerance1;
118  double tolerance2;
119  double score;
120  };
121 
123  typedef AngleEntryList::iterator AngleEntryIterator;
125  typedef AngleEntryList::const_iterator ConstAngleEntryIterator;
126 
131  const std::string& getMatchPatternString() const;
132 
137  void setMatchPatternString(const std::string& ptn_str);
138 
144 
150 
155  void addAngle(const AngleEntry& ang_entry);
156 
164  void addAngle(double angle, double tol1 = 0.0, double tol2 = 0.0, double score = 0.0);
165 
170  std::size_t getNumAngles() const;
171 
178  const AngleEntry& getAngle(std::size_t idx) const;
179 
185  void removeAngle(std::size_t idx);
186 
193 
199 
205 
211 
217 
223 
229 
235 
241 
246  void swap(TorsionRule& rule);
247 
251  void clear();
252 
253  private:
254  void checkAngleIndex(std::size_t idx, bool it) const;
255 
256  std::string matchPatternStr;
258  AngleEntryList angles;
259  };
260  } // namespace ConfGen
261 } // namespace CDPL
262 
263 #endif // CDPL_CONFGEN_TORSIONRULE_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::MolecularGraph.
std::shared_ptr< MolecularGraph > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MolecularGraph instances.
Definition: MolecularGraph.hpp:63
One preferred torsion angle for a rule, characterized by its value, the two tolerance bands and a sco...
Definition: TorsionRule.hpp:66
double getTolerance2() const
Returns the second (relaxed) tolerance band.
Definition: TorsionRule.hpp:101
double getTolerance1() const
Returns the first (preferred) tolerance band.
Definition: TorsionRule.hpp:92
double getScore() const
Returns the score (higher values mark more strongly preferred angles).
Definition: TorsionRule.hpp:110
double getAngle() const
Returns the angle value.
Definition: TorsionRule.hpp:83
AngleEntry(double ang, double tol1=0.0, double tol2=0.0, double score=0.0)
Constructs the AngleEntry with the given angle value, tolerances and score.
Definition: TorsionRule.hpp:76
Data structure for the representation of single torsion library rules.
Definition: TorsionRule.hpp:53
AngleEntryList::iterator AngleEntryIterator
A mutable iterator over the angle entries.
Definition: TorsionRule.hpp:123
AngleEntryIterator begin()
Returns a mutable iterator pointing to the first angle entry (range-based for support).
void setMatchPatternString(const std::string &ptn_str)
Sets the SMARTS-like match pattern in textual form.
void setMatchPattern(const Chem::MolecularGraph::SharedPointer &ptn)
Sets the compiled match-pattern molecular graph.
ConstAngleEntryIterator getAnglesBegin() const
Returns a constant iterator pointing to the first angle entry.
const std::string & getMatchPatternString() const
Returns the SMARTS-like match pattern in textual form.
ConstAngleEntryIterator end() const
Returns a constant iterator pointing one past the last angle entry (range-based for support).
ConstAngleEntryIterator begin() const
Returns a constant iterator pointing to the first angle entry (range-based for support).
AngleEntryList::const_iterator ConstAngleEntryIterator
A constant iterator over the angle entries.
Definition: TorsionRule.hpp:125
const Chem::MolecularGraph::SharedPointer & getMatchPattern() const
Returns the compiled match-pattern molecular graph.
const AngleEntry & getAngle(std::size_t idx) const
Returns the angle entry at index idx.
void clear()
Clears the match pattern and removes all angle entries.
AngleEntryIterator end()
Returns a mutable iterator pointing one past the last angle entry (range-based for support).
AngleEntryIterator getAnglesBegin()
Returns a mutable iterator pointing to the first angle entry.
void removeAngle(const AngleEntryIterator &it)
Removes the angle entry referenced by iterator it.
void addAngle(double angle, double tol1=0.0, double tol2=0.0, double score=0.0)
Constructs and appends a new angle entry.
void addAngle(const AngleEntry &ang_entry)
Appends the angle entry ang_entry to the rule.
void removeAngle(std::size_t idx)
Removes the angle entry at index idx.
ConstAngleEntryIterator getAnglesEnd() const
Returns a constant iterator pointing one past the last angle entry.
void swap(TorsionRule &rule)
Swaps the contents of this rule with rule.
std::size_t getNumAngles() const
Returns the number of stored angle entries.
AngleEntryIterator getAnglesEnd()
Returns a mutable iterator pointing one past the last angle entry.
The namespace of the Chemical Data Processing Library.