Bug fix


I found and fixed a minor bug in fix_addforce.cpp.

The bug occurs when any processor owns no atoms at the start of a run. Initialization calls FixAddForce::post_force(), but if nlocal = 0, sforce is never created, i.e.

  if ((varflag == ATOM || estyle == ATOM) && nlocal > maxatom) {
    maxatom = atom->nmax;

is skipped. This induces an MPI_Allreduce error at runtime that kills the run without saying much else. A simple fix that works:

  if ((nlocal==0) || ( (varflag == ATOM || estyle == ATOM) && nlocal > maxatom)) { ... }

With this modification, the code runs as expected.

If balance were working perfectly, and if everyone who needed to knew enough to use balance, this might not be an issue, but it looks like balance.cpp is currently undergoing a lot of development.