forked from lijiext/lammps
coding style and whitespace cleanup to match LAMMPS style
This commit is contained in:
parent
9fa4588eb7
commit
6eddc1a2ee
|
@ -11,13 +11,25 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "math.h"
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author: Abdoreza Ershadinia, a.ershadinia at gmail.com
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
#include "math_extra.h"
|
#include "math_extra.h"
|
||||||
#include "fix_wall_ees.h"
|
#include "fix_wall_ees.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "atom_vec.h"
|
#include "atom_vec.h"
|
||||||
#include "atom_vec_ellipsoid.h"
|
#include "atom_vec_ellipsoid.h"
|
||||||
|
#include "domain.h"
|
||||||
|
#include "region.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "lattice.h"
|
||||||
|
#include "update.h"
|
||||||
|
#include "output.h"
|
||||||
|
#include "respa.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "math_extra.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
@ -96,13 +108,13 @@ void FixWallEES::wall_particle(int m, int which, double coord)
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
|
|
||||||
if (side < 0)
|
if (side < 0)
|
||||||
delta = x[i][dim] - coord;
|
delta = x[i][dim] - coord;
|
||||||
else
|
else
|
||||||
delta = coord - x[i][dim];
|
delta = coord - x[i][dim];
|
||||||
|
|
||||||
if (delta >= cutoff[m])
|
if (delta >= cutoff[m])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double A[3][3] = {{0,0,0},{0,0,0},{0,0,0}};
|
double A[3][3] = {{0,0,0},{0,0,0},{0,0,0}};
|
||||||
double tempvec[3]= {0,0,0};
|
double tempvec[3]= {0,0,0};
|
||||||
|
@ -168,37 +180,37 @@ void FixWallEES::wall_particle(int m, int which, double coord)
|
||||||
hms = delta - sigman;
|
hms = delta - sigman;
|
||||||
|
|
||||||
fwall = side*(
|
fwall = side*(
|
||||||
-1*coeff4[m]/hhss2 +
|
-1*coeff4[m]/hhss2 +
|
||||||
coeff3[m] * ( 21*delta6 + 63*delta4*sigman2 + 27*delta2*sigman4 + sigman6 ) / hhss8
|
coeff3[m] * ( 21*delta6 + 63*delta4*sigman2 + 27*delta2*sigman4 + sigman6 ) / hhss8
|
||||||
);
|
);
|
||||||
f[i][dim] -= fwall;
|
f[i][dim] -= fwall;
|
||||||
|
|
||||||
ewall[0] += -1*coeff2[m] * ( 4*delta/sigman2/hhss + 2*log(hms/hps)/sigman3 ) +
|
ewall[0] += -1*coeff2[m] * ( 4*delta/sigman2/hhss + 2*log(hms/hps)/sigman3 ) +
|
||||||
coeff1[m] * ( 35*delta5 + 70*delta3*sigman2 + 15*delta*sigman4 ) / hhss7;
|
coeff1[m] * ( 35*delta5 + 70*delta3*sigman2 + 15*delta*sigman4 ) / hhss7;
|
||||||
|
|
||||||
ewall[m+1] += fwall;
|
ewall[m+1] += fwall;
|
||||||
|
|
||||||
twall = coeff6[m] * ( 6.*delta3/sigman4/hhss2 - 10.*delta/sigman2/hhss2 + 3.*log(hms/hps)/sigman5 ) +
|
twall = coeff6[m] * ( 6.*delta3/sigman4/hhss2 - 10.*delta/sigman2/hhss2 + 3.*log(hms/hps)/sigman5 ) +
|
||||||
coeff5[m] * ( 21.*delta5 + 30.*delta3*sigman2 + 5.*delta*sigman4 ) / hhss8 ;
|
coeff5[m] * ( 21.*delta5 + 30.*delta3*sigman2 + 5.*delta*sigman4 ) / hhss8 ;
|
||||||
|
|
||||||
|
|
||||||
MathExtra::matvec(Lx,nhat,tempvec);
|
MathExtra::matvec(Lx,nhat,tempvec);
|
||||||
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
||||||
for(int k = 0; k<3; k++) tempvec2[k] *= shape[k];
|
for(int k = 0; k<3; k++) tempvec2[k] *= shape[k];
|
||||||
that[0] = MathExtra::dot3(SAn,tempvec2);
|
that[0] = MathExtra::dot3(SAn,tempvec2);
|
||||||
|
|
||||||
MathExtra::matvec(Ly,nhat,tempvec);
|
MathExtra::matvec(Ly,nhat,tempvec);
|
||||||
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
||||||
for(int k = 0; k<3; k++) tempvec2[k] *= shape[k];
|
for(int k = 0; k<3; k++) tempvec2[k] *= shape[k];
|
||||||
that[1] = MathExtra::dot3(SAn,tempvec2);
|
that[1] = MathExtra::dot3(SAn,tempvec2);
|
||||||
|
|
||||||
MathExtra::matvec(Lz,nhat,tempvec);
|
MathExtra::matvec(Lz,nhat,tempvec);
|
||||||
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
||||||
for(int k = 0; k < 3; k++) tempvec2[k] *= shape[k];
|
for(int k = 0; k < 3; k++) tempvec2[k] *= shape[k];
|
||||||
that[2] = MathExtra::dot3(SAn,tempvec2);
|
that[2] = MathExtra::dot3(SAn,tempvec2);
|
||||||
|
|
||||||
|
|
||||||
for(int j = 0; j<3 ; j++)
|
for(int j = 0; j<3 ; j++)
|
||||||
tor[i][j] += twall * that[j];
|
tor[i][j] += twall * that[j];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* -*- c++ -*- ----------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
@ -10,10 +10,14 @@
|
||||||
|
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
#include <iostream>
|
|
||||||
#include "math.h"
|
/* ----------------------------------------------------------------------
|
||||||
#include "stdlib.h"
|
Contributing author: Abdoreza Ershadinia, a.ershadinia at gmail.com
|
||||||
#include "string.h"
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include "fix_wall_region_ees.h"
|
#include "fix_wall_region_ees.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "atom_vec.h"
|
#include "atom_vec.h"
|
||||||
|
@ -31,117 +35,109 @@
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|
||||||
enum{LJ93,LJ126,COLLOID,HARMONIC,EES};//me
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
/// USAGE:
|
|
||||||
/// fix ID group-ID wall/region/ees region-ID epsilon sigma cutoff
|
|
||||||
///
|
|
||||||
FixWallRegionEES::FixWallRegionEES(LAMMPS *lmp, int narg, char **arg) :
|
FixWallRegionEES::FixWallRegionEES(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Fix(lmp, narg, arg)
|
Fix(lmp, narg, arg)
|
||||||
{
|
{
|
||||||
if (narg != 7) error->all(FLERR,"Illegal fix wall/region/ees command");
|
if (narg != 7) error->all(FLERR,"Illegal fix wall/region/ees command");
|
||||||
scalar_flag = 1;
|
scalar_flag = 1;
|
||||||
vector_flag = 1;
|
vector_flag = 1;
|
||||||
size_vector = 3;
|
size_vector = 3;
|
||||||
global_freq = 1;
|
global_freq = 1;
|
||||||
extscalar = 1;
|
extscalar = 1;
|
||||||
extvector = 1;
|
extvector = 1;
|
||||||
|
|
||||||
// parse args
|
// parse args
|
||||||
|
|
||||||
iregion = domain->find_region(arg[3]);
|
iregion = domain->find_region(arg[3]);
|
||||||
if (iregion == -1)
|
if (iregion == -1)
|
||||||
error->all(FLERR,"Region ID for fix wall/region/ees does not exist");
|
error->all(FLERR,"Region ID for fix wall/region/ees does not exist");
|
||||||
int n = strlen(arg[3]) + 1;
|
int n = strlen(arg[3]) + 1;
|
||||||
idregion = new char[n];
|
idregion = new char[n];
|
||||||
strcpy(idregion,arg[3]);
|
strcpy(idregion,arg[3]);
|
||||||
|
|
||||||
|
epsilon = force->numeric(FLERR,arg[4]);
|
||||||
|
sigma = force->numeric(FLERR,arg[5]);
|
||||||
|
cutoff = force->numeric(FLERR,arg[6]);
|
||||||
|
|
||||||
|
if (cutoff <= 0.0) error->all(FLERR,"Fix wall/region/ees cutoff <= 0.0");
|
||||||
|
|
||||||
epsilon = force->numeric(FLERR,arg[4]);
|
eflag = 0;
|
||||||
sigma = force->numeric(FLERR,arg[5]);
|
ewall[0] = ewall[1] = ewall[2] = ewall[3] = 0.0;
|
||||||
cutoff = force->numeric(FLERR,arg[6]);
|
|
||||||
|
|
||||||
if (cutoff <= 0.0) error->all(FLERR,"Fix wall/region/ees cutoff <= 0.0");
|
|
||||||
|
|
||||||
eflag = 0;
|
|
||||||
ewall[0] = ewall[1] = ewall[2] = ewall[3] = 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixWallRegionEES::~FixWallRegionEES()
|
FixWallRegionEES::~FixWallRegionEES()
|
||||||
{
|
{
|
||||||
delete [] idregion;
|
delete [] idregion;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
int FixWallRegionEES::setmask()
|
int FixWallRegionEES::setmask()
|
||||||
{
|
{
|
||||||
int mask = 0;
|
int mask = 0;
|
||||||
mask |= POST_FORCE;
|
mask |= POST_FORCE;
|
||||||
mask |= THERMO_ENERGY;
|
mask |= THERMO_ENERGY;
|
||||||
mask |= POST_FORCE_RESPA;
|
mask |= POST_FORCE_RESPA;
|
||||||
mask |= MIN_POST_FORCE;
|
mask |= MIN_POST_FORCE;
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixWallRegionEES::init()
|
void FixWallRegionEES::init()
|
||||||
{
|
{
|
||||||
// set index and check validity of region
|
// set index and check validity of region
|
||||||
|
|
||||||
iregion = domain->find_region(idregion);
|
iregion = domain->find_region(idregion);
|
||||||
if (iregion == -1)
|
if (iregion == -1)
|
||||||
error->all(FLERR,"Region ID for fix wall/region/ees does not exist");
|
error->all(FLERR,"Region ID for fix wall/region/ees does not exist");
|
||||||
|
|
||||||
|
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
||||||
|
if (!avec)
|
||||||
|
error->all(FLERR,"Fix wall/region/ees requires atom style ellipsoid");
|
||||||
|
|
||||||
|
// check that all particles are finite-size ellipsoids
|
||||||
|
// no point particles allowed, spherical is OK
|
||||||
|
|
||||||
|
int *ellipsoid = atom->ellipsoid;
|
||||||
|
int *mask = atom->mask;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
|
for (int i = 0; i < nlocal; i++)
|
||||||
|
if (mask[i] & groupbit)
|
||||||
|
if (ellipsoid[i] < 0)
|
||||||
|
error->one(FLERR,"Fix wall/region/ees requires extended particles");
|
||||||
|
|
||||||
|
// setup coefficients
|
||||||
|
|
||||||
|
coeff1 = ( 2. / 4725. ) * epsilon * pow(sigma,12.0);
|
||||||
|
coeff2 = ( 1. / 24. ) * epsilon * pow(sigma,6.0);
|
||||||
|
coeff3 = ( 2. / 315. ) * epsilon * pow(sigma,12.0);
|
||||||
|
coeff4 = ( 1. / 3. ) * epsilon * pow(sigma,6.0);
|
||||||
|
coeff5 = ( 4. / 315. ) * epsilon * pow(sigma,12.0);
|
||||||
|
coeff6 = ( 1. / 12. ) * epsilon * pow(sigma,6.0);
|
||||||
|
offset = 0;
|
||||||
|
|
||||||
|
|
||||||
avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
if (strstr(update->integrate_style,"respa"))
|
||||||
if (!avec)
|
nlevels_respa = ((Respa *) update->integrate)->nlevels;
|
||||||
error->all(FLERR,"Fix wall/region/ees requires atom style ellipsoid");
|
|
||||||
|
|
||||||
// check that all particles are finite-size ellipsoids
|
|
||||||
// no point particles allowed, spherical is OK
|
|
||||||
|
|
||||||
int *ellipsoid = atom->ellipsoid;
|
|
||||||
int *mask = atom->mask;
|
|
||||||
int nlocal = atom->nlocal;
|
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
|
||||||
if (mask[i] & groupbit)
|
|
||||||
if (ellipsoid[i] < 0)
|
|
||||||
error->one(FLERR,"Fix wall/region/ees requires extended particles");
|
|
||||||
|
|
||||||
|
|
||||||
// setup coefficients for each style
|
|
||||||
|
|
||||||
coeff1 = ( 2. / 4725. ) * epsilon * pow(sigma,12.0);
|
|
||||||
coeff2 = ( 1. / 24. ) * epsilon * pow(sigma,6.0);
|
|
||||||
coeff3 = ( 2. / 315. ) * epsilon * pow(sigma,12.0);
|
|
||||||
coeff4 = ( 1. / 3. ) * epsilon * pow(sigma,6.0);
|
|
||||||
coeff5 = ( 4. / 315. ) * epsilon * pow(sigma,12.0);
|
|
||||||
coeff6 = ( 1. / 12. ) * epsilon * pow(sigma,6.0);
|
|
||||||
offset = 0;
|
|
||||||
|
|
||||||
|
|
||||||
if (strstr(update->integrate_style,"respa"))
|
|
||||||
nlevels_respa = ((Respa *) update->integrate)->nlevels;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixWallRegionEES::setup(int vflag)
|
void FixWallRegionEES::setup(int vflag)
|
||||||
{
|
{
|
||||||
if (strstr(update->integrate_style,"verlet"))
|
if (strstr(update->integrate_style,"verlet"))
|
||||||
post_force(vflag);
|
post_force(vflag);
|
||||||
else {
|
else {
|
||||||
((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1);
|
((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1);
|
||||||
post_force_respa(vflag,nlevels_respa-1,0);
|
post_force_respa(vflag,nlevels_respa-1,0);
|
||||||
((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1);
|
((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
@ -155,121 +151,111 @@ void FixWallRegionEES::min_setup(int vflag)
|
||||||
|
|
||||||
void FixWallRegionEES::post_force(int vflag)
|
void FixWallRegionEES::post_force(int vflag)
|
||||||
{
|
{
|
||||||
//me
|
//sth is needed here, but I dont know what
|
||||||
//sth is needed here, but I dont know what
|
//that is calculation of sn
|
||||||
//that is calculation of sn
|
|
||||||
|
|
||||||
int i,m,n;
|
int i,m,n;
|
||||||
double rinv,fx,fy,fz,tooclose[3];//me
|
double rinv,fx,fy,fz,sn,tooclose[3];
|
||||||
double sn;//me
|
|
||||||
|
|
||||||
eflag = 0;
|
eflag = 0;
|
||||||
ewall[0] = ewall[1] = ewall[2] = ewall[3] = 0.0;
|
ewall[0] = ewall[1] = ewall[2] = ewall[3] = 0.0;
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
double **f = atom->f;
|
double **f = atom->f;
|
||||||
double *radius = atom->radius;
|
double **tor = atom->torque;
|
||||||
|
|
||||||
double **tor = atom->torque; //me
|
AtomVecEllipsoid::Bonus *bonus = avec->bonus;
|
||||||
|
int *ellipsoid = atom->ellipsoid;
|
||||||
|
|
||||||
//avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");//me
|
int *mask = atom->mask;
|
||||||
AtomVecEllipsoid::Bonus *bonus = avec->bonus;//me
|
int nlocal = atom->nlocal;
|
||||||
int *ellipsoid = atom->ellipsoid;//me
|
|
||||||
|
|
||||||
int *mask = atom->mask;
|
Region *region = domain->regions[iregion];
|
||||||
int nlocal = atom->nlocal;
|
region->prematch();
|
||||||
|
|
||||||
Region *region = domain->regions[iregion];
|
int onflag = 0;
|
||||||
region->prematch();
|
|
||||||
|
|
||||||
int onflag = 0;
|
// region->match() insures particle is in region or on surface, else error
|
||||||
|
// if returned contact dist r = 0, is on surface, also an error
|
||||||
|
// in COLLOID case, r <= radius is an error
|
||||||
|
|
||||||
// region->match() insures particle is in region or on surface, else error
|
for (i = 0; i < nlocal; i++)
|
||||||
// if returned contact dist r = 0, is on surface, also an error
|
if (mask[i] & groupbit) {
|
||||||
// in COLLOID case, r <= radius is an error
|
if (!region->match(x[i][0],x[i][1],x[i][2])) {
|
||||||
|
onflag = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < nlocal; i++)
|
double A[3][3] = {{0,0,0},{0,0,0},{0,0,0}};
|
||||||
if (mask[i] & groupbit) {
|
double tempvec[3]= {0,0,0};
|
||||||
if (!region->match(x[i][0],x[i][1],x[i][2])) {
|
double sn2 = 0.0;
|
||||||
onflag = 1;
|
double nhat[3] = {0,0,0};
|
||||||
continue;
|
double* shape = bonus[ellipsoid[i]].shape;;
|
||||||
}
|
MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A);
|
||||||
|
|
||||||
double A[3][3] = {{0,0,0},{0,0,0},{0,0,0}};
|
for(int which = 0 ; which < 3; which ++){//me
|
||||||
double tempvec[3]= {0,0,0};
|
nhat[which]=1;
|
||||||
double sn2 = 0.0;
|
nhat[(which+1)%3] = 0 ;
|
||||||
double nhat[3] = {0,0,0};
|
nhat[(which+2)%3] = 0 ;
|
||||||
double* shape = bonus[ellipsoid[i]].shape;;
|
sn2 = 0 ;
|
||||||
MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A);
|
MathExtra::transpose_matvec(A,nhat,tempvec);
|
||||||
|
for(int k = 0; k<3; k++) tempvec[k] *= shape[k];
|
||||||
|
for(int k = 0; k<3 ; k++) sn2 += tempvec[k]*tempvec[k];
|
||||||
|
sn = sqrt(sn2);
|
||||||
|
tooclose[which] = sn;
|
||||||
|
}
|
||||||
|
|
||||||
for(int which = 0 ; which < 3; which ++){//me
|
n = region->surface(x[i][0],x[i][1],x[i][2],cutoff);
|
||||||
nhat[which]=1;
|
|
||||||
nhat[(which+1)%3] = 0 ;
|
|
||||||
nhat[(which+2)%3] = 0 ;
|
|
||||||
sn2 = 0 ;
|
|
||||||
MathExtra::transpose_matvec(A,nhat,tempvec);
|
|
||||||
for(int k = 0; k<3; k++) tempvec[k] *= shape[k];
|
|
||||||
for(int k = 0; k<3 ; k++) sn2 += tempvec[k]*tempvec[k];
|
|
||||||
sn = sqrt(sn2);
|
|
||||||
tooclose[which] = sn;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (m = 0; m < n; m++) {
|
||||||
|
|
||||||
|
if (region->contact[m].delx != 0 && region->contact[m].r <= tooclose[0]){
|
||||||
|
onflag = 1;
|
||||||
|
continue;
|
||||||
|
} else if (region->contact[m].dely != 0 && region->contact[m].r <= tooclose[1]){
|
||||||
|
onflag = 1;
|
||||||
|
continue;
|
||||||
|
} else if (region->contact[m].delz !=0 && region->contact[m].r <= tooclose[2]){
|
||||||
|
onflag = 1;
|
||||||
|
continue;
|
||||||
|
} else rinv = 1.0/region->contact[m].r;
|
||||||
|
|
||||||
n = region->surface(x[i][0],x[i][1],x[i][2],cutoff);
|
ees(m,i);
|
||||||
|
|
||||||
for (m = 0; m < n; m++) {
|
ewall[0] += eng;
|
||||||
|
fx = fwall * region->contact[m].delx * rinv;
|
||||||
|
fy = fwall * region->contact[m].dely * rinv;
|
||||||
|
fz = fwall * region->contact[m].delz * rinv;
|
||||||
|
f[i][0] += fx;
|
||||||
|
f[i][1] += fy;
|
||||||
|
f[i][2] += fz;
|
||||||
|
|
||||||
if(region->contact[m].delx != 0 && region->contact[m].r <= tooclose[0] ){
|
ewall[1] -= fx;
|
||||||
onflag = 1;
|
ewall[2] -= fy;
|
||||||
continue;
|
ewall[3] -= fz;
|
||||||
|
|
||||||
}else if (region->contact[m].dely != 0 && region->contact[m].r <= tooclose[1]){
|
tor[i][0] += torque[0];
|
||||||
onflag = 1;
|
tor[i][1] += torque[1];
|
||||||
continue;
|
tor[i][2] += torque[2];
|
||||||
}else if (region->contact[m].delz !=0 && region->contact[m].r <= tooclose[2]){
|
}
|
||||||
onflag = 1;
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else rinv = 1.0/region->contact[m].r;
|
|
||||||
|
|
||||||
ees(m,i);//me
|
if (onflag) error->one(FLERR,"Particle on or inside surface of region "
|
||||||
|
"used in fix wall/region/ees");
|
||||||
ewall[0] += eng;
|
|
||||||
fx = fwall * region->contact[m].delx * rinv;
|
|
||||||
fy = fwall * region->contact[m].dely * rinv;
|
|
||||||
fz = fwall * region->contact[m].delz * rinv;
|
|
||||||
f[i][0] += fx;
|
|
||||||
f[i][1] += fy;
|
|
||||||
f[i][2] += fz;
|
|
||||||
|
|
||||||
ewall[1] -= fx;
|
|
||||||
ewall[2] -= fy;
|
|
||||||
ewall[3] -= fz;
|
|
||||||
|
|
||||||
tor[i][0] += torque[0];
|
|
||||||
tor[i][1] += torque[1];
|
|
||||||
tor[i][2] += torque[2];
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (onflag) error->one(FLERR,"Particle on or inside surface of region "
|
|
||||||
"used in fix wall/region/ees");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixWallRegionEES::post_force_respa(int vflag, int ilevel, int iloop)
|
void FixWallRegionEES::post_force_respa(int vflag, int ilevel, int iloop)
|
||||||
{
|
{
|
||||||
if (ilevel == nlevels_respa-1) post_force(vflag);
|
if (ilevel == nlevels_respa-1) post_force(vflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixWallRegionEES::min_post_force(int vflag)
|
void FixWallRegionEES::min_post_force(int vflag)
|
||||||
{
|
{
|
||||||
post_force(vflag);
|
post_force(vflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
@ -278,13 +264,13 @@ void FixWallRegionEES::min_post_force(int vflag)
|
||||||
|
|
||||||
double FixWallRegionEES::compute_scalar()
|
double FixWallRegionEES::compute_scalar()
|
||||||
{
|
{
|
||||||
// only sum across procs one time
|
// only sum across procs one time
|
||||||
|
|
||||||
if (eflag == 0) {
|
if (eflag == 0) {
|
||||||
MPI_Allreduce(ewall,ewall_all,4,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(ewall,ewall_all,4,MPI_DOUBLE,MPI_SUM,world);
|
||||||
eflag = 1;
|
eflag = 1;
|
||||||
}
|
}
|
||||||
return ewall_all[0];
|
return ewall_all[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
@ -293,18 +279,15 @@ double FixWallRegionEES::compute_scalar()
|
||||||
|
|
||||||
double FixWallRegionEES::compute_vector(int n)
|
double FixWallRegionEES::compute_vector(int n)
|
||||||
{
|
{
|
||||||
// only sum across procs one time
|
// only sum across procs one time
|
||||||
|
|
||||||
if (eflag == 0) {
|
if (eflag == 0) {
|
||||||
MPI_Allreduce(ewall,ewall_all,4,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(ewall,ewall_all,4,MPI_DOUBLE,MPI_SUM,world);
|
||||||
eflag = 1;
|
eflag = 1;
|
||||||
}
|
}
|
||||||
return ewall_all[n+1];
|
return ewall_all[n+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//me
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
EES interaction for ellipsoid particle with wall
|
EES interaction for ellipsoid particle with wall
|
||||||
compute eng and fwall and twall = magnitude of wall force and torque
|
compute eng and fwall and twall = magnitude of wall force and torque
|
||||||
|
@ -312,94 +295,89 @@ double FixWallRegionEES::compute_vector(int n)
|
||||||
|
|
||||||
void FixWallRegionEES::ees(int m, int i)
|
void FixWallRegionEES::ees(int m, int i)
|
||||||
{
|
{
|
||||||
Region *region = domain->regions[iregion];
|
Region *region = domain->regions[iregion];
|
||||||
region->prematch();
|
region->prematch();
|
||||||
|
|
||||||
double delta = 0.0, delta2 = 0.0, delta3 = 0.0, delta4 = 0.0, delta5 = 0.0, delta6 = 0.0;
|
double delta, delta2, delta3, delta4, delta5, delta6;
|
||||||
double sigman = 0.0, sigman2 = 0.0 , sigman3 = 0.0, sigman4 = 0.0, sigman5 = 0.0, sigman6 = 0.0;
|
double sigman, sigman2 , sigman3, sigman4, sigman5, sigman6;
|
||||||
double hhss = 0.0, hhss2 = 0.0, hhss4 = 0.0, hhss7 = 0.0, hhss8 = 0.0; //h^2 - s_n^2
|
double hhss, hhss2, hhss4, hhss7, hhss8; //h^2 - s_n^2
|
||||||
double hps = 0.0; //h+s_n
|
double hps; //h+s_n
|
||||||
double hms = 0.0; //h-s_n
|
double hms; //h-s_n
|
||||||
double twall = 0.0;
|
double twall;
|
||||||
double tempvec[3]={0,0,0};
|
|
||||||
double tempvec2[3]= {0,0,0};
|
|
||||||
|
|
||||||
double SAn[3] = {0,0,0};
|
double A[3][3], nhat[3], SAn[3], that[3];
|
||||||
double that[3] = {0,0,0};
|
|
||||||
|
|
||||||
double Lx[3][3] = {{0,0,0},{0,0,-1},{0,1,0}};
|
double tempvec[3]= {0,0,0};
|
||||||
double Ly[3][3] = {{0,0,1},{0,0,0},{-1,0,0}};
|
double tempvec2[3]= {0,0,0};
|
||||||
double Lz[3][3] = {{0,-1,0},{1,0,0},{0,0,0}};
|
|
||||||
|
|
||||||
double A[3][3] = {{0,0,0},{0,0,0},{0,0,0}};
|
double Lx[3][3] = {{0,0,0},{0,0,-1},{0,1,0}};
|
||||||
double nhat[3] = {0,0,0};
|
double Ly[3][3] = {{0,0,1},{0,0,0},{-1,0,0}};
|
||||||
|
double Lz[3][3] = {{0,-1,0},{1,0,0},{0,0,0}};
|
||||||
|
|
||||||
nhat[0] = region->contact[m].delx / region->contact[m].r;
|
nhat[0] = region->contact[m].delx / region->contact[m].r;
|
||||||
nhat[1] = region->contact[m].dely / region->contact[m].r;
|
nhat[1] = region->contact[m].dely / region->contact[m].r;
|
||||||
nhat[2] = region->contact[m].delz / region->contact[m].r;
|
nhat[2] = region->contact[m].delz / region->contact[m].r;
|
||||||
|
|
||||||
//avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid");
|
AtomVecEllipsoid::Bonus *bonus = avec->bonus;
|
||||||
AtomVecEllipsoid::Bonus *bonus = avec->bonus;
|
int *ellipsoid = atom->ellipsoid;
|
||||||
int *ellipsoid = atom->ellipsoid;//me
|
|
||||||
|
|
||||||
double* shape = bonus[ellipsoid[i]].shape;;
|
double* shape = bonus[ellipsoid[i]].shape;;
|
||||||
MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A);
|
MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A);
|
||||||
|
|
||||||
MathExtra::transpose_matvec(A,nhat,tempvec);
|
sigman2 = 0.0;
|
||||||
for(int k = 0; k<3; k++) tempvec[k] *= shape[k];
|
MathExtra::transpose_matvec(A,nhat,tempvec);
|
||||||
for(int k = 0; k<3 ; k++) sigman2 += tempvec[k]*tempvec[k];
|
for(int k = 0; k<3; k++) tempvec[k] *= shape[k];
|
||||||
for(int k = 0; k<3; k++) SAn[k] = tempvec[k];
|
for(int k = 0; k<3; k++) sigman2 += tempvec[k]*tempvec[k];
|
||||||
|
for(int k = 0; k<3; k++) SAn[k] = tempvec[k];
|
||||||
|
|
||||||
|
sigman = sqrt(sigman2);
|
||||||
|
delta = fabs(region->contact[m].r);
|
||||||
|
|
||||||
sigman = sqrt(sigman2);
|
sigman3 = sigman2 * sigman;
|
||||||
delta = fabs(region->contact[m].r);
|
sigman4 = sigman2 * sigman2;
|
||||||
|
sigman5 = sigman4 * sigman;
|
||||||
|
sigman6 = sigman3 * sigman3;
|
||||||
|
|
||||||
sigman3 = sigman2 * sigman;
|
delta2 = delta * delta;
|
||||||
sigman4 = sigman2 * sigman2;
|
delta3 = delta2 * delta;
|
||||||
sigman5 = sigman4 * sigman;
|
delta4 = delta2 * delta2;
|
||||||
sigman6 = sigman3 * sigman3;
|
delta5 = delta3 * delta2;
|
||||||
|
delta6 = delta3 * delta3;
|
||||||
|
|
||||||
delta2 = delta * delta;
|
hhss = delta2 - sigman2;
|
||||||
delta3 = delta2 * delta;
|
hhss2 = hhss * hhss;
|
||||||
delta4 = delta2 * delta2;
|
hhss4 = hhss2 * hhss2;
|
||||||
delta5 = delta3 * delta2;
|
hhss8 = hhss4 * hhss4;
|
||||||
delta6 = delta3 * delta3;
|
hhss7 = hhss4 * hhss2 * hhss;
|
||||||
|
|
||||||
hhss = delta2 - sigman2;
|
hps = delta + sigman;
|
||||||
hhss2 = hhss * hhss;
|
hms = delta - sigman;
|
||||||
hhss4 = hhss2 * hhss2;
|
|
||||||
hhss8 = hhss4 * hhss4;
|
|
||||||
hhss7 = hhss4 * hhss2 * hhss;
|
|
||||||
|
|
||||||
hps = delta + sigman;
|
fwall = -1*coeff4/hhss2 + coeff3
|
||||||
hms = delta - sigman;
|
* (21*delta6 + 63*delta4*sigman2 + 27*delta2*sigman4 + sigman6) / hhss8;
|
||||||
|
|
||||||
fwall = -1*coeff4/hhss2 +
|
eng = -1*coeff2 * (4*delta/sigman2/hhss + 2*log(hms/hps)/sigman3) +
|
||||||
coeff3 * ( 21*delta6 + 63*delta4*sigman2 + 27*delta2*sigman4 + sigman6 ) / hhss8
|
coeff1 * (35*delta5 + 70*delta3*sigman2 + 15*delta*sigman4) / hhss7;
|
||||||
;
|
|
||||||
|
|
||||||
eng = -1*coeff2 * ( 4*delta/sigman2/hhss + 2*log(hms/hps)/sigman3 ) +
|
twall = coeff6 * (6*delta3/sigman4/hhss2 - 10*delta/sigman2/hhss2
|
||||||
coeff1 * ( 35*delta5 + 70*delta3*sigman2 + 15*delta*sigman4 ) / hhss7;
|
+ 3*log(hms/hps)/sigman5)
|
||||||
|
+ coeff5 * (21.*delta5 + 30.*delta3*sigman2 + 5.*delta*sigman4) / hhss8;
|
||||||
|
|
||||||
twall = coeff6 * ( 6.*delta3/sigman4/hhss2 - 10.*delta/sigman2/hhss2 + 3.*log(hms/hps)/sigman5 ) +
|
MathExtra::matvec(Lx,nhat,tempvec);
|
||||||
coeff5 * ( 21.*delta5 + 30.*delta3*sigman2 + 5.*delta*sigman4 ) / hhss8 ;
|
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
||||||
|
for(int k = 0; k<3; k++) tempvec2[k] *= shape[k];
|
||||||
|
that[0] = MathExtra::dot3(SAn,tempvec2);
|
||||||
|
|
||||||
MathExtra::matvec(Lx,nhat,tempvec);
|
MathExtra::matvec(Ly,nhat,tempvec);
|
||||||
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
||||||
for(int k = 0; k<3; k++) tempvec2[k] *= shape[k];
|
for(int k = 0; k<3; k++) tempvec2[k] *= shape[k];
|
||||||
that[0] = MathExtra::dot3(SAn,tempvec2);
|
that[1] = MathExtra::dot3(SAn,tempvec2);
|
||||||
|
|
||||||
MathExtra::matvec(Ly,nhat,tempvec);
|
MathExtra::matvec(Lz,nhat,tempvec);
|
||||||
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
||||||
for(int k = 0; k<3; k++) tempvec2[k] *= shape[k];
|
for(int k = 0; k < 3; k++) tempvec2[k] *= shape[k];
|
||||||
that[1] = MathExtra::dot3(SAn,tempvec2);
|
that[2] = MathExtra::dot3(SAn,tempvec2);
|
||||||
|
|
||||||
MathExtra::matvec(Lz,nhat,tempvec);
|
|
||||||
MathExtra::transpose_matvec(A,tempvec,tempvec2);
|
|
||||||
for(int k = 0; k < 3; k++) tempvec2[k] *= shape[k];
|
|
||||||
that[2] = MathExtra::dot3(SAn,tempvec2);
|
|
||||||
|
|
||||||
for(int j = 0; j<3 ; j++)
|
|
||||||
torque[j] = twall * that[j];
|
|
||||||
|
|
||||||
|
for(int j = 0; j<3 ; j++)
|
||||||
|
torque[j] = twall * that[j];
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class FixWallRegionEES : public Fix {
|
||||||
double compute_vector(int);
|
double compute_vector(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class AtomVecEllipsoid *avec;//me
|
class AtomVecEllipsoid *avec;
|
||||||
|
|
||||||
int iregion;
|
int iregion;
|
||||||
double epsilon,sigma,cutoff;
|
double epsilon,sigma,cutoff;
|
||||||
|
@ -50,11 +50,11 @@ class FixWallRegionEES : public Fix {
|
||||||
char *idregion;
|
char *idregion;
|
||||||
|
|
||||||
double coeff1,coeff2,coeff3,coeff4,offset;
|
double coeff1,coeff2,coeff3,coeff4,offset;
|
||||||
double coeff5, coeff6;//me
|
double coeff5, coeff6;
|
||||||
double eng,fwall;
|
double eng,fwall;
|
||||||
double torque[3];//me
|
double torque[3];
|
||||||
|
|
||||||
void ees(int, int);//me
|
void ees(int, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue