diff --git a/pair_allegro.cpp b/pair_allegro.cpp index 2a821f2..89c892d 100644 --- a/pair_allegro.cpp +++ b/pair_allegro.cpp @@ -203,7 +203,7 @@ void PairAllegro::coeff(int narg, char **arg) { model = torch::jit::freeze(model); } - + // In PyTorch >=1.11, this is now set_fusion_strategy torch::jit::FusionStrategy strategy; strategy = {{torch::jit::FusionBehavior::DYNAMIC, 10}}; @@ -470,9 +470,9 @@ void PairAllegro::compute(int eflag, int vflag){ for(int ii = 0; ii < ntotal; ii++){ int i = ilist[ii]; - f[i][0] = forces[i][0]; - f[i][1] = forces[i][1]; - f[i][2] = forces[i][2]; + f[i][0] += forces[i][0]; + f[i][1] += forces[i][1]; + f[i][2] += forces[i][2]; if (eflag_atom && ii < inum) eatom[i] = atomic_energies[i][0]; if(ii < inum) eng_vdwl += atomic_energies[i][0]; } diff --git a/pair_allegro_kokkos.cpp b/pair_allegro_kokkos.cpp index d46647b..3ca39a4 100644 --- a/pair_allegro_kokkos.cpp +++ b/pair_allegro_kokkos.cpp @@ -306,9 +306,9 @@ void PairAllegroKokkos::compute(int eflag_in, int vflag_in) Kokkos::parallel_reduce("Allegro: store forces", Kokkos::RangePolicy(0, ignum), KOKKOS_LAMBDA(const int i, double &eng_vdwl){ - f(i,0) = d_forces(i,0); - f(i,1) = d_forces(i,1); - f(i,2) = d_forces(i,2); + f(i,0) += d_forces(i,0); + f(i,1) += d_forces(i,1); + f(i,2) += d_forces(i,2); if(eflag_atom && i < inum){ d_eatom(i) = d_atomic_energy(i); }