Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
DupeResiduePDB.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file DupeResiduePDB.c
5 
6  \version V1.2
7  \date 07.07.14
8  \brief Create a new PDB linked list with a copy of a residue
9 
10  \copyright (c) Dr. Andrew C. R. Martin, UCL, 1996-2007
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 27.08.96 Original from mutmodel By: ACRM
50 - V1.1 08.11.07 Initialize p and q; Moved into bioplib
51 - V1.2 07.07.14 Use bl prefix for functions By: CTP
52 
53 *************************************************************************/
54 /* Doxygen
55  -------
56  #GROUP Handling PDB Data
57  #SUBGROUP Manipulating the PDB linked list
58  #FUNCTION blDupeResiduePDB()
59  Makes a duplicate PDB linked list of just one residue
60  Note that CONECT data will not be preserved since it would not
61  be valid.
62 */
63 /************************************************************************/
64 /* Includes
65 */
66 #include <stdlib.h>
67 #include "pdb.h"
68 #include "macros.h"
69 
70 /************************************************************************/
71 /* Defines and macros
72 */
73 
74 /************************************************************************/
75 /* Globals
76 */
77 
78 /************************************************************************/
79 /* Prototypes
80 */
81 
82 /************************************************************************/
83 /*>PDB *blDupeResiduePDB(PDB *in)
84  ----------------------------
85 *//**
86 
87  \param[in] *in PDB linked list pointing to residue to duplicate
88  \return Duplicate linked list of residue at `in'
89  (NULL if allocation fails)
90 
91  Makes a duplicate PDB linked list of just the residue pointed to by
92  `in'. Note that CONECT data will not be preserved since it would not
93  be valid.
94 
95 - 27.08.96 Original By: ACRM
96 - 08.11.07 Initialize p and q
97  Moved into bioplib
98 - 07.07.14 Use bl prefix for functions By: CTP
99 */
101 {
102  PDB *pNext,
103  *out = NULL,
104  *p = NULL,
105  *q = NULL;
106 
107  /* Find the next residue */
108  pNext = blFindNextResidue(in);
109 
110  for(p=in; p!=pNext; NEXT(p))
111  {
112  if(out==NULL)
113  {
114  INIT(out, PDB);
115  q=out;
116  }
117  else
118  {
119  ALLOCNEXT(q, PDB);
120  }
121  if(q==NULL)
122  {
123  FREELIST(out, PDB);
124  return(NULL);
125  }
126 
127  blCopyPDB(q, p);
128  q->nConect=0;
129  }
130 
131  return(out);
132 }
133 
134 
#define ALLOCNEXT(x, y)
Definition: macros.h:251
Include file for PDB routines.
#define NULL
Definition: array2.c:99
Definition: pdb.h:298
#define NEXT(x)
Definition: macros.h:249
Useful macros.
PDB * blDupeResiduePDB(PDB *in)
void blCopyPDB(PDB *out, PDB *in)
Definition: CopyPDB.c:108
#define FREELIST(y, z)
Definition: macros.h:264
#define INIT(x, y)
Definition: macros.h:244
PDB * blFindNextResidue(PDB *pdb)