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

This commit is contained in:
sjplimp 2007-03-15 23:38:38 +00:00
parent ced2f61033
commit 3bf07918d4
19 changed files with 185 additions and 188 deletions

View File

@ -163,7 +163,7 @@ void FixGranDiag::end_of_step()
// set bottom of box for binning purposes
boxzlo = domain->boxzlo;
boxzlo = domain->boxlo[2];
// update ghost atom info
// else ghost x/v is out-of-date at end of timestep

View File

@ -132,9 +132,9 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) :
yhi = ((RegBlock *) domain->regions[iregion])->yhi;
zlo = ((RegBlock *) domain->regions[iregion])->zlo;
zhi = ((RegBlock *) domain->regions[iregion])->zhi;
if (xlo < domain->boxxlo || xhi > domain->boxxhi ||
ylo < domain->boxylo || yhi > domain->boxyhi ||
zlo < domain->boxzlo || zhi > domain->boxzhi)
if (xlo < domain->boxlo[0] || xhi > domain->boxhi[0] ||
ylo < domain->boxlo[1] || yhi > domain->boxhi[1] ||
zlo < domain->boxlo[2] || zhi > domain->boxhi[2])
error->all("Insertion region extends outside simulation box");
} else if (strcmp(domain->regions[iregion]->style,"cylinder") == 0) {
region_style = 2;
@ -146,9 +146,9 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) :
zhi = ((RegCylinder *) domain->regions[iregion])->hi;
if (axis != 'z')
error->all("Must use a z-axis cylinder with fix pour");
if (xc-rc < domain->boxxlo || xc+rc > domain->boxxhi ||
yc-rc < domain->boxylo || yc+rc > domain->boxyhi ||
zlo < domain->boxzlo || zhi > domain->boxzhi)
if (xc-rc < domain->boxlo[0] || xc+rc > domain->boxhi[0] ||
yc-rc < domain->boxlo[1] || yc+rc > domain->boxhi[1] ||
zlo < domain->boxlo[2] || zhi > domain->boxhi[2])
error->all("Insertion region extends outside simulation box");
} else error->all("Must use a block or cylinder region with fix pour");
@ -446,11 +446,11 @@ void FixPour::pre_exchange()
if (coord[0] >= sublo[0] && coord[0] < subhi[0] &&
coord[1] >= sublo[1] && coord[1] < subhi[1] &&
coord[2] >= sublo[2] && coord[2] < subhi[2]) flag = 1;
else if (force->dimension == 3 && coord[2] >= domain->boxzhi &&
else if (force->dimension == 3 && coord[2] >= domain->boxhi[2] &&
comm->myloc[2] == comm->procgrid[2]-1 &&
coord[0] >= sublo[0] && coord[0] < subhi[0] &&
coord[1] >= sublo[1] && coord[1] < subhi[1]) flag = 1;
else if (force->dimension == 2 && coord[1] >= domain->boxyhi &&
else if (force->dimension == 2 && coord[1] >= domain->boxhi[1] &&
comm->myloc[1] == comm->procgrid[1]-1 &&
coord[0] >= sublo[0] && coord[0] < subhi[0]) flag = 1;

View File

@ -150,9 +150,9 @@ void DumpXTC::write_header(int n)
// cell basis vectors
float zero = 0.0;
float xdim = domain->boxxhi - domain->boxxlo;
float ydim = domain->boxyhi - domain->boxylo;
float zdim = domain->boxzhi - domain->boxzlo;
float xdim = domain->boxhi[0] - domain->boxlo[0];
float ydim = domain->boxhi[1] - domain->boxlo[1];
float zdim = domain->boxhi[2] - domain->boxlo[2];
xdr_float(&xd,&xdim); xdr_float(&xd,&zero); xdr_float(&xd,&zero);
xdr_float(&xd,&zero); xdr_float(&xd,&ydim); xdr_float(&xd,&zero);

View File

@ -61,22 +61,22 @@ void CreateBox::command(int narg, char **arg)
// set simulation domain params from prism params
if (strcmp(domain->regions[iregion]->style,"prism") != 0) {
domain->boxxlo = domain->regions[iregion]->extent_xlo;
domain->boxxhi = domain->regions[iregion]->extent_xhi;
domain->boxylo = domain->regions[iregion]->extent_ylo;
domain->boxyhi = domain->regions[iregion]->extent_yhi;
domain->boxzlo = domain->regions[iregion]->extent_zlo;
domain->boxzhi = domain->regions[iregion]->extent_zhi;
domain->boxlo[0] = domain->regions[iregion]->extent_xlo;
domain->boxhi[0] = domain->regions[iregion]->extent_xhi;
domain->boxlo[1] = domain->regions[iregion]->extent_ylo;
domain->boxhi[1] = domain->regions[iregion]->extent_yhi;
domain->boxlo[2] = domain->regions[iregion]->extent_zlo;
domain->boxhi[2] = domain->regions[iregion]->extent_zhi;
} else {
domain->triclinic = 1;
RegPrism *region = (RegPrism *) domain->regions[iregion];
domain->boxxlo = region->xlo;
domain->boxxhi = region->xhi;
domain->boxylo = region->ylo;
domain->boxyhi = region->yhi;
domain->boxzlo = region->zlo;
domain->boxzhi = region->zhi;
domain->boxlo[0] = region->xlo;
domain->boxhi[0] = region->xhi;
domain->boxlo[1] = region->ylo;
domain->boxhi[1] = region->yhi;
domain->boxlo[2] = region->zlo;
domain->boxhi[2] = region->zhi;
domain->xy = region->xy;
domain->xz = region->xz;
domain->yz = region->yz;

View File

@ -59,8 +59,8 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp)
boundary[2][0] = boundary[2][1] = 0;
triclinic = 0;
boxxlo = boxylo = boxzlo = -0.5;
boxxhi = boxyhi = boxzhi = 0.5;
boxlo[0] = boxlo[1] = boxlo[2] = -0.5;
boxhi[0] = boxhi[1] = boxhi[2] = 0.5;
xy = xz = yz = 0.0;
prd_lamda[0] = prd_lamda[1] = prd_lamda[2] = 1.0;
@ -103,7 +103,7 @@ void Domain::set_initial_box()
{
// error checks for orthogonal and triclinic domains
if (boxxlo >= boxxhi || boxylo >= boxyhi || boxzlo >= boxzhi)
if (boxlo[0] >= boxhi[0] || boxlo[1] >= boxhi[1] || boxlo[2] >= boxhi[2])
error->one("Box bounds are invalid");
if (triclinic) {
@ -116,30 +116,30 @@ void Domain::set_initial_box()
if (yz != 0.0 && (!yperiodic || !zperiodic))
error->all("Triclinic box must be periodic in skewed dimensions");
if (fabs(xy/(boxyhi-boxylo)) > 0.5)
if (fabs(xy/(boxhi[1]-boxlo[1])) > 0.5)
error->all("Triclinic box skew is too large");
if (fabs(xz/(boxzhi-boxzlo)) > 0.5)
if (fabs(xz/(boxhi[2]-boxlo[2])) > 0.5)
error->all("Triclinic box skew is too large");
if (fabs(yz/(boxzhi-boxzlo)) > 0.5)
if (fabs(yz/(boxhi[2]-boxlo[2])) > 0.5)
error->all("Triclinic box skew is too large");
}
// adjust box lo/hi for shrink-wrapped dims
if (boundary[0][0] == 2) boxxlo -= SMALL;
else if (boundary[0][0] == 3) minxlo = boxxlo;
if (boundary[0][1] == 2) boxxhi += SMALL;
else if (boundary[0][1] == 3) minxhi = boxxhi;
if (boundary[0][0] == 2) boxlo[0] -= SMALL;
else if (boundary[0][0] == 3) minxlo = boxlo[0];
if (boundary[0][1] == 2) boxhi[0] += SMALL;
else if (boundary[0][1] == 3) minxhi = boxhi[0];
if (boundary[1][0] == 2) boxylo -= SMALL;
else if (boundary[1][0] == 3) minylo = boxylo;
if (boundary[1][1] == 2) boxyhi += SMALL;
else if (boundary[1][1] == 3) minyhi = boxyhi;
if (boundary[1][0] == 2) boxlo[1] -= SMALL;
else if (boundary[1][0] == 3) minylo = boxlo[1];
if (boundary[1][1] == 2) boxhi[1] += SMALL;
else if (boundary[1][1] == 3) minyhi = boxhi[1];
if (boundary[2][0] == 2) boxzlo -= SMALL;
else if (boundary[2][0] == 3) minzlo = boxzlo;
if (boundary[2][1] == 2) boxzhi += SMALL;
else if (boundary[2][1] == 3) minzhi = boxzhi;
if (boundary[2][0] == 2) boxlo[2] -= SMALL;
else if (boundary[2][0] == 3) minzlo = boxlo[2];
if (boundary[2][1] == 2) boxhi[2] += SMALL;
else if (boundary[2][1] == 3) minzhi = boxhi[2];
}
/* ----------------------------------------------------------------------
@ -149,17 +149,14 @@ void Domain::set_initial_box()
void Domain::set_global_box()
{
prd[0] = xprd = boxxhi - boxxlo;
prd[1] = yprd = boxyhi - boxylo;
prd[2] = zprd = boxzhi - boxzlo;
prd[0] = xprd = boxhi[0] - boxlo[0];
prd[1] = yprd = boxhi[1] - boxlo[1];
prd[2] = zprd = boxhi[2] - boxlo[2];
xprd_half = 0.5*xprd;
yprd_half = 0.5*yprd;
zprd_half = 0.5*zprd;
boxlo[0] = boxxlo; boxlo[1] = boxylo; boxlo[2] = boxzlo;
boxhi[0] = boxxhi; boxhi[1] = boxyhi; boxhi[2] = boxzhi;
if (triclinic) {
h[0] = xprd;
h[1] = yprd;
@ -286,25 +283,25 @@ void Domain::reset_box()
// if set, observe min box size settings
if (xperiodic == 0) {
if (boundary[0][0] == 2) boxxlo = -all[0][0] - SMALL;
else if (boundary[0][0] == 3) boxxlo = MIN(-all[0][0]-SMALL,minxlo);
if (boundary[0][1] == 2) boxxhi = all[0][1] + SMALL;
else if (boundary[0][1] == 3) boxxhi = MAX(all[0][1]+SMALL,minxhi);
if (boxxlo > boxxhi) error->all("Illegal simulation box");
if (boundary[0][0] == 2) boxlo[0] = -all[0][0] - SMALL;
else if (boundary[0][0] == 3) boxlo[0] = MIN(-all[0][0]-SMALL,minxlo);
if (boundary[0][1] == 2) boxhi[0] = all[0][1] + SMALL;
else if (boundary[0][1] == 3) boxhi[0] = MAX(all[0][1]+SMALL,minxhi);
if (boxlo[0] > boxhi[0]) error->all("Illegal simulation box");
}
if (yperiodic == 0) {
if (boundary[1][0] == 2) boxylo = -all[1][0] - SMALL;
else if (boundary[1][0] == 3) boxylo = MIN(-all[1][0]-SMALL,minylo);
if (boundary[1][1] == 2) boxyhi = all[1][1] + SMALL;
else if (boundary[1][1] == 3) boxyhi = MAX(all[1][1]+SMALL,minyhi);
if (boxylo > boxyhi) error->all("Illegal simulation box");
if (boundary[1][0] == 2) boxlo[1] = -all[1][0] - SMALL;
else if (boundary[1][0] == 3) boxlo[1] = MIN(-all[1][0]-SMALL,minylo);
if (boundary[1][1] == 2) boxhi[1] = all[1][1] + SMALL;
else if (boundary[1][1] == 3) boxhi[1] = MAX(all[1][1]+SMALL,minyhi);
if (boxlo[1] > boxhi[1]) error->all("Illegal simulation box");
}
if (zperiodic == 0) {
if (boundary[2][0] == 2) boxzlo = -all[2][0] - SMALL;
else if (boundary[2][0] == 3) boxzlo = MIN(-all[2][0]-SMALL,minzlo);
if (boundary[2][1] == 2) boxzhi = all[2][1] + SMALL;
else if (boundary[2][1] == 3) boxzhi = MAX(all[2][1]+SMALL,minzhi);
if (boxzlo > boxzhi) error->all("Illegal simulation box");
if (boundary[2][0] == 2) boxlo[2] = -all[2][0] - SMALL;
else if (boundary[2][0] == 3) boxlo[2] = MIN(-all[2][0]-SMALL,minzlo);
if (boundary[2][1] == 2) boxhi[2] = all[2][1] + SMALL;
else if (boundary[2][1] == 3) boxhi[2] = MAX(all[2][1]+SMALL,minzhi);
if (boxlo[2] > boxhi[2]) error->all("Illegal simulation box");
}
}
@ -751,23 +748,25 @@ void Domain::print_box(char *str)
if (screen) {
if (domain->triclinic == 0)
fprintf(screen,"%sorthogonal box = (%g %g %g) to (%g %g %g)\n",
str,boxxlo,boxylo,boxzlo,boxxhi,boxyhi,boxzhi);
str,boxlo[0],boxlo[1],boxlo[2],boxhi[0],boxhi[1],boxhi[2]);
else {
char *format =
"%striclinic box = (%g %g %g) to (%g %g %g) with tilt (%g %g %g)\n";
fprintf(screen,format,
str,boxxlo,boxylo,boxzlo,boxxhi,boxyhi,boxzhi,xy,xz,yz);
str,boxlo[0],boxlo[1],boxlo[2],boxhi[0],boxhi[1],boxhi[2],
xy,xz,yz);
}
}
if (logfile) {
if (triclinic == 0)
fprintf(logfile,"%sorthogonal box = (%g %g %g) to (%g %g %g)\n",
str,boxxlo,boxylo,boxzlo,boxxhi,boxyhi,boxzhi);
str,boxlo[0],boxlo[1],boxlo[2],boxhi[0],boxhi[1],boxhi[2]);
else {
char *format =
"%striclinic box = (%g %g %g) to (%g %g %g) with tilt (%g %g %g)\n";
fprintf(logfile,format,
str,boxxlo,boxylo,boxzlo,boxxhi,boxyhi,boxzhi,xy,xz,yz);
str,boxlo[0],boxlo[1],boxlo[2],boxhi[0],boxhi[1],boxhi[2],
xy,xz,yz);
}
}
}

View File

@ -42,18 +42,13 @@ class Domain : protected Pointers {
double prd[3]; // array form of dimensions
// triclinic box
// xprd,half,prd = same
// (as if untilted)
// xprd,half,prd = same (as if untilt)
double prd_lamda[3]; // lamda box = (1,1,1)
double boxxlo,boxxhi; // orthogonal box
double boxylo,boxyhi; // global box bounds
double boxzlo,boxzhi;
double boxlo[3],boxhi[3]; // array form of box bounds
double boxlo[3],boxhi[3]; // orthogonal box global bounds
// triclinic box
// boxxlo/hi,boxlo/hi = same
// (as if untilted)
// boxlo/hi = same (as if untilted)
double boxlo_lamda[3],boxhi_lamda[3]; // lamda box = (0,1)
double boxlo_bound[3],boxhi_bound[3]; // bounding box of tilted domain

View File

@ -122,12 +122,12 @@ void Dump::write()
// simulation box bounds
if (domain->triclinic == 0) {
boxxlo = domain->boxxlo;
boxxhi = domain->boxxhi;
boxylo = domain->boxylo;
boxyhi = domain->boxyhi;
boxzlo = domain->boxzlo;
boxzhi = domain->boxzhi;
boxxlo = domain->boxlo[0];
boxxhi = domain->boxhi[0];
boxylo = domain->boxlo[1];
boxyhi = domain->boxhi[1];
boxzlo = domain->boxlo[2];
boxzhi = domain->boxhi[2];
} else {
boxxlo = domain->boxlo_bound[0];
boxxhi = domain->boxhi_bound[0];

View File

@ -311,7 +311,7 @@ int DumpCustom::count()
nstride = 3;
} else if (thresh_array[ithresh] == XS) {
double **x = atom->x;
double boxxlo = domain->boxxlo;
double boxxlo = domain->boxlo[0];
double invxprd = 1.0/domain->xprd;
for (i = 0; i < nlocal; i++)
dchoose[i] = (x[i][0] - boxxlo) * invxprd;
@ -319,7 +319,7 @@ int DumpCustom::count()
nstride = 1;
} else if (thresh_array[ithresh] == YS) {
double **x = atom->x;
double boxylo = domain->boxylo;
double boxylo = domain->boxlo[1];
double invyprd = 1.0/domain->yprd;
for (i = 0; i < nlocal; i++)
dchoose[i] = (x[i][1] - boxylo) * invyprd;
@ -327,7 +327,7 @@ int DumpCustom::count()
nstride = 1;
} else if (thresh_array[ithresh] == ZS) {
double **x = atom->x;
double boxzlo = domain->boxzlo;
double boxzlo = domain->boxlo[2];
double invzprd = 1.0/domain->zprd;
for (i = 0; i < nlocal; i++)
dchoose[i] = (x[i][2] - boxzlo) * invzprd;
@ -1155,7 +1155,7 @@ void DumpCustom::pack_xs(int n)
double **x = atom->x;
int nlocal = atom->nlocal;
double boxxlo = domain->boxxlo;
double boxxlo = domain->boxlo[0];
double invxprd = 1.0/domain->xprd;
for (int i = 0; i < nlocal; i++)
@ -1172,7 +1172,7 @@ void DumpCustom::pack_ys(int n)
double **x = atom->x;
int nlocal = atom->nlocal;
double boxylo = domain->boxylo;
double boxylo = domain->boxlo[1];
double invyprd = 1.0/domain->yprd;
for (int i = 0; i < nlocal; i++)
@ -1189,7 +1189,7 @@ void DumpCustom::pack_zs(int n)
double **x = atom->x;
int nlocal = atom->nlocal;
double boxzlo = domain->boxzlo;
double boxzlo = domain->boxlo[2];
double invzprd = 1.0/domain->zprd;
for (int i = 0; i < nlocal; i++)

View File

@ -204,10 +204,10 @@ void FixDeposit::pre_exchange()
if (force->dimension == 2) {
dim = 1;
max = domain->boxylo;
max = domain->boxlo[1];
} else {
dim = 2;
max = domain->boxzlo;
max = domain->boxlo[2];
}
double **x = atom->x;
@ -271,11 +271,11 @@ void FixDeposit::pre_exchange()
if (newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] &&
newcoord[1] >= sublo[1] && newcoord[1] < subhi[1] &&
newcoord[2] >= sublo[2] && newcoord[2] < subhi[2]) flag = 1;
else if (force->dimension == 3 && newcoord[2] >= domain->boxzhi &&
else if (force->dimension == 3 && newcoord[2] >= domain->boxhi[2] &&
comm->myloc[2] == comm->procgrid[2]-1 &&
newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] &&
newcoord[1] >= sublo[1] && newcoord[1] < subhi[1]) flag = 1;
else if (force->dimension == 2 && newcoord[1] >= domain->boxyhi &&
else if (force->dimension == 2 && newcoord[1] >= domain->boxhi[1] &&
comm->myloc[1] == comm->procgrid[1]-1 &&
newcoord[0] >= sublo[0] && newcoord[0] < subhi[0]) flag = 1;

View File

@ -623,12 +623,12 @@ void FixNPH::box_dilate(int flag)
double oldlo,oldhi,ctr;
if (domain->xperiodic && p_flag[0]) {
oldlo = domain->boxxlo;
oldhi = domain->boxxhi;
oldlo = domain->boxlo[0];
oldhi = domain->boxhi[0];
ctr = 0.5 * (oldlo + oldhi);
domain->boxxlo = (oldlo-ctr)*dilation[0] + ctr;
domain->boxxhi = (oldhi-ctr)*dilation[0] + ctr;
domain->xprd = domain->boxxhi - domain->boxxlo;
domain->boxlo[0] = (oldlo-ctr)*dilation[0] + ctr;
domain->boxhi[0] = (oldhi-ctr)*dilation[0] + ctr;
domain->prd[0] = domain->xprd = domain->boxhi[0] - domain->boxlo[0];
if (dilate_partial) {
for (i = 0; i < n; i++)
if (mask[i] & groupbit)
@ -640,16 +640,16 @@ void FixNPH::box_dilate(int flag)
if (nrigid)
for (i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->
dilate(0,oldlo,oldhi,domain->boxxlo,domain->boxxhi);
dilate(0,oldlo,oldhi,domain->boxlo[0],domain->boxhi[0]);
}
if (domain->yperiodic && p_flag[1]) {
oldlo = domain->boxylo;
oldhi = domain->boxyhi;
oldlo = domain->boxlo[1];
oldhi = domain->boxhi[1];
ctr = 0.5 * (oldlo + oldhi);
domain->boxylo = (oldlo-ctr)*dilation[1] + ctr;
domain->boxyhi = (oldhi-ctr)*dilation[1] + ctr;
domain->yprd = domain->boxyhi - domain->boxylo;
domain->boxlo[1] = (oldlo-ctr)*dilation[1] + ctr;
domain->boxhi[1] = (oldhi-ctr)*dilation[1] + ctr;
domain->prd[1] = domain->yprd = domain->boxhi[1] - domain->boxlo[1];
if (dilate_partial) {
for (i = 0; i < n; i++)
if (mask[i] & groupbit)
@ -661,16 +661,16 @@ void FixNPH::box_dilate(int flag)
if (nrigid)
for (i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->
dilate(1,oldlo,oldhi,domain->boxylo,domain->boxyhi);
dilate(1,oldlo,oldhi,domain->boxlo[1],domain->boxhi[1]);
}
if (domain->zperiodic && p_flag[2]) {
oldlo = domain->boxzlo;
oldhi = domain->boxzhi;
oldlo = domain->boxlo[2];
oldhi = domain->boxhi[2];
ctr = 0.5 * (oldlo + oldhi);
domain->boxzlo = (oldlo-ctr)*dilation[2] + ctr;
domain->boxzhi = (oldhi-ctr)*dilation[2] + ctr;
domain->zprd = domain->boxzhi - domain->boxzlo;
domain->boxlo[2] = (oldlo-ctr)*dilation[2] + ctr;
domain->boxhi[2] = (oldhi-ctr)*dilation[2] + ctr;
domain->prd[2] = domain->zprd = domain->boxhi[2] - domain->boxlo[2];
if (dilate_partial) {
for (i = 0; i < n; i++)
if (mask[i] & groupbit)
@ -682,7 +682,7 @@ void FixNPH::box_dilate(int flag)
if (nrigid)
for (i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->
dilate(2,oldlo,oldhi,domain->boxzlo,domain->boxzhi);
dilate(2,oldlo,oldhi,domain->boxlo[2],domain->boxhi[2]);
}
}

View File

@ -649,12 +649,12 @@ void FixNPT::box_dilate(int flag)
double oldlo,oldhi,ctr;
if (domain->xperiodic && p_flag[0]) {
oldlo = domain->boxxlo;
oldhi = domain->boxxhi;
oldlo = domain->boxlo[0];
oldhi = domain->boxhi[0];
ctr = 0.5 * (oldlo + oldhi);
domain->boxxlo = (oldlo-ctr)*dilation[0] + ctr;
domain->boxxhi = (oldhi-ctr)*dilation[0] + ctr;
domain->xprd = domain->boxxhi - domain->boxxlo;
domain->boxlo[0] = (oldlo-ctr)*dilation[0] + ctr;
domain->boxhi[0] = (oldhi-ctr)*dilation[0] + ctr;
domain->prd[0] = domain->xprd = domain->boxhi[0] - domain->boxlo[0];
if (dilate_partial) {
for (i = 0; i < n; i++)
if (mask[i] & groupbit)
@ -666,16 +666,16 @@ void FixNPT::box_dilate(int flag)
if (nrigid)
for (i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->
dilate(0,oldlo,oldhi,domain->boxxlo,domain->boxxhi);
dilate(0,oldlo,oldhi,domain->boxlo[0],domain->boxhi[0]);
}
if (domain->yperiodic && p_flag[1]) {
oldlo = domain->boxylo;
oldhi = domain->boxyhi;
oldlo = domain->boxlo[1];
oldhi = domain->boxhi[1];
ctr = 0.5 * (oldlo + oldhi);
domain->boxylo = (oldlo-ctr)*dilation[1] + ctr;
domain->boxyhi = (oldhi-ctr)*dilation[1] + ctr;
domain->yprd = domain->boxyhi - domain->boxylo;
domain->boxlo[1] = (oldlo-ctr)*dilation[1] + ctr;
domain->boxhi[1] = (oldhi-ctr)*dilation[1] + ctr;
domain->prd[1] = domain->yprd = domain->boxhi[1] - domain->boxlo[1];
if (dilate_partial) {
for (i = 0; i < n; i++)
if (mask[i] & groupbit)
@ -687,16 +687,16 @@ void FixNPT::box_dilate(int flag)
if (nrigid)
for (i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->
dilate(1,oldlo,oldhi,domain->boxylo,domain->boxyhi);
dilate(1,oldlo,oldhi,domain->boxlo[1],domain->boxhi[1]);
}
if (domain->zperiodic && p_flag[2]) {
oldlo = domain->boxzlo;
oldhi = domain->boxzhi;
oldlo = domain->boxlo[2];
oldhi = domain->boxhi[2];
ctr = 0.5 * (oldlo + oldhi);
domain->boxzlo = (oldlo-ctr)*dilation[2] + ctr;
domain->boxzhi = (oldhi-ctr)*dilation[2] + ctr;
domain->zprd = domain->boxzhi - domain->boxzlo;
domain->boxlo[2] = (oldlo-ctr)*dilation[2] + ctr;
domain->boxhi[2] = (oldhi-ctr)*dilation[2] + ctr;
domain->prd[2] = domain->zprd = domain->boxhi[2] - domain->boxlo[2];
if (dilate_partial) {
for (i = 0; i < n; i++)
if (mask[i] & groupbit)
@ -708,7 +708,7 @@ void FixNPT::box_dilate(int flag)
if (nrigid)
for (i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->
dilate(2,oldlo,oldhi,domain->boxzlo,domain->boxzhi);
dilate(2,oldlo,oldhi,domain->boxlo[2],domain->boxhi[2]);
}
}

View File

@ -37,6 +37,9 @@ FixUniaxial::FixUniaxial(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
{
if (narg != 6) error->all("Illegal fix uniaxial command");
box_change = 1;
nevery = atoi(arg[3]);
if (nevery <= 0) error->all("Illegal fix uniaxial command");
@ -79,21 +82,21 @@ void FixUniaxial::init()
{
// store pointers to domain variable so can loop over dimensions
domainlo[0] = &domain->boxxlo;
domainlo[1] = &domain->boxylo;
domainlo[2] = &domain->boxzlo;
domainlo[0] = &domain->boxlo[0];
domainlo[1] = &domain->boxlo[1];
domainlo[2] = &domain->boxlo[2];
domainhi[0] = &domain->boxxhi;
domainhi[1] = &domain->boxyhi;
domainhi[2] = &domain->boxzhi;
domainhi[0] = &domain->boxhi[0];
domainhi[1] = &domain->boxhi[1];
domainhi[2] = &domain->boxhi[2];
domainprd[0] = &domain->xprd;
domainprd[1] = &domain->yprd;
domainprd[2] = &domain->zprd;
double L = pow((domain->boxxhi-domain->boxxlo)*
(domain->boxyhi-domain->boxylo)*
(domain->boxzhi-domain->boxzlo) ,1.0/3.0);
double L = pow((domain->boxhi[0]-domain->boxlo[0])*
(domain->boxhi[1]-domain->boxlo[1])*
(domain->boxhi[2]-domain->boxlo[2]) ,1.0/3.0);
// save box sizes for coordinate rescaling
// calculate strains and asymmetry parameter
@ -196,7 +199,7 @@ void FixUniaxial::end_of_step()
*domainlo[m] = newlo;
*domainhi[m] = newhi;
*domainprd[m] = newhi - newlo;
domain->prd[m] = *domainprd[m] = newhi - newlo;
if (nrigid)
for (i = 0; i < nrigid; i++)

View File

@ -94,12 +94,12 @@ int FixVolRescale::setmask()
void FixVolRescale::init()
{
xlo_start = domain->boxxlo;
xhi_start = domain->boxxhi;
ylo_start = domain->boxylo;
yhi_start = domain->boxyhi;
zlo_start = domain->boxzlo;
zhi_start = domain->boxzhi;
xlo_start = domain->boxlo[0];
xhi_start = domain->boxhi[0];
ylo_start = domain->boxlo[1];
yhi_start = domain->boxhi[1];
zlo_start = domain->boxlo[2];
zhi_start = domain->boxhi[2];
if (force->kspace) kspace_flag = 1;
else kspace_flag = 0;
@ -138,51 +138,51 @@ void FixVolRescale::end_of_step()
int nlocal = atom->nlocal;
if (xflag) {
oldlo = domain->boxxlo;
oldhi = domain->boxxhi;
oldlo = domain->boxlo[0];
oldhi = domain->boxhi[0];
newlo = xlo_start + delta * (xlo_stop-xlo_start);
newhi = xhi_start + delta * (xhi_stop-xhi_start);
ratio = (newhi - newlo) / domain->xprd;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
x[i][0] = newlo + (x[i][0] - oldlo) * ratio;
domain->boxxlo = newlo;
domain->boxxhi = newhi;
domain->xprd = newhi - newlo;
domain->boxlo[0] = newlo;
domain->boxhi[0] = newhi;
domain->prd[0] = domain->xprd = newhi - newlo;
if (nrigid)
for (i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->dilate(0,oldlo,oldhi,newlo,newhi);
}
if (yflag) {
oldlo = domain->boxylo;
oldhi = domain->boxyhi;
oldlo = domain->boxlo[1];
oldhi = domain->boxhi[1];
newlo = ylo_start + delta * (ylo_stop-ylo_start);
newhi = yhi_start + delta * (yhi_stop-yhi_start);
ratio = (newhi - newlo) / domain->yprd;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
x[i][1] = newlo + (x[i][1] - oldlo) * ratio;
domain->boxylo = newlo;
domain->boxyhi = newhi;
domain->yprd = newhi - newlo;
domain->boxlo[1] = newlo;
domain->boxhi[1] = newhi;
domain->prd[1] = domain->yprd = newhi - newlo;
if (nrigid)
for (i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->dilate(1,oldlo,oldhi,newlo,newhi);
}
if (zflag) {
oldlo = domain->boxzlo;
oldhi = domain->boxzhi;
oldlo = domain->boxlo[2];
oldhi = domain->boxhi[2];
newlo = zlo_start + delta * (zlo_stop-zlo_start);
newhi = zhi_start + delta * (zhi_stop-zhi_start);
ratio = (newhi - newlo) / domain->zprd;
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
x[i][2] = newlo + (x[i][2] - oldlo) * ratio;
domain->boxzlo = newlo;
domain->boxzhi = newhi;
domain->zprd = newhi - newlo;
domain->boxlo[2] = newlo;
domain->boxhi[2] = newhi;
domain->prd[2] = domain->zprd = newhi - newlo;
if (nrigid)
for (i = 0; i < nrigid; i++)
modify->fix[rfix[i]]->dilate(2,oldlo,oldhi,newlo,newhi);

View File

@ -76,12 +76,12 @@ void FixWallReflect::init()
void FixWallReflect::initial_integrate()
{
double xlo = domain->boxxlo;
double xhi = domain->boxxhi;
double ylo = domain->boxylo;
double yhi = domain->boxyhi;
double zlo = domain->boxzlo;
double zhi = domain->boxzhi;
double xlo = domain->boxlo[0];
double xhi = domain->boxhi[0];
double ylo = domain->boxlo[1];
double yhi = domain->boxhi[1];
double zlo = domain->boxlo[2];
double zhi = domain->boxhi[2];
double **x = atom->x;
double **v = atom->v;

View File

@ -353,11 +353,11 @@ void ReadData::header(int flag)
else if (strstr(line,"improper types"))
sscanf(line,"%d",&atom->nimpropertypes);
else if (strstr(line,"xlo xhi"))
sscanf(line,"%lg %lg",&domain->boxxlo,&domain->boxxhi);
sscanf(line,"%lg %lg",&domain->boxlo[0],&domain->boxhi[0]);
else if (strstr(line,"ylo yhi"))
sscanf(line,"%lg %lg",&domain->boxylo,&domain->boxyhi);
sscanf(line,"%lg %lg",&domain->boxlo[1],&domain->boxhi[1]);
else if (strstr(line,"zlo zhi"))
sscanf(line,"%lg %lg",&domain->boxzlo,&domain->boxzhi);
sscanf(line,"%lg %lg",&domain->boxlo[2],&domain->boxhi[2]);
else if (strstr(line,"xy xz yz")) {
domain->triclinic = 1;
sscanf(line,"%lg %lg %lg",&domain->xy,&domain->xz,&domain->yz);

View File

@ -505,17 +505,17 @@ void ReadRestart::header()
atom->improper_per_atom = read_int();
} else if (flag == 34) {
domain->boxxlo = read_double();
domain->boxlo[0] = read_double();
} else if (flag == 35) {
domain->boxxhi = read_double();
domain->boxhi[0] = read_double();
} else if (flag == 36) {
domain->boxylo = read_double();
domain->boxlo[1] = read_double();
} else if (flag == 37) {
domain->boxyhi = read_double();
domain->boxhi[1] = read_double();
} else if (flag == 38) {
domain->boxzlo = read_double();
domain->boxlo[2] = read_double();
} else if (flag == 39) {
domain->boxzhi = read_double();
domain->boxhi[2] = read_double();
} else if (flag == 40) {
force->special_lj[1] = read_double();

View File

@ -168,9 +168,9 @@ void Replicate::command(int narg, char **arg)
// setup new simulation box
domain->boxxhi = domain->boxxlo + nx*old_xprd;
domain->boxyhi = domain->boxylo + ny*old_yprd;
domain->boxzhi = domain->boxzlo + nz*old_zprd;
domain->boxhi[0] = domain->boxlo[0] + nx*old_xprd;
domain->boxhi[1] = domain->boxlo[1] + ny*old_yprd;
domain->boxhi[2] = domain->boxlo[2] + nz*old_zprd;
if (triclinic) {
domain->xy *= ny;
domain->xz *= nz;

View File

@ -1326,42 +1326,42 @@ void Thermo::compute_lz()
void Thermo::compute_xlo()
{
dvalue = domain->boxxlo;
dvalue = domain->boxlo[0];
}
/* ---------------------------------------------------------------------- */
void Thermo::compute_xhi()
{
dvalue = domain->boxxhi;
dvalue = domain->boxhi[0];
}
/* ---------------------------------------------------------------------- */
void Thermo::compute_ylo()
{
dvalue = domain->boxylo;
dvalue = domain->boxlo[1];
}
/* ---------------------------------------------------------------------- */
void Thermo::compute_yhi()
{
dvalue = domain->boxyhi;
dvalue = domain->boxhi[1];
}
/* ---------------------------------------------------------------------- */
void Thermo::compute_zlo()
{
dvalue = domain->boxzlo;
dvalue = domain->boxlo[2];
}
/* ---------------------------------------------------------------------- */
void Thermo::compute_zhi()
{
dvalue = domain->boxzhi;
dvalue = domain->boxhi[2];
}
/* ---------------------------------------------------------------------- */

View File

@ -272,12 +272,12 @@ void WriteRestart::header()
write_int(32,atom->nimpropertypes);
write_int(33,atom->improper_per_atom);
write_double(34,domain->boxxlo);
write_double(35,domain->boxxhi);
write_double(36,domain->boxylo);
write_double(37,domain->boxyhi);
write_double(38,domain->boxzlo);
write_double(39,domain->boxzhi);
write_double(34,domain->boxlo[0]);
write_double(35,domain->boxhi[0]);
write_double(36,domain->boxlo[1]);
write_double(37,domain->boxhi[1]);
write_double(38,domain->boxlo[2]);
write_double(39,domain->boxhi[2]);
write_double(40,force->special_lj[1]);
write_double(41,force->special_lj[2]);