git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@7632 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2012-02-01 01:19:23 +00:00
parent 915cd9188e
commit 74ad43e245
4 changed files with 55 additions and 41 deletions

View File

@ -448,7 +448,18 @@ int PairKIM::get_neigh(void **kimmdl,int *mode,int *request,
}else{ }else{
*numnei = numneigh[pointsto] ; *numnei = numneigh[pointsto] ;
*atom =ilist[pointsto]; *atom =ilist[pointsto];
*nei1atom = firstneigh[pointsto];
// strip off neighbor mask for molecular systems
if (atom->molecular) {
int n = *numnei;
for (int i = 0; i < n; i++) {
onebuf[i] = *neiatom & NEIGHMASK;
neiatom++;
}
*nei1atom = onebuf;
} else *nei1atom = firstneigh[pointsto];
pointsto++; pointsto++;
if (*numnei > KIM_API_MAX_NEIGHBORS) if (*numnei > KIM_API_MAX_NEIGHBORS)
return KIM_STATUS_NEIGH_TOO_MANY_NEIGHBORS; return KIM_STATUS_NEIGH_TOO_MANY_NEIGHBORS;
@ -474,7 +485,12 @@ int PairKIM::get_neigh(void **kimmdl,int *mode,int *request,
} }
*atom=ilist[*request]; *atom=ilist[*request];
*numnei=numneigh[*request]; *numnei=numneigh[*request];
*nei1atom = firstneigh[*request];
// strip off neighbor mask for molecular systems
if (atom->molecular) {
} else *nei1atom = firstneigh[*request];
if (*numnei > KIM_API_MAX_NEIGHBORS) if (*numnei > KIM_API_MAX_NEIGHBORS)
return KIM_STATUS_NEIGH_TOO_MANY_NEIGHBORS; return KIM_STATUS_NEIGH_TOO_MANY_NEIGHBORS;
if (pkim->support_Rij){ if (pkim->support_Rij){

View File

@ -236,7 +236,7 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
if (set[5].style && domain->yperiodic == 0) if (set[5].style && domain->yperiodic == 0)
error->all(FLERR,"Cannot use fix deform on a 2nd non-periodic boundary"); error->all(FLERR,"Cannot use fix deform on a 2nd non-periodic boundary");
// apply scaling to FINAL,DELTA,VEL,WIGGLE since they have distance/vel units // apply scaling to FINAL,DELTA,VEL,WIGGLE since they have dist/vel units
int flag = 0; int flag = 0;
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
@ -320,6 +320,12 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
} }
} }
// set varflag
varflag = 0;
for (int i = 0; i < 6; i++)
if (set[i].style == VARIABLE) varflag = 1;
// set initial values at time fix deform is issued // set initial values at time fix deform is issued
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
@ -333,7 +339,7 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
else if (i == 3) set[i].tilt_initial = domain->yz; else if (i == 3) set[i].tilt_initial = domain->yz;
} }
// reneighboring only forced if flips will occur due to shape changes // reneighboring only forced if flips can occur due to shape changes
if (set[3].style || set[4].style || set[5].style) force_reneighbor = 1; if (set[3].style || set[4].style || set[5].style) force_reneighbor = 1;
next_reneighbor = -1; next_reneighbor = -1;
@ -422,7 +428,7 @@ void FixDeform::init()
// if single run, start is current values // if single run, start is current values
// if multiple runs enabled via run start/stop settings, // if multiple runs enabled via run start/stop settings,
// start is value when fix deform was issued // start is value when fix deform was issued
// if NONE, no need to set // if VARIABLE or NONE, no need to set
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (update->firststep == update->beginstep) { if (update->firststep == update->beginstep) {
@ -466,13 +472,6 @@ void FixDeform::init()
0.5*set[i].amplitude * sin(TWOPI*delt/set[i].tperiod); 0.5*set[i].amplitude * sin(TWOPI*delt/set[i].tperiod);
set[i].hi_stop = set[i].hi_start + set[i].hi_stop = set[i].hi_start +
0.5*set[i].amplitude * sin(TWOPI*delt/set[i].tperiod); 0.5*set[i].amplitude * sin(TWOPI*delt/set[i].tperiod);
} else if (set[i].style == VARIABLE) {
bigint holdstep = update->ntimestep;
update->ntimestep = update->endstep;
double delta = input->variable->compute_equal(set[i].hvar);
update->ntimestep = holdstep;
set[i].lo_stop = set[i].lo_start - 0.5*delta;
set[i].hi_stop = set[i].hi_start + 0.5*delta;
} }
} }
@ -537,13 +536,6 @@ void FixDeform::init()
set[i].tilt_max = set[i].tilt_start + set[i].amplitude; set[i].tilt_max = set[i].tilt_start + set[i].amplitude;
} }
} }
} else if (set[i].style == VARIABLE) {
bigint holdstep = update->ntimestep;
update->ntimestep = update->endstep;
double delta_tilt = input->variable->compute_equal(set[i].hvar);
update->ntimestep = holdstep;
set[i].tilt_stop = set[i].tilt_start + delta_tilt;
} }
} }
@ -554,33 +546,29 @@ void FixDeform::init()
error->all(FLERR,"Cannot use fix deform trate on a box with zero tilt"); error->all(FLERR,"Cannot use fix deform trate on a box with zero tilt");
// if yz changes and will cause box flip, then xy cannot be changing // if yz changes and will cause box flip, then xy cannot be changing
// NOTE: is this comment correct, not what is tested below? // yz = [3], xy = [5]
// test for WIGGLE is on min/max oscillation limit, not tilt_stop
// test for VARIABLE is error, since no way to calculate min/max limits
// this is b/c the flips would induce continuous changes in xz // this is b/c the flips would induce continuous changes in xz
// in order to keep the edge vectors of the flipped shape matrix // in order to keep the edge vectors of the flipped shape matrix
// an integer combination of the edge vectors of the unflipped shape matrix // an integer combination of the edge vectors of the unflipped shape matrix
// VARIABLE for yz is error, since no way to calculate if box flip occurs
// WIGGLE lo/hi flip test is on min/max oscillation limit, not tilt_stop
if (set[3].style && set[5].style) { if (set[3].style && set[5].style) {
int flag = 0; int flag = 0;
double lo,hi; double lo,hi;
if (set[3].style == VARIABLE)
error->all(FLERR,"Fix deform cannot use yz variable with xy");
if (set[3].style == WIGGLE) { if (set[3].style == WIGGLE) {
lo = set[3].tilt_min; lo = set[3].tilt_min;
hi = set[3].tilt_max; hi = set[3].tilt_max;
} else lo = hi = set[3].tilt_stop; } else lo = hi = set[3].tilt_stop;
if (set[3].style == VARIABLE)
error->all(FLERR,"Fix deform is changing yz with xy variable");
// NOTE is this preceding error test and message correct?
// NOTE is this test on set[1] correct? which is y dim?
if (lo < -0.5*(set[1].hi_start-set[1].lo_start) || if (lo < -0.5*(set[1].hi_start-set[1].lo_start) ||
hi > 0.5*(set[1].hi_start-set[1].lo_start)) flag = 1; hi > 0.5*(set[1].hi_start-set[1].lo_start)) flag = 1;
if (set[1].style) { if (set[1].style) {
if (lo < -0.5*(set[1].hi_stop-set[1].lo_stop) || if (lo < -0.5*(set[1].hi_stop-set[1].lo_stop) ||
hi > 0.5*(set[1].hi_stop-set[1].lo_stop)) flag = 1; hi > 0.5*(set[1].hi_stop-set[1].lo_stop)) flag = 1;
} }
if (flag) if (flag) error->all(FLERR,"Fix deform is changing yz too much with xy");
error->all(FLERR,
"Fix deform is changing yz by too much with changing xy");
} }
// set domain->h_rate values for use by domain and other fixes/computes // set domain->h_rate values for use by domain and other fixes/computes
@ -672,10 +660,14 @@ void FixDeform::end_of_step()
double delta = update->ntimestep - update->beginstep; double delta = update->ntimestep - update->beginstep;
delta /= update->endstep - update->beginstep; delta /= update->endstep - update->beginstep;
// wrap variable evaluations with clear/add
if (varflag) modify->clearstep_compute();
// set new box size // set new box size
// for TRATE, set target directly based on current time, also set h_rate // for TRATE, set target directly based on current time, also set h_rate
// for WIGGLE, set target directly based on current time, also set h_rate // for WIGGLE, set target directly based on current time, also set h_rate
// for VARIABLE, set target directly based on current time, also set h_rate // for VARIABLE, set target directly via variable eval, also set h_rate
// for NONE, target is current box size // for NONE, target is current box size
// for others except VOLUME, target is linear value between start and stop // for others except VOLUME, target is linear value between start and stop
@ -698,11 +690,9 @@ void FixDeform::end_of_step()
cos(TWOPI*delt/set[i].tperiod); cos(TWOPI*delt/set[i].tperiod);
h_ratelo[i] = -0.5*h_rate[i]; h_ratelo[i] = -0.5*h_rate[i];
} else if (set[i].style == VARIABLE) { } else if (set[i].style == VARIABLE) {
// NOTE: worry about clearstep, addstep, maybe set on double del = input->variable->compute_equal(set[i].hvar);
// outside of loop with global varflag set[i].lo_target = set[i].lo_start - 0.5*del;
double delta = input->variable->compute_equal(set[i].hvar); set[i].hi_target = set[i].hi_start + 0.5*del;
set[i].lo_target = set[i].lo_start - 0.5*delta;
set[i].hi_target = set[i].hi_start + 0.5*delta;
h_rate[i] = input->variable->compute_equal(set[i].hratevar); h_rate[i] = input->variable->compute_equal(set[i].hratevar);
h_ratelo[i] = -0.5*h_rate[i]; h_ratelo[i] = -0.5*h_rate[i];
} else if (set[i].style == NONE) { } else if (set[i].style == NONE) {
@ -769,7 +759,7 @@ void FixDeform::end_of_step()
// for triclinic, set new box shape // for triclinic, set new box shape
// for TRATE, set target directly based on current time. also set h_rate // for TRATE, set target directly based on current time. also set h_rate
// for WIGGLE, set target directly based on current time. also set h_rate // for WIGGLE, set target directly based on current time. also set h_rate
// for VARIABLE, set target directly based on current time. also set h_rate // for VARIABLE, set target directly via variable eval. also set h_rate
// for NONE, target is current tilt // for NONE, target is current tilt
// for other styles, target is linear value between start and stop values // for other styles, target is linear value between start and stop values
@ -820,6 +810,8 @@ void FixDeform::end_of_step()
} }
} }
if (varflag) modify->addstep_compute(update->ntimestep + nevery);
// if any tilt targets exceed bounds, set flip flag and new tilt_flip values // if any tilt targets exceed bounds, set flip flag and new tilt_flip values
// flip will be performed on next timestep before reneighboring // flip will be performed on next timestep before reneighboring
// when yz flips and xy is non-zero, xz must also change // when yz flips and xy is non-zero, xz must also change

View File

@ -39,6 +39,7 @@ class FixDeform : public Fix {
private: private:
int triclinic,scaleflag,flip; int triclinic,scaleflag,flip;
double *h_rate,*h_ratelo; double *h_rate,*h_ratelo;
int varflag; // 1 if VARIABLE option is used, 0 if not
int kspace_flag; // 1 if KSpace invoked, 0 if not int kspace_flag; // 1 if KSpace invoked, 0 if not
int nrigid; // number of rigid fixes int nrigid; // number of rigid fixes
int *rfix; // indices of rigid fixes int *rfix; // indices of rigid fixes

View File

@ -118,31 +118,36 @@ void FixIndent::init()
{ {
if (xstr) { if (xstr) {
xvar = input->variable->find(xstr); xvar = input->variable->find(xstr);
if (xvar < 0) error->all(FLERR,"Variable name for fix indent does not exist"); if (xvar < 0)
error->all(FLERR,"Variable name for fix indent does not exist");
if (!input->variable->equalstyle(xvar)) if (!input->variable->equalstyle(xvar))
error->all(FLERR,"Variable for fix indent is invalid style"); error->all(FLERR,"Variable for fix indent is invalid style");
} }
if (ystr) { if (ystr) {
yvar = input->variable->find(ystr); yvar = input->variable->find(ystr);
if (yvar < 0) error->all(FLERR,"Variable name for fix indent does not exist"); if (yvar < 0)
error->all(FLERR,"Variable name for fix indent does not exist");
if (!input->variable->equalstyle(yvar)) if (!input->variable->equalstyle(yvar))
error->all(FLERR,"Variable for fix indent is not equal style"); error->all(FLERR,"Variable for fix indent is not equal style");
} }
if (zstr) { if (zstr) {
zvar = input->variable->find(zstr); zvar = input->variable->find(zstr);
if (zvar < 0) error->all(FLERR,"Variable name for fix indent does not exist"); if (zvar < 0)
error->all(FLERR,"Variable name for fix indent does not exist");
if (!input->variable->equalstyle(zvar)) if (!input->variable->equalstyle(zvar))
error->all(FLERR,"Variable for fix indent is not equal style"); error->all(FLERR,"Variable for fix indent is not equal style");
} }
if (rstr) { if (rstr) {
rvar = input->variable->find(rstr); rvar = input->variable->find(rstr);
if (rvar < 0) error->all(FLERR,"Variable name for fix indent does not exist"); if (rvar < 0)
error->all(FLERR,"Variable name for fix indent does not exist");
if (!input->variable->equalstyle(rvar)) if (!input->variable->equalstyle(rvar))
error->all(FLERR,"Variable for fix indent is not equal style"); error->all(FLERR,"Variable for fix indent is not equal style");
} }
if (pstr) { if (pstr) {
pvar = input->variable->find(pstr); pvar = input->variable->find(pstr);
if (pvar < 0) error->all(FLERR,"Variable name for fix indent does not exist"); if (pvar < 0)
error->all(FLERR,"Variable name for fix indent does not exist");
if (!input->variable->equalstyle(pvar)) if (!input->variable->equalstyle(pvar))
error->all(FLERR,"Variable for fix indent is not equal style"); error->all(FLERR,"Variable for fix indent is not equal style");
} }