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,2015,2016,2017 by the GROMACS development team.
7 * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
8 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
9 * and including many others, as listed in the AUTHORS file in the
10 * top-level source directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
39 #ifndef GMX_FILEIO_PDBIO_H
40 #define GMX_FILEIO_PDBIO_H
44 #include "gromacs/math/vectypes.h"
45 #include "gromacs/topology/atoms.h"
46 #include "gromacs/utility/basedefinitions.h"
47 #include "gromacs/utility/real.h"
53 enum class PbcType : int;
55 typedef struct gmx_conect_t* gmx_conect;
57 /* Write a PDB line with an ATOM or HETATM record directly to a file pointer.
59 * Returns the number of characters printed.
61 int gmx_fprintf_pdb_atomline(FILE* fp,
62 enum PDB_record record,
64 const char* atom_name,
65 char alternate_location,
69 char res_insertion_code,
77 /* Enumerated value for indexing an uij entry (anisotropic temperature factors) */
88 void pdb_use_ter(gmx_bool bSet);
89 /* set read_pdbatoms to read upto 'TER' or 'ENDMDL' (default, bSet=FALSE).
90 This function is fundamentally broken as far as thread-safety is concerned.*/
92 void gmx_write_pdb_box(FILE* out, PbcType pbcType, const matrix box);
93 /* write the box in the CRYST1 record,
94 * with pbcType=PbcType::Unset the pbc is guessed from the box
95 * This function is fundamentally broken as far as thread-safety is concerned.
98 void write_pdbfile_indexed(FILE* out,
100 const t_atoms* atoms,
110 /* REALLY low level */
112 void write_pdbfile(FILE* out,
114 const t_atoms* atoms,
121 /* Low level pdb file writing routine.
123 * ONLY FOR SPECIAL PURPOSES,
125 * USE write_sto_conf WHEN YOU CAN.
127 * override chain-identifiers with chain when chain>0
128 * write ENDMDL when bEndmodel is TRUE.
130 * If the gmx_conect structure is not NULL its content is dumped as CONECT records
131 * which may be useful for visualization purposes.
134 void get_pdb_atomnumber(const t_atoms* atoms, AtomProperties* aps);
135 /* Routine to extract atomic numbers from the atom names */
137 int read_pdbfile(FILE* in,
140 struct t_atoms* atoms,
141 struct t_symtab* symtab,
146 /* Function returns number of atoms found.
147 * pbcType and gmx_conect structure may be NULL.
150 void gmx_pdb_read_conf(const char* infile,
157 /* Read a pdb file and extract ATOM and HETATM fields.
158 * Read a box from the CRYST1 line, return 0 box when no CRYST1 is found.
159 * pbcType may be NULL.
161 * If name is not nullptr, gmx_strdup the title string into it. */
163 void get_pdb_coordnum(FILE* in, int* natoms);
164 /* Read a pdb file and count the ATOM and HETATM fields. */
166 gmx_bool is_hydrogen(const char* nm);
167 /* Return whether atom nm is a hydrogen */
169 gmx_bool is_dummymass(const char* nm);
170 /* Return whether atom nm is a dummy mass */
172 /* Routines to handle CONECT records if they have been read in */
173 void gmx_conect_dump(FILE* fp, gmx_conect conect);
175 gmx_bool gmx_conect_exist(gmx_conect conect, int ai, int aj);
176 /* Return TRUE if there is a conection between the atoms */
178 void gmx_conect_add(gmx_conect conect, int ai, int aj);
179 /* Add a connection between ai and aj (numbered from 0 to natom-1) */
181 gmx_conect gmx_conect_generate(const t_topology* top);
182 /* Generate a conect structure from a topology */
184 gmx_conect gmx_conect_init();
185 /* Initiate data structure */
187 void gmx_conect_done(gmx_conect gc);
190 #endif /* GMX_FILEIO_PDBIO_H */