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,2021, 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.
38 #ifndef GMX_FILEIO_CONFIO_H
39 #define GMX_FILEIO_CONFIO_H
41 #include "gromacs/math/vectypes.h"
42 #include "gromacs/utility/basedefinitions.h"
44 /* For reading coordinate files it is assumed that enough memory
45 * has been allocated beforehand.
51 enum class PbcType : int;
53 void write_sto_conf_indexed(const char* outfile,
62 /* like write_sto_conf, but indexed */
64 void write_sto_conf(const char* outfile,
71 /* write atoms, x, v (if .gro and not NULL) and box (if not NULL)
72 * to an STO (.gro or .pdb) file */
74 void write_sto_conf_mtop(const char* outfile,
76 const gmx_mtop_t& mtop,
81 /* As write_sto_conf, but uses a gmx_mtop_t struct */
83 /*! \brief Read a configuration and, when available, a topology from a tpr or structure file.
85 * When reading from a tpr file, the complete topology is returned in \p mtop.
86 * When reading from a structure file, only the atoms struct in \p mtop contains data.
88 * \param[in] infile Input file name
89 * \param[out] haveTopology true when a topology was read and stored in mtop
90 * \param[out] mtop The topology, either complete or only atom data
91 * \param[out] pbcType Enum reporting the type of PBC
92 * \param[in,out] x Coordinates will be stored when *x!=NULL
93 * \param[in,out] v Velocities will be stored when *v!=NULL
94 * \param[out] box Box dimensions
96 void readConfAndTopology(const char* infile,
104 /*! \brief Read a configuration from a structure file.
106 * This should eventually be superseded by TopologyInformation
108 * \param[in] infile Input file name
109 * \param[out] symtab The symbol table
110 * \param[out] name The title of the molecule, e.g. from pdb TITLE record
111 * \param[out] atoms The global t_atoms struct
112 * \param[out] pbcType Enum reporting the type of PBC
113 * \param[in,out] x Coordinates will be stored when *x!=NULL
114 * \param[in,out] v Velocities will be stored when *v!=NULL
115 * \param[out] box Box dimensions
117 void readConfAndAtoms(const char* infile,
126 /*! \brief Read a configuration and, when available, a topology from a tpr or structure file.
128 * Deprecated, superseded by readConfAndTopology().
129 * When \p requireMasses = TRUE, this routine must return a topology with
130 * mass data. Masses are either read from a tpr input file, or otherwise
131 * looked up from the mass database, and when such lookup fails a fatal error
133 * When \p requireMasses = FALSE, masses will still be read from tpr input and
134 * their presence is signaled with the \p haveMass flag in t_atoms of \p top.
136 * \param[in] infile Input file name
137 * \param[out] top The topology, either complete or only atom data. Caller is
138 * responsible for calling done_top().
139 * \param[out] pbcType Enum reporting the type of PBC
140 * \param[in,out] x Coordinates will be stored when *x!=NULL
141 * \param[in,out] v Velocities will be stored when *v!=NULL
142 * \param[out] box Box dimensions
143 * \param[in] requireMasses Require masses to be present, either from tpr or from the mass
145 * \returns if a topology is available
147 gmx_bool read_tps_conf(const char* infile,
148 struct t_topology* top,
153 gmx_bool requireMasses);