Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / fileio / tngio_for_tools.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2013,2014, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 #ifndef GMX_FILEIO_TNGIO_FOR_TOOLS_H
36 #define GMX_FILEIO_TNGIO_FOR_TOOLS_H
37
38 #include <stdio.h>
39
40 #include "tng/tng_io_fwd.h"
41
42 #include "gromacs/legacyheaders/types/simple.h"
43 #include "gromacs/utility/basedefinitions.h"
44 #include "gromacs/utility/real.h"
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 #if 0
50 }
51 #endif
52
53 struct gmx_mtop_t;
54 struct t_trxframe;
55
56 /*! \brief Prepare to write TNG output from trajectory conversion tools */
57 void gmx_prepare_tng_writing(const char              *filename,
58                              char                     mode,
59                              tng_trajectory_t        *in,
60                              tng_trajectory_t        *out,
61                              int                      nAtoms,
62                              const struct gmx_mtop_t *mtop,
63                              const atom_id           *index,
64                              const char              *indexGroupName);
65
66 /*! \brief Write a trxframe to a TNG file
67  *
68  * \param output Trajectory to write to
69  * \param frame  Frame data to write
70  * \param natoms Number of atoms to actually write
71  *
72  * The natoms field in frame is the number of atoms in the system. The
73  * parameter natoms supports writing an index-group subset of the
74  * atoms.
75  */
76 void gmx_write_tng_from_trxframe(tng_trajectory_t        output,
77                                  struct t_trxframe      *frame,
78                                  int                     natoms);
79
80 /*! \brief Creates a molecule containing only the indexed atoms and sets
81  * the number of all other molecules to 0. Works similar to a
82  * selection group. */
83 void gmx_tng_setup_atom_subgroup(tng_trajectory_t tng,
84                                  const int        nind,
85                                  const atom_id   *ind,
86                                  const char      *name);
87
88 /*! \brief Read the first/next TNG frame. */
89 gmx_bool gmx_read_next_tng_frame(tng_trajectory_t            input,
90                                  struct t_trxframe          *fr,
91                                  gmx_int64_t                *requestedIds,
92                                  int                         numRequestedIds);
93
94 /*! \brief Print the molecule system to stream */
95 void gmx_print_tng_molecule_system(tng_trajectory_t input,
96                                    FILE            *stream);
97
98 /*! \brief Get a list of block IDs present in the next frame with data. */
99 gmx_bool gmx_get_tng_data_block_types_of_next_frame(tng_trajectory_t     input,
100                                                     int                  frame,
101                                                     int                  nRequestedIds,
102                                                     gmx_int64_t         *requestedIds,
103                                                     gmx_int64_t         *nextFrame,
104                                                     gmx_int64_t         *nBlocks,
105                                                     gmx_int64_t        **blockIds);
106
107 /*! \brief Get data of the next frame with data from the data block
108  * with the specified block ID. */
109 gmx_bool gmx_get_tng_data_next_frame_of_block_type(tng_trajectory_t     input,
110                                                    gmx_int64_t          blockId,
111                                                    real               **values,
112                                                    gmx_int64_t         *frameNumber,
113                                                    double              *frameTime,
114                                                    gmx_int64_t         *nValuesPerFrame,
115                                                    gmx_int64_t         *nAtoms,
116                                                    real                *prec,
117                                                    char                *name,
118                                                    int                  maxLen,
119                                                    gmx_bool            *bOK);
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif