From 03f99b8b358864a970951a3de40b2f9b750e5909 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 18 Mar 2009 17:47:46 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@2678 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_evaporate.cpp | 25 +++++++++++++++++++++++++ src/fix_evaporate.h | 1 + 2 files changed, 26 insertions(+) diff --git a/src/fix_evaporate.cpp b/src/fix_evaporate.cpp index f74d18c9ad..913cf7696a 100644 --- a/src/fix_evaporate.cpp +++ b/src/fix_evaporate.cpp @@ -21,6 +21,7 @@ #include "domain.h" #include "region.h" #include "comm.h" +#include "group.h" #include "random_park.h" #include "random_mars.h" #include "memory.h" @@ -84,6 +85,30 @@ int FixEvaporate::setmask() return mask; } +/* ---------------------------------------------------------------------- */ + +void FixEvaporate::init() +{ + // check that no deletable atoms are in atom->firstgroup + // deleting such an atom would not leave firstgroup atoms first + + if (atom->firstgroup >= 0) { + int *mask = atom->mask; + int nlocal = atom->nlocal; + int firstgroupbit = group->bitmask[atom->firstgroup]; + + int flag = 0; + for (int i = 0; i < nlocal; i++) + if ((mask[i] & groupbit) && (mask[i] && firstgroupbit)) flag = 1; + + int flagall; + MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); + + if (flagall) + error->all("Cannot evaporate atoms in atom_modify first group"); + } +} + /* ---------------------------------------------------------------------- perform particle deletion done before exchange, borders, reneighbor diff --git a/src/fix_evaporate.h b/src/fix_evaporate.h index 5b9866222e..8f788eb4fc 100644 --- a/src/fix_evaporate.h +++ b/src/fix_evaporate.h @@ -23,6 +23,7 @@ class FixEvaporate : public Fix { FixEvaporate(class LAMMPS *, int, char **); ~FixEvaporate(); int setmask(); + void init(); void pre_exchange(); double compute_scalar(); double memory_usage();