Commit 56e1032c authored by Jared's avatar Jared
Browse files

Update gcmc to have a max and min

parent 0849e03d
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -391,6 +391,14 @@ void FixGCMC::options(int narg, char **arg)
      overlap_cutoffsq = rtmp*rtmp;
      overlap_flag = 1;
      iarg += 2;
    } else if (strcmp(arg[iarg],"min") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command");
      min_ngas = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"max") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command");
      max_ngas = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else error->all(FLERR,"Illegal fix gcmc command");
  }
}
@@ -897,7 +905,7 @@ void FixGCMC::attempt_atomic_deletion()
{
  ndeletion_attempts += 1.0;

  if (ngas == 0) return;
  if (ngas == 0 || ngas == min_ngas) return;

  int i = pick_random_gas_atom();

@@ -938,6 +946,8 @@ void FixGCMC::attempt_atomic_insertion()

  ninsertion_attempts += 1.0;

  if (ngas == max_ngas) return;
  
  // pick coordinates for insertion point

  double coord[3];
@@ -1252,7 +1262,7 @@ void FixGCMC::attempt_molecule_deletion()
{
  ndeletion_attempts += 1.0;

  if (ngas == 0) return;
  if (ngas == 0 || ngas == min_ngas) return;

  // work-around to avoid n=0 problem with fix rigid/nvt/small

@@ -1291,6 +1301,8 @@ void FixGCMC::attempt_molecule_insertion()
  double lamda[3];
  ninsertion_attempts += 1.0;

  if (ngas == max_ngas) return;
  
  double com_coord[3];
  if (regionflag) {
    int region_attempt = 0;
@@ -1574,7 +1586,7 @@ void FixGCMC::attempt_atomic_deletion_full()

  ndeletion_attempts += 1.0;

  if (ngas == 0) return;
  if (ngas == 0 || ngas == min_ngas) return;

  double energy_before = energy_stored;

@@ -1623,6 +1635,8 @@ void FixGCMC::attempt_atomic_insertion_full()
  double lamda[3];
  ninsertion_attempts += 1.0;

  if (ngas == max_ngas) return;
  
  double energy_before = energy_stored;

  double coord[3];
@@ -1918,7 +1932,7 @@ void FixGCMC::attempt_molecule_deletion_full()
{
  ndeletion_attempts += 1.0;

  if (ngas == 0) return;
  if (ngas == 0 || ngas == min_ngas) return;

  // work-around to avoid n=0 problem with fix rigid/nvt/small

@@ -2001,6 +2015,8 @@ void FixGCMC::attempt_molecule_insertion_full()
  double lamda[3];
  ninsertion_attempts += 1.0;

  if (ngas == max_ngas) return;

  double energy_before = energy_stored;

  tagint maxmol = 0;
+2 −0
Original line number Diff line number Diff line
@@ -120,6 +120,8 @@ class FixGCMC : public Fix {
  imageint imagezero;
  double overlap_cutoffsq; // square distance cutoff for overlap
  int overlap_flag;
  int max_ngas;
  int min_ngas;

  double energy_intra;