00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_STRUCTURE_ADDHYDROGENPROCESSOR_H 00006 #define BALL_STRUCTURE_ADDHYDROGENPROCESSOR_H 00007 00008 #ifndef BALL_CONCEPT_PROCESSOR_H 00009 #include <BALL/CONCEPT/processor.h> 00010 #endif 00011 00012 #ifndef BALL_MATHS_VECTOR3_H 00013 #include <BALL/MATHS/vector3.h> 00014 #endif 00015 00016 #ifndef BALL_KERNEL_ATOM_H 00017 #include <BALL/KERNEL/atom.h> 00018 #endif 00019 00020 #include <vector> 00021 00022 namespace BALL 00023 { 00024 00047 class BALL_EXPORT AddHydrogenProcessor 00048 : public UnaryProcessor<Composite> 00049 { 00050 00051 public: 00052 00054 AddHydrogenProcessor(); 00055 00057 virtual ~AddHydrogenProcessor(); 00058 00060 AddHydrogenProcessor(const AddHydrogenProcessor& hbp); 00061 00062 virtual bool start(); 00063 00065 virtual Processor::Result operator() (Composite &composite); 00066 00068 Size getConnectivity(Atom& atom); 00069 00071 void setRings(const vector<vector<Atom*> >& rings); 00072 00074 Size getNumberOfAddedHydrogens() { return nr_hydrogens_;} 00075 00076 protected: 00077 00078 Size countBondOrders(Atom& atom); 00079 void addHydrogen_(Atom& atom, Vector3 position); 00080 inline bool isRingAtom_(Atom& atom); 00081 vector<Atom*> getPartners_(Atom& atom); 00082 Vector3 getNormal_(const Vector3& v); 00083 inline bool normalize_(Vector3& v); 00084 bool hasMultipleBond_(Atom& atom); 00085 // get the ideal bond length for the given element with hydrogen atoms 00086 float getBondLength_(Position element); 00087 00088 HashSet<Atom*> ring_atoms_; 00089 Position atom_nr_; 00090 Atom* last_atom_; 00091 Size nr_hydrogens_; 00092 }; //class AddHydrogenProcessor 00093 00094 } //namesspace BALL 00095 00096 #endif // BALL_STRUCTURE_ADDHYDROGENPROCESSOR_H