BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
buildBondsProcessor.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_STRUCTURE_BUILDBONDSPROCESSOR_H
6 #define BALL_STRUCTURE_BUILDBONDSPROCESSOR_H
7 
8 #ifndef BALL_CONCEPT_PROCESSOR_H
9  #include <BALL/CONCEPT/processor.h>
10 #endif
11 
12 #ifndef BALL_KERNEL_ATOMCONTAINER_H
14 #endif
15 
16 #ifndef BALL_DATATYPE_HASHMAP_H
17  #include <BALL/DATATYPE/hashMap.h>
18 #endif
19 
20 #ifndef BALL_KERNEL_BOND_H
21  #include <BALL/KERNEL/bond.h>
22 #endif
23 
24 #ifndef BALL_DATATYPE_OPTIONS_H
25  #include <BALL/DATATYPE/options.h>
26 #endif
27 
28 namespace BALL
29 {
30 
35  : public UnaryProcessor<AtomContainer>
36  {
37 
38  public:
39 
43  struct BALL_EXPORT Option
45  {
49  static const char* BONDLENGTHS_FILENAME;
50 
57  static const char* DELETE_EXISTING_BONDS;
58 
64  static const char* REESTIMATE_BONDORDERS_RINGS;
65 
71  static const char* DELETE_OVERESTIMATED_BONDS;
72  };
73 
76  {
78  static const char* BONDLENGTHS_FILENAME;
79 
81  static const bool DELETE_EXISTING_BONDS;
82 
84  static const bool REESTIMATE_BONDORDERS_RINGS;
85 
87  static const bool DELETE_OVERESTIMATED_BONDS;
88  };
90 
91 
95 
97 
100 
103 
105  BuildBondsProcessor(const String& file_name) throw(Exception::FileNotFound);
106 
108  virtual ~BuildBondsProcessor();
110 
114 
116  virtual bool start();
117 
119  virtual Processor::Result operator () (AtomContainer& ac);
121 
125  Size getNumberOfBondsBuilt();
127 
129  void setBondLengths(const String& file_name) throw(Exception::FileNotFound);
130 
133 
135 
139  BuildBondsProcessor& operator = (const BuildBondsProcessor& bbp);
142 
146  Options options;
148 
151  void setDefaultOptions();
153 
154  protected:
155 
157  Size buildBondsHashGrid3_(AtomContainer& ac);
158 
160  void estimateBondOrders_(AtomContainer& ac);
161 
163  void reestimateBondOrdersRings_(AtomContainer& ac);
164 
166  void deleteOverestimatedBonds_(AtomContainer& ac);
167 
169  void readBondLengthsFromFile_(const String& file_name = "") throw(Exception::FileNotFound);
170 
172  Size num_bonds_;
173 
175  HashMap<Size, HashMap<Size, HashMap<int, float> > > bond_lengths_;
176 
178  HashMap<Size, HashMap<Size, float> > max_bond_lengths_;
179 
181  HashMap<Size, HashMap<Size, float> > min_bond_lengths_;
182 
183  /*_ returns the best fitting bond order of a bond between atoms of
184  element e1 and element e2 with a distance of length
185  */
186  Bond::BondOrder getNearestBondOrder_(float length, Size e1, Size e2);
187 
188  /*_ Returns true if the atom with atomic number an1 and atom with
189  atomic number an2 can share a bond. If, the parameter length
190  holds the maximal length of such a bond.
191  */
192  bool getMaxBondLength_(float& length, Size an1, Size an2);
193 
194  /*_ Returns true if the atom with atomic number an1 and atom with
195  atomic number an2 can share a bond. If, the parameter length
196  holds the minimal length of such a bond.
197  */
198  bool getMinBondLength_(float& length, Size an1, Size an2);
199 
201  float max_length_;
202  };
203 
204 } // namespace BALL
205 
206 
207 #endif // BALL_STRUCTURE_BUILDBONDSPROCESSOR_H
#define BALL_CREATE(name)
Definition: create.h:62
HashMap< Size, HashMap< Size, HashMap< int, float > > > getBondMap()
Return the bond length Hashmap.
static const char * DELETE_OVERESTIMATED_BONDS
static const char * REESTIMATE_BONDORDERS_RINGS
static const bool DELETE_EXISTING_BONDS
this option is off by default
static const bool DELETE_OVERESTIMATED_BONDS
this option is off by default
static const bool REESTIMATE_BONDORDERS_RINGS
this option is off by default
Default values for options.
static const char * BONDLENGTHS_FILENAME
default file name for the bond lengths
HashMap class based on the STL map (containing serveral convenience functions)
Definition: hashMap.h:73
#define BALL_EXPORT
Definition: COMMON/global.h:50