27 const WEIGHTING_FUNCTION& weight)
29 auto moleculesPos = molecules.
getPos();
30 auto moleculesLambda = molecules.
getLambda();
36 auto atomsPos = atoms.
getPos();
41 auto kernel = KOKKOS_LAMBDA(
const idx_t& moleculeIdx)
43 auto atomsStart = moleculesAtomsOffset(moleculeIdx);
44 auto atomsEnd = atomsStart + moleculesNumAtoms(moleculeIdx);
46 moleculesPos(moleculeIdx, 0) = 0_r;
47 moleculesPos(moleculeIdx, 1) = 0_r;
48 moleculesPos(moleculeIdx, 2) = 0_r;
50 for (
auto atomIdx = atomsStart; atomIdx < atomsEnd; ++atomIdx)
52 assert(atomsRelativeMass(atomIdx) > 1e-8 &&
53 "Contribution almost zero. Did you forget to set relative mass?");
54 moleculesPos(moleculeIdx, 0) += atomsPos(atomIdx, 0) * atomsRelativeMass(atomIdx);
55 moleculesPos(moleculeIdx, 1) += atomsPos(atomIdx, 1) * atomsRelativeMass(atomIdx);
56 moleculesPos(moleculeIdx, 2) += atomsPos(atomIdx, 2) * atomsRelativeMass(atomIdx);
59 weight(moleculesPos(moleculeIdx, 0),
60 moleculesPos(moleculeIdx, 1),
61 moleculesPos(moleculeIdx, 2),
62 moleculesLambda(moleculeIdx),
63 moleculesModulatedLambda(moleculeIdx),
64 moleculesGradLambda(moleculeIdx, 0),
65 moleculesGradLambda(moleculeIdx, 1),
66 moleculesGradLambda(moleculeIdx, 2));
68 Kokkos::parallel_for(
"UpdateMolecules::update", policy, kernel);