Fixes for Windows/ICC--typecasting
[gromacs.git] / include / pdbio.h
blobc05431139eaae6049952204c4597bbc5d17725b9
1 /*
2 *
3 * This source code is part of
4 *
5 * G R O M A C S
6 *
7 * GROningen MAchine for Chemical Simulations
8 *
9 * VERSION 3.2.0
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gromacs Runs On Most of All Computer Systems
36 #ifndef _pdbio_h
37 #define _pdbio_h
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
43 #include "sysstuff.h"
44 #include "typedefs.h"
45 #include "symtab.h"
46 #include "atomprop.h"
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
52 typedef struct gmx_conect_t *gmx_conect;
54 /* THE pdb format (for ATOM/HETATOM lines) */
55 static const char *pdbformat ="%-6s%5u %-4.4s%3.3s %c%4d%c %8.3f%8.3f%8.3f";
56 static const char *pdbformat4="%-6s%5u %-4.4s %3.3s %c%4d%c %8.3f%8.3f%8.3f";
58 /* Enumerated type for pdb records. The other entries are ignored
59 * when reading a pdb file
61 enum { epdbATOM, epdbHETATM, epdbANISOU, epdbCRYST1, epdbCOMPND,
62 epdbMODEL, epdbENDMDL, epdbTER, epdbHEADER, epdbTITLE, epdbREMARK,
63 epdbCONECT, epdbNR };
65 /* Enumerated value for indexing an uij entry (anisotropic temperature factors) */
66 enum { U11, U22, U33, U12, U13, U23 };
68 extern void set_pdb_wide_format(bool bSet);
69 /* If bSet, use wider format for occupancy and bfactor */
71 extern void pdb_use_ter(bool bSet);
72 /* set read_pdbatoms to read upto 'TER' or 'ENDMDL' (default, bSet=FALSE) */
74 extern void gmx_write_pdb_box(FILE *out,int ePBC,matrix box);
75 /* write the box in the CRYST1 record,
76 * with ePBC=-1 the pbc is guessed from the box
79 extern void write_pdbfile_indexed(FILE *out,const char *title,t_atoms *atoms,
80 rvec x[],int ePBC,matrix box,char chain,
81 int model_nr,atom_id nindex,atom_id index[],
82 gmx_conect conect);
83 /* REALLY low level */
85 extern void write_pdbfile(FILE *out,const char *title,t_atoms *atoms,
86 rvec x[],int ePBC,matrix box,char chain,
87 int model_nr,gmx_conect conect);
88 /* Low level pdb file writing routine.
90 * ONLY FOR SPECIAL PURPOSES,
92 * USE write_sto_conf WHEN YOU CAN.
94 * override chain-identifiers with chain when chain>0
95 * write ENDMDL when bEndmodel is TRUE.
97 * If the gmx_conect structure is not NULL its content is dumped as CONECT records
98 * which may be useful for visualization purposes.
101 extern void get_pdb_atomnumber(t_atoms *atoms,gmx_atomprop_t aps);
102 /* Routine to extract atomic numbers from the atom names */
104 extern int read_pdbfile(FILE *in,char *title,int *model_nr,
105 t_atoms *atoms,rvec x[],int *ePBC,matrix box,
106 bool bChange,gmx_conect conect);
107 /* Function returns number of atoms found.
108 * ePBC and gmx_conect structure may be NULL.
111 extern void read_pdb_conf(const char *infile,char *title,
112 t_atoms *atoms,rvec x[],int *ePBC,matrix box,
113 bool bChange,gmx_conect conect);
114 /* Read a pdb file and extract ATOM and HETATM fields.
115 * Read a box from the CRYST1 line, return 0 box when no CRYST1 is found.
116 * Change atom names according to protein conventions if wanted.
117 * ePBC and gmx_conect structure may be NULL.
120 extern void get_pdb_coordnum(FILE *in,int *natoms);
121 /* Read a pdb file and count the ATOM and HETATM fields. */
123 extern bool is_hydrogen(const char *nm);
124 /* Return whether atom nm is a hydrogen */
126 extern bool is_dummymass(const char *nm);
127 /* Return whether atom nm is a dummy mass */
129 /* Routines to handle CONECT records if they have been read in */
130 extern void gmx_conect_dump(FILE *fp,gmx_conect conect);
132 extern bool gmx_conect_exist(gmx_conect conect,int ai,int aj);
133 /* Return TRUE if there is a conection between the atoms */
135 extern void gmx_conect_add(gmx_conect conect,int ai,int aj);
136 /* Add a connection between ai and aj (numbered from 0 to natom-1) */
138 extern gmx_conect gmx_conect_generate(t_topology *top);
139 /* Generate a conect structure from a topology */
141 extern gmx_conect gmx_conect_init();
142 /* Initiate data structure */
144 extern void gmx_conect_done(gmx_conect gc);
145 /* Free memory */
147 #ifdef __cplusplus
149 #endif
151 #endif /* _pdbio_h */