Unverified Commit 89f58836 authored by To Quy-Dong's avatar To Quy-Dong Committed by GitHub
Browse files

Add files via upload

parent b681e6e8
Loading
Loading
Loading
Loading
+32 −12
Changes for src/fix_wall_reflect.cpp: 32 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -24,11 +24,11 @@
#include "error.h"
#include "force.h"


using namespace LAMMPS_NS;
using namespace FixConst;

enum{XLO=0,XHI=1,YLO=2,YHI=3,ZLO=4,ZHI=5};
enum{NONE=0,EDGE,CONSTANT,VARIABLE};


/* ---------------------------------------------------------------------- */

@@ -36,8 +36,13 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
  Fix(lmp, narg, arg),
  nwall(0)
{ 
  

  if (narg < 4) error->all(FLERR,"Illegal fix wall/reflect command");

  if (strcmp(arg[2],"wall/reflect") == 0){ // child class can be stochastic


  dynamic_group_allow = 1;

  // parse args
@@ -84,6 +89,7 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
      nwall++;
      iarg += 2;


    } else if (strcmp(arg[iarg],"units") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal wall/reflect command");
      if (strcmp(arg[iarg+1],"box") == 0) scaleflag = 0;
@@ -140,6 +146,8 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
    if (wallstyle[m] == VARIABLE) varflag = 1;
}

}

/* ---------------------------------------------------------------------- */

FixWallReflect::~FixWallReflect()
@@ -186,16 +194,13 @@ void FixWallReflect::init()

void FixWallReflect::post_integrate()
{
  int i,dim,side;
  //int m;
  double coord;

  // coord = current position of wall
  // evaluate variable if necessary, wrap with clear/add

  double **x = atom->x;
  double **v = atom->v;
  int *mask = atom->mask;
  int nlocal = atom->nlocal;


  if (varflag) modify->clearstep_compute();

@@ -207,11 +212,29 @@ void FixWallReflect::post_integrate()
      else coord *= zscale;
    } else coord = coord0[m];

    dim = wallwhich[m] / 2;
    side = wallwhich[m] % 2;

    wall_particle(m,wallwhich[m],coord);


  if (varflag) modify->addstep_compute(update->ntimestep + 1);
}
}

void FixWallReflect::wall_particle(int m, int which, double coord)
{
  int i, dim, side,sign;

  double **x = atom->x;
  double **v = atom->v;
  int *mask = atom->mask;
  int nlocal = atom->nlocal;

    dim = which / 2;
    side = which % 2;

    for (i = 0; i < nlocal; i++)
      if (mask[i] & groupbit) {

        if (side == 0) {
          if (x[i][dim] < coord) {
            x[i][dim] = coord + (coord - x[i][dim]);
@@ -225,6 +248,3 @@ void FixWallReflect::post_integrate()
        }
      }
}
 No newline at end of file

  if (varflag) modify->addstep_compute(update->ntimestep + 1);
}
+3 −0
Changes for src/fix_wall_reflect.h: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -28,9 +28,12 @@ class FixWallReflect : public Fix {
 public:
  FixWallReflect(class LAMMPS *, int, char **);
  virtual ~FixWallReflect();
  virtual void wall_particle(int m, int which, double coord);
  int setmask();
  void init();
  void post_integrate();
  enum{XLO=0,XHI=1,YLO=2,YHI=3,ZLO=4,ZHI=5};
  enum{NONE=0,EDGE,CONSTANT,VARIABLE};
  
 protected:
  int nwall;