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 enum class PbcType : int; 52 53 void write_sto_conf_indexed(const char* outfile, 54 const char* title, 55 const t_atoms* atoms, 56 const rvec x[], 57 const rvec* v, 58 PbcType pbcType, 59 const matrix box, 60 int nindex, 61 int index[]); 62 /* like write_sto_conf, but indexed */ 63 64 void write_sto_conf(const char* outfile, 65 const char* title, 66 const t_atoms* atoms, 67 const rvec x[], 68 const rvec* v, 69 PbcType pbcType, 70 const matrix box); 71 /* write atoms, x, v (if .gro and not NULL) and box (if not NULL) 72 * to an STO (.gro or .pdb) file */ 73 74 void write_sto_conf_mtop(const char* outfile, 75 const char* title, 76 const gmx_mtop_t* mtop, 77 const rvec x[], 78 const rvec* v, 79 PbcType pbcType, 80 const matrix box); 81 /* As write_sto_conf, but uses a gmx_mtop_t struct */ 82 83 /*! \brief Read a configuration and, when available, a topology from a tpr or structure file. 84 * 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. 87 * 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 95 */ 96 void readConfAndTopology(const char* infile, 97 bool* haveTopology, 98 gmx_mtop_t* mtop, 99 PbcType* pbcType, 100 rvec** x, 101 rvec** v, 102 matrix box); 103 104 /*! \brief Read a configuration from a structure file. 105 * 106 * This should eventually be superseded by TopologyInformation 107 * 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 116 */ 117 void readConfAndAtoms(const char* infile, 118 t_symtab* symtab, 119 char** name, 120 t_atoms* atoms, 121 PbcType* pbcType, 122 rvec** x, 123 rvec** v, 124 matrix box); 125 126 /*! \brief Read a configuration and, when available, a topology from a tpr or structure file. 127 * 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 132 * results. 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. 135 * 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 144 * database \returns if a topology is available 145 */ 146 gmx_bool read_tps_conf(const char* infile, 147 struct t_topology* top, 148 PbcType* pbcType, 149 rvec** x, 150 rvec** v, 151 matrix box, 152 gmx_bool requireMasses); 153 154 #endif 155