Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Functions | Variables
kernel_test.cpp File Reference
#include "gmxpre.h"
#include <numeric>
#include <vector>
#include "gromacs/ewald/ewald_utils.h"
#include "gromacs/gpu_utils/hostallocator.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/forcerec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdtypes/atominfo.h"
#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/simulation_workload.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/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/topology.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/logger.h"
#include "testutils/refdata.h"
#include "testutils/testasserts.h"
#include "testutils/testinit.h"
#include "spc27_coords.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 reference data for the force+energy kernel. The reference data is only stored once for kernels that are expected to produce the same output (i.e. only different kernel layout or analytical vs tabulated Ewald LR correction). For the force only kernel, the forces are compared to those produced by the force+energy flavor.

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}::TestSystem
 Description of the system used for benchmarking. 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...
 
class  gmx::test::NbnxmKernelTestBody
 Test case whose body checks that the NBNxM kernel produces correct output. More...
 

Macros

#define GENERATE_REFERENCE_DATA   0
 

Functions

std::pair< real, realgmx::test::anonymous_namespace{kernel_test.cpp}::combineLJParams (const real sigma0, const real epsilon0, const real sigma1, const real epsilon1, const LJCombinationRule ljCombinationRule)
 Generate a C6, C12 pair using the combination rule.
 
int gmx::test::anonymous_namespace{kernel_test.cpp}::combRuleInitFromOptions (const KernelOptions &options)
 Returns the enum value for initializing the 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}::fullNameOfTest (const testing::TestParamInfo< KernelInputParameters > &info, const std::string &testName)
 Help GoogleTest name our test cases. More...
 
std::string gmx::test::anonymous_namespace{kernel_test.cpp}::makeRefDataFileName ()
 
void gmx::test::registerTestsDynamically ()
 Declaration of function used to dynamically register GoogleTest tests. More...
 

Variables

constexpr int gmx::test::anonymous_namespace{kernel_test.cpp}::numAtomsInMolecule = 3
 The number of atoms in a molecule.
 
constexpr int gmx::test::anonymous_namespace{kernel_test.cpp}::typeO = 0
 The atom type of the oxygen atom.
 
constexpr int gmx::test::anonymous_namespace{kernel_test.cpp}::typeHWithLJ = 1
 The atom type of a hydrogen atom with LJ.
 
constexpr int gmx::test::anonymous_namespace{kernel_test.cpp}::typeHWithoutLJ = 2
 The atom type of a hydrogen atom without LJ.
 
constexpr real gmx::test::anonymous_namespace{kernel_test.cpp}::chargeO = -0.8476
 The charge of the oxygen atom.
 
constexpr real gmx::test::anonymous_namespace{kernel_test.cpp}::chargeH = 0.4238
 The charge of the hydrogen atom.
 
constexpr real gmx::test::anonymous_namespace{kernel_test.cpp}::sigmaO = 0.316557
 The LJ sigma parameter of the Oxygen atom.
 
constexpr real gmx::test::anonymous_namespace{kernel_test.cpp}::epsilonO = 0.650194
 The LJ epsilon parameter of the Oxygen atom.
 
constexpr real gmx::test::anonymous_namespace{kernel_test.cpp}::sigmaH = 0.04
 The LJ sigma parameter of Hydrogen atoms with LJ.
 
constexpr real gmx::test::anonymous_namespace{kernel_test.cpp}::epsilonH = 0.192464
 The LJ epsilon parameter Hydrogen atoms with LJ.
 
const int gmx::test::anonymous_namespace{kernel_test.cpp}::c_numEnergyGroups = 3
 
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
 
const auto gmx::test::testKernelTypes