Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
WriteCrystPDB.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file WriteCrystPDB.c
5 
6  \version V1.1
7  \date 07.07.14
8  \brief
9 
10  \copyright (c) UCL / Dr. Andrew C. R. Martin 1993-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.0R 12.10.05 Original
50 - V1.1 07.07.14 Use bl prefix for functions By: CTP
51 
52 *************************************************************************/
53 /* Doxygen
54  -------
55  #GROUP Handling PDB Data
56  #SUBGROUP File IO
57  #FUNCTION blWriteCrystPDB()
58  Write crystal parameters (unit cell, space group, origin and scale
59  matrices) to a PDB file.
60 */
61 /************************************************************************/
62 /* Includes
63 */
64 #include <stdio.h>
65 #include <math.h>
66 #include "MathType.h"
67 
68 /************************************************************************/
69 /* Defines and macros
70 */
71 
72 /************************************************************************/
73 /* Globals
74 */
75 
76 /************************************************************************/
77 /* Prototypes
78 */
79 
80 
81 /************************************************************************/
82 /*>void blWriteCrystPDB(FILE *fp, VEC3F UnitCell, VEC3F CellAngles,
83  char *spacegroup,
84  REAL OrigMatrix[3][4], REAL ScaleMatrix[3][4])
85  -------------------------------------------------------------------
86 *//**
87 
88  \param[in] *fp Output file pointet
89  \param[in] UnitCell The unit cell dimensions
90  \param[in] CellAngles The unit cell angles
91  \param[in] *spacegroup The crystal's space group
92  \param[in] OrigMatrix The origin matrix
93  \param[in] ScaleMatrix The scale matrix
94 
95  Write crystal parameters (unit cell, space group, origin and scale
96  matrices) to a PDB file.
97 
98 - 12.10.95 Original By: ACRM
99 - 17.10.95 Corrected %lf to %f in fprintf()s
100 - 07.07.14 Use bl prefix for functions By: CTP
101 */
102 void blWriteCrystPDB(FILE *fp, VEC3F UnitCell, VEC3F CellAngles,
103  char *spacegroup,
104  REAL OrigMatrix[3][4], REAL ScaleMatrix[3][4])
105 {
106  int i;
107 
108  CellAngles.x *= 180.0/PI;
109  CellAngles.y *= 180.0/PI;
110  CellAngles.z *= 180.0/PI;
111 
112  fprintf(fp,"CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f %14s\n",
113  UnitCell.x, UnitCell.y, UnitCell.z,
114  CellAngles.x, CellAngles.y, CellAngles.z, spacegroup);
115  for(i=0; i<3; i++)
116  {
117  fprintf(fp,"ORIGX%1d %10.6f%10.6f%10.6f%15.5f\n", i+1,
118  OrigMatrix[i][0],
119  OrigMatrix[i][1],
120  OrigMatrix[i][2],
121  OrigMatrix[i][3]);
122  }
123  for(i=0; i<3; i++)
124  {
125  fprintf(fp,"SCALE%1d %10.6f%10.6f%10.6f%15.5f\n", i+1,
126  ScaleMatrix[i][0],
127  ScaleMatrix[i][1],
128  ScaleMatrix[i][2],
129  ScaleMatrix[i][3]);
130  }
131 }
132 
REAL x
Definition: MathType.h:70
#define PI
Definition: macros.h:215
Definition: MathType.h:69
double REAL
Definition: MathType.h:67
void blWriteCrystPDB(FILE *fp, VEC3F UnitCell, VEC3F CellAngles, char *spacegroup, REAL OrigMatrix[3][4], REAL ScaleMatrix[3][4])
Type definitions for maths.
REAL z
Definition: MathType.h:70
REAL y
Definition: MathType.h:70