/* * PotentialTrainer.hpp * * Created on: Sep 11, 2014 * Author: heber */ #ifndef POTENTIALTRAINER_HPP_ #define POTENTIALTRAINER_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Potentials/SerializablePotential.hpp" class element; class HomologyContainer; class HomologyGraph; /** This class is a functor for training a (compound) potential from homologies. * */ class PotentialTrainer { public: PotentialTrainer(); ~PotentialTrainer(); bool operator()( const HomologyContainer &_homologies, const HomologyGraph &_graph, const boost::filesystem::path &_trainingfile, const unsigned int _maxiterations, const double _threshold, const unsigned int _best_of_howmany) const; /** Get the first matching homologous graph based only on the number of nodes. * * We could directly access the equal_range in the HomologyContainer we if were * specified the full HomologyGraph. However, if we have only get "CH4", then * we lack the bonding structure, hence one half of the graph is missing. * * Therefore, we step through all graphs and get the first to match exactly * with the number of specified element.s * * \param homologies container sorted by homologous fragments/graphs * \param types fragment specification, e.g. "CH4" * \return the first matching HomologyGraph */ static HomologyGraph getFirstGraphwithSpecifiedElements( const HomologyContainer &homologies, const SerializablePotential::ParticleTypes_t &types); static SerializablePotential::ParticleTypes_t getNumbersFromElements( const std::vector &fragment); }; #endif /* POTENTIALTRAINER_HPP_ */