Refactor preprocessing atom types.
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / resall.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) 2010,2014,2015,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 /*! \file
38  * \internal \brief
39  * Methods to get residue information during preprocessing.
40  */
41 #ifndef GMX_GMXPREPROCESS_RESALL_H
42 #define GMX_GMXPREPROCESS_RESALL_H
43
44 #include <cstdio>
45
46 #include <vector>
47
48 #include "gromacs/utility/arrayref.h"
49
50 class PreprocessingAtomTypes;
51 struct PreprocessResidue;
52 struct t_symtab;
53
54 /*! \brief
55  * Search for an entry in the rtp database.
56  *
57  * A mismatch of one character is allowed,
58  * if there is only one nearly matching entry in the database,
59  * a warning will be generated.
60  *
61  * \param[in] key The atomname to search for.
62  * \param[in] rtpDBEntry Database with residue information.
63  * \returns The rtp residue name.
64  */
65 std::string searchResidueDatabase(const std::string &key, gmx::ArrayRef<const PreprocessResidue> rtpDBEntry);
66
67 /*! \brief
68  * Returns matching entry in database.
69  *
70  * \param[in] rtpname Name of the entry looked for.
71  * \param[in] rtpDBEntry Database to search.
72  * \throws If the name can not be found in the database.
73  */
74 gmx::ArrayRef<const PreprocessResidue>::const_iterator
75 getDatabaseEntry(const std::string &rtpname, gmx::ArrayRef<const PreprocessResidue> rtpDBEntry);
76
77 /*! \brief
78  * Read atom types into database.
79  *
80  * \param[in] ffdir Force field directory.
81  * \param[in] tab Symbol table for names.
82  * \returns Atom type database.
83  */
84 PreprocessingAtomTypes read_atype(const char *ffdir, t_symtab *tab);
85
86 /*! \brief
87  * Read in database, append to exisiting.
88  *
89  * \param[in] resdb Name of database file.
90  * \param[inout] rtpDBEntry Database to populate.
91  * \param[inout] atype Atomtype information.
92  * \param[inout] tab Symbol table for names.
93  * \param[in] bAllowOverrideRTP If entries can be overwritten in the database.
94  */
95 void readResidueDatabase(const std::string               &resdb,
96                          std::vector<PreprocessResidue>  *rtpDBEntry,
97                          PreprocessingAtomTypes          *atype,
98                          t_symtab                        *tab,
99                          bool                             bAllowOverrideRTP);
100
101 /*! \brief
102  * Print out database.
103  *
104  * \param[in] out File to write to.
105  * \param[in] rtpDBEntry Database to write out.
106  * \param[in] atype Atom type information.
107  */
108 void print_resall(FILE *out, gmx::ArrayRef<const PreprocessResidue> rtpDBEntry,
109                   const PreprocessingAtomTypes &atype);
110
111 #endif