00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: MMFF94Processors.h,v 1.1.8.1 2007/03/25 21:25:18 oliver Exp $ 00005 // 00006 00007 #ifndef BALL_MOLMEC_MMFF94_PROCESSORS_H 00008 #define BALL_MOLMEC_MMFF94_PROCESSORS_H 00009 00010 #ifndef BALL_MOLMEC_MMFF94_MMFF94PARAMETERS_H 00011 # include <BALL/MOLMEC/MMFF94/MMFF94Parameters.h> 00012 #endif 00013 00014 #ifndef BALL_DATATYPE_HASHSET_H 00015 # include <BALL/DATATYPE/hashSet.h> 00016 #endif 00017 00018 #ifndef BALL_DATATYPE_STRINGHASHMAP_H 00019 # include <BALL/DATATYPE/stringHashMap.h> 00020 #endif 00021 00022 #ifndef BALL_KERNEL_BOND_H 00023 # include <BALL/KERNEL/bond.h> 00024 #endif 00025 00026 #ifndef BALL_STRUCTURE_ATOMTYPER_H 00027 # include <BALL/STRUCTURE/atomTyper.h> 00028 #endif 00029 00030 #include <vector> 00031 00032 namespace BALL 00033 { 00034 using std::vector; 00035 00036 class MMFF94ESParameters; 00037 class Molecule; 00038 class System; 00039 00041 class BALL_EXPORT MMFF94AtomTyper 00042 : public AtomTyper 00043 { 00044 public: 00045 00046 struct AromaticType 00047 { 00048 String new_type; 00049 Position atomic_number; 00050 bool cation; 00051 bool anion; 00052 }; 00053 00054 BALL_CREATE(MMFF94AtomTyper) 00055 00056 00057 MMFF94AtomTyper(); 00058 00060 MMFF94AtomTyper(const MMFF94AtomTyper& t); 00061 00063 virtual ~MMFF94AtomTyper() {}; 00064 00066 virtual void assignTo(System& s); 00067 00069 virtual bool setupHydrogenTypes(Parameters& p, const String& section); 00070 00072 virtual bool setupSymbolsToTypes(Parameters& p, const String& section); 00073 00075 virtual bool setupAromaticTypes(Parameters& p, const String& section); 00076 00078 void collectHeteroAtomTypes(const MMFF94AtomTypes& atom_types); 00079 00080 protected: 00081 00082 bool assignAromaticType_5_(Atom& atom, Position L5, bool anion, bool cation); 00083 00084 StringHashMap<String> partner_type_to_htype_; 00085 StringHashMap<Position> id_to_type_; 00086 HashMap<String, AromaticType> aromatic_types_5_map_; 00087 HashSet<String> cation_atoms_; 00088 MMFF94AtomTypes* atom_types_; 00089 HashSet<Position> hetero_atom_types_; 00090 }; 00091 00092 00096 class BALL_EXPORT MMFF94ChargeProcessor 00097 : public UnaryProcessor<Atom> 00098 { 00099 public: 00100 00101 BALL_CREATE(MMFF94ChargeProcessor) 00102 00103 00104 MMFF94ChargeProcessor(); 00105 00107 MMFF94ChargeProcessor(const MMFF94ChargeProcessor& cp); 00108 00110 virtual ~MMFF94ChargeProcessor() {}; 00111 00113 const MMFF94ChargeProcessor& operator = (const MMFF94ChargeProcessor& cp) 00114 ; 00115 00117 virtual void clear() 00118 ; 00119 00121 virtual bool start(); 00122 00124 virtual bool finish(); 00125 00127 virtual Processor::Result operator () (Atom& atom); 00128 00130 void assignFormalCharge(Atom& atom); 00131 00133 const HashSet<Atom*>& getUnassignedAtoms() { return unassigned_atoms_;} 00134 00136 void setESParameters(const MMFF94ESParameters& es) { es_parameters_ = &es; } 00137 00139 void setup(const String& filename); 00140 00142 void setAromaticRings(const vector<HashSet<Atom*> >& rings) { aromatic_rings_ = rings;} 00143 00144 protected: 00145 00146 void assignPartialCharges_(); 00147 00148 vector<Atom*> atoms_; 00149 HashSet<Atom*> unassigned_atoms_; 00150 const MMFF94ESParameters* es_parameters_; 00151 HashMap<String, float> types_to_charges_; 00152 HashSet<String> rule_types_; 00153 vector<HashSet<Atom*> > aromatic_rings_; 00154 }; 00155 00156 } // namespace BALL 00157 00158 #endif // BALL_MOLMEC_MMFF94_PROCESSORS_H