Commit 25c3a452 authored by Tongtong Shen's avatar Tongtong Shen
Browse files

Added New keywords rotation rx ry rz to fix_deposit

parent 572235e6
Loading
Loading
Loading
Loading
+22 −5
Original line number Diff line number Diff line
@@ -11,10 +11,10 @@
   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

#include "fix_deposit.h"
#include <mpi.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "fix_deposit.h"
#include "atom.h"
#include "atom_vec.h"
#include "molecule.h"
@@ -418,9 +418,15 @@ void FixDeposit::pre_exchange()
      while (rng > molfrac[imol]) imol++;
      natom = onemols[imol]->natoms;
      if (dimension == 3) {
        if (rflag == 1) {
          r[0] = rx;
          r[1] = ry;
          r[2] = rz;
        } else {
          r[0] = random->uniform() - 0.5;
          r[1] = random->uniform() - 0.5;
          r[2] = random->uniform() - 0.5;
        }
      } else {
        r[0] = r[1] = 0.0;
        r[2] = 1.0;
@@ -659,6 +665,10 @@ void FixDeposit::options(int narg, char **arg)
  xmid = ymid = zmid = 0.0;
  scaleflag = 1;
  targetflag = 0;
  rflag = 0;
  rx = 0.0;
  ry = 0.0;
  rz = 0.0;

  int iarg = 0;
  while (iarg < narg) {
@@ -766,6 +776,13 @@ void FixDeposit::options(int narg, char **arg)
      vzlo = force->numeric(FLERR,arg[iarg+1]);
      vzhi = force->numeric(FLERR,arg[iarg+2]);
      iarg += 3;
    } else if (strcmp(arg[iarg],"rotation") == 0) {
      if (iarg+4 > narg) error->all(FLERR,"Illegal fix deposit command");
      rflag = 1;
      rx = force->numeric(FLERR,arg[iarg+1]);
      ry = force->numeric(FLERR,arg[iarg+2]);
      rz = force->numeric(FLERR,arg[iarg+3]);
      iarg += 4;
    } else if (strcmp(arg[iarg],"units") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command");
      if (strcmp(arg[iarg+1],"box") == 0) scaleflag = 0;
+3 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ FixStyle(deposit,FixDeposit)
#ifndef LMP_FIX_DEPOSIT_H
#define LMP_FIX_DEPOSIT_H

#include <cstdio>
#include "fix.h"

namespace LAMMPS_NS {
@@ -38,9 +39,9 @@ class FixDeposit : public Fix {
 private:
  int ninsert,ntype,nfreq,seed;
  int iregion,globalflag,localflag,maxattempt,rateflag,scaleflag,targetflag;
  int mode,rigidflag,shakeflag,idnext,distflag;
  int mode,rigidflag,shakeflag,idnext,distflag,rflag;
  double lo,hi,deltasq,nearsq,rate,sigma;
  double vxlo,vxhi,vylo,vyhi,vzlo,vzhi;
  double vxlo,vxhi,vylo,vyhi,vzlo,vzhi,rx,ry,rz;
  double xlo,xhi,ylo,yhi,zlo,zhi,xmid,ymid,zmid;
  double tx,ty,tz;
  char *idregion;