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