From 97d7c4227aefd64d71ea64a9c24d5cc2adda1fb0 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Thu, 15 Jun 2017 14:18:00 +0200
Subject: [PATCH] Further fix

After d669afb2b9a1230a74d9299a59ea0fa374639622 there was still
a fix in EffectiveEnergyDrift.cpp when a domain had zero atoms.

This could affect real calculations, so I think this fix should be
backported to v2.3

Fixes #246
---
 src/generic/EffectiveEnergyDrift.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/generic/EffectiveEnergyDrift.cpp b/src/generic/EffectiveEnergyDrift.cpp
index 2fc2ff32a..f0d98d1f0 100644
--- a/src/generic/EffectiveEnergyDrift.cpp
+++ b/src/generic/EffectiveEnergyDrift.cpp
@@ -258,8 +258,8 @@ void EffectiveEnergyDrift::update() {
     }
 
     //share stored data
-    plumed.comm.Allgatherv(&indexS[0], pNLocalAtoms, &indexR[0], &indexCnt[0], &indexDsp[0]);
-    plumed.comm.Allgatherv(&dataS[0], pNLocalAtoms*6, &dataR[0], &dataCnt[0], &dataDsp[0]);
+    plumed.comm.Allgatherv((!indexS.empty()?&indexS[0]:NULL), pNLocalAtoms, &indexR[0], &indexCnt[0], &indexDsp[0]);
+    plumed.comm.Allgatherv((!dataS.empty()?&dataS[0]:NULL), pNLocalAtoms*6, &dataR[0], &dataCnt[0], &dataDsp[0]);
 
     //resize vectors to store the proper amount of data
     pGatindex.resize(nLocalAtoms);
-- 
GitLab