BALL  1.4.1
partialBondOrderAssignment.h
Go to the documentation of this file.
00001 #ifndef BALL_STRUCTURE_BONDORDERS_PARTIALBONDORDERASSIGNMENT_H
00002 #define BALL_STRUCTURE_BONDORDERS_PARTIALBONDORDERASSIGNMENT_H
00003 
00004 #ifndef BALL_COMMON_GLOBAL_H
00005 # include <BALL/COMMON/global.h>
00006 #endif
00007 
00008 #ifndef BALL_KERNEL_ATOM_H
00009 # include <BALL/KERNEL/atom.h>
00010 #endif
00011 
00012 #ifndef BALL_KERNEL_BOND_H
00013 # include <BALL/KERNEL/bond.h>
00014 #endif
00015 
00016 #include <boost/shared_ptr.hpp>
00017 #include <vector>
00018 
00019 namespace BALL
00020 {
00021   class AssignBondOrderProcessor;
00022   class BondOrderAssignment;
00023 
00033   class BALL_EXPORT PartialBondOrderAssignment
00034   {
00035     public:
00036       // this enum allows faster access to the type of the chosen heuristic than a string compare
00037       enum HEURISTIC_INDEX
00038       {
00039         SIMPLE,
00040         MEDIUM,
00041         TIGHT
00042       };
00043 
00044       // Constructor
00045       PartialBondOrderAssignment(AssignBondOrderProcessor* parent);
00046 
00047       // Destructor
00048       ~PartialBondOrderAssignment();
00049 
00050       boost::shared_ptr<BondOrderAssignment> convertToFullAssignment();
00051 
00052       // 
00053       void clear();
00054 
00055       // the less operator.
00056       // NOTE: we want a reverse sort, hence we actually return a "greater" 
00057       bool operator < (const PartialBondOrderAssignment& b) const;
00058 
00059       // the penalty
00060       float coarsePenalty(float atom_type_penalty, float bond_length_penalty) const;
00061 
00062       // the combined penalty of structure and type penalty
00063       float coarsePenalty() const;
00064 
00065       // the bond length penalty 
00066       float finePenalty() const {return estimated_bond_length_penalty;}
00067 
00069       float getAtomTypePenalty(bool include_heuristic_term = true, HEURISTIC_INDEX heuristic_index = SIMPLE);
00070 
00078       bool estimatePenalty_(bool include_heuristic_term = true, HEURISTIC_INDEX heuristic_index = SIMPLE);
00079 
00081       float estimateAtomTypePenalty_(Atom* atom,
00082                                      Index atom_index,    // the atom index
00083                                      int fixed_valence,   // its so far fixed valence (incl. virtual H's)
00084                                      int fixed_virtual_order, // its so far fixed virtual H's
00085                                      int num_free_bonds,  // its number of unfixed original bonds
00086                                      HEURISTIC_INDEX heuristic_index);
00087 
00089       //  NOTE: virtual bonds are excluded!
00090       float estimateBondLengthPenalty_(Index atom_index, // the atom index
00091                                        const vector<Bond*>& free_bonds,
00092                                        int fixed_virtual_order,
00093                                        int fixed_valence,
00094                                        int num_free_bonds);
00095 
00096 
00097       // the estimated atom type penalty
00098       float estimated_atom_type_penalty;
00099       // the estimated bond length penalty
00100       float estimated_bond_length_penalty;
00101 
00102       // the bond orders 
00103       // the i-th entry denotes the bondorder of the i-th bond
00104       // unset bonds get the order 0
00105       vector<short> bond_orders;
00106 
00107       // the index of the bond last considered 
00108       Position last_bond;
00109 
00110       AssignBondOrderProcessor* abop;
00111   };
00112 }
00113 
00114 #endif // BALL_STRUCTURE_BONDORDERS_PARTIALBONDORDERASSIGNMENT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines