diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index a7729ba839..4076209b5a 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -38,6 +38,7 @@ using namespace MathConst; enum{ATOM,MOLECULE}; enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files +enum{DIST_UNIFORM,DIST_GAUSSIAN}; #define EPSILON 1.0e6 @@ -169,6 +170,10 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : vyhi *= yscale; vzlo *= zscale; vzhi *= zscale; + xmid *= xscale; + ymid *= yscale; + zmid *= zscale; + sigma *= xscale; // same as in region sphere tx *= xscale; ty *= yscale; tz *= zscale; @@ -336,15 +341,19 @@ void FixDeposit::pre_exchange() attempt++; // choose random position for new particle within region - - coord[0] = xlo + random->uniform() * (xhi-xlo); - coord[1] = ylo + random->uniform() * (yhi-ylo); - coord[2] = zlo + random->uniform() * (zhi-zlo); - while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0) { - coord[0] = xlo + random->uniform() * (xhi-xlo); - coord[1] = ylo + random->uniform() * (yhi-ylo); - coord[2] = zlo + random->uniform() * (zhi-zlo); - } + if (distflag == DIST_UNIFORM) { + do { + coord[0] = xlo + random->uniform() * (xhi-xlo); + coord[1] = ylo + random->uniform() * (yhi-ylo); + coord[2] = zlo + random->uniform() * (zhi-zlo); + } while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0); + } else if (distflag == DIST_GAUSSIAN) { + do { + coord[0] = xmid + random->gaussian() * sigma; + coord[1] = ymid + random->gaussian() * sigma; + coord[2] = zmid + random->gaussian() * sigma; + } while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0); + } else error->all(FLERR,"Unknown particle distribution in fix deposit"); // adjust vertical coord by offset @@ -644,6 +653,9 @@ void FixDeposit::options(int narg, char **arg) maxattempt = 10; rateflag = 0; vxlo = vxhi = vylo = vyhi = vzlo = vzhi = 0.0; + distflag = DIST_UNIFORM; + sigma = 1.0; + xmid = ymid = zmid = 0.0; scaleflag = 1; targetflag = 0; @@ -759,6 +771,14 @@ void FixDeposit::options(int narg, char **arg) else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = 1; else error->all(FLERR,"Illegal fix deposit command"); iarg += 2; + } else if (strcmp(arg[iarg],"gaussian") == 0) { + if (iarg+5 > narg) error->all(FLERR,"Illegal fix deposit command"); + xmid = force->numeric(FLERR,arg[iarg+1]); + ymid = force->numeric(FLERR,arg[iarg+2]); + zmid = force->numeric(FLERR,arg[iarg+3]); + sigma = force->numeric(FLERR,arg[iarg+4]); + distflag = DIST_GAUSSIAN; + iarg += 5; } else if (strcmp(arg[iarg],"target") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deposit command"); tx = force->numeric(FLERR,arg[iarg+1]); diff --git a/src/MISC/fix_deposit.h b/src/MISC/fix_deposit.h index 76fc4f89e7..4663cf6647 100644 --- a/src/MISC/fix_deposit.h +++ b/src/MISC/fix_deposit.h @@ -39,10 +39,10 @@ class FixDeposit : public Fix { private: int ninsert,ntype,nfreq,seed; int iregion,globalflag,localflag,maxattempt,rateflag,scaleflag,targetflag; - int mode,rigidflag,shakeflag,idnext; - double lo,hi,deltasq,nearsq,rate; + int mode,rigidflag,shakeflag,idnext,distflag; + double lo,hi,deltasq,nearsq,rate,sigma; double vxlo,vxhi,vylo,vyhi,vzlo,vzhi; - double xlo,xhi,ylo,yhi,zlo,zhi; + double xlo,xhi,ylo,yhi,zlo,zhi,xmid,ymid,zmid; double tx,ty,tz; char *idregion; char *idrigid,*idshake; diff --git a/src/compute.cpp b/src/compute.cpp index 63a00daa7f..662f60f485 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -133,7 +133,7 @@ void Compute::modify_params(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"extra") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command"); - extra_dof = force->inumeric(FLERR,arg[iarg+1]); + extra_dof = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"dynamic") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command"); diff --git a/src/compute.h b/src/compute.h index 32290a07c0..aae706b34d 100644 --- a/src/compute.h +++ b/src/compute.h @@ -147,7 +147,7 @@ class Compute : protected Pointers { int instance_me; // which Compute class instantiation I am double natoms_temp; // # of atoms used for temperature calculation - int extra_dof; // extra DOF for temperature computes + double extra_dof; // extra DOF for temperature computes int fix_dof; // DOF due to fixes int dynamic; // recount atoms for temperature computes int dynamic_user; // user request for temp compute to be dynamic diff --git a/src/info.cpp b/src/info.cpp index 459894ce48..ead5a68a75 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -262,7 +262,7 @@ void Info::command(int narg, char **arg) fprintf(out,"Communication cutoff for type %d = %g\n", i, cut); } } - fprintf(out,"Nprocs = %d Nthreads = %d\n", + fprintf(out,"Nprocs = %d, Nthreads = %d\n", comm->nprocs, comm->nthreads); fprintf(out,"Processor grid = %d x %d x %d\n",comm->procgrid[0], comm->procgrid[1], comm->procgrid[2]); @@ -411,7 +411,7 @@ void Info::command(int narg, char **arg) fprintf(out,"\nVariable information:\n"); for (int i=0; i < nvar; ++i) { int ndata = 1; - fprintf(out,"Variable[%3d]: %-10s style = %-10s def =", + fprintf(out,"Variable[%3d]: %-10s, style = %-10s, def =", i,names[i],varstyles[style[i]]); if ((style[i] != LOOP) && (style[i] != ULOOP)) ndata = input->variable->num[i];