diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 7478dddb9e..ca65291358 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -448,7 +448,18 @@ int PairKIM::get_neigh(void **kimmdl,int *mode,int *request, }else{ *numnei = numneigh[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++; if (*numnei > KIM_API_MAX_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]; *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) return KIM_STATUS_NEIGH_TOO_MANY_NEIGHBORS; if (pkim->support_Rij){ diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index dc9881d17c..864a97db6f 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -236,7 +236,7 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (set[5].style && domain->yperiodic == 0) 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; 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 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; } - // 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; next_reneighbor = -1; @@ -422,7 +428,7 @@ void FixDeform::init() // if single run, start is current values // if multiple runs enabled via run start/stop settings, // 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++) { if (update->firststep == update->beginstep) { @@ -466,13 +472,6 @@ void FixDeform::init() 0.5*set[i].amplitude * sin(TWOPI*delt/set[i].tperiod); set[i].hi_stop = set[i].hi_start + 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; } } - - } 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"); // if yz changes and will cause box flip, then xy cannot be changing - // NOTE: is this comment correct, not what is tested below? - // 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 + // yz = [3], xy = [5] // this is b/c the flips would induce continuous changes in xz // in order to keep the edge vectors of the flipped 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) { int flag = 0; double lo,hi; + if (set[3].style == VARIABLE) + error->all(FLERR,"Fix deform cannot use yz variable with xy"); if (set[3].style == WIGGLE) { lo = set[3].tilt_min; hi = set[3].tilt_max; } 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) || hi > 0.5*(set[1].hi_start-set[1].lo_start)) flag = 1; if (set[1].style) { 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; } - if (flag) - error->all(FLERR, - "Fix deform is changing yz by too much with changing xy"); + if (flag) error->all(FLERR,"Fix deform is changing yz too much with xy"); } // 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; delta /= update->endstep - update->beginstep; + // wrap variable evaluations with clear/add + + if (varflag) modify->clearstep_compute(); + // set new box size // 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 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 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); h_ratelo[i] = -0.5*h_rate[i]; } else if (set[i].style == VARIABLE) { - // NOTE: worry about clearstep, addstep, maybe set on - // outside of loop with global varflag - double delta = input->variable->compute_equal(set[i].hvar); - set[i].lo_target = set[i].lo_start - 0.5*delta; - set[i].hi_target = set[i].hi_start + 0.5*delta; + double del = input->variable->compute_equal(set[i].hvar); + set[i].lo_target = set[i].lo_start - 0.5*del; + set[i].hi_target = set[i].hi_start + 0.5*del; h_rate[i] = input->variable->compute_equal(set[i].hratevar); h_ratelo[i] = -0.5*h_rate[i]; } else if (set[i].style == NONE) { @@ -769,7 +759,7 @@ void FixDeform::end_of_step() // for triclinic, set new box shape // 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 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 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 // flip will be performed on next timestep before reneighboring // when yz flips and xy is non-zero, xz must also change diff --git a/src/fix_deform.h b/src/fix_deform.h index a54202c921..ddd3c73c27 100644 --- a/src/fix_deform.h +++ b/src/fix_deform.h @@ -39,6 +39,7 @@ class FixDeform : public Fix { private: int triclinic,scaleflag,flip; 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 nrigid; // number of rigid fixes int *rfix; // indices of rigid fixes diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index 48f72ac048..93e327ef70 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -118,31 +118,36 @@ void FixIndent::init() { if (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)) error->all(FLERR,"Variable for fix indent is invalid style"); } if (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)) error->all(FLERR,"Variable for fix indent is not equal style"); } if (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)) error->all(FLERR,"Variable for fix indent is not equal style"); } if (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)) error->all(FLERR,"Variable for fix indent is not equal style"); } if (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)) error->all(FLERR,"Variable for fix indent is not equal style"); }