diff --git a/src/MUTATION/fix_mutate.cpp b/src/MUTATION/fix_mutate.cpp index 52d71fa749..18047feb91 100644 --- a/src/MUTATION/fix_mutate.cpp +++ b/src/MUTATION/fix_mutate.cpp @@ -94,7 +94,7 @@ void FixMutate::compute() if (mask[i] & groupbit) { if (random->uniform() < prob) { mask[i] = imutant; - }MUT + } } } } diff --git a/src/NUFEB/fix_divide_bacillus.cpp b/src/NUFEB/fix_divide_bacillus.cpp index 51d6e99671..3be5cb9935 100644 --- a/src/NUFEB/fix_divide_bacillus.cpp +++ b/src/NUFEB/fix_divide_bacillus.cpp @@ -108,7 +108,7 @@ void FixDivideBacillus::compute() double imass, jmass; double ilen, xp1[3], xp2[3]; - // double phiz = random->uniform() * 2e-8; + // double phiz = random->uniform() * 2e-8; double vsphere = four_thirds_pi * atom->radius[i]*atom->radius[i]*atom->radius[i]; double acircle = MY_PI*atom->radius[i]*atom->radius[i]; diff --git a/src/NUFEB/fix_property.cpp b/src/NUFEB/fix_property.cpp index 1ec85e4809..8d33965b1f 100644 --- a/src/NUFEB/fix_property.cpp +++ b/src/NUFEB/fix_property.cpp @@ -79,7 +79,7 @@ int FixProperty::modify_param(int narg, char **arg) double FixProperty::memory_usage() { double bytes; - if (size_peratom_cols > 0) + if (size_peratom_cols > 1) bytes = atom->nmax*size_peratom_cols*sizeof(double); else bytes = atom->nmax*sizeof(double); @@ -93,7 +93,7 @@ double FixProperty::memory_usage() void FixProperty::grow_arrays(int nmax) { - if (size_peratom_cols > 0) { + if (size_peratom_cols > 1) { memory->grow(aprop,nmax,size_peratom_cols,"fix_property:array"); array_atom = aprop; } else { @@ -108,7 +108,7 @@ void FixProperty::grow_arrays(int nmax) void FixProperty::copy_arrays(int i, int j, int /*delflag*/) { - if (size_peratom_cols > 0) { + if (size_peratom_cols > 1) { for (int m = 0; m < size_peratom_cols; m++) aprop[j][m] = aprop[i][m]; } else { @@ -122,7 +122,7 @@ void FixProperty::copy_arrays(int i, int j, int /*delflag*/) int FixProperty::pack_exchange(int i, double *buf) { - if (size_peratom_cols > 0) { + if (size_peratom_cols > 1) { for (int m = 0; m < size_peratom_cols; m++) buf[m] = aprop[i][m]; } else { @@ -137,7 +137,7 @@ int FixProperty::pack_exchange(int i, double *buf) int FixProperty::unpack_exchange(int nlocal, double *buf) { - if (size_peratom_cols > 0) { + if (size_peratom_cols > 1) { for (int m = 0; m < size_peratom_cols; m++) aprop[nlocal][m] = buf[m]; } else { @@ -153,7 +153,7 @@ int FixProperty::unpack_exchange(int nlocal, double *buf) int FixProperty::pack_restart(int i, double *buf) { buf[0] = size_peratom_cols + 1; - if (size_peratom_cols > 0) { + if (size_peratom_cols > 1) { for (int m = 0; m < size_peratom_cols; m++) buf[m+1] = aprop[i][m]; } else { @@ -174,9 +174,9 @@ void FixProperty::unpack_restart(int nlocal, int nth) int m = 0; for (int i = 0; i < nth; i++) m += static_cast (extra[nlocal][m]); m++; - if (size_peratom_cols > 0) { + if (size_peratom_cols > 1) { for (int i = 0; i < size_peratom_cols; i++) - aprop[nlocal][i] = extra[nlocal][m]; + aprop[nlocal][i] = extra[nlocal][m++]; } else { vprop[nlocal] = extra[nlocal][m]; } diff --git a/src/NUFEB/fix_property_ancestor.cpp b/src/NUFEB/fix_property_ancestor.cpp index ab394cbb6f..0bda959dda 100644 --- a/src/NUFEB/fix_property_ancestor.cpp +++ b/src/NUFEB/fix_property_ancestor.cpp @@ -30,8 +30,8 @@ FixPropertyAncestor::FixPropertyAncestor(LAMMPS *lmp, int narg, char **arg) : if (narg < 3) error->all(FLERR,"Illegal fix property/nufeb/ancestor command"); create_attribute = 1; - // use vprop if size_peratom_cols = 0 - size_peratom_cols = 0; + // use vprop if size_peratom_cols = 1 + size_peratom_cols = 1; grow_arrays(atom->nmax); } diff --git a/src/NUFEB/fix_property_cycletime.cpp b/src/NUFEB/fix_property_cycletime.cpp index d20bb95af7..e080ee81a0 100644 --- a/src/NUFEB/fix_property_cycletime.cpp +++ b/src/NUFEB/fix_property_cycletime.cpp @@ -19,6 +19,7 @@ #include "memory.h" #include "error.h" #include "update.h" +#include "random_park.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -26,7 +27,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixPropertyCycletime::FixPropertyCycletime(LAMMPS *lmp, int narg, char **arg) : - FixProperty(lmp, narg, arg) + FixProperty(lmp, narg, arg) { if (narg < 3) error->all(FLERR,"Illegal fix nufeb/property/cycletime command"); @@ -35,6 +36,37 @@ FixPropertyCycletime::FixPropertyCycletime(LAMMPS *lmp, int narg, char **arg) : // use aprop if size_peratom_cols > 0 size_peratom_cols = 2; grow_arrays(atom->nmax); + + seed = 0; + max_time = 0; + ran_flag = 0; + + int iarg = 3; + while (iarg < narg) { + if (strcmp(arg[iarg], "seed") == 0) { + seed = utils::inumeric(FLERR,arg[iarg+1],true,lmp); + random = new RanPark(lmp, seed); + ran_flag = 1; + iarg += 2; + } else if (strcmp(arg[iarg], "max_time") == 0 ) { + max_time = utils::numeric(FLERR,arg[iarg+1],true,lmp); + iarg += 2; + } else { + error->all(FLERR, "Illegal fix nufeb/property/cycletime command"); + } + } + + for (int i = 0; i < atom->nlocal; i++) { + if (atom->mask[i] & groupbit) { + if (ran_flag > 0) { + aprop[i][0] = random->uniform() * max_time; + aprop[i][1] = aprop[i][0]; + } else { + aprop[i][0] = 0.0; + aprop[i][1] = 0.0; + } + } + } } /* ---------------------------------------------------------------------- */ @@ -46,16 +78,6 @@ int FixPropertyCycletime::setmask() return mask; } -/* ---------------------------------------------------------------------- */ - -void FixPropertyCycletime::init() -{ - for (int i = 0; i < atom->nlocal; i++) { - aprop[i][0] = 0.0; - aprop[i][1] = 0.0; - } -} - /* ---------------------------------------------------------------------- update cell age ------------------------------------------------------------------------- */ @@ -67,6 +89,7 @@ void FixPropertyCycletime::biology_nufeb() for (int i = 0; i < atom->nlocal; i++) { if (atom->mask[i] & groupbit) { aprop[i][0] += update->dt; + aprop[i][1] += update->dt; } } } @@ -78,7 +101,6 @@ void FixPropertyCycletime::biology_nufeb() void FixPropertyCycletime::set_arrays(int j) { aprop[j][0] = 0.0; - aprop[j][1] = 0.0; } /* ---------------------------------------------------------------------- @@ -87,10 +109,9 @@ void FixPropertyCycletime::set_arrays(int j) ------------------------------------------------------------------------- */ void FixPropertyCycletime::update_arrays(int i, int j) { - // no need to update j here as this has been done in set_arrary // when cell divides, record cell cycle time and reset to 0 - aprop[i][1] = aprop[i][0]; aprop[i][0] = 0.0; + aprop[j][1] = aprop[i][1]; } /* ---------------------------------------------------------------------- diff --git a/src/NUFEB/fix_property_cycletime.h b/src/NUFEB/fix_property_cycletime.h index 51d4b73d7c..5e959e2042 100644 --- a/src/NUFEB/fix_property_cycletime.h +++ b/src/NUFEB/fix_property_cycletime.h @@ -25,17 +25,27 @@ FixStyle(nufeb/property/cycletime,FixPropertyCycletime) namespace LAMMPS_NS { class FixPropertyCycletime : public FixProperty { - public: +public: FixPropertyCycletime(class LAMMPS *, int, char **); virtual ~FixPropertyCycletime() {}; - void init(); int setmask(); void biology_nufeb(); void set_arrays(int); void update_arrays(int, int); double compute_scalar(); + +// int pack_restart(int, double *); +// void unpack_restart(int, int); +// int size_restart(int); +// int maxsize_restart(); + +protected: + int seed, ran_flag; + double max_time; + + class RanPark *random; }; } diff --git a/src/NUFEB/fix_property_generation.cpp b/src/NUFEB/fix_property_generation.cpp index 861e12415a..481670b024 100644 --- a/src/NUFEB/fix_property_generation.cpp +++ b/src/NUFEB/fix_property_generation.cpp @@ -31,8 +31,8 @@ FixPropertyGeneration::FixPropertyGeneration(LAMMPS *lmp, int narg, char **arg) if (narg < 3) error->all(FLERR,"Illegal fix nufeb/property/generation command"); create_attribute = 1; - // use vprop if size_peratom_cols = 0 - size_peratom_cols = 0; + // use vprop if size_peratom_cols = 1 + size_peratom_cols = 1; grow_arrays(atom->nmax); } @@ -68,9 +68,7 @@ void FixPropertyGeneration::set_arrays(int j) ------------------------------------------------------------------------- */ void FixPropertyGeneration::update_arrays(int i, int j) { - if (atom->mask[i] & groupbit) vprop[i]++; - if (atom->mask[j] & groupbit) vprop[j] = vprop[i]; } diff --git a/src/PLASMID/fix_property_plasmid.cpp b/src/PLASMID/fix_property_plasmid.cpp index 36cb865292..dd6d1963d0 100644 --- a/src/PLASMID/fix_property_plasmid.cpp +++ b/src/PLASMID/fix_property_plasmid.cpp @@ -78,7 +78,7 @@ FixPropertyPlasmid::FixPropertyPlasmid(LAMMPS *lmp, int narg, char **arg) : if (plm_init > plm_max) error->all(FLERR,"Illegal fix nufeb/property/plasmid command: " "initial plasmid cannot be more than maximum plasmid number"); - size_peratom_cols = 0; + size_peratom_cols = 1; fila_max = plm_max * (plm_max - 1) / 2; grow_arrays(atom->nmax);