Victor
 All Data Structures Functions Variables Friends Pages
RapdfPotential.h
1 /* This file is part of Victor.
2 
3  Victor is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 3 of the License, or
6  (at your option) any later version.
7 
8  Victor is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with Victor. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 
18 #ifndef _RAPDFPOTENTIAL_H_
19 #define _RAPDFPOTENTIAL_H_
20 // Includes:
21 #include <vector>
22 #include <Potential.h>
23 
24 // Global constants, typedefs, etc. (to avoid):
25 const unsigned int MAX_BINS = 18;
26 const unsigned int MAX_TYPES = 168;
27 
28  namespace Victor { namespace Energy {
29 
39  class RapdfPotential : public Potential {
40  public:
41 
42  // CONSTRUCTORS/DESTRUCTOR:
44 
45  virtual ~RapdfPotential() {
46  PRINT_NAME;
47  }
48 
49  // PREDICATES:
50  virtual long double calculateEnergy(Spacer& sp);
51  virtual long double calculateEnergy(Spacer& sp, unsigned int index1,
52  unsigned int index2);
53  virtual long double calculateEnergy(AminoAcid& aa, Spacer& sp);
54  virtual long double calculateEnergy(AminoAcid& aa, AminoAcid& aa2);
55  virtual long double calculateEnergy(Atom& at1, Atom& at2, string aaType,
56  string aaType2);
57 
58  // MODIFIERS:
59  // OPERATORS:
60 
61  protected:
62 
63  // HELPERS:
64  unsigned int pGetDistanceBinOne(double distance);
65  unsigned int pGetGroupBin(const char* group_name);
66 
67  // ATTRIBUTES:
68  double prob[MAX_BINS][MAX_TYPES][MAX_TYPES];
69 
70  public:
71 
72  string path;
73  private:
74 
75  };
76 
77  // ---------------------------------------------------------------------------
78  // RapdfPotential
79  // -----------------x-------------------x-------------------x-----------------
80 
86  inline long double RapdfPotential::calculateEnergy(Atom& at1, Atom& at2, string aaType,
87  string aaType2) {
88  double d = at1.distance(at2);
89  if ((d >= 20.0) || (at1.getType() == "OXT") || (at2.getType() == "OXT")
90  || ((at1.getType() == "CB") && (aaType == "GLY"))
91  || ((at2.getType() == "CB") && (aaType2 == "GLY")))
92  return 0.0;
93  string tmp1 = threeLetter2OneLetter(aaType) + at1.getType();
94  string tmp2 = threeLetter2OneLetter(aaType2) + at2.getType();
95  unsigned int dist = pGetDistanceBinOne(d);
96  unsigned int grp1 = pGetGroupBin(tmp1.c_str());
97  unsigned int grp2 = pGetGroupBin(tmp2.c_str());
98  if (dist + grp1 + grp2 < 999)
99  return prob[dist][grp1][grp2];
100  else // ignore errors
101  return 0;
102  }
103 
104 }} // namespace
105 #endif //_RAPDFPOTENTIAL_H_
RapdfPotential()
Definition: RapdfPotential.cc:37
double distance(Atom &other)
Definition: Atom.cc:66
virtual string getType() const
Definition: SimpleBond.h:114
unsigned int pGetGroupBin(const char *group_name)
Definition: RapdfPotential.cc:187
unsigned int pGetDistanceBinOne(double distance)
Definition: RapdfPotential.cc:154
Distance-dependent residue-specific all-atom probability discriminatory function. ...
Definition: RapdfPotential.h:39
Abstract class for the energy potential.
Definition: Potential.h:37
Implements a simple atom type.
Definition: Atom.h:39
virtual long double calculateEnergy(Spacer &sp)
Definition: RapdfPotential.cc:67
It mplements a simple amino acid.
Definition: AminoAcid.h:43
Implements a "Spacer" for a protein chain. Includes methods to obtain values from the atoms and its p...
Definition: Spacer.h:42