From 2120df62cb5b6a1a743194c059f5e2ab76e4bae7 Mon Sep 17 00:00:00 2001 From: Berk Hess Date: Mon, 4 Aug 2014 14:18:36 +0200 Subject: [PATCH] Fix hang with LJ-PME and empty domains With LJ-PME and DD domains with 0 atoms and LJ-PME mdrun could hang. Fixes #1571. Change-Id: Ie205954c4f5e1a52df846a69972f735867eea15d --- src/gromacs/legacyheaders/pme.h | 1 + src/gromacs/mdlib/domdec.c | 4 +++- src/gromacs/mdlib/pme_pp.c | 23 +++++++++++++---------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/gromacs/legacyheaders/pme.h b/src/gromacs/legacyheaders/pme.h index 5f985fe29b..da0b4a1c5d 100644 --- a/src/gromacs/legacyheaders/pme.h +++ b/src/gromacs/legacyheaders/pme.h @@ -152,6 +152,7 @@ gmx_pme_pp_t gmx_pme_pp_init(t_commrec *cr); /* Initialize the PME-only side of the PME <-> PP communication */ void gmx_pme_send_parameters(t_commrec *cr, + const interaction_const_t *ic, gmx_bool bFreeEnergy_q, gmx_bool bFreeEnergy_lj, real *chargeA, real *chargeB, real *sqrt_c6A, real *sqrt_c6B, diff --git a/src/gromacs/mdlib/domdec.c b/src/gromacs/mdlib/domdec.c index c995192a36..ae2a4f8098 100644 --- a/src/gromacs/mdlib/domdec.c +++ b/src/gromacs/mdlib/domdec.c @@ -9769,7 +9769,9 @@ void dd_partition_system(FILE *fplog, if (!(cr->duty & DUTY_PME)) { /* Send the charges and/or c6/sigmas to our PME only node */ - gmx_pme_send_parameters(cr, mdatoms->nChargePerturbed, mdatoms->nTypePerturbed, + gmx_pme_send_parameters(cr, + fr->ic, + mdatoms->nChargePerturbed, mdatoms->nTypePerturbed, mdatoms->chargeA, mdatoms->chargeB, mdatoms->sqrt_c6A, mdatoms->sqrt_c6B, mdatoms->sigmaA, mdatoms->sigmaB, diff --git a/src/gromacs/mdlib/pme_pp.c b/src/gromacs/mdlib/pme_pp.c index 1b3f9c6527..0aee97b824 100644 --- a/src/gromacs/mdlib/pme_pp.c +++ b/src/gromacs/mdlib/pme_pp.c @@ -190,9 +190,11 @@ static void gmx_pme_send_coeffs_coords(t_commrec *cr, int flags, if (debug) { - fprintf(debug, "PP rank %d sending to PME rank %d: %d%s%s\n", + fprintf(debug, "PP rank %d sending to PME rank %d: %d%s%s%s%s\n", cr->sim_nodeid, dd->pme_nodeid, n, flags & PP_PME_CHARGE ? " charges" : "", + flags & PP_PME_SQRTC6 ? " sqrtC6" : "", + flags & PP_PME_SIGMA ? " sigma" : "", flags & PP_PME_COORD ? " coordinates" : ""); } @@ -295,6 +297,7 @@ static void gmx_pme_send_coeffs_coords(t_commrec *cr, int flags, } void gmx_pme_send_parameters(t_commrec *cr, + const interaction_const_t *ic, gmx_bool bFreeEnergy_q, gmx_bool bFreeEnergy_lj, real *chargeA, real *chargeB, real *sqrt_c6A, real *sqrt_c6B, @@ -303,15 +306,14 @@ void gmx_pme_send_parameters(t_commrec *cr, { int flags; - /* We always send the charges, even with only LJ- and no Coulomb-PME */ - flags = PP_PME_CHARGE; - if (sqrt_c6A != NULL) + flags = 0; + if (EEL_PME(ic->eeltype)) { - flags |= PP_PME_SQRTC6; + flags |= PP_PME_CHARGE; } - if (sigmaA != NULL) + if (EVDW_PME(ic->vdwtype)) { - flags |= PP_PME_SIGMA; + flags |= (PP_PME_SQRTC6 | PP_PME_SIGMA); } if (bFreeEnergy_q || bFreeEnergy_lj) { @@ -561,9 +563,10 @@ int gmx_pme_recv_coeffs_coords(struct gmx_pme_pp *pme_pp, nat += pme_pp->nat[sender]; if (debug) { - fprintf(debug, "Received from PP rank %d: %d " - "charges\n", - pme_pp->node[sender], pme_pp->nat[sender]); + fprintf(debug, "Received from PP rank %d: %d %s\n", + pme_pp->node[sender], pme_pp->nat[sender], + (q == eCommType_ChargeA || + q == eCommType_ChargeB) ? "charges" : "params"); } } } -- 2.22.0