hybridisationProcessor.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 #ifndef BALL_STRUCTURE_HYBRIDISATIONPROCESSOR_H
00006 #define BALL_STRUCTURE_HYBRIDISATIONPROCESSOR_H
00007 
00008 #ifndef BALL_CONCEPT_PROCESSOR_H
00009   #include <BALL/CONCEPT/processor.h>
00010 #endif
00011 
00012 #ifndef BALL_KERNEL_ATOMCONTAINER_H
00013   #include <BALL/KERNEL/atomContainer.h>
00014 #endif
00015 
00016 #ifndef BALL_DATATYPE_HASHMAP_H
00017   #include <BALL/DATATYPE/hashMap.h>
00018 #endif
00019 
00020 #ifndef BALL_KERNEL_BOND_H
00021   #include <BALL/KERNEL/bond.h>
00022 #endif
00023 
00024 #ifndef BALL_DATATYPE_OPTIONS_H
00025   #include <BALL/DATATYPE/options.h>
00026 #endif
00027 
00028 #ifndef BALL_DATATYPE_STRINGHASHMAP_H
00029   #include <BALL/DATATYPE/stringHashMap.h>
00030 #endif
00031 
00032 
00033 #include <map>
00034 
00035 
00036 namespace BALL 
00037 {
00038 
00042   class BALL_EXPORT HybridisationProcessor 
00043     : public UnaryProcessor<AtomContainer> 
00044   {
00045 
00046     public:
00047 
00051 
00052       struct BALL_EXPORT Option
00053       {
00057         static const char* ATOM_TYPE_SMARTS_FILENAME;
00058         
00062         static const char* ATOM_TYPE_FF_FILENAME;
00063         
00073         static const String METHOD; 
00074 
00075       };
00076 
00078       struct BALL_EXPORT Default
00079       {
00081         static const char* ATOM_TYPE_SMARTS_FILENAME;
00082         
00086         static const char* ATOM_TYPE_FF_FILENAME;
00087         
00091         static const String METHOD;
00092       };
00093 
00094       struct BALL_EXPORT Method
00095       {
00096         static const String SMART_MATCHING;
00097         static const String STRUCTURE_BASED; 
00098         static const String FF_BASED; 
00099       };
00100 
00101 
00103     
00104 
00108 
00109       BALL_CREATE(HybridisationProcessor);
00110       
00112       HybridisationProcessor();
00113     
00115       HybridisationProcessor(const HybridisationProcessor& hp);
00116     
00119       HybridisationProcessor(const String& smarts_file_name, const String& ff_file_name) throw(Exception::FileNotFound);
00120       
00122       virtual ~HybridisationProcessor();
00124 
00128 
00130       virtual bool start();
00131 
00133       virtual Processor::Result operator () (AtomContainer& ac);
00135 
00139 
00140       Size getNumberOfHybridisationStatesSet(); 
00141 
00143       void setAtomTypeSmarts(const String& file_name) throw(Exception::FileNotFound);
00144 
00146       vector< std::pair<String, Size> > getHybridisationMap() { return atom_type_smarts_;};
00148 
00152 
00153       HybridisationProcessor& operator = (const HybridisationProcessor& hp);
00155 
00159 
00160       Options options;
00161 
00164       void setDefaultOptions();
00166       
00167     protected:
00168       
00171       struct Elements_
00172       {
00174         String type;
00176         unsigned char hyb;
00177       };
00178       
00181       struct AtomNames_
00182       {
00184         String a1;
00186         String a2;
00188         String a3;
00189       };
00190       
00192       bool readAtomTypeSmartsFromFile_(const String& file_name = "") throw(Exception::FileNotFound);
00193       
00195       Size num_hybridisation_states_;
00196 
00198       vector< std::pair<String, Size> > atom_type_smarts_;
00199       
00203       StringHashMap<StringHashMap<StringHashMap<std::multimap<float, AtomNames_> > > > bond_angles_;
00204       
00205       bool readAndInitBondAnglesFromFile_(const String& file_name = "") throw(Exception::FileNotFound);
00206       
00209       StringHashMap<Elements_> elements_;
00210       
00211 
00213       bool valid_;
00214       
00215   
00217       double AverageBondAngle_(Atom* a);
00218 
00219   };
00220 
00221 } // namespace BALL 
00222 
00223 
00224 #endif // BALL_STRUCTURE_HYBRIDISATIONPROCESSOR_H