88ab95af8797046b8e030909997c96af1aa988b6
[alexxy/gromacs.git] / src / gromacs / mdlib / forcerec.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 The GROMACS development team.
7  * Copyright (c) 2018,2019,2020,2021, 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_MDLIB_FORCEREC_H
39 #define GMX_MDLIB_FORCEREC_H
40
41 #include "gromacs/math/vec.h"
42 #include "gromacs/timing/wallcycle.h"
43 #include "gromacs/utility/arrayref.h"
44
45 struct gmx_hw_info_t;
46 struct t_commrec;
47 struct t_forcerec;
48 struct t_filenm;
49 struct t_inputrec;
50 struct gmx_localtop_t;
51 struct gmx_mtop_t;
52 struct gmx_wallcycle;
53 struct interaction_const_t;
54 union t_iparams;
55 enum class LongRangeVdW : int;
56
57 namespace gmx
58 {
59 class MDLogger;
60 class PhysicalNodeCommunicator;
61 } // namespace gmx
62
63 /*! \brief Create nonbonded parameter lists
64  *
65  * \param[in] numAtomTypes           The number of atom types
66  * \param[in] iparams                The LJ parameters
67  * \param[in] useBuckinghamPotential Use Buckingham potential
68  */
69 std::vector<real> makeNonBondedParameterLists(int                            numAtomTypes,
70                                               gmx::ArrayRef<const t_iparams> iparams,
71                                               bool useBuckinghamPotential);
72
73 /*! \brief Calculate c6 parameters for grid correction
74  *
75  * \param[in] numAtomTypes           The number of atom types
76  * \param[in] iparams                The LJ parameters
77  * \param[in] ljpme_combination_rule How long range LJ is treated
78  */
79 std::vector<real> makeLJPmeC6GridCorrectionParameters(int                            numAtomTypes,
80                                                       gmx::ArrayRef<const t_iparams> iparams,
81                                                       LongRangeVdW ljpme_combination_rule);
82
83 /*! \brief Set the number of charge groups and atoms.
84  *
85  * The force calculation needs information on which atoms it
86  * should do work.
87  * \param[inout] fr                  The forcerec
88  * \param[in]    natoms_force        Number of atoms to compute force on
89  * \param[in]    natoms_force_constr Number of atoms involved in constraints
90  * \param[in]    natoms_f_novirsum   Number of atoms for which
91  *                                   force is to be compute but no virial
92  */
93 void forcerec_set_ranges(t_forcerec* fr, int natoms_force, int natoms_force_constr, int natoms_f_novirsum);
94
95 /*! \brief Initiate table constants
96  *
97  * Initializes the tables in the interaction constant data structure.
98  * \param[in] fp                     File for debugging output
99  * \param[in] ic                     Structure holding the table constant
100  * \param[in] rlist                  Length of the neighbour list
101  * \param[in] tableExtensionLength   Length by which to extend the tables. Taken from the input record.
102  */
103 void init_interaction_const_tables(FILE* fp, interaction_const_t* ic, real rlist, real tableExtensionLength);
104
105 /*! \brief Initialize forcerec structure.
106  *
107  * \param[in]  fplog              File for printing
108  * \param[in]  mdlog              File for printing
109  * \param[out] forcerec                 The forcerec
110  * \param[in]  inputrec                 Inputrec structure
111  * \param[in]  mtop               Molecular topology
112  * \param[in]  commrec                 Communication structures
113  * \param[in]  box                Simulation box
114  * \param[in]  tabfn              Table potential file for non-bonded interactions
115  * \param[in]  tabpfn             Table potential file for pair interactions
116  * \param[in]  tabbfnm            Table potential files for bonded interactions
117  * \param[in]  print_force        Print forces for atoms with force >= print_force
118  */
119 void init_forcerec(FILE*                            fplog,
120                    const gmx::MDLogger&             mdlog,
121                    t_forcerec*                      forcerec,
122                    const t_inputrec&                inputrec,
123                    const gmx_mtop_t&                mtop,
124                    const t_commrec*                 commrec,
125                    matrix                           box,
126                    const char*                      tabfn,
127                    const char*                      tabpfn,
128                    gmx::ArrayRef<const std::string> tabbfnm,
129                    real                             print_force);
130
131 #endif