#include <BALL/STRUCTURE/assignBondOrderProcessor.h>
Bond Order assignment processor Assignment of bond orders from topology information.
Called with default options the processor computes up to Default::MAX_NUMBER_OF_SOLUTIONS many possible bond orders with optimal value and applies the first solution found to the given AtomContainer ac_.
AssignBondOrderProcessor bop; bop.options.setBool(AssignBondOrderProcessor::Option::COMPUTE_ALSO_NON_OPTIMAL_SOLUTIONS, true); ... sys.apply(bop); i = bop.getNumberOfComputedSolutions(); bop.apply(i-1); ... while (bop.computeNextSolution()) { i++; bop.apply(i); }
enum BALL::AssignBondOrderProcessor::HEURISTIC_INDEX [protected] |
BALL::AssignBondOrderProcessor::AssignBondOrderProcessor | ( | ) |
Default Constructor.
BALL::AssignBondOrderProcessor::AssignBondOrderProcessor | ( | const AssignBondOrderProcessor & | abop | ) |
Copy Construcor.
virtual BALL::AssignBondOrderProcessor::~AssignBondOrderProcessor | ( | ) | [virtual] |
Destructor.
Applies the i-th precomputed bond order combination.
Set the AtomContainer ac_'s bond orders to the ones found in the (already computed!) i-th solution, start counting in 0!
i | index of the solution, whose bond orders should be assigned. |
Applies the given solution.
BALL::AssignBondOrderProcessor::BALL_CREATE | ( | AssignBondOrderProcessor | ) |
void BALL::AssignBondOrderProcessor::clear | ( | ) |
Clears the datastructures. NOTE: The options remain! Use setDefaultOptions() to clear the options.
Computes and applies one of the next best solutions.
Ignores the options MAX_NUMBER_OF_SOLUTIONS and COMPUTE_ALSO_NON_OPTIMAL_SOLUTIONS .
Adds missing hydrogens as virtual hydrogens to the given Atom, determines the possible penalty blocks, and returns the maximal possible atom type penalty.
"virtual" means that NO atoms and bonds are added to the AtomContainer.
atom | the atom, to which the virtual hydrogens should be added. |
float BALL::AssignBondOrderProcessor::estimateAtomTypePenalty_ | ( | Atom * | atom, | |
Index | atom_index, | |||
int | fixed_valence, | |||
int | fixed_virtual_order, | |||
int | num_free_bonds, | |||
PQ_Entry_ & | entry | |||
) | [protected] |
Estimates the atom type penalty for a given unclosed atom.
float BALL::AssignBondOrderProcessor::estimateBondLengthPenalty_ | ( | Index | atom_index, | |
const vector< Bond * > & | free_bonds, | |||
int | fixed_virtual_order, | |||
int | fixed_valence, | |||
int | num_free_bonds | |||
) | [protected] |
Estimates the bond length penalty for a given unclosed atom.
bool BALL::AssignBondOrderProcessor::estimatePenalty_ | ( | PQ_Entry_ & | entry, | |
bool | include_heuristic_term = true | |||
) | [protected] |
Estimates the objective function f = g* + h* of the ASTAR - algorithm, if include_heuristic_term == true, otherwise compute only f = g*. The result is stored in the PQ_Entry_ entry's member estimated_atom_type_penalty.
bool | - true, if the entry is still valid. | |
bool | - false otherwise. |
float BALL::AssignBondOrderProcessor::evaluatePenalty | ( | AtomContainer * | ac | ) |
Evaluates the AtomContainer ac's bond orders as specified in the Options and returns the computed penalty.
ac | AtomContainer, whose bond orders should be evalated. |
virtual bool BALL::AssignBondOrderProcessor::finish | ( | ) | [virtual] |
Processor method which is called after the operator()-call.
Reimplemented from BALL::UnaryProcessor< AtomContainer >.
AtomContainer const* BALL::AssignBondOrderProcessor::getAtomContainer | ( | ) | const [inline] |
Returns a nonmutable pointer to the original Molecule as AtomContainer.
AtomContainer* BALL::AssignBondOrderProcessor::getAtomContainer | ( | ) | [inline] |
Returns a pointer to the original Molecule as AtomContainer.
Returns the number of added hydrogens in Solution i.
References BALL::LogStream::error(), and BALL::Log.
Size BALL::AssignBondOrderProcessor::getNumberOfComputedSolutions | ( | ) | [inline] |
Returns the number of already computed solutions.
NOTE: Having applied the operator with option ALGORITHM::ASTAR this method returns the number of optimal solutions+1!
int BALL::AssignBondOrderProcessor::getNumberOfNodeExpansions | ( | Position | i | ) | [inline] |
References BALL::LogStream::error(), and BALL::Log.
int BALL::AssignBondOrderProcessor::getNumberOfNodeExpansions_ | ( | const Solution_ & | sol | ) | [inline, protected] |
int BALL::AssignBondOrderProcessor::getPenaltyClass_ | ( | Atom * | atom | ) | [protected] |
Finds the first matching SMARTS-expression in the penalty-vector and returns its index.
int | - -1 if there is no matching expression |
int BALL::AssignBondOrderProcessor::getQueueSize | ( | Position | i | ) | [inline] |
References BALL::LogStream::error(), and BALL::Log.
int BALL::AssignBondOrderProcessor::getQueueSize_ | ( | const Solution_ & | sol | ) | [inline, protected] |
const System& BALL::AssignBondOrderProcessor::getSolution | ( | Position | i | ) | throw (Exception::IndexOverflow) |
Returns a reference to the original system to which solution i was applied.
NOTE: This method has the same effect as calling apply(i)!
i | index of the solution, whose bond order assignment should be applied. |
Returns the total charge of solution i.
i | index of the solution, whose charge should be computed. |
References BALL::LogStream::error(), BALL::Log, and BALL::Maths::max().
Returns the total charge of a solution.
sol | solution, whose charge should be computed. |
References BALL::AssignBondOrderProcessor::Solution_::total_charge, and BALL::AssignBondOrderProcessor::Solution_::valid.
Returns the total penalty of solution i.
i | index of the solution, whose penalty should be returned. |
References BALL::LogStream::error(), BALL::Log, and BALL::Maths::max().
float BALL::AssignBondOrderProcessor::getTotalPenalty_ | ( | const Solution_ & | sol | ) | [inline, protected] |
Returns the total penalty of the given solution.
sol | solution, whose penalty should be returned. |
References BALL::AssignBondOrderProcessor::Solution_::atom_type_penalty, and BALL::AssignBondOrderProcessor::Solution_::bond_length_penalty.
virtual Processor::Result BALL::AssignBondOrderProcessor::operator() | ( | AtomContainer & | ac | ) | [virtual] |
Operator () for the processor
Called with Default-options the processor computes all possible bond orders with optimal value and applies the first solution to the given AtomContainer ac_.
ac | the AtomContainer to which the processor is applied. |
Reimplemented from BALL::UnaryProcessor< AtomContainer >.
AssignBondOrderProcessor& BALL::AssignBondOrderProcessor::operator= | ( | const AssignBondOrderProcessor & | abop | ) |
assignment operator
bool BALL::AssignBondOrderProcessor::performAStarStep_ | ( | ) | [protected] |
Computes a next solution in the ASTAR - algorithm.
bool BALL::AssignBondOrderProcessor::performBranchAndBound_ | ( | ) | [protected] |
vector<PQ_Entry_> BALL::AssignBondOrderProcessor::performGreedy_ | ( | PQ_Entry_ & | entry, | |
Size | greedy_k = 10 | |||
) | [protected] |
bool BALL::AssignBondOrderProcessor::preassignPenaltyClasses_ | ( | ) | [protected] |
Assigns every atom of the AtomContainer to which the processor is applied to a block of possible valences and the corresponding penalties.
bool | - false if the AtomContainer to which the processor is applied to has an atom with no matching penalty block. | |
bool | - true otherwise |
bool BALL::AssignBondOrderProcessor::precomputeBondLengthPenalties_ | ( | ) | [protected] |
Precomputes for every bond of the AtomContainer, to which the processor is applied to, the possible bond length penalties resulting from deviation of the actual bond length to a standard length for bonds with same atom types and the chosen bond order.
bool | - false if the AtomContainer is invalid or the processor is in an invalid state | |
bool | - true otherwise |
bool BALL::AssignBondOrderProcessor::readAtomPenalties_ | ( | ) | throw (Exception::FileNotFound()) [protected] |
Reads and stores the penalty-INIFile (for example BondOrder.ini).
bool BALL::AssignBondOrderProcessor::readOptions_ | ( | ) | [protected] |
Reads, checks and stores the options.
bool - false if one of the options got an invalid value.
bool - true otherwise
void BALL::AssignBondOrderProcessor::resetBondOrders | ( | ) |
Reset all bond orders and assigned hydrogens.
Resets the AtomContainer we are operating on to the bond order configuration it had before applying the AssignBondOrderProcessor.
void BALL::AssignBondOrderProcessor::setDefaultOptions | ( | ) |
Resets the options to default values.
virtual bool BALL::AssignBondOrderProcessor::start | ( | ) | [virtual] |
Processor method which is called before the operator()-call.
Reimplemented from BALL::UnaryProcessor< AtomContainer >.
void BALL::AssignBondOrderProcessor::storeOriginalConfiguration_ | ( | ) | [protected] |
Stores the original configuration of the atom container.
friend class PQ_Entry_ [friend] |
friend class Solution [friend] |
AtomContainer* BALL::AssignBondOrderProcessor::ac_ [protected] |
float BALL::AssignBondOrderProcessor::alpha_ [protected] |
vector< vector<int> > BALL::AssignBondOrderProcessor::atom_to_block_ [protected] |
HashMap<Atom*, int> BALL::AssignBondOrderProcessor::atom_to_virtual_bond_index_ [protected] |
vector<std::pair<String, String> > BALL::AssignBondOrderProcessor::block_definition_ [protected] |
vector<Size> BALL::AssignBondOrderProcessor::block_to_length_ [protected] |
vector<Position> BALL::AssignBondOrderProcessor::block_to_start_idx_ [protected] |
vector<int> BALL::AssignBondOrderProcessor::block_to_start_valence_ [protected] |
std::map<Bond*, short> BALL::AssignBondOrderProcessor::bond_fixed_ [protected] |
HashMap<Bond*, vector<float> > BALL::AssignBondOrderProcessor::bond_lengths_penalties_ [protected] |
HashMap<Bond*, Index> BALL::AssignBondOrderProcessor::bond_to_index_ [protected] |
bool BALL::AssignBondOrderProcessor::evaluation_mode_ [protected] |
std::vector<Position> BALL::AssignBondOrderProcessor::fixed_val_ [protected] |
std::vector<Bond*> BALL::AssignBondOrderProcessor::free_bonds_ [protected] |
int BALL::AssignBondOrderProcessor::greedy_node_expansions_ [protected] |
std::vector<Bond*> BALL::AssignBondOrderProcessor::ilp_index_to_free_bond_ [protected] |
std::vector<Bond*> BALL::AssignBondOrderProcessor::index_to_bond_ [protected] |
int BALL::AssignBondOrderProcessor::last_applied_solution_ [protected] |
int BALL::AssignBondOrderProcessor::max_bond_order_ [protected] |
int BALL::AssignBondOrderProcessor::max_number_of_solutions_ [protected] |
int BALL::AssignBondOrderProcessor::num_of_free_bonds_ [protected] |
HashMap<Atom*, int> BALL::AssignBondOrderProcessor::number_of_virtual_hydrogens_ [protected] |
vector<int> BALL::AssignBondOrderProcessor::penalties_ [protected] |
std::priority_queue<PQ_Entry_> BALL::AssignBondOrderProcessor::queue_ [protected] |
The priority queue.
vector<Solution_> BALL::AssignBondOrderProcessor::solutions_ [protected] |
int BALL::AssignBondOrderProcessor::step_ [protected] |
Timer BALL::AssignBondOrderProcessor::timer_ [protected] |
bool BALL::AssignBondOrderProcessor::valid_ [protected] |
Bond* BALL::AssignBondOrderProcessor::virtual_bond_ [protected] |
vector<Atom*> BALL::AssignBondOrderProcessor::virtual_bond_index_to_atom_ [protected] |
std::vector<int> BALL::AssignBondOrderProcessor::virtual_bond_index_to_number_of_virtual_hydrogens_ [protected] |