- OutputQuantities output;
- output.energy = calculateSimpleBond(input_.ftype, iatoms.size(), iatoms.data(),
- &input_.iparams, as_rvec_array(x_.data()), output.f,
- output.fshift, &pbc_, lambda, &output.dvdlambda, &mdatoms,
- /* struct t_fcdata * */ nullptr, ddgatindex.data(),
- BondedKernelFlavor::ForcesAndVirialAndEnergy);
- // Internal consistency test of both test input
- // and bonded functions.
- EXPECT_TRUE((input_.fep || (output.dvdlambda == 0.0))) << "dvdlambda was " << output.dvdlambda;
- checkOutput(checker, output);
+ /* Here we run both the standard, plain-C force+shift-forcs+energy+free-energy
+ * kernel flavor and the potentially optimized, with SIMD and less output,
+ * force only kernels. Note that we also run the optimized kernel for free-energy
+ * input when lambda=0, as the force output should match the non free-energy case.
+ */
+ std::vector<BondedKernelFlavor> flavors = { BondedKernelFlavor::ForcesAndVirialAndEnergy };
+ if (!input_.fep || lambda == 0)
+ {
+ flavors.push_back(BondedKernelFlavor::ForcesSimdWhenAvailable);
+ }
+ for (const auto flavor : flavors)
+ {
+ OutputQuantities output;
+ output.energy =
+ calculateSimpleBond(input_.ftype, iatoms.size(), iatoms.data(), &input_.iparams,
+ as_rvec_array(x_.data()), output.f, output.fshift, &pbc_,
+ lambda, &output.dvdlambda, &mdatoms,
+ /* struct t_fcdata * */ nullptr, ddgatindex.data(), flavor);
+ // Internal consistency test of both test input
+ // and bonded functions.
+ EXPECT_TRUE((input_.fep || (output.dvdlambda == 0.0))) << "dvdlambda was " << output.dvdlambda;
+ checkOutput(checker, output, flavor);
+ }