OpenStructure
packing_potential.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_QA_PACKING_POTENTIAL_HH
20 #define OST_QA_PACKING_POTENTIAL_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 
26 
27 #include <boost/shared_ptr.hpp>
28 
30 
31 #include "packing_statistics.hh"
32 #include "multi_classifier.hh"
33 
34 namespace ost { namespace qa {
35 
40 
42  PackingPotentialOpts(int bucket_size, int max_count, Real cutoff,
43  Real sigma=0.02);
52 
53  template <typename DS>
54  void Serialize(DS& ds);
55 };
56 
58 typedef boost::shared_ptr<PackingPotential> PackingPotentialPtr;
59 
60 
65 public:
67 public:
69 
75  static PackingPotentialPtr Create(const PackingStatisticsPtr& stat,
76  const PackingPotentialOpts& opts,
77  bool calculate_average_energy_flag=0);
78 
79  static PackingPotentialPtr LoadFromFile(const String& filename);
80 
81  void SaveToFile(const String& filename);
82 
86  Real GetTotalEnergy(const mol::EntityView& view,
87  const mol::EntityViewList& views);
88 
89  int GetEnergyCounts();
90 
91 
92  Real GetPackingEnergy(AminoAcid aa, int count) const
93  {
94  count=count>options_.max_counts ? options_.max_counts : count;
95  return energies_.Get(aa, count/options_.bucket_size);
96  }
97  const PackingPotentialOpts& GetOptions() const { return options_; }
98  template <typename DS>
99  void Serialize(DS& ds);
100 
101 public:
103  virtual bool VisitAtom(const mol::AtomHandle& atom);
104 private:
110  void Fill(const PackingStatisticsPtr& stat,
111  bool calculate_average_energy_flag=0);
112 
113  PackingPotentialOpts options_;
114  PackingEnergies energies_;
115 
116  // used to calculate total energy...
117  mol::EntityView view_;
118  mol::EntityViewList views_;
119  Real energy_;
120  int energy_counts_;
121 };
122 
123 }}
124 
125 #endif
126