int fep_state;
int fep_states_lj = pme->bFEP_lj ? 2 : 1;
const gmx_bool bCalcEnerVir = flags & GMX_PME_CALC_ENER_VIR;
+ const gmx_bool bBackFFT = flags & (GMX_PME_CALC_F | GMX_PME_CALC_POT);
const gmx_bool bCalcF = flags & GMX_PME_CALC_F;
assert(pme->nnodes > 0);
}
}
- if (bCalcF)
+ if (bBackFFT)
{
/* do 3d-invfft */
if (thread == 0)
* With MPI we have to synchronize here before gmx_sum_qgrid_dd.
*/
- if (bCalcF)
+ if (bBackFFT)
{
/* distribute local grid to all nodes */
#if GMX_MPI
where();
unwrap_periodic_pmegrid(pme, grid);
+ }
+ if (bCalcF)
+ {
/* interpolate forces for our local atoms */
where();
get_pme_ener_vir_lj(pme->solve_work, pme->nthread, &energy_AB[2+fep_state], vir_AB[2+fep_state]);
}
- if (bCalcF)
+ if (bBackFFT)
{
bFirst = !(flags & GMX_PME_DO_COULOMB);
calc_initial_lb_coeffs(pme, local_c6, local_sigma);
unwrap_periodic_pmegrid(pme, grid);
- /* interpolate forces for our local atoms */
- where();
- bClearF = (bFirst && PAR(cr));
- scale = pme->bFEP ? (fep_state < 1 ? 1.0-lambda_lj : lambda_lj) : 1.0;
- scale *= lb_scale_factor[grid_index-2];
-#pragma omp parallel for num_threads(pme->nthread) schedule(static)
- for (thread = 0; thread < pme->nthread; thread++)
+ if (bCalcF)
{
- try
+ /* interpolate forces for our local atoms */
+ where();
+ bClearF = (bFirst && PAR(cr));
+ scale = pme->bFEP ? (fep_state < 1 ? 1.0-lambda_lj : lambda_lj) : 1.0;
+ scale *= lb_scale_factor[grid_index-2];
+
+#pragma omp parallel for num_threads(pme->nthread) schedule(static)
+ for (thread = 0; thread < pme->nthread; thread++)
{
- gather_f_bsplines(pme, grid, bClearF, &pme->atc[0],
- &pme->atc[0].spline[thread],
- scale);
+ try
+ {
+ gather_f_bsplines(pme, grid, bClearF, &pme->atc[0],
+ &pme->atc[0].spline[thread],
+ scale);
+ }
+ GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
}
- GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
- }
- where();
- inc_nrnb(nrnb, eNR_GATHERFBSP,
- pme->pme_order*pme->pme_order*pme->pme_order*pme->atc[0].n);
+ where();
+
+ inc_nrnb(nrnb, eNR_GATHERFBSP,
+ pme->pme_order*pme->pme_order*pme->pme_order*pme->atc[0].n);
+ }
wallcycle_stop(wcycle, ewcPME_SPREADGATHER);
bFirst = FALSE;