forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10840 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
0a0a430c93
commit
7d0088da79
|
@ -25,9 +25,9 @@
|
|||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "math_special.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "math_special.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathSpecial;
|
||||
|
@ -141,7 +141,8 @@ void PairColloid::compute(int eflag, int vflag)
|
|||
evdwl = 2.0/9.0*fR *
|
||||
(1.0-(K[1]*(K[1]*(K[1]/3.0+3.0*K[2])+4.2*K[4])+K[2]*K[4]) *
|
||||
sigma6[itype][jtype]/K[6]) - offset[itype][jtype];
|
||||
if (rsq <= K[1]) error->one(FLERR,"Overlapping small/large in pair colloid");
|
||||
if (rsq <= K[1])
|
||||
error->one(FLERR,"Overlapping small/large in pair colloid");
|
||||
break;
|
||||
|
||||
case LARGE_LARGE:
|
||||
|
@ -179,7 +180,8 @@ void PairColloid::compute(int eflag, int vflag)
|
|||
if (eflag)
|
||||
evdwl += a12[itype][jtype]/6.0 *
|
||||
(2.0*K[0]*(K[7]+K[8])-log(K[8]/K[7])) - offset[itype][jtype];
|
||||
if (r <= K[1]) error->one(FLERR,"Overlapping large/large in pair colloid");
|
||||
if (r <= K[1])
|
||||
error->one(FLERR,"Overlapping large/large in pair colloid");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "respa.h"
|
||||
#include "input.h"
|
||||
#include "variable.h"
|
||||
#include "region.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
|
@ -42,7 +43,7 @@ enum{NONE,CONSTANT,EQUAL,ATOM};
|
|||
FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
{
|
||||
if (narg != 6) error->all(FLERR,"Illegal fix efield command");
|
||||
if (narg < 6) error->all(FLERR,"Illegal fix efield command");
|
||||
|
||||
vector_flag = 1;
|
||||
scalar_flag = 1;
|
||||
|
@ -83,11 +84,22 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
|||
|
||||
// optional args
|
||||
|
||||
iregion = -1;
|
||||
idregion = NULL;
|
||||
estr = NULL;
|
||||
|
||||
int iarg = 6;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"energy") == 0) {
|
||||
if (strcmp(arg[iarg],"region") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix efield command");
|
||||
iregion = domain->find_region(arg[iarg+1]);
|
||||
if (iregion == -1)
|
||||
error->all(FLERR,"Region ID for fix efield does not exist");
|
||||
int n = strlen(arg[iarg+1]) + 1;
|
||||
idregion = new char[n];
|
||||
strcpy(idregion,arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"energy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix efield command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
|
@ -113,6 +125,7 @@ FixEfield::~FixEfield()
|
|||
delete [] ystr;
|
||||
delete [] zstr;
|
||||
delete [] estr;
|
||||
delete [] idregion;
|
||||
memory->destroy(efield);
|
||||
}
|
||||
|
||||
|
@ -172,6 +185,15 @@ void FixEfield::init()
|
|||
else error->all(FLERR,"Variable for fix efield is invalid style");
|
||||
} else estyle = NONE;
|
||||
|
||||
|
||||
// set index and check validity of region
|
||||
|
||||
if (iregion >= 0) {
|
||||
iregion = domain->find_region(idregion);
|
||||
if (iregion == -1)
|
||||
error->all(FLERR,"Region ID for fix aveforce does not exist");
|
||||
}
|
||||
|
||||
if (xstyle == ATOM || ystyle == ATOM || zstyle == ATOM)
|
||||
varflag = ATOM;
|
||||
else if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL)
|
||||
|
@ -257,6 +279,9 @@ void FixEfield::post_force(int vflag)
|
|||
if (qflag) {
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
if (iregion >= 0 &&
|
||||
!domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
|
||||
continue;
|
||||
fx = q[i]*ex;
|
||||
fy = q[i]*ey;
|
||||
fz = q[i]*ez;
|
||||
|
@ -281,6 +306,9 @@ void FixEfield::post_force(int vflag)
|
|||
double tx,ty,tz;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
if (iregion >= 0 &&
|
||||
!domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
|
||||
continue;
|
||||
tx = ez*mu[i][1] - ey*mu[i][2];
|
||||
ty = ex*mu[i][2] - ez*mu[i][0];
|
||||
tz = ey*mu[i][0] - ex*mu[i][1];
|
||||
|
@ -318,6 +346,9 @@ void FixEfield::post_force(int vflag)
|
|||
if (qflag) {
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
if (iregion >= 0 &&
|
||||
!domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
|
||||
continue;
|
||||
if (xstyle == ATOM) fx = qe2f * q[i]*efield[i][0];
|
||||
else fx = q[i]*ex;
|
||||
f[i][0] += fx;
|
||||
|
@ -343,6 +374,9 @@ void FixEfield::post_force(int vflag)
|
|||
double tx,ty,tz;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
if (iregion >= 0 &&
|
||||
!domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
|
||||
continue;
|
||||
tx = ez*mu[i][1] - ey*mu[i][2];
|
||||
ty = ex*mu[i][2] - ez*mu[i][0];
|
||||
tz = ey*mu[i][0] - ex*mu[i][1];
|
||||
|
|
|
@ -41,8 +41,9 @@ class FixEfield : public Fix {
|
|||
|
||||
private:
|
||||
double ex,ey,ez;
|
||||
int varflag;
|
||||
int varflag,iregion;;
|
||||
char *xstr,*ystr,*zstr,*estr;
|
||||
char *idregion;
|
||||
int xvar,yvar,zvar,evar,xstyle,ystyle,zstyle,estyle;
|
||||
int nlevels_respa;
|
||||
double qe2f;
|
||||
|
@ -69,6 +70,10 @@ Self-explanatory. Check the input script syntax and compare to the
|
|||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Region ID for fix addforce does not exist
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Fix efield requires atom attribute q or mu
|
||||
|
||||
Self-explanatory.
|
||||
|
|
Loading…
Reference in New Issue