-
Notifications
You must be signed in to change notification settings - Fork 1
/
hbenergy.c
72 lines (44 loc) · 2 KB
/
hbenergy.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "stride.h"
/*************************************************
Calculate the hydrogen bond energy as defined by
Boobbyer et al., 1989
**************************************************/
void GRID_Energy(float *CA2, float *C, float *O, float *H, float *N, COMMAND *Cmd, HBOND *HBond)
{
float ProjH[3];
/***** Distance dependence ( 8-6 potential ) ****/
if( Cmd->Truncate && HBond->AccDonDist < RmGRID )
HBond->AccDonDist = RmGRID;
HBond->Er = CGRID/pow(HBond->AccDonDist,8.0) - DGRID/pow(HBond->AccDonDist,6.0);
/************** Angular dependance ****************/
/* Find projection of the hydrogen on the O-C-CA plane */
Project4_123(O,C,CA2,H,ProjH);
/* Three angles determining the direction of the hydrogen bond */
HBond->ti = fabs(180.0 - Ang(ProjH,O,C));
HBond->to = Ang(H,O,ProjH);
HBond->p = Ang(N,H,O);
/* Calculate both angle-dependent HB energy components Et and Ep */
if( HBond->ti >= 0.0 && HBond->ti < 90.0 )
HBond->Et = cos(RAD(HBond->to))*(0.9+0.1*sin(RAD(2*HBond->ti)));
else
if( HBond->ti >= 90.0 && HBond->ti < 110.0 )
HBond->Et = K1GRID*cos(RAD(HBond->to))*
(pow((K2GRID-pow(cos(RAD(HBond->ti)),2.0)),3.0));
else
HBond->Et = 0.0;
if( HBond->p > 90.0 && HBond->p < 270.0 )
HBond->Ep = pow(cos(RAD(HBond->p)),2.0);
else
HBond->Ep = 0.0;
/******** Full hydrogen bond energy *********************/
HBond->Energy = 1000.0*HBond->Er*HBond->Et*HBond->Ep;
}
#define Q -27888.0
/********************************************************
Calculate the energy of polar interaction as defined by
Kabsch and Sander (1983)
*********************************************************/
void DSSP_Energy(float *Dummy, float *C, float *O, float *H, float *N, COMMAND *Cmd,
HBOND *HBond)
/* Dummy not used, for compatibility with GRID_Energy */
{ HBond->Energy = Q/Dist(O,H) + Q/Dist(C,N) - Q/HBond->AccDonDist - Q/Dist(C,H); }