The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
GetPDBCoor.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file GetPDBCoor.c
5 
6  \version V1.3
7  \date 14.03.96
8  \brief
9 
10  \copyright (c) UCL / Dr. Andrew C. R. Martin 1993-6
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 01.03.94 Original release
50 - V1.1 11.03.94 Fixed bug in calls to matfit(). Had not been changed
51  to reflect modification in MatMult3_33().
52 - V1.2 14.03.94 Fixed FitPDB(); wasn't filling in the output matrix
53 - V1.3 14.03.96 Added FitCaPDB()
54  Changed FitPDB() and FitCaCbPDB() to use
55  ApplyMatrixPDB() rather than RotatePDB() since the PDB
56  linked lists are already at the origin
57 
58 *************************************************************************/
59 /* Doxygen
60  -------
61  #GROUP Handling PDB Data
62  #SUBGROUP Extracting data
63  #FUNCTION blGetPDBCoor()
64  Get the coordinates out of a PDB linked list into an array of type COOR
65  The COOR array is allocated for you
66 */
67 /************************************************************************/
68 /* Includes
69 */
70 #include <stdlib.h>
71 
72 #include "pdb.h"
73 #include "macros.h"
74 
75 /************************************************************************/
76 /* Defines and macros
77 */
78 
79 /************************************************************************/
80 /* Globals
81 */
82 
83 /************************************************************************/
84 /* Prototypes
85 */
86 
87 
88 /************************************************************************/
89 /*>int blGetPDBCoor(PDB *pdb, COOR **coor)
90  ---------------------------------------
91 *//**
92 
93  \param[in] *pdb PDB linked list
94  \param[out] **coor Array of coordinate structure pointers
95  \return Number of coordinates copied
96 
97  Get the coordinates out of a PDB linked list into an array of type COOR
98  The COOR array is allocated for you
99 
100 - 17.06.93 Original By: ACRM
101 - 22.06.93 Corrected return value
102 - 07.07.14 Use bl prefix for functions By: CTP
103 */
104 int blGetPDBCoor(PDB *pdb, COOR **coor)
105 {
106  PDB *p;
107  int NAtoms;
108 
109  /* Check valid pdb linked list */
110  if(pdb == NULL) return(0);
111 
112  /* Count the atoms in the PDB linked list */
113  for(p=pdb,NAtoms=0; p!=NULL; NEXT(p)) NAtoms++;
114 
115  /* Allocate memory for coordinate array */
116  *coor = (COOR *)malloc(NAtoms * sizeof(COOR));
117  if(*coor == NULL) return(0);
118 
119  /* Copy the coordinates into the array */
120  for(p=pdb,NAtoms=0; p!=NULL; NEXT(p),NAtoms++)
121  {
122  (*coor)[NAtoms].x = p->x;
123  (*coor)[NAtoms].y = p->y;
124  (*coor)[NAtoms].z = p->z;
125  }
126 
127  return(NAtoms);
128 }
129 
130 
Include file for PDB routines.
REAL x
Definition: MathType.h:70
#define NULL
Definition: array2.c:99
Definition: pdb.h:298
#define NEXT(x)
Definition: macros.h:249
Useful macros.
Definition: MathType.h:69
int blGetPDBCoor(PDB *pdb, COOR **coor)
Definition: GetPDBCoor.c:104
REAL z
Definition: pdb.h:300
REAL x
Definition: pdb.h:300
REAL y
Definition: pdb.h:300