diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index 0369c0d367..196b3b489b 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -720,3 +720,35 @@ void FixDeposit::restart(char *buf) random->reset(seed); } + +/* ---------------------------------------------------------------------- + extract particle radius for atom type = itype +------------------------------------------------------------------------- */ + +void *FixDeposit::extract(const char *str, int &itype) +{ + if (strcmp(str,"radius") == 0) { + if (mode == ATOM) { + if (itype == ntype) oneradius = 0.5; + else oneradius = 0.0; + } else { + double *radius = onemol->radius; + int *type = onemol->type; + int natoms = onemol->natoms; + + // check radii of matching types in Molecule + // default to 0.5, if radii not defined in Molecule + // same as atom->avec->create_atom(), invoked in pre_exchange() + + oneradius = 0.0; + for (int i = 0; i < natoms; i++) + if (type[i] == itype-ntype) { + if (radius) oneradius = MAX(oneradius,radius[i]); + else oneradius = 0.5; + } + } + itype = 0; + return &oneradius; + } + return NULL; +} diff --git a/src/MISC/fix_deposit.h b/src/MISC/fix_deposit.h index 3022f57180..86f3499202 100644 --- a/src/MISC/fix_deposit.h +++ b/src/MISC/fix_deposit.h @@ -27,8 +27,6 @@ namespace LAMMPS_NS { class FixDeposit : public Fix { public: - int ntype; // type of deposited atom, visible to PairGran - FixDeposit(class LAMMPS *, int, char **); ~FixDeposit(); int setmask(); @@ -36,9 +34,10 @@ class FixDeposit : public Fix { void pre_exchange(); void write_restart(FILE *); void restart(char *); + void *extract(const char *, int &); private: - int ninsert,nfreq,seed; + int ninsert,ntype,nfreq,seed; int iregion,globalflag,localflag,maxattempt,rateflag,scaleflag,targetflag; int mode,rigidflag,shakeflag,idnext; double lo,hi,deltasq,nearsq,rate; @@ -53,6 +52,7 @@ class FixDeposit : public Fix { double **coords; imageint *imageflags; class Fix *fixrigid,*fixshake; + double oneradius; int nfirst,ninserted; tagint maxtag_all,maxmol_all;