Victor
 All Data Structures Functions Variables Friends Pages
TorsionPotential.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 _TORSIONPOTENTIAL_H_
19 #define _TORSIONPOTENTIAL_H_
20 // Includes:
21 #include <vector>
22 #include <Spacer.h>
23 #include <AminoAcidCode.h>
24 #include <Potential.h>
25 
26 // Global constants, typedefs, etc. (to avoid):
27 
28 using namespace Victor::Energy;
29 
30 using namespace Victor::Biopool;
31 
32 using namespace Victor;
33  namespace Victor { namespace Energy {
34 
40  class TorsionPotential : public Potential {
41  public:
42  // CONSTRUCTORS/DESTRUCTOR:
43 
45  }
46 
47  virtual ~TorsionPotential() {
48  PRINT_NAME;
49  }
50 
51  // PREDICATES:
52  virtual long double calculateEnergy(Spacer& sp) = 0;
53  virtual long double calculateEnergy(Spacer& sp, unsigned int index1,
54  unsigned int index2) = 0;
55  virtual long double calculateEnergy(AminoAcid& aa) = 0;
56  virtual long double calculateEnergy(AminoAcid& aa, Spacer& sp) = 0;
57  virtual long double calculateEnergy(AminoAcid& diheds, AminoAcidCode code) = 0;
58 
59  //Max propensities environement independent
60  virtual double calculateMaxEnergy(Spacer& sp);
61  virtual double calculateMinEnergy(Spacer& sp);
62  virtual double calculateMaxEnergy(unsigned int amino);
63  virtual double calculateMinEnergy(unsigned int amino);
64  virtual double pReturnMaxPropensities(int amino) = 0;
65 
66  virtual double pReturnMinPropensities(int amino) {
67  ERROR("ERROR. NOT IMPLEMENTED FOR THIS CLASS.", exception)
68  }
69 
70  //Max propensities pre-amino angle phi/psi depend (not implemented in all version)
71 
72  virtual double pReturnMaxPropensitiesPreAngle(int amino, int prephi, int prepsi) {
73  ERROR("ERROR. NOT IMPLEMENTED FOR THIS CLASS.", exception)
74  }
75 
76  virtual double pReturnMinPropensitiesPreAngle(int amino, int prephi, int prepsi) {
77  ERROR("ERROR. NOT IMPLEMENTED FOR THIS CLASS.", exception)
78  }
79  //Usefull here only for calculate relative energy
80 
81  virtual int sGetPropBin2(double p) {
82  ERROR("ERROR. NOT IMPLEMENTED FOR THIS CLASS.", exception)
83  }
84 
85  virtual vector< vector<ANGLES> >* orderedEnergy() {
86  ERROR("ERROR. NOT IMPLEMENTED FOR THIS CLASS.", exception);
87  }
88 
89  virtual string getLabel() {
90  return "torsion potential";
91  }
92 
93  // MODIFIERS:
94 
95  // OPERATORS:
96 
97  protected:
98 
99  // HELPERS:
100  virtual void pConstructData() = 0;
101  virtual void pResetData() = 0;
102 
103  virtual double getOmegaAngle(int prop, long RANGE_OMEGA) {
104  ERROR("ERROR. NOT IMPLEMENTED FOR THIS CLASS.", exception)
105  }
106 
107  virtual double getPhiPsiAngle(int prop, long SIZE_TABLE, int ARC_STEP) {
108  ERROR("ERROR. NOT IMPLEMENTED FOR THIS CLASS.", exception)
109  }
110 
111  // ATTRIBUTES:
112 
113  private:
114 
115  };
116 
117  // ---------------------------------------------------------------------------
118  // TorsionPotential
119  // ---------------------------------------------------------------------------
120 
126  inline double TorsionPotential::calculateMaxEnergy(unsigned int amino) {
127  return -log(pReturnMaxPropensities(static_cast<int> (amino)));
128  }
129 
135  inline double TorsionPotential::calculateMinEnergy(unsigned int amino) {
136  return -log(pReturnMinPropensities(static_cast<int> (amino)));
137  }
138 
145  long double tmp = 0.0;
146  for (unsigned int i = 1; i < sp.sizeAmino() - 1; i++)
147  tmp += calculateMaxEnergy(sp.getAmino(i).getCode());
148  return tmp;
149  }
150 
157  long double tmp = 0.0;
158  for (unsigned int i = 1; i < sp.sizeAmino() - 1; i++)
159  tmp += calculateMinEnergy(sp.getAmino(i).getCode());
160  return tmp;
161  }
162 
163 
164 }} // namespace
165 #endif// _TORSIONPOTENTIAL_H_
166 
167 
168 
169 
170 
171 
AminoAcid & getAmino(unsigned int n)
Definition: Spacer.cc:962
const unsigned int sizeAmino() const
Definition: Spacer.cc:197
Abstract class for the energy potential.
Definition: Potential.h:37
virtual double calculateMaxEnergy(Spacer &sp)
Definition: TorsionPotential.h:144
It mplements a simple amino acid.
Definition: AminoAcid.h:43
This class implements a simple torsion potential based on the statistical preference of aminoacid typ...
Definition: TorsionPotential.h:40
Implements a "Spacer" for a protein chain. Includes methods to obtain values from the atoms and its p...
Definition: Spacer.h:42
virtual double calculateMinEnergy(Spacer &sp)
Definition: TorsionPotential.h:156