reformat modified core LAMMPS code
This commit is contained in:
@ -24,25 +24,19 @@
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
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
|
||||
@ -55,7 +49,8 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
|
||||
if ((strcmp(arg[iarg],"xlo") == 0) || (strcmp(arg[iarg],"xhi") == 0) ||
|
||||
(strcmp(arg[iarg],"ylo") == 0) || (strcmp(arg[iarg],"yhi") == 0) ||
|
||||
(strcmp(arg[iarg],"zlo") == 0) || (strcmp(arg[iarg],"zhi") == 0)) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall/reflect command");
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal fix wall/reflect command");
|
||||
|
||||
int newwall;
|
||||
if (strcmp(arg[iarg],"xlo") == 0) newwall = XLO;
|
||||
@ -89,7 +84,6 @@ 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;
|
||||
@ -145,7 +139,6 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
|
||||
for (int m = 0; m < nwall; m++)
|
||||
if (wallstyle[m] == VARIABLE) varflag = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -200,8 +193,6 @@ void FixWallReflect::post_integrate()
|
||||
// coord = current position of wall
|
||||
// evaluate variable if necessary, wrap with clear/add
|
||||
|
||||
|
||||
|
||||
if (varflag) modify->clearstep_compute();
|
||||
|
||||
for (int m = 0; m < nwall; m++) {
|
||||
@ -212,10 +203,8 @@ void FixWallReflect::post_integrate()
|
||||
else coord *= zscale;
|
||||
} else coord = coord0[m];
|
||||
|
||||
|
||||
wall_particle(m,wallwhich[m],coord);
|
||||
|
||||
|
||||
if (varflag) modify->addstep_compute(update->ntimestep + 1);
|
||||
}
|
||||
}
|
||||
@ -232,7 +221,7 @@ void FixWallReflect::wall_particle(int m, int which, double coord)
|
||||
dim = which / 2;
|
||||
side = which % 2;
|
||||
|
||||
for (i = 0; i < nlocal; i++)
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
if (mask[i] & groupbit) {
|
||||
|
||||
if (side == 0) {
|
||||
@ -248,3 +237,4 @@ void FixWallReflect::wall_particle(int m, int which, double coord)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include "random_mars.h"
|
||||
#include <cmath>
|
||||
#include "error.h"
|
||||
#include "math_const.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -125,7 +126,6 @@ double RanMars::gaussian(double mu, double sigma)
|
||||
v1 = mu+sigma*gaussian();
|
||||
return v1;
|
||||
}
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -136,9 +136,9 @@ double RanMars::rayleigh(double sigma)
|
||||
{
|
||||
double first,v1;
|
||||
|
||||
if (sigma <= 0)
|
||||
if (sigma <= 0) {
|
||||
error->all(FLERR,"Invalid Rayleigh parameter");
|
||||
else {
|
||||
} else {
|
||||
v1 = uniform();
|
||||
first = sigma*sqrt(-2.0*log(v1));
|
||||
return first;
|
||||
@ -153,17 +153,20 @@ double RanMars::rayleigh(double sigma)
|
||||
double RanMars::besselexp(double theta, double alpha, double cp)
|
||||
{
|
||||
double first,v1,v2;
|
||||
|
||||
|
||||
if ((theta < 0) || (alpha < 0) || (alpha >1))
|
||||
if ((theta < 0) || (alpha < 0) || (alpha >1)) {
|
||||
error->all(FLERR,"Invalid Bessel exponential distribution parameters");
|
||||
else {
|
||||
} else {
|
||||
v1 = uniform();
|
||||
v2 = uniform();
|
||||
if (cp < 0)
|
||||
first = sqrt((1-alpha)*cp*cp-2*alpha*theta*log(v1)+2*sqrt(-2*theta*(1-alpha)*alpha*log(v1))*cos(2*M_PI*v2)*cp);
|
||||
else {
|
||||
first = - sqrt((1-alpha)*cp*cp-2*alpha*theta*log(v1)-2*sqrt(-2*theta*(1-alpha)*alpha*log(v1))*cos(2*M_PI*v2)*cp) ;}
|
||||
if (cp < 0) {
|
||||
first = sqrt((1.0-alpha)*cp*cp - 2.0*alpha*theta*log(v1)
|
||||
+ 2.0*sqrt(-2.0*theta*(1.0-alpha)*alpha*log(v1))
|
||||
* cos(2.0*MathConst::MY_PI*v2)*cp);
|
||||
} else {
|
||||
first = -sqrt((1.0-alpha)*cp*cp - 2.0*alpha*theta*log(v1)
|
||||
- 2.0*sqrt(-2.0*theta*(1.0-alpha)*alpha*log(v1))
|
||||
* cos(2.0*MathConst::MY_PI*v2)*cp);
|
||||
}
|
||||
return first;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user