git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5047 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -16,6 +16,7 @@
|
|||||||
#include "fix_addforce.h"
|
#include "fix_addforce.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
#include "modify.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
#include "respa.h"
|
#include "respa.h"
|
||||||
@ -248,10 +249,14 @@ void FixAddForce::post_force(int vflag)
|
|||||||
f[i][2] += zvalue;
|
f[i][2] += zvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// variable force
|
// variable force, wrap with clear/add
|
||||||
// potential energy = evar if defined, else 0.0
|
// potential energy = evar if defined, else 0.0
|
||||||
|
// wrap with clear/add
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
modify->clearstep_compute();
|
||||||
|
|
||||||
if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar);
|
if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar);
|
||||||
else if (xstyle == ATOM)
|
else if (xstyle == ATOM)
|
||||||
input->variable->compute_atom(xvar,igroup,&sforce[0][0],4,0);
|
input->variable->compute_atom(xvar,igroup,&sforce[0][0],4,0);
|
||||||
@ -264,6 +269,8 @@ void FixAddForce::post_force(int vflag)
|
|||||||
if (estyle == ATOM)
|
if (estyle == ATOM)
|
||||||
input->variable->compute_atom(evar,igroup,&sforce[0][3],4,0);
|
input->variable->compute_atom(evar,igroup,&sforce[0][3],4,0);
|
||||||
|
|
||||||
|
modify->addstep_compute(update->ntimestep + 1);
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
if (iregion >= 0 &&
|
if (iregion >= 0 &&
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
#include "fix_aveforce.h"
|
#include "fix_aveforce.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
#include "modify.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
#include "respa.h"
|
#include "respa.h"
|
||||||
@ -206,6 +207,7 @@ void FixAveForce::post_force(int vflag)
|
|||||||
|
|
||||||
// average the force on participating atoms
|
// average the force on participating atoms
|
||||||
// add in requested amount, computed via variable evaluation if necessary
|
// add in requested amount, computed via variable evaluation if necessary
|
||||||
|
// wrap variable evaluation with clear/add
|
||||||
|
|
||||||
MPI_Allreduce(foriginal,foriginal_all,4,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(foriginal,foriginal_all,4,MPI_DOUBLE,MPI_SUM,world);
|
||||||
|
|
||||||
@ -213,9 +215,11 @@ void FixAveForce::post_force(int vflag)
|
|||||||
if (ncount == 0) return;
|
if (ncount == 0) return;
|
||||||
|
|
||||||
if (varflag == EQUAL) {
|
if (varflag == EQUAL) {
|
||||||
|
modify->clearstep_compute();
|
||||||
if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar);
|
if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar);
|
||||||
if (ystyle == EQUAL) yvalue = input->variable->compute_equal(yvar);
|
if (ystyle == EQUAL) yvalue = input->variable->compute_equal(yvar);
|
||||||
if (zstyle == EQUAL) zvalue = input->variable->compute_equal(zvar);
|
if (zstyle == EQUAL) zvalue = input->variable->compute_equal(zvar);
|
||||||
|
modify->addstep_compute(update->ntimestep + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
double fave[3];
|
double fave[3];
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#include "fix_efield.h"
|
#include "fix_efield.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
#include "modify.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "respa.h"
|
#include "respa.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
@ -176,7 +177,12 @@ void FixEfield::post_force(int vflag)
|
|||||||
f[i][2] += q[i]*ez;
|
f[i][2] += q[i]*ez;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// variable efield, wrap with clear/add
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
modify->clearstep_compute();
|
||||||
|
|
||||||
if (xstyle == EQUAL) ex = qe2f * input->variable->compute_equal(xvar);
|
if (xstyle == EQUAL) ex = qe2f * input->variable->compute_equal(xvar);
|
||||||
else if (xstyle == ATOM)
|
else if (xstyle == ATOM)
|
||||||
input->variable->compute_atom(xvar,igroup,&efield[0][0],3,0);
|
input->variable->compute_atom(xvar,igroup,&efield[0][0],3,0);
|
||||||
@ -187,6 +193,8 @@ void FixEfield::post_force(int vflag)
|
|||||||
else if (zstyle == ATOM)
|
else if (zstyle == ATOM)
|
||||||
input->variable->compute_atom(zvar,igroup,&efield[0][2],3,0);
|
input->variable->compute_atom(zvar,igroup,&efield[0][2],3,0);
|
||||||
|
|
||||||
|
modify->addstep_compute(update->ntimestep + 1);
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
if (xstyle == ATOM) f[i][0] += qe2f * q[i]*efield[i][0];
|
if (xstyle == ATOM) f[i][0] += qe2f * q[i]*efield[i][0];
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "lattice.h"
|
#include "lattice.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
#include "modify.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "respa.h"
|
#include "respa.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
@ -81,6 +82,9 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
else if (cdim == 2 && !pstr) pvalue *= zscale;
|
else if (cdim == 2 && !pstr) pvalue *= zscale;
|
||||||
} else error->all("Illegal fix indent command");
|
} else error->all("Illegal fix indent command");
|
||||||
|
|
||||||
|
varflag = 0;
|
||||||
|
if (xstr || ystr || zstr || rstr || pstr) varflag = 1;
|
||||||
|
|
||||||
indenter_flag = 0;
|
indenter_flag = 0;
|
||||||
indenter[0] = indenter[1] = indenter[2] = indenter[3] = 0.0;
|
indenter[0] = indenter[1] = indenter[2] = indenter[3] = 0.0;
|
||||||
}
|
}
|
||||||
@ -172,6 +176,9 @@ void FixIndent::min_setup(int vflag)
|
|||||||
void FixIndent::post_force(int vflag)
|
void FixIndent::post_force(int vflag)
|
||||||
{
|
{
|
||||||
// indenter values, 0 = energy, 1-3 = force components
|
// indenter values, 0 = energy, 1-3 = force components
|
||||||
|
// wrap variable evaluations with clear/add
|
||||||
|
|
||||||
|
if (varflag) modify->clearstep_compute();
|
||||||
|
|
||||||
indenter_flag = 0;
|
indenter_flag = 0;
|
||||||
indenter[0] = indenter[1] = indenter[2] = indenter[3] = 0.0;
|
indenter[0] = indenter[1] = indenter[2] = indenter[3] = 0.0;
|
||||||
@ -237,7 +244,7 @@ void FixIndent::post_force(int vflag)
|
|||||||
// ctr = current indenter axis
|
// ctr = current indenter axis
|
||||||
// remap into periodic box
|
// remap into periodic box
|
||||||
// 3rd coord is just near box for remap(), since isn't used
|
// 3rd coord is just near box for remap(), since isn't used
|
||||||
|
|
||||||
double ctr[3];
|
double ctr[3];
|
||||||
if (cdim == 0) {
|
if (cdim == 0) {
|
||||||
ctr[0] = domain->boxlo[0];
|
ctr[0] = domain->boxlo[0];
|
||||||
@ -335,6 +342,8 @@ void FixIndent::post_force(int vflag)
|
|||||||
indenter[cdim+1] -= fatom;
|
indenter[cdim+1] -= fatom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (varflag) modify->addstep_compute(update->ntimestep + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class FixIndent : public Fix {
|
|||||||
double xvalue,yvalue,zvalue,rvalue,pvalue;
|
double xvalue,yvalue,zvalue,rvalue,pvalue;
|
||||||
int indenter_flag,planeside;
|
int indenter_flag,planeside;
|
||||||
double indenter[4],indenter_all[4];
|
double indenter[4],indenter_all[4];
|
||||||
int cdim;
|
int cdim,varflag;
|
||||||
int nlevels_respa;
|
int nlevels_respa;
|
||||||
|
|
||||||
void options(int, char **);
|
void options(int, char **);
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
#include "modify.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "lattice.h"
|
#include "lattice.h"
|
||||||
@ -569,7 +570,9 @@ void FixMove::initial_integrate(int vflag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pre-compute variable values
|
// pre-compute variable values, wrap with clear/add
|
||||||
|
|
||||||
|
modify->clearstep_compute();
|
||||||
|
|
||||||
if (xvarstr) {
|
if (xvarstr) {
|
||||||
if (xvarstyle == EQUAL) dx = input->variable->compute_equal(xvar);
|
if (xvarstyle == EQUAL) dx = input->variable->compute_equal(xvar);
|
||||||
@ -596,6 +599,8 @@ void FixMove::initial_integrate(int vflag)
|
|||||||
else input->variable->compute_atom(vzvar,igroup,&velocity[0][2],3,0);
|
else input->variable->compute_atom(vzvar,igroup,&velocity[0][2],3,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modify->addstep_compute(update->ntimestep + 1);
|
||||||
|
|
||||||
// update x,v
|
// update x,v
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) {
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
#include "fix_setforce.h"
|
#include "fix_setforce.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
#include "modify.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
#include "respa.h"
|
#include "respa.h"
|
||||||
@ -222,7 +223,12 @@ void FixSetForce::post_force(int vflag)
|
|||||||
if (zstyle) f[i][2] = zvalue;
|
if (zstyle) f[i][2] = zvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// variable force, wrap with clear/add
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
modify->clearstep_compute();
|
||||||
|
|
||||||
if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar);
|
if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar);
|
||||||
else if (xstyle == ATOM)
|
else if (xstyle == ATOM)
|
||||||
input->variable->compute_atom(xvar,igroup,&sforce[0][0],3,0);
|
input->variable->compute_atom(xvar,igroup,&sforce[0][0],3,0);
|
||||||
@ -233,6 +239,8 @@ void FixSetForce::post_force(int vflag)
|
|||||||
else if (zstyle == ATOM)
|
else if (zstyle == ATOM)
|
||||||
input->variable->compute_atom(zvar,igroup,&sforce[0][2],3,0);
|
input->variable->compute_atom(zvar,igroup,&sforce[0][2],3,0);
|
||||||
|
|
||||||
|
modify->addstep_compute(update->ntimestep + 1);
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
if (iregion >= 0 &&
|
if (iregion >= 0 &&
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class FixSetForce : public Fix {
|
|||||||
char *idregion;
|
char *idregion;
|
||||||
int xvar,yvar,zvar,xstyle,ystyle,zstyle;
|
int xvar,yvar,zvar,xstyle,ystyle,zstyle;
|
||||||
double foriginal[3],foriginal_all[3];
|
double foriginal[3],foriginal_all[3];
|
||||||
int force_flag;
|
int varany,force_flag;
|
||||||
int nlevels_respa;
|
int nlevels_respa;
|
||||||
|
|
||||||
int maxatom;
|
int maxatom;
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "lattice.h"
|
#include "lattice.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
#include "modify.h"
|
||||||
#include "respa.h"
|
#include "respa.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
@ -145,10 +146,11 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set time_depend if any wall positions are variable
|
// set time_depend and varflag if any wall positions are variable
|
||||||
|
|
||||||
|
varflag = 0;
|
||||||
for (int m = 0; m < nwall; m++)
|
for (int m = 0; m < nwall; m++)
|
||||||
if (wallstyle[m] == VARIABLE) time_depend = 1;
|
if (wallstyle[m] == VARIABLE) time_depend = varflag = 1;
|
||||||
|
|
||||||
eflag = 0;
|
eflag = 0;
|
||||||
for (int m = 0; m <= nwall; m++) ewall[m] = 0.0;
|
for (int m = 0; m <= nwall; m++) ewall[m] = 0.0;
|
||||||
@ -225,7 +227,9 @@ void FixWall::post_force(int vflag)
|
|||||||
for (int m = 0; m <= nwall; m++) ewall[m] = 0.0;
|
for (int m = 0; m <= nwall; m++) ewall[m] = 0.0;
|
||||||
|
|
||||||
// coord = current position of wall
|
// coord = current position of wall
|
||||||
// evaluate variable if necessary
|
// evaluate variable if necessary, wrap with clear/add
|
||||||
|
|
||||||
|
if (varflag) modify->clearstep_compute();
|
||||||
|
|
||||||
double coord;
|
double coord;
|
||||||
for (int m = 0; m < nwall; m++) {
|
for (int m = 0; m < nwall; m++) {
|
||||||
@ -235,6 +239,8 @@ void FixWall::post_force(int vflag)
|
|||||||
|
|
||||||
wall_particle(m,wallwhich[m],coord);
|
wall_particle(m,wallwhich[m],coord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (varflag) modify->addstep_compute(update->ntimestep + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -41,11 +41,10 @@ class FixWall : public Fix {
|
|||||||
double coord0[6],epsilon[6],sigma[6],cutoff[6];
|
double coord0[6],epsilon[6],sigma[6],cutoff[6];
|
||||||
char *varstr[6];
|
char *varstr[6];
|
||||||
int varindex[6];
|
int varindex[6];
|
||||||
int eflag;
|
int eflag,varflag;
|
||||||
double ewall[7],ewall_all[7];
|
double ewall[7],ewall_all[7];
|
||||||
int nlevels_respa;
|
int nlevels_respa;
|
||||||
double dt;
|
double dt;
|
||||||
int time_origin;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
#include "fix_wall_reflect.h"
|
#include "fix_wall_reflect.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
#include "update.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "lattice.h"
|
#include "lattice.h"
|
||||||
@ -132,10 +133,11 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set time_depend if any wall positions are variable
|
// set time_depend and varflag if any wall positions are variable
|
||||||
|
|
||||||
|
varflag = 0;
|
||||||
for (int m = 0; m < nwall; m++)
|
for (int m = 0; m < nwall; m++)
|
||||||
if (wallstyle[m] == VARIABLE) time_depend = 1;
|
if (wallstyle[m] == VARIABLE) time_depend = varflag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -185,11 +187,16 @@ void FixWallReflect::post_integrate()
|
|||||||
int i,dim,side;
|
int i,dim,side;
|
||||||
double coord;
|
double coord;
|
||||||
|
|
||||||
|
// coord = current position of wall
|
||||||
|
// evaluate variable if necessary, wrap with clear/add
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
double **v = atom->v;
|
double **v = atom->v;
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
|
if (varflag) modify->clearstep_compute();
|
||||||
|
|
||||||
for (int m = 0; m < nwall; m++) {
|
for (int m = 0; m < nwall; m++) {
|
||||||
if (wallstyle[m] == VARIABLE)
|
if (wallstyle[m] == VARIABLE)
|
||||||
coord = input->variable->compute_equal(varindex[m]);
|
coord = input->variable->compute_equal(varindex[m]);
|
||||||
@ -213,4 +220,6 @@ void FixWallReflect::post_integrate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (varflag) modify->addstep_compute(update->ntimestep + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,7 @@ class FixWallReflect : public Fix {
|
|||||||
double coord0[6];
|
double coord0[6];
|
||||||
char *varstr[6];
|
char *varstr[6];
|
||||||
int varindex[6];
|
int varindex[6];
|
||||||
|
int varflag;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user