diff --git a/doc/src/compute.rst b/doc/src/compute.rst index cf17433035..508c440e78 100644 --- a/doc/src/compute.rst +++ b/doc/src/compute.rst @@ -284,8 +284,8 @@ The individual style names on the :doc:`Commands compute ` pag * :doc:`smd/vol ` - per-particle volumes and their sum in Smooth Mach Dynamics * :doc:`snap ` - gradients of SNAP energy and forces w.r.t. linear coefficients and related quantities for fitting SNAP potentials * :doc:`sna/atom ` - bispectrum components for each atom -* :doc:`sna/grid ` - global array of bispectrum components on a regular grid -* :doc:`sna/grid/local ` - local array of bispectrum components on a regular grid +* :doc:`sna/grid ` - global array of bispectrum components on a regular grid +* :doc:`sna/grid/local ` - local array of bispectrum components on a regular grid * :doc:`snad/atom ` - derivative of bispectrum components for each atom * :doc:`snav/atom ` - virial contribution from bispectrum components for each atom * :doc:`sph/e/atom ` - per-atom internal energy of Smooth-Particle Hydrodynamics atoms diff --git a/doc/src/compute_sna_atom.rst b/doc/src/compute_sna_atom.rst index 2bbee1e6b6..5f777685fd 100644 --- a/doc/src/compute_sna_atom.rst +++ b/doc/src/compute_sna_atom.rst @@ -35,7 +35,7 @@ Syntax * twojmax = band limit for bispectrum components (non-negative integer) * R_1, R_2,... = list of cutoff radii, one for each type (distance units) * w_1, w_2,... = list of neighbor weights, one for each type -* nx, ny, nz = number of grid points in x, y, and z directions (positive integer) +* nx, ny, nz = number of grid points in x, y, and z directions (positive integer) * zero or more keyword/value pairs may be appended * keyword = *rmin0* or *switchflag* or *bzeroflag* or *quadraticflag* or *chem* or *bnormflag* or *wselfallflag* or *bikflag* or *switchinnerflag* or *sinner* or *dinner* @@ -223,7 +223,7 @@ These are calculated from the local density of nearby atoms *i'* around each grid point, as if there was a central atom *i* at the grid point. This is useful for characterizing fine-scale structure in a configuration of atoms, and it has been used -to build a machine-learning surrogate for finite-temperature Kohn-Sham +to build a machine-learning surrogate for finite-temperature Kohn-Sham density functional theory (:ref:`Ellis et al. `). Neighbor atoms not in the group do not contribute to the bispectrum components of the grid points. The distance cutoff :math:`R_{ii'}` @@ -231,7 +231,7 @@ and other parameters are defined as for a central atom with the same type as the neighbor atoms *i'*. Compute *sna/grid* calculates a global array containing bispectrum -components for a regular grid of points. +components for a regular grid of points. The grid is aligned with the current box dimensions, with the first point at the box origin, and forming a regular 3d array with *nx*, *ny*, and *nz* points in the x, y, and z directions. For triclinic @@ -720,7 +720,7 @@ The array contains one row for each of the :math:`nx \times ny \times nz` grid points, looping over the index for *ix* fastest, then *iy*, and *iz* slowest. Each row of the array contains the *x*, *y*, and *z* coordinates of the grid point, followed by the bispectrum -components. +components. Compute *sna/grid/local* evaluates a local array. The array contains one row for each of the @@ -754,7 +754,7 @@ The optional keyword defaults are *rmin0* = 0, .. _Thompson20141: **(Thompson)** Thompson, Swiler, Trott, Foiles, Tucker, J Comp Phys, 285, 316, (2015). - + .. _Bartok20101: **(Bartok)** Bartok, Payne, Risi, Csanyi, Phys Rev Lett, 104, 136403 (2010). diff --git a/src/ML-SNAP/compute_sna_grid.cpp b/src/ML-SNAP/compute_sna_grid.cpp index 1d868ba769..8247771493 100644 --- a/src/ML-SNAP/compute_sna_grid.cpp +++ b/src/ML-SNAP/compute_sna_grid.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract @@ -41,7 +41,7 @@ ComputeSNAGrid::ComputeSNAGrid(LAMMPS *lmp, int narg, char **arg) : int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; // skip over arguments used by base class - // so that argument positions are identical to + // so that argument positions are identical to // regular per-atom compute arg += nargbase; @@ -63,7 +63,7 @@ ComputeSNAGrid::ComputeSNAGrid(LAMMPS *lmp, int narg, char **arg) : wselfallflag = 0; switchinnerflag = 0; nelements = 1; - + // process required arguments memory->create(radelem,ntypes+1,"sna/grid:radelem"); // offset by 1 to match up with types @@ -175,14 +175,14 @@ ComputeSNAGrid::ComputeSNAGrid(LAMMPS *lmp, int narg, char **arg) : if (switchinnerflag && !(sinnerflag && dinnerflag)) error->all(FLERR,"Illegal compute sna/grid command: switchinnerflag = 1, missing sinner/dinner keyword"); - + if (!switchinnerflag && (sinnerflag || dinnerflag)) error->all(FLERR,"Illegal compute sna/grid command: switchinnerflag = 0, unexpected sinner/dinner keyword"); snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, chemflag, bnormflag, wselfallflag, - nelements, switchinnerflag); + nelements, switchinnerflag); ncoeff = snaptr->ncoeff; nvalues = ncoeff; @@ -236,83 +236,83 @@ void ComputeSNAGrid::compute_array() const int ntotal = atom->nlocal + atom->nghost; // insure rij, inside, and typej are of size jnum - + snaptr->grow_rij(ntotal); for (int iz = nzlo; iz <= nzhi; iz++) for (int iy = nylo; iy <= nyhi; iy++) for (int ix = nxlo; ix <= nxhi; ix++) { - double xgrid[3]; - const int igrid = iz*(nx*ny) + iy*nx + ix; - grid2x(igrid, xgrid); - const double xtmp = xgrid[0]; - const double ytmp = xgrid[1]; - const double ztmp = xgrid[2]; + double xgrid[3]; + const int igrid = iz*(nx*ny) + iy*nx + ix; + grid2x(igrid, xgrid); + const double xtmp = xgrid[0]; + const double ytmp = xgrid[1]; + const double ztmp = xgrid[2]; - // currently, all grid points are type 1 - - const int itype = 1; - int ielem = 0; - if (chemflag) - ielem = map[itype]; - const double radi = radelem[itype]; + // currently, all grid points are type 1 - // rij[][3] = displacements between atom I and those neighbors - // inside = indices of neighbors of I within cutoff - // typej = types of neighbors of I within cutoff + const int itype = 1; + int ielem = 0; + if (chemflag) + ielem = map[itype]; + const double radi = radelem[itype]; - int ninside = 0; - for (int j = 0; j < ntotal; j++) { + // rij[][3] = displacements between atom I and those neighbors + // inside = indices of neighbors of I within cutoff + // typej = types of neighbors of I within cutoff - // check that j is in compute group + int ninside = 0; + for (int j = 0; j < ntotal; j++) { - if (!(mask[j] & groupbit)) continue; + // check that j is in compute group - const double delx = xtmp - x[j][0]; - const double dely = ytmp - x[j][1]; - const double delz = ztmp - x[j][2]; - const double rsq = delx*delx + dely*dely + delz*delz; - int jtype = type[j]; - int jelem = 0; - if (chemflag) + if (!(mask[j] & groupbit)) continue; + + const double delx = xtmp - x[j][0]; + const double dely = ytmp - x[j][1]; + const double delz = ztmp - x[j][2]; + const double rsq = delx*delx + dely*dely + delz*delz; + int jtype = type[j]; + int jelem = 0; + if (chemflag) jelem = map[jtype]; - if (rsq < cutsq[jtype][jtype] && rsq > 1e-20) { - snaptr->rij[ninside][0] = delx; - snaptr->rij[ninside][1] = dely; - snaptr->rij[ninside][2] = delz; - snaptr->inside[ninside] = j; - snaptr->wj[ninside] = wjelem[jtype]; - snaptr->rcutij[ninside] = 2.0*radelem[jtype]*rcutfac; - if (switchinnerflag) { - snaptr->sinnerij[ninside] = sinnerelem[jelem]; - snaptr->dinnerij[ninside] = dinnerelem[jelem]; - } - if (chemflag) snaptr->element[ninside] = jelem; - ninside++; - } - } + if (rsq < cutsq[jtype][jtype] && rsq > 1e-20) { + snaptr->rij[ninside][0] = delx; + snaptr->rij[ninside][1] = dely; + snaptr->rij[ninside][2] = delz; + snaptr->inside[ninside] = j; + snaptr->wj[ninside] = wjelem[jtype]; + snaptr->rcutij[ninside] = 2.0*radelem[jtype]*rcutfac; + if (switchinnerflag) { + snaptr->sinnerij[ninside] = sinnerelem[jelem]; + snaptr->dinnerij[ninside] = dinnerelem[jelem]; + } + if (chemflag) snaptr->element[ninside] = jelem; + ninside++; + } + } - snaptr->compute_ui(ninside, ielem); - snaptr->compute_zi(); - snaptr->compute_bi(ielem); + snaptr->compute_ui(ninside, ielem); + snaptr->compute_zi(); + snaptr->compute_bi(ielem); - // linear contributions + // linear contributions - for (int icoeff = 0; icoeff < ncoeff; icoeff++) - gridlocal[size_array_cols_base+icoeff][iz][iy][ix] = snaptr->blist[icoeff]; - - // quadratic contributions + for (int icoeff = 0; icoeff < ncoeff; icoeff++) + gridlocal[size_array_cols_base+icoeff][iz][iy][ix] = snaptr->blist[icoeff]; - if (quadraticflag) { - int ncount = ncoeff; - for (int icoeff = 0; icoeff < ncoeff; icoeff++) { - double bveci = snaptr->blist[icoeff]; - gridlocal[size_array_cols_base+ncount++][iz][iy][ix] = 0.5*bveci*bveci; - for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) - gridlocal[size_array_cols_base+ncount++][iz][iy][ix] = bveci*snaptr->blist[jcoeff]; - } - } + // quadratic contributions + + if (quadraticflag) { + int ncount = ncoeff; + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { + double bveci = snaptr->blist[icoeff]; + gridlocal[size_array_cols_base+ncount++][iz][iy][ix] = 0.5*bveci*bveci; + for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) + gridlocal[size_array_cols_base+ncount++][iz][iy][ix] = bveci*snaptr->blist[jcoeff]; + } + } } memset(&grid[0][0],0,size_array_rows*size_array_cols*sizeof(double)); @@ -320,9 +320,9 @@ void ComputeSNAGrid::compute_array() for (int iz = nzlo; iz <= nzhi; iz++) for (int iy = nylo; iy <= nyhi; iy++) for (int ix = nxlo; ix <= nxhi; ix++) { - const int igrid = iz*(nx*ny) + iy*nx + ix; - for (int j = 0; j < nvalues; j++) - grid[igrid][size_array_cols_base + j] = gridlocal[size_array_cols_base + j][iz][iy][ix]; + const int igrid = iz*(nx*ny) + iy*nx + ix; + for (int j = 0; j < nvalues; j++) + grid[igrid][size_array_cols_base + j] = gridlocal[size_array_cols_base + j][iz][iy][ix]; } MPI_Allreduce(&grid[0][0],&gridall[0][0],size_array_rows*size_array_cols,MPI_DOUBLE,MPI_SUM,world); assign_coords_all(); diff --git a/src/ML-SNAP/compute_sna_grid.h b/src/ML-SNAP/compute_sna_grid.h index c203ce8bb4..9bc3da8112 100644 --- a/src/ML-SNAP/compute_sna_grid.h +++ b/src/ML-SNAP/compute_sna_grid.h @@ -1,6 +1,6 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract @@ -54,19 +54,3 @@ class ComputeSNAGrid : public ComputeGrid { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -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. - -Self-explanatory. - -W: More than one compute sna/grid - -Self-explanatory. - -*/ diff --git a/src/ML-SNAP/compute_sna_grid_local.cpp b/src/ML-SNAP/compute_sna_grid_local.cpp index 1dacc28617..70b5b362d8 100644 --- a/src/ML-SNAP/compute_sna_grid_local.cpp +++ b/src/ML-SNAP/compute_sna_grid_local.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract @@ -41,7 +41,7 @@ ComputeSNAGridLocal::ComputeSNAGridLocal(LAMMPS *lmp, int narg, char **arg) : int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; // skip over arguments used by base class - // so that argument positions are identical to + // so that argument positions are identical to // regular per-atom compute arg += nargbase; @@ -63,7 +63,7 @@ ComputeSNAGridLocal::ComputeSNAGridLocal(LAMMPS *lmp, int narg, char **arg) : wselfallflag = 0; switchinnerflag = 0; nelements = 1; - + // set local input checks int sinnerflag = 0; @@ -175,14 +175,14 @@ ComputeSNAGridLocal::ComputeSNAGridLocal(LAMMPS *lmp, int narg, char **arg) : if (switchinnerflag && !(sinnerflag && dinnerflag)) error->all(FLERR,"Illegal compute sna/grid/local command: switchinnerflag = 1, missing sinner/dinner keyword"); - + if (!switchinnerflag && (sinnerflag || dinnerflag)) error->all(FLERR,"Illegal compute sna/grid/local command: switchinnerflag = 0, unexpected sinner/dinner keyword"); snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, chemflag, bnormflag, wselfallflag, - nelements, switchinnerflag); + nelements, switchinnerflag); ncoeff = snaptr->ncoeff; nvalues = ncoeff; @@ -235,84 +235,84 @@ void ComputeSNAGridLocal::compute_local() const int ntotal = atom->nlocal + atom->nghost; // insure rij, inside, and typej are of size jnum - + snaptr->grow_rij(ntotal); int igrid = 0; for (int iz = nzlo; iz <= nzhi; iz++) for (int iy = nylo; iy <= nyhi; iy++) for (int ix = nxlo; ix <= nxhi; ix++) { - double xgrid[3]; - grid2x(ix, iy, iz, xgrid); - const double xtmp = xgrid[0]; - const double ytmp = xgrid[1]; - const double ztmp = xgrid[2]; + double xgrid[3]; + grid2x(ix, iy, iz, xgrid); + const double xtmp = xgrid[0]; + const double ytmp = xgrid[1]; + const double ztmp = xgrid[2]; - // currently, all grid points are type 1 - - const int itype = 1; - int ielem = 0; - if (chemflag) - ielem = map[itype]; - const double radi = radelem[itype]; + // currently, all grid points are type 1 - // rij[][3] = displacements between atom I and those neighbors - // inside = indices of neighbors of I within cutoff - // typej = types of neighbors of I within cutoff + const int itype = 1; + int ielem = 0; + if (chemflag) + ielem = map[itype]; + const double radi = radelem[itype]; - int ninside = 0; - for (int j = 0; j < ntotal; j++) { + // rij[][3] = displacements between atom I and those neighbors + // inside = indices of neighbors of I within cutoff + // typej = types of neighbors of I within cutoff - // check that j is in compute group + int ninside = 0; + for (int j = 0; j < ntotal; j++) { - if (!(mask[j] & groupbit)) continue; + // check that j is in compute group - const double delx = xtmp - x[j][0]; - const double dely = ytmp - x[j][1]; - const double delz = ztmp - x[j][2]; - const double rsq = delx*delx + dely*dely + delz*delz; - int jtype = type[j]; - int jelem = 0; - if (chemflag) - jelem = map[jtype]; - if (rsq < cutsq[jtype][jtype] && rsq > 1e-20) { - snaptr->rij[ninside][0] = delx; - snaptr->rij[ninside][1] = dely; - snaptr->rij[ninside][2] = delz; - snaptr->inside[ninside] = j; - snaptr->wj[ninside] = wjelem[jtype]; - snaptr->rcutij[ninside] = 2.0*radelem[jtype]*rcutfac; - if (switchinnerflag) { - snaptr->sinnerij[ninside] = sinnerelem[jelem]; - snaptr->dinnerij[ninside] = dinnerelem[jelem]; - } - if (chemflag) snaptr->element[ninside] = jelem; // element index for multi-element snap - ninside++; - } - } + if (!(mask[j] & groupbit)) continue; - snaptr->compute_ui(ninside, ielem); - snaptr->compute_zi(); - snaptr->compute_bi(ielem); + const double delx = xtmp - x[j][0]; + const double dely = ytmp - x[j][1]; + const double delz = ztmp - x[j][2]; + const double rsq = delx*delx + dely*dely + delz*delz; + int jtype = type[j]; + int jelem = 0; + if (chemflag) + jelem = map[jtype]; + if (rsq < cutsq[jtype][jtype] && rsq > 1e-20) { + snaptr->rij[ninside][0] = delx; + snaptr->rij[ninside][1] = dely; + snaptr->rij[ninside][2] = delz; + snaptr->inside[ninside] = j; + snaptr->wj[ninside] = wjelem[jtype]; + snaptr->rcutij[ninside] = 2.0*radelem[jtype]*rcutfac; + if (switchinnerflag) { + snaptr->sinnerij[ninside] = sinnerelem[jelem]; + snaptr->dinnerij[ninside] = dinnerelem[jelem]; + } + if (chemflag) snaptr->element[ninside] = jelem; // element index for multi-element snap + ninside++; + } + } - // linear contributions + snaptr->compute_ui(ninside, ielem); + snaptr->compute_zi(); + snaptr->compute_bi(ielem); - for (int icoeff = 0; icoeff < ncoeff; icoeff++) - alocal[igrid][size_local_cols_base+icoeff] = snaptr->blist[icoeff]; + // linear contributions - // quadratic contributions + for (int icoeff = 0; icoeff < ncoeff; icoeff++) + alocal[igrid][size_local_cols_base+icoeff] = snaptr->blist[icoeff]; - if (quadraticflag) { - int ncount = ncoeff; - for (int icoeff = 0; icoeff < ncoeff; icoeff++) { - double bveci = snaptr->blist[icoeff]; - alocal[igrid][size_local_cols_base+ncount++] = 0.5*bveci*bveci; - for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) - alocal[igrid][size_local_cols_base+ncount++] = - bveci*snaptr->blist[jcoeff]; - } - } - igrid++; + // quadratic contributions + + if (quadraticflag) { + int ncount = ncoeff; + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { + double bveci = snaptr->blist[icoeff]; + alocal[igrid][size_local_cols_base+ncount++] = 0.5*bveci*bveci; + for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) + alocal[igrid][size_local_cols_base+ncount++] = + bveci*snaptr->blist[jcoeff]; + } + } + igrid++; } } diff --git a/src/ML-SNAP/compute_sna_grid_local.h b/src/ML-SNAP/compute_sna_grid_local.h index 5ce40069ee..69a2c528fc 100644 --- a/src/ML-SNAP/compute_sna_grid_local.h +++ b/src/ML-SNAP/compute_sna_grid_local.h @@ -1,6 +1,6 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract @@ -54,17 +54,3 @@ class ComputeSNAGridLocal : public ComputeGridLocal { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -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. - -W: More than one compute sna/grid/local - -Self-explanatory. - -*/ diff --git a/src/compute_grid.cpp b/src/compute_grid.cpp index dd21b731e8..60c9987cbc 100644 --- a/src/compute_grid.cpp +++ b/src/compute_grid.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract @@ -128,7 +128,7 @@ void ComputeGrid::allocate() if (nxlo <= nxhi && nylo <= nyhi && nzlo <= nzhi) { gridlocal_allocated = 1; memory->create4d_offset(gridlocal,size_array_cols,nzlo,nzhi,nylo,nyhi, - nxlo,nxhi,"grid:gridlocal"); + nxlo,nxhi,"grid:gridlocal"); } array = gridall; } @@ -179,7 +179,7 @@ void ComputeGrid::set_grid_global() delxinv = nx/xprd; delyinv = ny/yprd; delzinv = nz/zprd; - + delx = 1.0/delxinv; dely = 1.0/delyinv; delz = 1.0/delzinv; @@ -245,9 +245,9 @@ void ComputeGrid::set_grid_local() double ComputeGrid::memory_usage() { - double nbytes = size_array_rows*size_array_cols * + double nbytes = size_array_rows*size_array_cols * sizeof(double); // grid - nbytes += size_array_rows*size_array_cols * + nbytes += size_array_rows*size_array_cols * sizeof(double); // gridall nbytes += size_array_cols*ngridlocal*sizeof(double); // gridlocal return nbytes; diff --git a/src/compute_grid.h b/src/compute_grid.h index 7bda1a89fa..b0214b2b15 100644 --- a/src/compute_grid.h +++ b/src/compute_grid.h @@ -1,6 +1,6 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract @@ -42,7 +42,7 @@ class ComputeGrid : public Compute { double *sublo, *subhi; // subdomain info (units real/ortho or reduced/tri) double delxinv,delyinv,delzinv; // inverse grid spacing double delx,dely,delz; // grid spacing - int nargbase; // number of base class args + int nargbase; // number of base class args double cutmax; // largest cutoff distance int size_array_cols_base; // number of columns used for coords, etc. int gridlocal_allocated; // shows if gridlocal allocated @@ -59,13 +59,3 @@ class ComputeGrid : public Compute { } #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -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. - -*/ diff --git a/src/compute_grid_local.cpp b/src/compute_grid_local.cpp index bcc56c3abd..e30d06fe45 100644 --- a/src/compute_grid_local.cpp +++ b/src/compute_grid_local.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract @@ -164,7 +164,7 @@ void ComputeGridLocal::set_grid_global() delxinv = nx/xprd; delyinv = ny/yprd; delzinv = nz/zprd; - + delx = 1.0/delxinv; dely = 1.0/delyinv; delz = 1.0/delzinv; @@ -233,34 +233,34 @@ void ComputeGridLocal::assign_coords() for (int iz = nzlo; iz <= nzhi; iz++) for (int iy = nylo; iy <= nyhi; iy++) for (int ix = nxlo; ix <= nxhi; ix++) { - alocal[igrid][0] = ix; - alocal[igrid][1] = iy; - alocal[igrid][2] = iz; - double xgrid[3]; + alocal[igrid][0] = ix; + alocal[igrid][1] = iy; + alocal[igrid][2] = iz; + double xgrid[3]; - // for triclinic: create gridpoint in lamda coordinates and transform after check. - // for orthorombic: create gridpoint in box coordinates. + // for triclinic: create gridpoint in lamda coordinates and transform after check. + // for orthorombic: create gridpoint in box coordinates. - if (triclinic) - grid2lamda(ix, iy, iz, xgrid); - else - grid2x(ix, iy, iz, xgrid); + if (triclinic) + grid2lamda(ix, iy, iz, xgrid); + else + grid2x(ix, iy, iz, xgrid); - // ensure gridpoint is not strictly outside subdomain + // ensure gridpoint is not strictly outside subdomain - if ((sublo[0]-xgrid[0]) > EPSILON || (xgrid[0]-subhi[0]) > EPSILON || - (sublo[1]-xgrid[1]) > EPSILON || (xgrid[1]-subhi[1]) > EPSILON || - (sublo[2]-xgrid[2]) > EPSILON || (xgrid[2]-subhi[2]) > EPSILON) - error->one(FLERR,"Invalid gridpoint position in compute grid/local"); + if ((sublo[0]-xgrid[0]) > EPSILON || (xgrid[0]-subhi[0]) > EPSILON || + (sublo[1]-xgrid[1]) > EPSILON || (xgrid[1]-subhi[1]) > EPSILON || + (sublo[2]-xgrid[2]) > EPSILON || (xgrid[2]-subhi[2]) > EPSILON) + error->one(FLERR,"Invalid gridpoint position in compute grid/local"); - // convert lamda to x, y, z, after sudomain check + // convert lamda to x, y, z, after sudomain check - if (triclinic) domain->lamda2x(xgrid, xgrid); + if (triclinic) domain->lamda2x(xgrid, xgrid); - alocal[igrid][3] = xgrid[0]; - alocal[igrid][4] = xgrid[1]; - alocal[igrid][5] = xgrid[2]; - igrid++; + alocal[igrid][3] = xgrid[0]; + alocal[igrid][4] = xgrid[1]; + alocal[igrid][5] = xgrid[2]; + igrid++; } } diff --git a/src/compute_grid_local.h b/src/compute_grid_local.h index 15ea8ca47f..5c5611250b 100644 --- a/src/compute_grid_local.h +++ b/src/compute_grid_local.h @@ -1,6 +1,6 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories + https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract @@ -39,7 +39,7 @@ class ComputeGridLocal : public Compute { double *sublo, *subhi; // subdomain info (units real/ortho or reduced/tri) double delxinv,delyinv,delzinv; // inverse grid spacing double delx,dely,delz; // grid spacing - int nargbase; // number of base class args + int nargbase; // number of base class args double cutmax; // largest cutoff distance int size_local_cols_base; // number of columns used for coords, etc. int gridlocal_allocated; // shows if gridlocal allocated @@ -57,13 +57,3 @@ class ComputeGridLocal : public Compute { } #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -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. - -*/