2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
5 * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
6 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 * and including many others, as listed in the AUTHORS file in the
8 * top-level source directory and at http://www.gromacs.org.
10 * GROMACS is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1
13 * of the License, or (at your option) any later version.
15 * GROMACS is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with GROMACS; if not, see
22 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 * If you want to redistribute modifications to GROMACS, please
26 * consider that scientific software is very special. Version
27 * control is crucial - bugs must be traceable. We will be happy to
28 * consider code for inclusion in the official distribution, but
29 * derived work must not be called official GROMACS. Details are found
30 * in the README & COPYING files - if they are missing, get the
31 * official version at http://www.gromacs.org.
33 * To help us fund GROMACS development, we humbly ask that you cite
34 * the research papers on the package. Check out http://www.gromacs.org.
40 * Declares the PairlistSet class
42 * There is one PairlistSet object per locality. A PairlistSet
43 * holds a list of CPU- or GPU-type pairlist objects, one for each thread,
44 * as well as helper objects to construct each of those pairlists.
46 * \author Berk Hess <hess@kth.se>
47 * \ingroup module_nbnxm
50 #ifndef GMX_NBNXM_PAIRLISTSET_H
51 #define GMX_NBNXM_PAIRLISTSET_H
55 #include "gromacs/math/vectypes.h"
56 #include "gromacs/mdtypes/locality.h"
57 #include "gromacs/utility/basedefinitions.h"
58 #include "gromacs/utility/real.h"
62 struct nbnxn_atomdata_t;
63 struct PairlistParams;
64 struct PairsearchWork;
65 struct SearchCycleCounting;
80 * \brief An object that holds the local or non-local pairlists
85 //! Constructor: initializes the pairlist set as empty
86 PairlistSet(gmx::InteractionLocality locality, const PairlistParams& listParams);
90 //! Constructs the pairlists in the set using the coordinates in \p nbat
91 void constructPairlists(const Nbnxm::GridSet& gridSet,
92 gmx::ArrayRef<PairsearchWork> searchWork,
93 nbnxn_atomdata_t* nbat,
94 const gmx::ListOfLists<int>& exclusions,
95 int minimumIlistCountForGpuBalancing,
97 SearchCycleCounting* searchCycleCounting);
99 //! Dispatch the kernel for dynamic pairlist pruning
100 void dispatchPruneKernel(const nbnxn_atomdata_t* nbat, const rvec* shift_vec);
102 //! Returns the locality
103 gmx::InteractionLocality locality() const { return locality_; }
105 //! Returns the lists of CPU pairlists
106 gmx::ArrayRef<const NbnxnPairlistCpu> cpuLists() const { return cpuLists_; }
108 //! Returns a pointer to the GPU pairlist, nullptr when not present
109 const NbnxnPairlistGpu* gpuList() const
111 if (!gpuLists_.empty())
113 return &gpuLists_[0];
121 //! Returns the lists of free-energy pairlists, empty when nonbonded interactions are not perturbed
122 gmx::ArrayRef<const std::unique_ptr<t_nblist>> fepLists() const { return fepLists_; }
125 //! The locality of the pairlist set
126 gmx::InteractionLocality locality_;
127 //! List of pairlists in CPU layout
128 std::vector<NbnxnPairlistCpu> cpuLists_;
129 //! List of working list for rebalancing CPU lists
130 std::vector<NbnxnPairlistCpu> cpuListsWork_;
131 //! List of pairlists in GPU layout
132 std::vector<NbnxnPairlistGpu> gpuLists_;
133 //! Pairlist parameters describing setup and ranges
134 const PairlistParams& params_;
135 //! Tells whether multiple lists get merged into one (the first) after creation
137 //! Tells whether the lists is of CPU type, otherwise GPU type
139 //! Lists for perturbed interactions in simple atom-atom layout
140 std::vector<std::unique_ptr<t_nblist>> fepLists_;
143 /* Pair counts for flop counting */
144 //! Total number of atom pairs for LJ+Q kernel
146 //! Total number of atom pairs for LJ kernel
148 //! Total number of atom pairs for Q kernel