2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2013,2014, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
38 #ifndef GMX_FILEIO_PDBIO_H
39 #define GMX_FILEIO_PDBIO_H
43 #include "../legacyheaders/types/simple.h"
53 typedef struct gmx_conect_t *gmx_conect;
55 /* Enumerated type for pdb records. The other entries are ignored
56 * when reading a pdb file
59 epdbATOM, epdbHETATM, epdbANISOU, epdbCRYST1, epdbCOMPND,
60 epdbMODEL, epdbENDMDL, epdbTER, epdbHEADER, epdbTITLE, epdbREMARK,
64 /* Write a PDB line with an ATOM or HETATM record directly to a file pointer.
66 * Returns the number of characters printed.
69 gmx_fprintf_pdb_atomline(FILE * fp,
70 enum PDB_record record,
72 const char * atom_name,
73 char alternate_location,
74 const char * res_name,
77 char res_insertion_code,
83 const char * element);
85 /* Enumerated value for indexing an uij entry (anisotropic temperature factors) */
87 U11, U22, U33, U12, U13, U23
90 void pdb_use_ter(gmx_bool bSet);
91 /* set read_pdbatoms to read upto 'TER' or 'ENDMDL' (default, bSet=FALSE).
92 This function is fundamentally broken as far as thread-safety is concerned.*/
94 void gmx_write_pdb_box(FILE *out, int ePBC, matrix box);
95 /* write the box in the CRYST1 record,
96 * with ePBC=-1 the pbc is guessed from the box
97 * This function is fundamentally broken as far as thread-safety is concerned.
100 void write_pdbfile_indexed(FILE *out, const char *title, struct t_atoms *atoms,
101 rvec x[], int ePBC, matrix box, char chain,
102 int model_nr, atom_id nindex, const atom_id index[],
103 gmx_conect conect, gmx_bool bTerSepChains);
104 /* REALLY low level */
106 void write_pdbfile(FILE *out, const char *title, struct t_atoms *atoms,
107 rvec x[], int ePBC, matrix box, char chain,
108 int model_nr, gmx_conect conect, gmx_bool bTerSepChains);
109 /* Low level pdb file writing routine.
111 * ONLY FOR SPECIAL PURPOSES,
113 * USE write_sto_conf WHEN YOU CAN.
115 * override chain-identifiers with chain when chain>0
116 * write ENDMDL when bEndmodel is TRUE.
118 * If the gmx_conect structure is not NULL its content is dumped as CONECT records
119 * which may be useful for visualization purposes.
122 void get_pdb_atomnumber(struct t_atoms *atoms, struct gmx_atomprop *aps);
123 /* Routine to extract atomic numbers from the atom names */
125 int read_pdbfile(FILE *in, char *title, int *model_nr,
126 struct t_atoms *atoms, rvec x[], int *ePBC, matrix box,
127 gmx_bool bChange, gmx_conect conect);
128 /* Function returns number of atoms found.
129 * ePBC and gmx_conect structure may be NULL.
132 void read_pdb_conf(const char *infile, char *title,
133 struct t_atoms *atoms, rvec x[], int *ePBC, matrix box,
134 gmx_bool bChange, gmx_conect conect);
135 /* Read a pdb file and extract ATOM and HETATM fields.
136 * Read a box from the CRYST1 line, return 0 box when no CRYST1 is found.
137 * Change atom names according to protein conventions if wanted.
138 * ePBC and gmx_conect structure may be NULL.
141 void get_pdb_coordnum(FILE *in, int *natoms);
142 /* Read a pdb file and count the ATOM and HETATM fields. */
144 gmx_bool is_hydrogen(const char *nm);
145 /* Return whether atom nm is a hydrogen */
147 gmx_bool is_dummymass(const char *nm);
148 /* Return whether atom nm is a dummy mass */
150 /* Routines to handle CONECT records if they have been read in */
151 void gmx_conect_dump(FILE *fp, gmx_conect conect);
153 gmx_bool gmx_conect_exist(gmx_conect conect, int ai, int aj);
154 /* Return TRUE if there is a conection between the atoms */
156 void gmx_conect_add(gmx_conect conect, int ai, int aj);
157 /* Add a connection between ai and aj (numbered from 0 to natom-1) */
159 gmx_conect gmx_conect_generate(struct t_topology *top);
160 /* Generate a conect structure from a topology */
162 gmx_conect gmx_conect_init(void);
163 /* Initiate data structure */
165 void gmx_conect_done(gmx_conect gc);
172 #endif /* GMX_FILEIO_PDBIO_H */