Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / fileio / confio.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
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,2018,2019, 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.
10  *
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.
15  *
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.
20  *
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.
25  *
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.
33  *
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.
36  */
37 #ifndef GMX_FILEIO_CONFIO_H
38 #define GMX_FILEIO_CONFIO_H
39
40 #include "gromacs/math/vectypes.h"
41 #include "gromacs/utility/basedefinitions.h"
42
43 /* For reading coordinate files it is assumed that enough memory
44  * has been allocated beforehand.
45  */
46 struct gmx_mtop_t;
47 struct t_atoms;
48 struct t_symtab;
49 struct t_topology;
50
51 void write_sto_conf_indexed(const char*    outfile,
52                             const char*    title,
53                             const t_atoms* atoms,
54                             const rvec     x[],
55                             const rvec*    v,
56                             int            ePBC,
57                             const matrix   box,
58                             int            nindex,
59                             int            index[]);
60 /* like write_sto_conf, but indexed */
61
62 void write_sto_conf(const char*    outfile,
63                     const char*    title,
64                     const t_atoms* atoms,
65                     const rvec     x[],
66                     const rvec*    v,
67                     int            ePBC,
68                     const matrix   box);
69 /* write atoms, x, v (if .gro and not NULL) and box (if not NULL)
70  * to an STO (.gro or .pdb) file */
71
72 void write_sto_conf_mtop(const char*       outfile,
73                          const char*       title,
74                          const gmx_mtop_t* mtop,
75                          const rvec        x[],
76                          const rvec*       v,
77                          int               ePBC,
78                          const matrix      box);
79 /* As write_sto_conf, but uses a gmx_mtop_t struct */
80
81 /*! \brief Read a configuration and, when available, a topology from a tpr or structure file.
82  *
83  * When reading from a tpr file, the complete topology is returned in \p mtop.
84  * When reading from a structure file, only the atoms struct in \p mtop contains data.
85  *
86  * \param[in]     infile        Input file name
87  * \param[out]    haveTopology  true when a topology was read and stored in mtop
88  * \param[out]    mtop          The topology, either complete or only atom data
89  * \param[out]    ePBC          Enum reporting the type of PBC
90  * \param[in,out] x             Coordinates will be stored when *x!=NULL
91  * \param[in,out] v             Velocities will be stored when *v!=NULL
92  * \param[out]    box           Box dimensions
93  */
94 void readConfAndTopology(const char* infile,
95                          bool*       haveTopology,
96                          gmx_mtop_t* mtop,
97                          int*        ePBC,
98                          rvec**      x,
99                          rvec**      v,
100                          matrix      box);
101
102 /*! \brief Read a configuration from a structure file.
103  *
104  * This should eventually be superseded by TopologyInformation
105  *
106  * \param[in]     infile        Input file name
107  * \param[out]    symtab        The symbol table
108  * \param[out]    name          The title of the molecule, e.g. from pdb TITLE record
109  * \param[out]    atoms         The global t_atoms struct
110  * \param[out]    ePBC          Enum reporting the type of PBC
111  * \param[in,out] x             Coordinates will be stored when *x!=NULL
112  * \param[in,out] v             Velocities will be stored when *v!=NULL
113  * \param[out]    box           Box dimensions
114  */
115 void readConfAndAtoms(const char* infile,
116                       t_symtab*   symtab,
117                       char**      name,
118                       t_atoms*    atoms,
119                       int*        ePBC,
120                       rvec**      x,
121                       rvec**      v,
122                       matrix      box);
123
124 /*! \brief Read a configuration and, when available, a topology from a tpr or structure file.
125  *
126  * Deprecated, superseded by readConfAndTopology().
127  * When \p requireMasses = TRUE, this routine must return a topology with
128  * mass data. Masses are either read from a tpr input file, or otherwise
129  * looked up from the mass database, and when such lookup fails a fatal error
130  * results.
131  * When \p requireMasses = FALSE, masses will still be read from tpr input and
132  * their presence is signaled with the \p haveMass flag in t_atoms of \p top.
133  *
134  * \param[in]     infile        Input file name
135  * \param[out]    top           The topology, either complete or only atom data. Caller is
136  * responsible for calling done_top(). \param[out]    ePBC          Enum reporting the type of PBC
137  * \param[in,out] x             Coordinates will be stored when *x!=NULL
138  * \param[in,out] v             Velocities will be stored when *v!=NULL
139  * \param[out]    box           Box dimensions
140  * \param[in]     requireMasses Require masses to be present, either from tpr or from the mass
141  * database \returns if a topology is available
142  */
143 gmx_bool read_tps_conf(const char*        infile,
144                        struct t_topology* top,
145                        int*               ePBC,
146                        rvec**             x,
147                        rvec**             v,
148                        matrix             box,
149                        gmx_bool           requireMasses);
150
151 #endif