SYCL: Avoid using no_init read accessor in rocFFT
[alexxy/gromacs.git] / src / gromacs / ewald / ewald.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,2017,2018 by the GROMACS development team.
7  * Copyright (c) 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 /*! \libinternal \defgroup module_ewald Ewald-family treatments of long-ranged forces
39  * \ingroup group_mdrun
40  *
41  * \brief Computes energies and forces for long-ranged interactions
42  * using the Ewald decomposition. Includes plain Ewald, PME, P3M for
43  * Coulomb, PME for Lennard-Jones, load-balancing for PME, and
44  * supporting code.
45  *
46  * \author Berk Hess <hess@kth.se>
47  * \author Erik Lindahl <erik@kth.se>
48  * \author Roland Schulz <roland@rschulz.eu>
49  * \author Mark Abraham <mark.j.abraham@gmail.com>
50  * \author Christan Wennberg <cwennberg@kth.se>
51  */
52
53 /*! \libinternal \file
54  *
55  * \brief This file contains function declarations necessary for
56  * computing energies and forces for the plain-Ewald long-ranged part,
57  * and the correction for overall system charge for all Ewald-family
58  * methods.
59  *
60  * \author David van der Spoel <david.vanderspoel@icm.uu.se>
61  * \author Mark Abraham <mark.j.abraham@gmail.com>
62  * \inlibraryapi
63  * \ingroup module_ewald
64  */
65
66 #ifndef GMX_EWALD_EWALD_H
67 #define GMX_EWALD_EWALD_H
68
69 #include <stdio.h>
70
71 #include <vector>
72
73 #include "gromacs/math/vectypes.h"
74 #include "gromacs/utility/real.h"
75
76 struct t_commrec;
77 struct t_forcerec;
78 struct t_inputrec;
79 struct t_complex;
80 enum class FreeEnergyPerturbationType : int;
81
82 namespace gmx
83 {
84 template<typename>
85 class ArrayRef;
86 }
87
88 struct gmx_ewald_tab_t
89 {
90     gmx_ewald_tab_t(const t_inputrec& ir, FILE* fp);
91
92     ~gmx_ewald_tab_t();
93
94     int nx;
95     int ny;
96     int nz;
97     int kmax;
98
99     std::vector<t_complex> tab_xy;
100     std::vector<t_complex> tab_qxyz;
101 };
102
103 /*! \brief Do the long-ranged part of an Ewald calculation */
104 real do_ewald(bool                           havePbcXY2Walls,
105               real                           wallEwaldZfac,
106               real                           epsilonR,
107               FreeEnergyPerturbationType     freeEnergyPerturbationType,
108               gmx::ArrayRef<const gmx::RVec> coords,
109               gmx::ArrayRef<gmx::RVec>       forces,
110               gmx::ArrayRef<const real>      chargeA,
111               gmx::ArrayRef<const real>      chargeB,
112               const matrix                   box,
113               const t_commrec*               commrec,
114               int                            natoms,
115               matrix                         lrvir,
116               real                           ewaldcoeff,
117               real                           lambda,
118               real*                          dvdlambda,
119               gmx_ewald_tab_t*               et);
120
121 /*! \brief Calculate the correction to the Ewald sum, due to a net system
122  * charge.
123  *
124  * Should only be called on one thread. */
125 real ewald_charge_correction(const t_commrec*            commrec,
126                              real                        epsilonR,
127                              real                        ewaldcoeffQ,
128                              gmx::ArrayRef<const double> qsum,
129                              real                        lambda,
130                              const matrix                box,
131                              real*                       dvdlambda,
132                              tensor                      vir);
133
134 #endif