00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2010 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_QA_PACKING_POTENTIAL_HH 00020 #define OST_QA_PACKING_POTENTIAL_HH 00021 00022 /* 00023 Author: Marco Biasini 00024 */ 00025 00026 00027 #include <boost/shared_ptr.hpp> 00028 00029 #include <ost/mol/entity_visitor.hh> 00030 00031 #include "packing_statistics.hh" 00032 #include "multi_classifier.hh" 00033 00034 namespace ost { namespace qa { 00035 00036 struct DLLEXPORT_OST_QA PackingPotentialOpts { 00039 PackingPotentialOpts(); 00040 00042 PackingPotentialOpts(int bucket_size, int max_count, Real cutoff, 00043 Real sigma=0.02); 00045 Real sigma; 00047 Real cutoff; 00049 int bucket_size; 00051 int max_counts; 00052 00053 template <typename DS> 00054 void Serialize(DS& ds); 00055 }; 00056 00057 class PackingPotential; 00058 typedef boost::shared_ptr<PackingPotential> PackingPotentialPtr; 00059 00060 00064 class DLLEXPORT_OST_QA PackingPotential : public mol::EntityVisitor { 00065 public: 00066 typedef MultiClassifier<float, int, int> PackingEnergies; 00067 public: 00068 PackingPotential(); 00069 00075 static PackingPotentialPtr Create(const PackingStatisticsPtr& stat, 00076 const PackingPotentialOpts& opts, 00077 bool calculate_average_energy_flag=0); 00078 00079 static PackingPotentialPtr LoadFromFile(const String& filename); 00080 00081 void SaveToFile(const String& filename); 00082 00086 Real GetTotalEnergy(const mol::EntityView& view, 00087 const mol::EntityViewList& views); 00088 00089 int GetEnergyCounts(); 00090 00091 template <typename DS> 00092 void Serialize(DS& ds); 00093 00094 public: 00096 virtual bool VisitAtom(const mol::AtomHandle& atom); 00097 private: 00103 void Fill(const PackingStatisticsPtr& stat, 00104 bool calculate_average_energy_flag=0); 00105 00106 PackingPotentialOpts options_; 00107 PackingEnergies energies_; 00108 00109 // used to calculate total energy... 00110 mol::EntityView view_; 00111 mol::EntityViewList views_; 00112 Real energy_; 00113 int energy_counts_; 00114 }; 00115 00116 }} 00117 00118 #endif 00119
1.5.8