The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
CalcChiPDB.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file CalcChiPDB.c
5 
6  \version V1.3
7  \date 14.12.16
8  \brief Perform calculations on PDB linked list
9 
10  \copyright (c) UCL / Dr. Andrew C. R. Martin 1993-2016
11  \author Dr. Andrew C. R. Martin
12  \par
13  Institute of Structural & Molecular Biology,
14  University College London,
15  Gower Street,
16  London.
17  WC1E 6BT.
18  \par
19  andrew@bioinf.org.uk
20  andrew.martin@ucl.ac.uk
21 
22 **************************************************************************
23 
24  This code is NOT IN THE PUBLIC DOMAIN, but it may be copied
25  according to the conditions laid out in the accompanying file
26  COPYING.DOC.
27 
28  The code may be modified as required, but any modifications must be
29  documented so that the person responsible can be identified.
30 
31  The code may not be sold commercially or included as part of a
32  commercial product except as described in the file COPYING.DOC.
33 
34 **************************************************************************
35 
36  Description:
37  ============
38 
39 
40 **************************************************************************
41 
42  Usage:
43  ======
44 
45 **************************************************************************
46 
47  Revision History:
48  =================
49 - V1.0 22.02.94 Original
50 - V1.1 27.02.98 Removed unreachable break from switch()
51 - V1.2 07.07.14 Use bl prefix for functions By: CTP
52 - V1.3 14.12.16 blCalcChi() now checks that all atoms found By: ACRM
53 
54 *************************************************************************/
55 /* Doxygen
56  -------
57  #GROUP Handling PDB Data
58  #SUBGROUP Calculations
59  #FUNCTION blCalcChi()
60  Calculates a sidechain torsion angle from a pdb linked list. Returns
61  9999.0 if any atoms not found
62 */
63 /************************************************************************/
64 /* Includes
65 */
66 #include <math.h>
67 
68 #include "MathType.h"
69 #include "macros.h"
70 #include "pdb.h"
71 #include "angle.h"
72 
73 /************************************************************************/
74 /* Defines and macros
75 */
76 
77 /************************************************************************/
78 /* Globals
79 */
80 
81 /************************************************************************/
82 /* Prototypes
83 */
84 
85 /************************************************************************/
86 /*>REAL blCalcChi(PDB *pdb, int type)
87  ----------------------------------
88 *//**
89 
90  \param[in] *pdb PDB linked list
91  \param[in] type Torsion type (see below)
92  \return Torsion angle
93 
94  Calculates a sidechain torsion angle from a pdb linked list. The atoms
95  to be included in the calculation are specified by type.
96 
97 
98  type Atom names Sequential atom numbers
99  --------------------------------------------------
100  0 N, CA, CB, XG (0 - 1 - 4 - 5)
101  1 CA, CB, XG, XD (1 - 4 - 5 - 6)
102  2 CB, XG, XD, XE (4 - 5 - 6 - 7)
103  3 XG, XD, XE, XZ (5 - 6 - 7 - 8)
104 
105 - 13.05.92 Original
106 - 27.02.98 Removed unreachable break from switch()
107 - 07.07.14 Use bl prefix for functions By: CTP
108 - 14.12.16 Added check that all atoms are found
109  Returns 9999.0 if any atom not found By: ACRM
110 */
111 REAL blCalcChi(PDB *pdb, int type)
112 {
113  REAL chi = 0.0;
114  PDB *one,
115  *two,
116  *three,
117  *four;
118 
119  switch(type)
120  {
121  case 0: /* N, CA, CB, XG (0 - 1 - 4 - 5) */
122  one = blGetPDBByN(pdb, 0);
123  two = blGetPDBByN(pdb, 1);
124  three = blGetPDBByN(pdb, 4);
125  four = blGetPDBByN(pdb, 5);
126  break;
127  case 1: /* CA, CB, XG, XD (1 - 4 - 5 - 6) */
128  one = blGetPDBByN(pdb, 1);
129  two = blGetPDBByN(pdb, 4);
130  three = blGetPDBByN(pdb, 5);
131  four = blGetPDBByN(pdb, 6);
132  break;
133  case 2: /* CB, XG, XD, XE (4 - 5 - 6 - 7) */
134  one = blGetPDBByN(pdb, 4);
135  two = blGetPDBByN(pdb, 5);
136  three = blGetPDBByN(pdb, 6);
137  four = blGetPDBByN(pdb, 7);
138  break;
139  case 3: /* XG, XD, XE, XZ (5 - 6 - 7 - 8) */
140  one = blGetPDBByN(pdb, 5);
141  two = blGetPDBByN(pdb, 6);
142  three = blGetPDBByN(pdb, 7);
143  four = blGetPDBByN(pdb, 8);
144  break;
145  default:
146  return(chi);
147  }
148 
149  if((one == NULL) || (two == NULL) || (three == NULL) || (four == NULL))
150  return(9999.0);
151 
152  /* Calculate the torsion angle */
153  chi = blPhi(one->x, one->y, one->z,
154  two->x, two->y, two->z,
155  three->x, three->y, three->z,
156  four->x, four->y, four->z);
157 
158  return(chi);
159 }
160 
Include file for PDB routines.
#define NULL
Definition: array2.c:99
Definition: pdb.h:298
Useful macros.
double REAL
Definition: MathType.h:67
REAL blPhi(REAL xi, REAL yi, REAL zi, REAL xj, REAL yj, REAL zj, REAL xk, REAL yk, REAL zk, REAL xl, REAL yl, REAL zl)
Definition: phi.c:107
REAL z
Definition: pdb.h:300
Include file for angle functions.
REAL blCalcChi(PDB *pdb, int type)
Definition: CalcChiPDB.c:111
PDB * blGetPDBByN(PDB *pdb, int n)
Definition: GetPDBByN.c:106
Type definitions for maths.
REAL x
Definition: pdb.h:300
REAL y
Definition: pdb.h:300