The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
CalcRMSPDB.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file CalcRMSPDB.c
5 
6  \version V1.4
7  \date 07.07.14
8  \brief Fit two PDB linked lists. Also a weighted fit and support
9  routines
10 
11  \copyright (c) UCL / Dr. Andrew C. R. Martin 1993-6
12  \author Dr. Andrew C. R. Martin
13  \par
14  Institute of Structural & Molecular Biology,
15  University College London,
16  Gower Street,
17  London.
18  WC1E 6BT.
19  \par
20  andrew@bioinf.org.uk
21  andrew.martin@ucl.ac.uk
22 
23 **************************************************************************
24 
25  This code is NOT IN THE PUBLIC DOMAIN, but it may be copied
26  according to the conditions laid out in the accompanying file
27  COPYING.DOC.
28 
29  The code may be modified as required, but any modifications must be
30  documented so that the person responsible can be identified.
31 
32  The code may not be sold commercially or included as part of a
33  commercial product except as described in the file COPYING.DOC.
34 
35 **************************************************************************
36 
37  Description:
38  ============
39 
40 
41 **************************************************************************
42 
43  Usage:
44  ======
45 
46 **************************************************************************
47 
48  Revision History:
49  =================
50 - V1.0 01.03.94 Original release
51 - V1.1 11.03.94 Fixed bug in calls to matfit(). Had not been changed
52  to reflect modification in MatMult3_33().
53 - V1.2 14.03.94 Fixed FitPDB(); wasn't filling in the output matrix
54 - V1.3 14.03.96 Added FitCaPDB()
55  Changed FitPDB() and FitCaCbPDB() to use
56  ApplyMatrixPDB() rather than RotatePDB() since the PDB
57  linked lists are already at the origin
58 - V1.4 07.07.14 Use bl prefix for functions By: CTP
59 
60 *************************************************************************/
61 /* Doxygen
62  -------
63  #GROUP Handling PDB Data
64  #SUBGROUP Calculations
65  #FUNCTION blCalcRMSPDB()
66  Calculate the RMS deviation between two pre-fitted PDB linked lists.
67 */
68 /************************************************************************/
69 /* Includes
70 */
71 #include <math.h>
72 #include <stdlib.h>
73 #include <string.h>
74 
75 #include "MathType.h"
76 #include "SysDefs.h"
77 #include "macros.h"
78 #include "fit.h"
79 #include "pdb.h"
80 
81 /************************************************************************/
82 /* Defines and macros
83 */
84 
85 /************************************************************************/
86 /* Globals
87 */
88 
89 /************************************************************************/
90 /* Prototypes
91 */
92 
93 /************************************************************************/
94 /*>REAL blCalcRMSPDB(PDB *pdb1, PDB *pdb2)
95  ---------------------------------------
96 *//**
97 
98  \param[in] *pdb1 First PDB linked list
99  \param[in] *pdb2 Second PDB linked list
100  \return RMS deviation
101 
102  Calculate the RMS deviation between two fitted PDB linked lists.
103  No fitting is done. The two lists must contain equivalent
104  structures (same atom types in same order). No checks are made
105  on this.
106 
107 - 11.03.94 Original By: ACRM
108 - 07.07.14 Use bl prefix for functions By: CTP
109 */
110 REAL blCalcRMSPDB(PDB *pdb1, PDB *pdb2)
111 {
112  PDB *p, *q;
113  int count = 0;
114  REAL dist = (REAL)0.0,
115  rms;
116 
117  for(p=pdb1, q=pdb2; p!=NULL && q!=NULL; NEXT(p), NEXT(q))
118  {
119  dist += DISTSQ(p,q);
120  count++;
121  }
122 
123  rms = (REAL)((count)?sqrt((double)(dist/(REAL)count)):0.0);
124  return(rms);
125 }
126 
127 
Include file for PDB routines.
#define NULL
Definition: array2.c:99
Definition: pdb.h:298
#define NEXT(x)
Definition: macros.h:249
Useful macros.
double REAL
Definition: MathType.h:67
Include file for least squares fitting.
System-type variable type definitions.
Type definitions for maths.
#define DISTSQ(a, b)
Definition: macros.h:228
REAL blCalcRMSPDB(PDB *pdb1, PDB *pdb2)
Definition: CalcRMSPDB.c:110