OpenStructure
reduced_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_REDUCED_POTENTIAL_HH
20 #define OST_QA_REDUCED_POTENTIAL_HH
21 
23 
24 
25 namespace ost { namespace qa {
26 
27 
29 
30 typedef boost::shared_ptr<ReducedPotential> ReducedPotentialPtr;
31 
35 public:
36 
37 
38 
39  static ReducedPotentialPtr Create(const ReducedStatisticsPtr& stats);
40  static ReducedPotentialPtr Load(const String& filename);
41 
42  void Save(const String& filename);
43 
44 
45  template <typename DS>
46  void Serialize(DS& ds);
47 
48  const ReducedStatOptions& GetOptions() const { return opts_; }
49 
50  Real GetTotalEnergy(ost::mol::EntityHandle ent, bool normalize=true);
51 
52  Real GetTotalEnergy(ost::mol::EntityView ent, bool normalize=true);
53  static bool GetCAlphaCBetaPos(const mol::ResidueHandle& res,
54  geom::Vec3& ca_pos,
55  geom::Vec3& cb_pos);
56 
57  Real GetEnergy(AminoAcid aa_one, AminoAcid aa_two,
58  Real ca_dist, Real angle) const
59  {
60  if (aa_one==Xxx || aa_two==Xxx) { return 0.0; }
61  if (ca_dist<opts_.lower_cutoff || ca_dist>=opts_.upper_cutoff) {
62  return 0.0;
63  }
64  if (angle<0.0 || angle>M_PI) { return 0.0; }
65  return energies_.Get(aa_one, aa_two, ca_dist, angle);
66  }
67 private:
68  void InitFromStats(const ReducedStatisticsPtr& stats);
69  ReducedPotential() { }
70 
71  ReducedStatOptions opts_;
72  ReducedEnergies energies_;
73 };
74 
75 
76 }}
77 
78 #endif