Gromacs  2026.0-dev-20241121-c76fa1e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Enumerations | Functions | Variables
kernel_test.cpp File Reference
#include "gmxpre.h"
#include "config.h"
#include <cmath>
#include <cstdint>
#include <algorithm>
#include <array>
#include <filesystem>
#include <memory>
#include <numeric>
#include <optional>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <gtest/gtest.h>
#include "gromacs/ewald/ewald_utils.h"
#include "gromacs/gpu_utils/hostallocator.h"
#include "gromacs/math/functions.h"
#include "gromacs/math/vec.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/mdlib/forcerec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdtypes/atominfo.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/locality.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/simulation_workload.h"
#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/nbnxm/gridset.h"
#include "gromacs/nbnxm/kernel_common.h"
#include "gromacs/nbnxm/nbnxm.h"
#include "gromacs/nbnxm/nbnxm_simd.h"
#include "gromacs/nbnxm/pairlistparams.h"
#include "gromacs/nbnxm/pairlistset.h"
#include "gromacs/nbnxm/pairlistsets.h"
#include "gromacs/nbnxm/pairsearch.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/forcefieldparameters.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/logger.h"
#include "gromacs/utility/range.h"
#include "gromacs/utility/real.h"
#include "gromacs/utility/stringutil.h"
#include "testutils/refdata.h"
#include "testutils/testasserts.h"
#include "testutils/testinit.h"
#include "testsystem.h"
+ Include dependency graph for kernel_test.cpp:

Description

Tests for NBNxM pair kernel forces and energies.

These tests covers all compiled flavors of the NBNxM kernels, not only those used by default by mdrun. The forces and energies are compared to common reference data for kernels that are expected to produce the same output (i.e. only different kernel layout or analytical vs tabulated Ewald LR correction).

The only thing currently not covered is LJ-PME with the Lorentz-Berthelot combination rule, as this is only implemented in the plain-C reference kernel and currently the reference data is generated by the SIMD kernels.

Author
Berk Hess hess@.nosp@m.kth..nosp@m.se

Classes

struct  gmx::test::anonymous_namespace{kernel_test.cpp}::KernelOptions
 The options for the kernel. More...
 
struct  gmx::test::anonymous_namespace{kernel_test.cpp}::KernelInputParameters
 Convenience typedef of the test input parameters. More...
 
class  gmx::test::anonymous_namespace{kernel_test.cpp}::NbnxmKernelTest
 Class that sets up and holds a set of N atoms and a full NxM pairlist. More...
 

Enumerations

enum  gmx::test::anonymous_namespace{kernel_test.cpp}::EnergyHandling : int { NoEnergies, Energies, ThreeEnergyGroups, Count }
 How the kernel should compute energies. More...
 

Functions

LJCombinationRule gmx::test::anonymous_namespace{kernel_test.cpp}::chooseLJPmeCombinationRule (const KernelOptions &options)
 Returns the enum value for initializing the LJ PME-grid combination rule for nbxnm_atomdata_t.
 
std::unique_ptr
< nonbonded_verlet_t > 
gmx::test::anonymous_namespace{kernel_test.cpp}::setupNbnxmForBenchInstance (const KernelOptions &options, const TestSystem &system)
 Sets up and returns a Nbnxm object for the given benchmark options and system.
 
CoulombInteractionType gmx::test::anonymous_namespace{kernel_test.cpp}::coulombInteractionType (CoulombKernelType coulombKernelType)
 Returns the coulomb interaction type given the Coulomb kernel type.
 
interaction_const_t gmx::test::anonymous_namespace{kernel_test.cpp}::setupInteractionConst (const KernelOptions &options)
 Return an interaction constants struct with members used in the benchmark set appropriately.
 
std::string gmx::test::anonymous_namespace{kernel_test.cpp}::nameOfTest (const testing::TestParamInfo< KernelInputParameters > &info)
 Help GoogleTest name our test cases. More...
 
bool gmx::test::anonymous_namespace{kernel_test.cpp}::isTabulated (const CoulombKernelType coulombKernelType)
 
std::string gmx::test::anonymous_namespace{kernel_test.cpp}::makeRefDataFileName ()
 Construct a refdata filename for this test. More...
 

Variables

const EnumerationArray
< EnergyHandling, int > 
gmx::test::anonymous_namespace{kernel_test.cpp}::sc_numEnergyGroups = { 0, 1, 3 }
 Lookup table for the number of energy groups in use.
 
const EnumerationArray
< EnergyHandling, const char * > 
gmx::test::anonymous_namespace{kernel_test.cpp}::sc_energyGroupNames
 Names for the kinds of energy handling. More...
 
const EnumerationArray
< CoulombKernelType, const
char * > 
gmx::test::anonymous_namespace{kernel_test.cpp}::coulombKernelTypeName
 
const std::array< const char
*, vdwktNR > 
gmx::test::anonymous_namespace{kernel_test.cpp}::vdwKernelTypeName