From a71d94841a8961acda577dc6c2f458488545fd66 Mon Sep 17 00:00:00 2001
From: pscrozi <pscrozi@f3b2605a-c512-4ea7-a41b-209d697bcdaa>
Date: Mon, 23 Mar 2015 18:04:12 +0000
Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13276
 f3b2605a-c512-4ea7-a41b-209d697bcdaa

---
 src/MC/fix_gcmc.cpp | 14 ++++++++------
 src/MC/fix_gcmc.h   |  1 -
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp
index e4af71faf5..80e81a2ac0 100644
--- a/src/MC/fix_gcmc.cpp
+++ b/src/MC/fix_gcmc.cpp
@@ -218,7 +218,6 @@ void FixGCMC::options(int narg, char **arg)
   molecule_group_inversebit = 0;
   exclusion_group = 0;
   exclusion_group_bit = 0;
-  exclusion_group_inversebit = 0;
   pressure_flag = false;
   pressure = 0.0;
   fugacity_coeff = 1.0;
@@ -432,7 +431,6 @@ void FixGCMC::init()
     if (exclusion_group == -1) 
       error->all(FLERR,"Could not find fix gcmc exclusion group ID");
     exclusion_group_bit = group->bitmask[exclusion_group];
-    exclusion_group_inversebit = exclusion_group_bit ^ ~0;
     
     // neighbor list exclusion setup
     // turn off interactions between group all and the exclusion group
@@ -1281,8 +1279,10 @@ void FixGCMC::attempt_atomic_deletion_full()
 
   int i = pick_random_gas_atom();
 
+  int tmpmask;
   if (i >= 0) {
-    atom->mask[i] |= exclusion_group_bit;
+    tmpmask = atom->mask[i];
+    atom->mask[i] = exclusion_group_bit;
     if (atom->q_flag) {
       q_tmp = atom->q[i];
       atom->q[i] = 0.0;
@@ -1302,7 +1302,7 @@ void FixGCMC::attempt_atomic_deletion_full()
     energy_stored = energy_after;    
   } else {
     if (i >= 0) {
-      atom->mask[i] &= exclusion_group_inversebit;
+      atom->mask[i] = tmpmask;
       if (atom->q_flag) atom->q[i] = q_tmp;
     }
     energy_stored = energy_before;
@@ -1565,9 +1565,11 @@ void FixGCMC::attempt_molecule_deletion_full()
   
   int m = 0;
   double q_tmp[natoms_per_molecule];
+  int tmpmask[atom->nlocal];
   for (int i = 0; i < atom->nlocal; i++) {
     if (atom->molecule[i] == deletion_molecule) {
-      atom->mask[i] |= exclusion_group_bit;
+      tmpmask[i] = atom->mask[i];
+      atom->mask[i] = exclusion_group_bit;
       if (atom->q_flag) {
         q_tmp[m] = atom->q[i];
         m++;
@@ -1597,7 +1599,7 @@ void FixGCMC::attempt_molecule_deletion_full()
     int m = 0;
     for (int i = 0; i < atom->nlocal; i++) {
       if (atom->molecule[i] == deletion_molecule) {
-        atom->mask[i] &= exclusion_group_inversebit;
+        atom->mask[i] = tmpmask[i];
         if (atom->q_flag) {
           atom->q[i] = q_tmp[m];
           m++;
diff --git a/src/MC/fix_gcmc.h b/src/MC/fix_gcmc.h
index 57ad0c4296..cc5a62a11a 100644
--- a/src/MC/fix_gcmc.h
+++ b/src/MC/fix_gcmc.h
@@ -61,7 +61,6 @@ class FixGCMC : public Fix {
   int molecule_group,molecule_group_bit;
   int molecule_group_inversebit;
   int exclusion_group,exclusion_group_bit;
-  int exclusion_group_inversebit;
   int ngcmc_type,nevery,seed;
   int ncycles,nexchanges,nmcmoves;
   int ngas;                 // # of gas atoms on all procs
-- 
GitLab