BALL  1.4.1
GAFFTypeProcessor.h
Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 #ifndef BALL_MOLMEC_AMBER_GAFFTYPEPROCESSOR_H
00006 #define BALL_MOLMEC_AMBER_GAFFTYPEPROCESSOR_H
00007 
00008 #ifndef BALL_CONCEPT_COMPOSITE_H
00009 # include <BALL/CONCEPT/composite.h>
00010 #endif
00011 
00012 #ifndef BALL_CONCEPT_PROCESSOR_H
00013 # include <BALL/CONCEPT/processor.h>
00014 #endif
00015 
00016 #ifndef BALL_MOLMEC_AMBER_GAFFCESPARSER_H
00017 # include <BALL/MOLMEC/AMBER/GAFFCESParser.h>
00018 #endif
00019 
00020 #ifndef BALL_DATATYPE_OPTIONS_H
00021 # include <BALL/DATATYPE/options.h>
00022 #endif
00023 
00024 #ifndef BALL_COMMON_EXCEPTION_H
00025 # include <BALL/COMMON/exception.h>
00026 #endif
00027 
00028 #ifndef BALL_KERNEL_MOLECULE_H
00029 # include <BALL/KERNEL/molecule.h>
00030 #endif
00031 
00032 #include <vector>
00033 #include <map>
00034 
00035 namespace BALL
00036 {
00037   class BALL_EXPORT GAFFTypeProcessor : public UnaryProcessor<Composite>
00038   {
00039     public:
00041       struct TypeDefinition
00042       {
00043         String atom_type;
00044         int atomic_number;
00045         int connectivity;
00046         String attached_hydrogens;
00047         String electron_withdrawal_atoms;
00048         String atomic_property;
00049         String chemical_environment;
00050       };
00051 
00052       struct BALL_EXPORT Option
00053       {
00055         static const String ATOMTYPE_FILENAME;
00056 
00058         static const String GAFF_ATOMTYPE_POSTPROCESSING;
00059       };
00060 
00061       struct BALL_EXPORT Default
00062       {
00064         static const String ATOMTYPE_FILENAME;
00065 
00067         static const bool GAFF_ATOMTYPE_POSTPROCESSING;
00068       };
00069 
00070       enum BALL_EXPORT BOND_TYPES
00071       {
00072         sb,
00073         SB,
00074         db,
00075         DB,
00076         TB,
00077         DL,
00078         AB
00079       };
00080 
00081       GAFFTypeProcessor();
00082       GAFFTypeProcessor(const Options& new_options);
00083       virtual ~GAFFTypeProcessor();
00084       virtual Processor::Result operator() (Composite &composite);
00085 
00086       std::set<String> getTypeNames() const;
00087 
00088       Options options;
00089 
00090     protected:
00091       // helper functions used in identifying the correct atom type
00092       std::vector<TypeDefinition> getCarbonTypes_()   { return atom_types_[6];  }
00093       std::vector<TypeDefinition> getHydrogenTypes_() { return atom_types_[1];  }
00094       std::vector<TypeDefinition> getNitrogenTypes_() { return atom_types_[7];  }
00095       std::vector<TypeDefinition> getOxygenTypes_()   { return atom_types_[8];  }
00096       std::vector<TypeDefinition> getSulfurTypes_()   { return atom_types_[16]; }
00097 
00104       void parseAtomtypeTableFile_()
00105         throw(Exception::FileNotFound);
00106 
00108       void precomputeBondProperties_(Molecule* molecule);
00109 
00113       void precomputeAtomProperties_(Molecule* molecule);
00114 
00116       void annotateBondTypes_();
00117 
00119       void annotateRingSizes_();
00120       void annotateAliphaticAndAromaticRingAtoms_();
00121       void annotatePlanarRingAtoms_();
00122       bool planarAtom_(const Atom& atom);
00123 
00126       bool assignAtomtype_(Atom& atom);
00127 
00130       void postProcessAtomTypes_(Molecule* molecule);
00131 
00132       //for every CESstring in atomtable store the "predicate tree"
00133       //built by GAFFCESParser
00134       StringHashMap<GAFFCESParser*> ces_parsers_;
00135 
00136       // stores the vectors of atom types indexed by atomic number for fast retrieval
00137       std::map<Position, std::vector<TypeDefinition> > atom_types_;
00138 
00139       // smallest set of smallest rings used for atomic environment strings
00140       std::vector<std::vector<Atom*> > sssr_;
00141 
00143       Molecule* current_molecule_;
00144   };
00145 }
00146 
00147 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines