Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
FindRawAtomInRes.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file FindRawAtomInRes.c
5 
6  \version V1.13
7  \date 07.07.14
8  \brief PDB linked list manipulation
9 
10  \copyright (c) UCL / Dr. Andrew C. R. Martin 1992-2014
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 release
50 - V1.1 23.05.94 Added FindNextChainPDB()
51 - V1.2 05.10.94 KillSidechain() uses BOOL rather than int
52 - V1.3 24.07.95 Added TermPDB()
53 - V1.4 25.07.95 Added GetPDBChainLabels()
54 - V1.5 26.09.95 Fixed bug in TermPDB()
55 - V1.6 12.10.95 Added DupePDB(), CopyPDBCoords()
56 - V1.7 23.10.95 Moved FindResidueSpec() to ParseRes.c
57 - V1.8 10.01.96 Added ExtractZonePDB()
58 - V1.9 14.03.96 Added FindAtomInRes()
59 - V1.10 08.10.99 Initialised some variables
60 - V1.11 28.02.01 Added FindRawAtomInRes()
61 - V1.12 03.06.05 Compares 4 rather than 5 characters
62 - V1.13 07.07.14 Use bl prefix for functions By: CTP
63 
64 *************************************************************************/
65 /* Doxygen
66  -------
67  #GROUP Handling PDB Data
68  #SUBGROUP Searching the PDB linked list
69  #FUNCTION blFindRawAtomInRes()
70  Searches the raw atom name (atnam_raw) field of the current residue
71  for the specified atom name
72 */
73 /************************************************************************/
74 /* Includes
75 */
76 #include <math.h>
77 #include <stdlib.h>
78 
79 #include "MathType.h"
80 #include "SysDefs.h"
81 #include "pdb.h"
82 #include "macros.h"
83 #include "general.h"
84 
85 /************************************************************************/
86 /* Defines and macros
87 */
88 
89 /************************************************************************/
90 /* Globals
91 */
92 
93 /************************************************************************/
94 /* Prototypes
95 */
96 
97 /************************************************************************/
98 /*>PDB *blFindRawAtomInRes(PDB *pdb, char *atnam_in)
99  -------------------------------------------------
100 *//**
101 
102  \param[in] *pdb The beginning of a residue in a PDB
103  linked list
104  \param[in] *atnam_in An atom name to search for (doesn't need
105  to be space-padded)
106  \return Pointer to required atom, NULL if not
107  found
108 
109  Searches the raw atom name (atnam_raw) field for the specified atom
110  name
111 
112 - 28.02.01 Original based on FindAtomInRes() By: ACRM
113 - 03.06.05 Now compares 4 characters rather than 5
114 - 07.07.14 Use bl prefix for functions By: CTP
115 */
116 PDB *blFindRawAtomInRes(PDB *pdb, char *atnam_in)
117 {
118  PDB *end,
119  *p;
120 
121  char atnam[8];
122 
123  /* First copy the specified atom name and pad to 5 chars */
124  strcpy(atnam,atnam_in);
125  blPadterm(atnam,5);
126 
127  /* Find the end of this residue */
128  end = blFindNextResidue(pdb);
129 
130  /* Search for the required atom */
131  for(p=pdb; p!=end; NEXT(p))
132  {
133  if(!strncmp(p->atnam_raw,atnam,4))
134  return(p);
135  }
136 
137  return(NULL);
138 }
Include file for PDB routines.
#define NULL
Definition: array2.c:99
Definition: pdb.h:298
void blPadterm(char *string, int length)
Definition: padterm.c:117
#define NEXT(x)
Definition: macros.h:249
Useful macros.
PDB * blFindRawAtomInRes(PDB *pdb, char *atnam_in)
char atnam_raw[8]
Definition: pdb.h:317
Header file for general purpose routines.
System-type variable type definitions.
PDB * blFindNextResidue(PDB *pdb)
Type definitions for maths.