The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
Pages
src
RenumAtomsPDB.c
Go to the documentation of this file.
1
/************************************************************************/
2
/**
3
4
\file RenumAtomsPDB.c
5
6
\version V1.5
7
\date 29.04.15
8
\brief
9
10
\copyright (c) UCL / Dr. Andrew C. R. Martin 1993-2015
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.1 01.03.94 Original
50
- V1.2 27.02.98 Removed unreachable break from switch()
51
- V1.3 07.07.14 Use bl prefix for functions By: CTP
52
- V1.4 23.02.15 Properly handled TER card numbering and now takes an
53
additional parameter - an offset for the start of
54
numbering
55
- V1.5 29.04.15 Increment atom number at start of HETATM records.
56
By: CTP
57
*************************************************************************/
58
/* Doxygen
59
-------
60
#GROUP Handling PDB Data
61
#SUBGROUP Manipulating the PDB linked list
62
#FUNCTION blRenumAtomsPDB()
63
Renumber the atoms throughout a PDB linked list
64
*/
65
/************************************************************************/
66
/* Includes
67
*/
68
#include "
macros.h
"
69
#include "
pdb.h
"
70
71
/************************************************************************/
72
/* Defines and macros
73
*/
74
75
/************************************************************************/
76
/* Globals
77
*/
78
79
/************************************************************************/
80
/* Prototypes
81
*/
82
83
84
/************************************************************************/
85
/*>void blRenumAtomsPDB(PDB *pdb)
86
------------------------------
87
*/
/**
88
89
\param[in,out] *pdb PDB linked list to renumber
90
\param[in] offset Number for the first atom
91
92
Renumber the atoms throughout a PDB linked list
93
94
- 01.08.93 Original
95
- 07.07.14 Use bl prefix for functions By: CTP
96
- 23.02.15 More intelligent version that allows for TER records which
97
are also numbered. Added offset parameter.
98
- 29.04.15 Increment atom number at start of HETATM records. By: CTP
99
*/
100
void
blRenumAtomsPDB
(
PDB
*pdb,
int
offset)
101
{
102
PDB
*p,
103
*prev =
NULL
;
104
int
i;
105
106
i=offset;
107
108
for
(p=pdb; p!=
NULL
;
NEXT
(p))
109
{
110
/* If there is a prevous atom and the chain of this atom is
111
different from that of the previous atom, bump the atom
112
counter
113
or
114
If the current atom is a hetatm and the previous atom is a
115
standard atom then bump the atom counter.
116
*/
117
if
((prev !=
NULL
) &&
118
( (!
CHAINMATCH
(p->
chain
, prev->
chain
) ) ||
119
( (!strncmp(p->
record_type
,
"HETATM"
, 6)) &&
120
(!strncmp(prev->
record_type
,
"ATOM "
, 6)) )))
121
{
122
i++;
123
}
124
p->
atnum
=i++;
125
prev=p;
126
}
127
}
128
pdb.h
Include file for PDB routines.
NULL
#define NULL
Definition:
array2.c:99
pdb_entry
Definition:
pdb.h:298
NEXT
#define NEXT(x)
Definition:
macros.h:249
pdb_entry::atnum
int atnum
Definition:
pdb.h:309
pdb_entry::record_type
char record_type[8]
Definition:
pdb.h:315
macros.h
Useful macros.
CHAINMATCH
#define CHAINMATCH(chain1, chain2)
Definition:
pdb.h:495
pdb_entry::chain
char chain[blMAXCHAINLABEL]
Definition:
pdb.h:321
blRenumAtomsPDB
void blRenumAtomsPDB(PDB *pdb, int offset)
Definition:
RenumAtomsPDB.c:100
Generated on Tue Oct 24 2017 10:57:14 for Bioplib by
1.8.8