From 62b27e591539f40e3b552af3d5c930356d898a53 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 8 Dec 2011 23:20:32 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@7324 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/min.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/min.cpp b/src/min.cpp index 6322b96f77..eebfd03dcd 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -533,11 +533,13 @@ void Min::force_clear() size_t nbytes = sizeof(double) * nall; - memset(&(atom->f[0][0]),0,3*nbytes); - if (torqueflag) memset(&(atom->torque[0][0]),0,3*nbytes); - if (erforceflag) memset(&(atom->erforce[0]), 0, nbytes); - if (e_flag) memset(&(atom->de[0]), 0, nbytes); - if (rho_flag) memset(&(atom->drho[0]), 0, nbytes); + if (nbytes) { + memset(&(atom->f[0][0]),0,3*nbytes); + if (torqueflag) memset(&(atom->torque[0][0]),0,3*nbytes); + if (erforceflag) memset(&(atom->erforce[0]), 0, nbytes); + if (e_flag) memset(&(atom->de[0]), 0, nbytes); + if (rho_flag) memset(&(atom->drho[0]), 0, nbytes); + } } /* ----------------------------------------------------------------------