From b260aa2b1164c2c68f3e2123e38cedb9ad902531 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 4 Apr 2014 04:07:13 -0400 Subject: [PATCH] fix for bug when trying to delete atoms on a node without atoms --- src/atom.cpp | 8 ++++---- src/atom_map.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index 2280943a33..84a403125e 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -161,9 +161,9 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) tag_enable = 1; map_style = map_user = 0; - map_tag_max = 0; + map_tag_max = -1; map_maxarray = 0; - map_nhash = 0; + map_nhash = -1; max_same = 0; sametag = NULL; @@ -1848,9 +1848,9 @@ bigint Atom::memory_usage() memory->destroy(memstr); bytes += max_same*sizeof(int); - if (map_style == 1) + if (map_style == 1 && map_tag_max >= 0) bytes += memory->usage(map_array,map_maxarray); - else if (map_style == 2) { + else if (map_style == 2 && map_nhash >=0) { bytes += map_nbucket*sizeof(int); bytes += map_nhash*sizeof(HashElem); } diff --git a/src/atom_map.cpp b/src/atom_map.cpp index 1d16cd71a0..13e1df888d 100644 --- a/src/atom_map.cpp +++ b/src/atom_map.cpp @@ -291,7 +291,7 @@ int Atom::map_style_set() // map_tag_max = max ID of any atom that will be in new map - tagint max = 0; + tagint max = -1; for (int i = 0; i < nlocal; i++) max = MAX(max,tag[i]); MPI_Allreduce(&max,&map_tag_max,1,MPI_LMP_TAGINT,MPI_MAX,world);