diff --git a/doc/src/Howto_grid.rst b/doc/src/Howto_grid.rst index 4601b19a20..4ac0898780 100644 --- a/doc/src/Howto_grid.rst +++ b/doc/src/Howto_grid.rst @@ -77,7 +77,7 @@ syntax: The prefix "c_" or "f_" refers to the ID of the compute or fix. Gname is the name of the grid, which is assigned by the compute or fix. Dname is the name of the data field, which is also assigned by the -compute or fix. +compute or fix. If the data field is a per-grid vector (one value per grid point), then no brackets are used to access the values. If the data field is diff --git a/doc/src/Howto_output.rst b/doc/src/Howto_output.rst index f21bafe81c..5ff58afaee 100644 --- a/doc/src/Howto_output.rst +++ b/doc/src/Howto_output.rst @@ -209,7 +209,7 @@ density (mass or number) or atom attributes such as position, velocity, force. They can also be per-atom quantities calculated by a :doc:`compute `, by a :doc:`fix `, or by an atom-style :doc:`variable `. The chunk-averaged output of this fix is -global and can also be used as input to other output commands. +global and can also be used as input to other output commands. Note that the :doc:`fix ave/grid ` command can also average the same per-atom quantities within spatial bins, but it does @@ -307,7 +307,7 @@ command, including per-atom quantities calculated by a :doc:`compute output commands. The :doc:`fix ave/grid ` command performs time-averaging -of either per-atom or per-grid data. +of either per-atom or per-grid data. For per-atom data it performs averaging for the atoms within each grid cell, similar to the :doc:`fix ave/chunk ` command when @@ -315,7 +315,7 @@ its chunks are defined as regular 2d or 3d bins. The per-atom quantities can be atom density (mass or number) or atom attributes such as position, velocity, force. They can also be per-atom quantities calculated by a :doc:`compute `, by a :doc:`fix -`, or by an atom-style :doc:`variable `. +`, or by an atom-style :doc:`variable `. The chief difference between the :doc:`fix ave/grid ` and :doc:`fix ave/chunk ` commands when used in this diff --git a/doc/src/fix_ave_grid.rst b/doc/src/fix_ave_grid.rst index 1c454a609e..61d09c8bdb 100644 --- a/doc/src/fix_ave_grid.rst +++ b/doc/src/fix_ave_grid.rst @@ -152,7 +152,7 @@ evaluation of an atom-style :doc:`variable `. In the latter cases, the compute, fix, or variable must produce a per-atom quantity, not a global quantity. Note that the :doc:`compute property/atom ` command provides access to any attribute -defined and stored by atoms. +defined and stored by atoms. The per-atom values of each input vector are summed and averaged independently of the per-atom values in other input vectors. diff --git a/src/EXTRA-FIX/fix_ttm_grid.cpp b/src/EXTRA-FIX/fix_ttm_grid.cpp index 02e2c31826..7b3e712f9d 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.cpp +++ b/src/EXTRA-FIX/fix_ttm_grid.cpp @@ -62,7 +62,7 @@ FixTTMGrid::FixTTMGrid(LAMMPS *lmp, int narg, char **arg) : if (outfile) error->all(FLERR,"Fix ttm/grid does not support outfile option - " "use dump grid instead"); */ - + skin_original = neighbor->skin; } @@ -456,12 +456,12 @@ void FixTTMGrid::allocate_grid() double maxdist = 0.5 * neighbor->skin; grid = new Grid3d(lmp, world, nxgrid, nygrid, nzgrid, maxdist, 1, SHIFT, - nxlo_in, nxhi_in, nylo_in, nyhi_in, nzlo_in, nzhi_in, + nxlo_in, nxhi_in, nylo_in, nyhi_in, nzlo_in, nzhi_in, nxlo_out, nxhi_out, nylo_out, nyhi_out, nzlo_out, nzhi_out); - ngridown = (nxhi_in - nxlo_in + 1) * (nyhi_in - nylo_in + 1) * + ngridown = (nxhi_in - nxlo_in + 1) * (nyhi_in - nylo_in + 1) * (nzhi_in - nzlo_in + 1); - ngridout = (nxhi_out - nxlo_out + 1) * (nyhi_out - nylo_out + 1) * + ngridout = (nxhi_out - nxlo_out + 1) * (nyhi_out - nylo_out + 1) * (nzhi_out - nzlo_out + 1); // setup grid communication and allocate grid data structs @@ -563,7 +563,7 @@ void FixTTMGrid::restart(char *buf) // communicate new T_electron values to ghost grid points - grid->forward_comm(Grid3d::FIX, this, 1, sizeof(double), 0, + grid->forward_comm(Grid3d::FIX, this, 1, sizeof(double), 0, grid_buf1, grid_buf2, MPI_DOUBLE); } diff --git a/src/KSPACE/fix_tune_kspace.cpp b/src/KSPACE/fix_tune_kspace.cpp index 637626804a..729e39466e 100644 --- a/src/KSPACE/fix_tune_kspace.cpp +++ b/src/KSPACE/fix_tune_kspace.cpp @@ -283,7 +283,7 @@ void FixTuneKspace::update_kspace_style(const std::string &new_kspace_style, // re-init neighbor list // probably only needed when redefining the pair style - // should happen after pair->init() to get pair style + // should happen after pair->init() to get pair style // neighbor list request registered neighbor->init(); diff --git a/src/compute_property_grid.cpp b/src/compute_property_grid.cpp index 8a33eab9e2..a028517d71 100644 --- a/src/compute_property_grid.cpp +++ b/src/compute_property_grid.cpp @@ -32,8 +32,8 @@ enum { UNSCALED, SCALED }; /* ---------------------------------------------------------------------- */ ComputePropertyGrid::ComputePropertyGrid(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), pack_choice(nullptr), - grid2d(nullptr), grid3d(nullptr), + Compute(lmp, narg, arg), pack_choice(nullptr), + grid2d(nullptr), grid3d(nullptr), vec2d(nullptr), array2d(nullptr), vec3d(nullptr), array3d(nullptr) { if (narg < 7) error->all(FLERR, "Illegal compute property/grid command"); @@ -46,12 +46,12 @@ ComputePropertyGrid::ComputePropertyGrid(LAMMPS *lmp, int narg, char **arg) : nygrid = utils::inumeric(FLERR,arg[4],false,lmp); nzgrid = utils::inumeric(FLERR,arg[5],false,lmp); - if (dimension == 2 && nzgrid != 1) + if (dimension == 2 && nzgrid != 1) error->all(FLERR,"Compute property/grid for 2d requires nz = 1"); - if (nxgrid <= 0 || nygrid <= 0 || nzgrid <= 0) + if (nxgrid <= 0 || nygrid <= 0 || nzgrid <= 0) error->all(FLERR, "Illegal compute property/grid command"); - + nvalues = narg - 6; pack_choice = new FnPtrPack[nvalues]; @@ -66,7 +66,7 @@ ComputePropertyGrid::ComputePropertyGrid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg], "iy") == 0) { pack_choice[jarg] = &ComputePropertyGrid::pack_indices<1>; } else if (strcmp(arg[iarg], "iz") == 0) { - if (dimension == 2) + if (dimension == 2) error->all(FLERR,"Compute property/grid for 2d cannot use z coord"); pack_choice[jarg] = &ComputePropertyGrid::pack_indices<2>; @@ -75,7 +75,7 @@ ComputePropertyGrid::ComputePropertyGrid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg], "y") == 0) { pack_choice[jarg] = &ComputePropertyGrid::pack_coords; } else if (strcmp(arg[iarg], "z") == 0) { - if (dimension == 2) + if (dimension == 2) error->all(FLERR,"Compute property/grid for 2d cannot use z coord"); pack_choice[jarg] = &ComputePropertyGrid::pack_coords; @@ -84,16 +84,16 @@ ComputePropertyGrid::ComputePropertyGrid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg], "ys") == 0) { pack_choice[jarg] = &ComputePropertyGrid::pack_coords; } else if (strcmp(arg[iarg], "zs") == 0) { - if (dimension == 2) + if (dimension == 2) error->all(FLERR,"Compute property/grid for 2d cannot use z coord"); pack_choice[jarg] = &ComputePropertyGrid::pack_coords; - } else if (strcmp(arg[iarg], "xc") == 0) { + } else if (strcmp(arg[iarg], "xc") == 0) { pack_choice[jarg] = &ComputePropertyGrid::pack_coords; } else if (strcmp(arg[iarg], "yc") == 0) { pack_choice[jarg] = &ComputePropertyGrid::pack_coords; } else if (strcmp(arg[iarg], "zc") == 0) { - if (dimension == 2) + if (dimension == 2) error->all(FLERR,"Compute property/grid for 2d cannot use z coord"); pack_choice[jarg] = &ComputePropertyGrid::pack_coords; @@ -102,7 +102,7 @@ ComputePropertyGrid::ComputePropertyGrid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg], "ysc") == 0) { pack_choice[jarg] = &ComputePropertyGrid::pack_coords; } else if (strcmp(arg[iarg], "zsc") == 0) { - if (dimension == 2) + if (dimension == 2) error->all(FLERR,"Compute property/grid for 2d cannot use z coord"); pack_choice[jarg] = &ComputePropertyGrid::pack_coords; @@ -243,27 +243,27 @@ void ComputePropertyGrid::allocate_grid() nxlo_in, nxhi_in, nylo_in, nyhi_in, nxlo_out, nxhi_out, nylo_out, nyhi_out); if (nvalues == 1) - memory->create2d_offset(vec2d, nylo_out, nyhi_out, nxlo_out, nxhi_out, + memory->create2d_offset(vec2d, nylo_out, nyhi_out, nxlo_out, nxhi_out, "property/grid:vec2d"); else memory->create3d_offset_last(array2d, nylo_out, nyhi_out, nxlo_out, nxhi_out, nvalues, "property/grid:array2d"); ngridout = (nxhi_out - nxlo_out + 1) * (nyhi_out - nylo_out + 1); - + } else { grid3d = new Grid3d(lmp, world, nxgrid, nygrid, nzgrid, 0.0, 0, 0.0, - nxlo_in, nxhi_in, nylo_in, nyhi_in, nzlo_in, nzhi_in, - nxlo_out, nxhi_out, nylo_out, nyhi_out, + nxlo_in, nxhi_in, nylo_in, nyhi_in, nzlo_in, nzhi_in, + nxlo_out, nxhi_out, nylo_out, nyhi_out, nzlo_out, nzhi_out); if (nvalues == 1) - memory->create3d_offset(vec3d, nzlo_out, nzhi_out, nylo_out, + memory->create3d_offset(vec3d, nzlo_out, nzhi_out, nylo_out, nyhi_out, nxlo_out, nxhi_out, "property/grid:vec3d"); else - memory->create4d_offset_last(array3d, nzlo_out, nzhi_out, nylo_out, + memory->create4d_offset_last(array3d, nzlo_out, nzhi_out, nylo_out, nyhi_out, nxlo_out, nxhi_out, nvalues, "property/grid:array3d"); - ngridout = (nxhi_out - nxlo_out + 1) * (nyhi_out - nylo_out + 1) * + ngridout = (nxhi_out - nxlo_out + 1) * (nyhi_out - nylo_out + 1) * (nzhi_out - nzlo_out + 1); } } @@ -331,7 +331,7 @@ template void ComputePropertyGrid::pack_indices(int n) if (nvalues == 0) { for (int iy = nylo_in; iy <= nyhi_in; iy++) for (int ix = nxlo_in; ix <= nxhi_in; ix++) { - if (IDIM == 0) vec2d[iy][ix] = ix + 1; + if (IDIM == 0) vec2d[iy][ix] = ix + 1; if (IDIM == 1) vec2d[iy][ix] = iy + 1; } } else { @@ -368,7 +368,7 @@ template void ComputePropertyGrid::pack_indices(int n) via templating ------------------------------------------------------------------------- */ -template +template void ComputePropertyGrid::pack_coords(int n) { double boxlo,delta; @@ -401,7 +401,7 @@ void ComputePropertyGrid::pack_coords(int n) if (IDIM == 1) vec2d[iy][ix] = boxlo + (iy+0.5)*delta; } } - + } else { for (int iy = nylo_in; iy <= nyhi_in; iy++) for (int ix = nxlo_in; ix <= nxhi_in; ix++) { @@ -423,7 +423,7 @@ void ComputePropertyGrid::pack_coords(int n) double dx = 1.0/nxgrid; double dy = 1.0/nygrid; lamda[2] = 0.0; - + if (nvalues == 0) { for (int iy = nylo_in; iy <= nyhi_in; iy++) { lamda[1] = iy*dy; @@ -434,7 +434,7 @@ void ComputePropertyGrid::pack_coords(int n) if (IDIM == 1) vec2d[iy][ix] = xone[1]; } } - + } else { for (int iy = nylo_in; iy <= nyhi_in; iy++) { lamda[1] = iy*dy; @@ -450,7 +450,7 @@ void ComputePropertyGrid::pack_coords(int n) // 3d grid - } else if (dimension == 3) { + } else if (dimension == 3) { // for coords which are orthogonal OR scaled @@ -504,7 +504,7 @@ void ComputePropertyGrid::pack_coords(int n) double dx = 1.0/nxgrid; double dy = 1.0/nygrid; double dz = 1.0/nzgrid; - + if (nvalues == 0) { for (int iz = nzlo_in; iz <= nzhi_in; iz++) { lamda[2] = iz*dz; diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index 4dad0d611e..e0fbb95990 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -41,8 +41,8 @@ enum{COMPUTE,FIX}; /* ---------------------------------------------------------------------- */ DumpGrid::DumpGrid(LAMMPS *lmp, int narg, char **arg) : - Dump(lmp, narg, arg), idregion(nullptr), earg(nullptr), vtype(nullptr), - vformat(nullptr), columns(nullptr), columns_default(nullptr), + Dump(lmp, narg, arg), idregion(nullptr), earg(nullptr), vtype(nullptr), + vformat(nullptr), columns(nullptr), columns_default(nullptr), field2index(nullptr), field2grid(nullptr), field2data(nullptr), argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), fix(nullptr), pack_choice(nullptr) @@ -155,7 +155,7 @@ DumpGrid::~DumpGrid() delete[] field2grid; delete[] field2data; delete[] argindex; - + delete[] idregion; for (int i = 0; i < ncompute; i++) delete[] id_compute[i]; @@ -255,13 +255,13 @@ void DumpGrid::init_style() for (i = 0; i < ncompute; i++) { compute[i] = modify->get_compute_by_id(id_compute[i]); - if (!compute[i]) + if (!compute[i]) error->all(FLERR,"Could not find dump grid compute ID {}",id_compute[i]); } for (i = 0; i < nfix; i++) { fix[i] = modify->get_fix_by_id(id_fix[i]); - if (!fix[i]) + if (!fix[i]) error->all(FLERR,"Could not find dump grid fix ID {}", id_fix[i]); } @@ -271,9 +271,9 @@ void DumpGrid::init_style() Fix *ifix; Grid2d *grid2d; Grid3d *grid3d; - + int nxtmp,nytmp,nztmp; - + for (int i = 0; i < nfield; i++) { if (dimension == 2) { if (field2source[i] == COMPUTE) { @@ -286,7 +286,7 @@ void DumpGrid::init_style() if (i == 0) grid2d->get_size(nxgrid,nygrid); else { grid2d->get_size(nxtmp,nytmp); - if (nxtmp != nxgrid || nytmp != nygrid) + if (nxtmp != nxgrid || nytmp != nygrid) error->all(FLERR,"Dump grid field grid sizes do not match"); } @@ -513,18 +513,18 @@ int DumpGrid::count() if (dimension == 2) { if (field2source[0] == COMPUTE) - grid2d = (Grid2d *) + grid2d = (Grid2d *) compute[field2index[0]]->get_grid_by_index(field2grid[0]); else if (field2source[0] == FIX) - grid2d = (Grid2d *) + grid2d = (Grid2d *) fix[field2index[0]]->get_grid_by_index(field2grid[0]); grid2d->get_bounds(nxlo_in,nxhi_in,nylo_in,nyhi_in); } else { if (field2source[0] == COMPUTE) - grid3d = (Grid3d *) + grid3d = (Grid3d *) compute[field2index[0]]->get_grid_by_index(field2grid[0]); else if (field2source[0] == FIX) - grid3d = (Grid3d *) + grid3d = (Grid3d *) fix[field2index[0]]->get_grid_by_index(field2grid[0]); grid3d->get_bounds(nxlo_in,nxhi_in,nylo_in,nyhi_in,nzlo_in,nzhi_in); } @@ -550,11 +550,11 @@ int DumpGrid::count() } // return count of grid points I own - + int ngrid; - if (dimension == 2) + if (dimension == 2) ngrid = (nxhi_in-nxlo_in+1) * (nyhi_in-nylo_in+1); - else + else ngrid = (nxhi_in-nxlo_in+1) * (nyhi_in-nylo_in+1) * (nzhi_in-nzlo_in+1); return ngrid; @@ -674,43 +674,43 @@ int DumpGrid::parse_fields(int narg, char **arg) auto name = argi.get_name(); Compute *icompute = nullptr; Fix *ifix = nullptr; - + switch (argi.get_type()) { - + case ArgInfo::UNKNOWN: { error->all(FLERR,"Invalid attribute in dump grid command"); } break; - + // compute value = c_ID // if no trailing [], then arg is set to 0, else arg is int between [] - + case ArgInfo::COMPUTE: { - if (dimension == 2) pack_choice[iarg] = &DumpGrid::pack_grid2d; + if (dimension == 2) pack_choice[iarg] = &DumpGrid::pack_grid2d; else pack_choice[iarg] = &DumpGrid::pack_grid3d; vtype[iarg] = Dump::DOUBLE; - field2source[iarg] = COMPUTE; - + field2source[iarg] = COMPUTE; + // split name = idcompute:gname:dname into 3 strings char *idcompute,*gname,*dname; utils::grid_parse(FLERR,name,idcompute,gname,dname,error); icompute = modify->get_compute_by_id(idcompute); - if (!icompute) + if (!icompute) error->all(FLERR,"Could not find dump grid compute ID: {}",idcompute); if (icompute->pergrid_flag == 0) error->all(FLERR,"Dump grid compute {} does not compute per-grid info", idcompute); - + int dim; int igrid = icompute->get_grid_by_name(gname,dim); - if (igrid < 0) + if (igrid < 0) error->all(FLERR,"Dump grid compute {} does not recognize grid name {}", idcompute,gname); - + int ncol; int idata = icompute->get_griddata_by_name(igrid,dname,ncol); - if (idata < 0) + if (idata < 0) error->all(FLERR, "Dump grid compute {} does not recognize data name {}", idcompute,dname); @@ -718,18 +718,18 @@ int DumpGrid::parse_fields(int narg, char **arg) if (argi.get_dim() == 0 && ncol) error->all(FLERR,"Dump grid compute {} data {} is not per-grid vector", idcompute,dname); - if (argi.get_dim() && ncol == 0) + if (argi.get_dim() && ncol == 0) error->all(FLERR,"Dump grid compute {} data {} is not per-grid array", idcompute,dname); if (argi.get_dim() && argi.get_index1() > ncol) error->all(FLERR, "Dump grid compute {} array {} is accessed out-of-range", idcompute,dname); - - + + field2index[iarg] = add_compute(idcompute); - field2grid[iarg] = igrid; - field2data[iarg] = idata; + field2grid[iarg] = igrid; + field2data[iarg] = idata; delete [] idcompute; delete [] gname; @@ -744,7 +744,7 @@ int DumpGrid::parse_fields(int narg, char **arg) if (dimension == 2) pack_choice[iarg] = &DumpGrid::pack_grid2d; else pack_choice[iarg] = &DumpGrid::pack_grid3d; vtype[iarg] = Dump::DOUBLE; - field2source[iarg] = FIX; + field2source[iarg] = FIX; // split name = idfix:gname:dname into 3 strings @@ -761,29 +761,29 @@ int DumpGrid::parse_fields(int narg, char **arg) int dim; int igrid = ifix->get_grid_by_name(gname,dim); - if (igrid < 0) + if (igrid < 0) error->all(FLERR,"Dump grid fix {} does not recognize grid name {}", idfix,gname); - + int ncol; int idata = ifix->get_griddata_by_name(igrid,dname,ncol); - if (idata < 0) + if (idata < 0) error->all(FLERR,"Dump grid fix {} does not recognize data name {}", idfix,dname); if (argi.get_dim() == 0 && ncol) error->all(FLERR,"Dump grid fix {} data {} is not per-grid vector", idfix,dname); - if (argi.get_dim() > 0 && ncol == 0) + if (argi.get_dim() > 0 && ncol == 0) error->all(FLERR,"Dump grid fix {} data {} is not per-grid array", idfix,dname); if (argi.get_dim() > 0 && argi.get_index1() > ncol) error->all(FLERR,"Dump grid fix {} array {} is accessed out-of-range", idfix,dname); - + field2index[iarg] = add_fix(idfix); - field2grid[iarg] = igrid; - field2data[iarg] = idata; + field2grid[iarg] = igrid; + field2data[iarg] = idata; delete [] idfix; delete [] gname; @@ -792,13 +792,13 @@ int DumpGrid::parse_fields(int narg, char **arg) } break; // no match - + default: { return iarg; } break; } } - + return narg; } @@ -936,29 +936,29 @@ void DumpGrid::pack_grid2d(int n) if (index == 0) { double **vec2d; if (field2source[n] == COMPUTE) - vec2d = (double **) + vec2d = (double **) compute[field2index[n]]->get_griddata_by_index(field2data[n]); else if (field2source[n] == FIX) - vec2d = (double **) + vec2d = (double **) fix[field2index[n]]->get_griddata_by_index(field2data[n]); for (int iy = nylo_in; iy <= nyhi_in; iy++) for (int ix = nxlo_in; ix <= nxhi_in; ix++) { - buf[n] = vec2d[iy][ix]; - n += size_one; + buf[n] = vec2d[iy][ix]; + n += size_one; } } else { double ***array2d; if (field2source[n] == COMPUTE) - array2d = (double ***) + array2d = (double ***) compute[field2index[n]]->get_griddata_by_index(field2data[n]); else if (field2source[n] == FIX) - array2d = (double ***) + array2d = (double ***) fix[field2index[n]]->get_griddata_by_index(field2data[n]); index--; for (int iy = nylo_in; iy <= nyhi_in; iy++) for (int ix = nxlo_in; ix <= nxhi_in; ix++) { - buf[n] = array2d[iy][ix][index]; - n += size_one; + buf[n] = array2d[iy][ix][index]; + n += size_one; } } } @@ -972,31 +972,31 @@ void DumpGrid::pack_grid3d(int n) if (index == 0) { double ***vec3d; if (field2source[n] == COMPUTE) - vec3d = (double ***) + vec3d = (double ***) compute[field2index[n]]->get_griddata_by_index(field2data[n]); else if (field2source[n] == FIX) - vec3d = (double ***) + vec3d = (double ***) fix[field2index[n]]->get_griddata_by_index(field2data[n]); for (int iz = nzlo_in; iz <= nzhi_in; iz++) for (int iy = nylo_in; iy <= nyhi_in; iy++) - for (int ix = nxlo_in; ix <= nxhi_in; ix++) { - buf[n] = vec3d[iz][iy][ix]; - n += size_one; - } + for (int ix = nxlo_in; ix <= nxhi_in; ix++) { + buf[n] = vec3d[iz][iy][ix]; + n += size_one; + } } else { double ****array3d; if (field2source[n] == COMPUTE) - array3d = (double ****) + array3d = (double ****) compute[field2index[n]]->get_griddata_by_index(field2data[n]); else if (field2source[n] == FIX) - array3d = (double ****) + array3d = (double ****) fix[field2index[n]]->get_griddata_by_index(field2data[n]); index--; for (int iz = nzlo_in; iz <= nzhi_in; iz++) for (int iy = nylo_in; iy <= nyhi_in; iy++) - for (int ix = nxlo_in; ix <= nxhi_in; ix++) { - buf[n] = array3d[iz][iy][ix][index]; + for (int ix = nxlo_in; ix <= nxhi_in; ix++) { + buf[n] = array3d[iz][iy][ix][index]; n += size_one; - } + } } } diff --git a/src/fix.h b/src/fix.h index c16c781648..8171f2ee31 100644 --- a/src/fix.h +++ b/src/fix.h @@ -101,7 +101,7 @@ class Fix : protected Pointers { int pergrid_flag; // 0/1 if per-grid data is stored int pergrid_freq; // frequency per-grid data is available at - + int extscalar; // 0/1 if global scalar is intensive/extensive int extvector; // 0/1/-1 if global vector is all int/ext/extlist int *extlist; // list of 0/1 int/ext for each vec component diff --git a/src/fix_ave_grid.cpp b/src/fix_ave_grid.cpp index 2b63d04e3c..72c2b8dcb6 100644 --- a/src/fix_ave_grid.cpp +++ b/src/fix_ave_grid.cpp @@ -51,8 +51,8 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), which(nullptr), argindex(nullptr), ids(nullptr), value2index(nullptr), value2grid(nullptr), value2data(nullptr), - grid2d(nullptr), grid3d(nullptr), - grid_buf1(nullptr), grid_buf2(nullptr), + grid2d(nullptr), grid3d(nullptr), + grid_buf1(nullptr), grid_buf2(nullptr), vec2d(nullptr), array2d(nullptr), vec3d(nullptr), array3d(nullptr), count2d(nullptr), count3d(nullptr) { @@ -141,7 +141,7 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : } else { ArgInfo argi(arg[iarg]); - + if (argi.get_type() == ArgInfo::NONE) break; if ((argi.get_type() == ArgInfo::UNKNOWN) || (argi.get_dim() > 1)) error->all(FLERR,"Invalid fix ave/grid command"); @@ -164,7 +164,7 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : if (nvalues == 0) error->all(FLERR,"No values in fix ave/grid command"); - if (modeatom && modegrid) + if (modeatom && modegrid) error->all(FLERR,"Fix ave/grid cannot operate on per-atom and " "per-grid values"); @@ -235,12 +235,12 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nvalues; i++) delete [] earg[i]; memory->sfree(earg); } - + // setup and error check // for fix inputs, check that fix frequency is acceptable dimension = domain->dimension; - + if (nevery <= 0 || nrepeat <= 0 || pergrid_freq <= 0) error->all(FLERR,"Illegal fix ave/grid command"); if (pergrid_freq % nevery || nrepeat*nevery > pergrid_freq) @@ -253,7 +253,7 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : if (biasflag) { tbias = modify->get_compute_by_id(id_bias); - if (!tbias) + if (!tbias) error->all(FLERR,"Could not find compute ID for temperature bias"); if (tbias->tempflag == 0) error->all(FLERR,"Bias compute does not calculate temperature"); @@ -261,9 +261,9 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Bias compute does not calculate a velocity bias"); } - if (normflag != ALL) + if (normflag != ALL) error->all(FLERR,"Fix ave/grid norm all is required for now"); - if (normflag != ONE) + if (normflag != ONE) error->all(FLERR,"Fix ave/grid ave one is required for now"); // error checks for ATOM mode @@ -305,7 +305,7 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : if (nevery % modify->fix[ifix]->peratom_freq) error->all(FLERR, "Fix for fix ave/atom not computed at compatible time"); - + } else if (which[i] == ArgInfo::VARIABLE) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) @@ -329,7 +329,7 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : strcpy(ids[i],idcompute); Compute *icompute = modify->get_compute_by_id(idcompute); - if (!icompute) + if (!icompute) error->all(FLERR,"Could not find fix ave/grid compute ID: {}", idcompute); if (icompute->pergrid_flag == 0) @@ -339,14 +339,14 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : int dim; int igrid = icompute->get_grid_by_name(gname,dim); - if (igrid < 0) + if (igrid < 0) error->all(FLERR, "Fix ave/grid compute {} does not recognize grid name {}", idcompute,gname); - + int ncol; int idata = icompute->get_griddata_by_name(igrid,dname,ncol); - if (idata < 0) + if (idata < 0) error->all(FLERR, "Fix ave/grid compute {} does not recognize data name {}", idcompute,dname); @@ -355,7 +355,7 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix ave/grid compute {} data {} is not per-grid vector", idcompute,dname); - if (argindex[i] && ncol == 0) + if (argindex[i] && ncol == 0) error->all(FLERR, "Fix ave/grid compute {} data {} is not per-grid array", idcompute,dname); @@ -363,9 +363,9 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix ave/grid compute {} array {} is accessed out-of-range", idcompute,dname); - - value2grid[i] = igrid; - value2data[i] = idata; + + value2grid[i] = igrid; + value2data[i] = idata; delete [] idcompute; delete [] gname; @@ -391,14 +391,14 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : int dim; int igrid = ifix->get_grid_by_name(gname,dim); - if (igrid < 0) + if (igrid < 0) error->all(FLERR, "Fix ave/grid compute {} does not recognize grid name {}", idfix,gname); - + int ncol; int idata = ifix->get_griddata_by_name(igrid,dname,ncol); - if (idata < 0) + if (idata < 0) error->all(FLERR, "Fix ave/grid compute {} does not recognize data name {}", idfix,dname); @@ -407,7 +407,7 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix ave/grid compute {} data {} is not per-grid vector", idfix,dname); - if (argindex[i] && ncol == 0) + if (argindex[i] && ncol == 0) error->all(FLERR, "Fix ave/grid compute {} data {} is not per-grid array", idfix,dname); @@ -415,9 +415,9 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix ave/grid compute {} array {} is accessed out-of-range", idfix,dname); - - value2grid[i] = igrid; - value2data[i] = idata; + + value2grid[i] = igrid; + value2data[i] = idata; delete [] idfix; delete [] gname; @@ -442,7 +442,7 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : grid2d = new Grid2d(lmp, world, nxgrid, nygrid, maxdist, 0, shift, nxlo_in, nxhi_in, nylo_in, nyhi_in, nxlo_out, nxhi_out, nylo_out, nyhi_out); - + grid2d->setup(ngrid_buf1, ngrid_buf2); memory->create(grid_buf1, ngrid_buf1, "ave/grid:grid_buf1"); memory->create(grid_buf2, ngrid_buf2, "ave/grid:grid_buf2"); @@ -450,41 +450,41 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : ngridout = (nxhi_out - nxlo_out + 1) * (nyhi_out - nylo_out + 1); if (nvalues == 1) - memory->create2d_offset(vec2d, nylo_out, nyhi_out, nxlo_out, nxhi_out, + memory->create2d_offset(vec2d, nylo_out, nyhi_out, nxlo_out, nxhi_out, "ave/grid:vec2d"); else memory->create3d_offset_last(array2d, nylo_out, nyhi_out, nxlo_out, nxhi_out, nvalues, "ave/grid:array2d"); - if (modeatom) - memory->create2d_offset(count2d, nylo_out, nyhi_out, nxlo_out, nxhi_out, + if (modeatom) + memory->create2d_offset(count2d, nylo_out, nyhi_out, nxlo_out, nxhi_out, "ave/grid:count2d"); - + } else { grid3d = new Grid3d(lmp, world, nxgrid, nygrid, nzgrid, maxdist, 0, shift, - nxlo_in, nxhi_in, nylo_in, nyhi_in, nzlo_in, nzhi_in, - nxlo_out, nxhi_out, nylo_out, nyhi_out, + nxlo_in, nxhi_in, nylo_in, nyhi_in, nzlo_in, nzhi_in, + nxlo_out, nxhi_out, nylo_out, nyhi_out, nzlo_out, nzhi_out); grid3d->setup(ngrid_buf1, ngrid_buf2); memory->create(grid_buf1, ngrid_buf1, "ave/grid:grid_buf1"); memory->create(grid_buf2, ngrid_buf2, "ave/grid:grid_buf2"); - ngridout = (nxhi_out - nxlo_out + 1) * (nyhi_out - nylo_out + 1) * + ngridout = (nxhi_out - nxlo_out + 1) * (nyhi_out - nylo_out + 1) * (nzhi_out - nzlo_out + 1); if (nvalues == 1) - memory->create3d_offset(vec3d, nzlo_out, nzhi_out, nylo_out, - nyhi_out, nxlo_out, nxhi_out, + memory->create3d_offset(vec3d, nzlo_out, nzhi_out, nylo_out, + nyhi_out, nxlo_out, nxhi_out, "ave/grid:vec3d"); else - memory->create4d_offset_last(array3d, nzlo_out, nzhi_out, nylo_out, - nyhi_out, nxlo_out, nxhi_out, nvalues, + memory->create4d_offset_last(array3d, nzlo_out, nzhi_out, nylo_out, + nyhi_out, nxlo_out, nxhi_out, nvalues, "ave/grid:array3d"); if (modeatom) - memory->create3d_offset(count3d, nzlo_out, nzhi_out, nylo_out, - nyhi_out, nxlo_out, nxhi_out, + memory->create3d_offset(count3d, nzlo_out, nzhi_out, nylo_out, + nyhi_out, nxlo_out, nxhi_out, "ave/grid:vec3d"); } @@ -591,9 +591,9 @@ void FixAveGrid::init() Fix *fix; Grid2d *grid2d; Grid3d *grid3d; - + int nxtmp,nytmp,nztmp; - + for (int m = 0; m < nvalues; m++) { if (dimension == 2) { if (which[m] == ArgInfo::COMPUTE) { @@ -604,7 +604,7 @@ void FixAveGrid::init() grid2d = (Grid2d *) fix->get_grid_by_index(value2grid[m]); } grid2d->get_size(nxtmp,nytmp); - if (nxtmp != nxgrid || nytmp != nygrid) + if (nxtmp != nxgrid || nytmp != nygrid) error->all(FLERR,"Fix ave/grid value grid sizes do not match"); } else { @@ -688,18 +688,18 @@ void FixAveGrid::end_of_step() // nvalues + 1 more for atom count if (modeatom) { - if (dimension == 2) + if (dimension == 2) grid2d->reverse_comm(Grid2d::FIX,this,nvalues+1,sizeof(double),0, grid_buf1,grid_buf2,MPI_DOUBLE); - else + else grid3d->reverse_comm(Grid3d::FIX,this,nvalues+1,sizeof(double),0, grid_buf1,grid_buf2,MPI_DOUBLE); } // just return if this proc owns no grid points - + if (ngridout == 0) return; - + // average the final results across Nrepeat samples // for ATOM mode, result = total_value / total_count // exception is DENSITY_NUMBER: @@ -734,11 +734,11 @@ void FixAveGrid::end_of_step() for (ix = nxlo_in; ix <= nxhi_in; ix++) { count = count2d[iy][ix]; if (count) { - if (which[0] == ArgInfo::DENSITY_NUMBER) + if (which[0] == ArgInfo::DENSITY_NUMBER) norm = 1.0 / (binvol * repeat); - else if (which[0] == ArgInfo::DENSITY_MASS) + else if (which[0] == ArgInfo::DENSITY_MASS) norm = mv2d / (binvol * nrepeat); - else if (which[0] == ArgInfo::TEMPERATURE) + else if (which[0] == ArgInfo::TEMPERATURE) norm = mvv2e /((repeat*cdof + adof*count) * boltz); else norm = 1.0/count; @@ -753,11 +753,11 @@ void FixAveGrid::end_of_step() if (count) { invcount = 1.0/count; for (m = 0; m <= nvalues; m++) { - if (which[m] == ArgInfo::DENSITY_NUMBER) + if (which[m] == ArgInfo::DENSITY_NUMBER) norm = 1.0 / (binvol * repeat); - else if (which[m] == ArgInfo::DENSITY_MASS) + else if (which[m] == ArgInfo::DENSITY_MASS) norm = mv2d / (binvol * nrepeat); - else if (which[m] == ArgInfo::TEMPERATURE) + else if (which[m] == ArgInfo::TEMPERATURE) norm = mvv2e /((repeat*cdof + adof*count) * boltz); else norm = 1.0/count; @@ -774,11 +774,11 @@ void FixAveGrid::end_of_step() for (ix = nxlo_in; ix <= nxhi_in; ix++) { count = count3d[iz][iy][ix]; if (count) { - if (which[0] == ArgInfo::DENSITY_NUMBER) + if (which[0] == ArgInfo::DENSITY_NUMBER) norm = 1.0 / (binvol * repeat); - else if (which[0] == ArgInfo::DENSITY_MASS) + else if (which[0] == ArgInfo::DENSITY_MASS) norm = mv2d / (binvol * nrepeat); - else if (which[0] == ArgInfo::TEMPERATURE) + else if (which[0] == ArgInfo::TEMPERATURE) norm = mvv2e /((repeat*cdof + adof*count) * boltz); else norm = 1.0/count; @@ -794,11 +794,11 @@ void FixAveGrid::end_of_step() if (count) { invcount = 1.0/count; for (m = 0; m <= nvalues; m++) { - if (which[m] == ArgInfo::DENSITY_NUMBER) + if (which[m] == ArgInfo::DENSITY_NUMBER) norm = 1.0 / (binvol * repeat); - else if (which[m] == ArgInfo::DENSITY_MASS) + else if (which[m] == ArgInfo::DENSITY_MASS) norm = mv2d / (binvol * nrepeat); - else if (which[m] == ArgInfo::TEMPERATURE) + else if (which[m] == ArgInfo::TEMPERATURE) norm = mvv2e /((repeat*cdof + adof*count) * boltz); else norm = 1.0/count; @@ -836,7 +836,7 @@ void FixAveGrid::end_of_step() for (iy = nylo_in; iy <= nyhi_in; iy++) for (ix = nxlo_in; ix <= nxhi_in; ix++) for (m = 0; m <= nvalues; m++) - array3d[iz][iy][ix][m] *= invrepeat; + array3d[iz][iy][ix][m] *= invrepeat; } } } @@ -871,7 +871,7 @@ void FixAveGrid::atom2grid() double dxinv = nxgrid/prd[0]; double dyinv = nygrid/prd[1]; double dzinv = nzgrid/prd[2]; - + double **x = atom->x; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -956,7 +956,7 @@ void FixAveGrid::atom2grid() for (m = 0; m < nvalues; m++) { n = value2index[m]; j = argindex[m]; - + // V,F adds velocity,force to value if (which[m] == ArgInfo::V || which[m] == ArgInfo::F) { @@ -964,7 +964,7 @@ void FixAveGrid::atom2grid() double **attribute; if (which[m] == ArgInfo::V) attribute = atom->v; else if (which[m] == ArgInfo::F) attribute = atom->f; - + if (dimension == 2) { if (nvalues == 1) { for (i = 0; i < nlocal; i++) { @@ -988,14 +988,14 @@ void FixAveGrid::atom2grid() array3d[bin[i][0]][bin[i][1]][bin[i][2]][m] += attribute[i][j]; } } - + // DENSITY_NUMBER adds 1 to value // DENSITY_MASS or MASS adds mass to value - } else if ((which[m] == ArgInfo::DENSITY_NUMBER) || - (which[m] == ArgInfo::DENSITY_MASS) || + } else if ((which[m] == ArgInfo::DENSITY_NUMBER) || + (which[m] == ArgInfo::DENSITY_MASS) || (which[m] == ArgInfo::MASS)) { - + int *type = atom->type; double *mass = atom->mass; double *rmass = atom->rmass; @@ -1106,7 +1106,7 @@ void FixAveGrid::atom2grid() } else if (which[m] == ArgInfo::COMPUTE || which[m] == ArgInfo::FIX || which[m] == ArgInfo::VARIABLE) { double *ovector,**oarray; - + if (which[m] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[n]; if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { @@ -1166,7 +1166,7 @@ void FixAveGrid::atom2grid() if (!skip[i]) vec3d[bin[i][0]][bin[i][1]][bin[i][2]] += ovector[i]; } - } else { + } else { int jm1 = j - 1; for (i = 0; i < nlocal; i++) { if (!skip[i]) @@ -1207,10 +1207,10 @@ void FixAveGrid::grid2grid() n = value2index[m]; j = argindex[m]; int idata = value2data[m]; - + Compute *compute; Fix *fix; - + if (which[m] == ArgInfo::COMPUTE) { compute = modify->compute[n]; if (!(compute->invoked_flag & Compute::INVOKED_PERGRID)) { @@ -1222,17 +1222,17 @@ void FixAveGrid::grid2grid() if (dimension == 2) { double **ovec2d,***oarray2d; if (which[m] == ArgInfo::COMPUTE) { - if (j == 0) + if (j == 0) ovec2d = (double **) compute->get_griddata_by_index(idata); else oarray2d = (double ***) compute->get_griddata_by_index(idata); } else { - if (j == 0) + if (j == 0) ovec2d = (double **) fix->get_griddata_by_index(idata); - else + else oarray2d = (double ***) fix->get_griddata_by_index(idata); } - + if (nvalues == 1) { if (j == 0) { for (iy = nylo_in; iy <= nyhi_in; iy++) @@ -1256,18 +1256,18 @@ void FixAveGrid::grid2grid() array2d[iy][ix][m] += oarray2d[iy][ix][jm1]; } } - + } else { double ***ovec3d,****oarray3d; if (which[m] == ArgInfo::COMPUTE) { - if (j == 0) + if (j == 0) ovec3d = (double ***) compute->get_griddata_by_index(idata); - else + else oarray3d = (double ****) compute->get_griddata_by_index(idata); } else { if (j == 0) { ovec3d = (double ***) fix->get_griddata_by_index(idata); - } else + } else oarray3d = (double ****) fix->get_griddata_by_index(idata); } @@ -1316,11 +1316,11 @@ void FixAveGrid::zero_grid() memset(&vec2d[nylo_out][nxlo_out],0, ngridout*sizeof(double)); else memset(&array2d[nylo_out][nxlo_out][0],0,ngridout*nvalues*sizeof(double)); - if (modeatom) + if (modeatom) memset(&count2d[nylo_out][nxlo_out],0,ngridout*sizeof(double)); } else { if (nvalues == 1) - memset(&vec3d[nzlo_out][nylo_out][nxlo_out],0,ngridout*sizeof(double)); + memset(&vec3d[nzlo_out][nylo_out][nxlo_out],0,ngridout*sizeof(double)); else memset(&array3d[nzlo_out][nylo_out][nxlo_out][0],0, ngridout*nvalues*sizeof(double)); diff --git a/src/grid2d.cpp b/src/grid2d.cpp index bea24421cf..6a5a0c8446 100644 --- a/src/grid2d.cpp +++ b/src/grid2d.cpp @@ -125,7 +125,7 @@ Grid2d::Grid2d(LAMMPS *lmp, MPI_Comm gcomm, // error check on size of grid stored by this proc bigint total = (bigint) (oxhi - oxlo + 1) * (oyhi - oylo + 1); - if (total > MAXSMALLINT) + if (total > MAXSMALLINT) error->one(FLERR, "Too many owned+ghost grid2d points"); // store grid bounds and proc neighs @@ -883,7 +883,7 @@ void Grid2d::ghost_box_drop(int *box, int *pbc) ------------------------------------------------------------------------- */ void Grid2d::box_drop_grid(int *box, int proclower, int procupper, - int &np, int *plist) + int &np, int *plist) { // end recursion when partition is a single proc // add proclower to plist @@ -899,7 +899,7 @@ void Grid2d::box_drop_grid(int *box, int proclower, int procupper, // = location in tree that stores this cut // cut = index of first grid cell in upper partition // dim = 0,1,2 dimension of cut - + int procmid = proclower + (procupper - proclower) / 2 + 1; int dim = rcbinfo[procmid].dim; int cut = rcbinfo[procmid].cut; @@ -955,7 +955,7 @@ int Grid2d::ghost_adjacent_tiled() ------------------------------------------------------------------------- */ void Grid2d::forward_comm(int caller, void *ptr, int nper, int nbyte, int which, - void *buf1, void *buf2, MPI_Datatype datatype) + void *buf1, void *buf2, MPI_Datatype datatype) { if (layout == REGULAR) { if (caller == KSPACE) @@ -1060,7 +1060,7 @@ forward_comm_tiled(T *ptr, int nper, int nbyte, int which, ------------------------------------------------------------------------- */ void Grid2d::reverse_comm(int caller, void *ptr, int nper, int nbyte, int which, - void *buf1, void *buf2, MPI_Datatype datatype) + void *buf1, void *buf2, MPI_Datatype datatype) { if (layout == REGULAR) { if (caller == KSPACE) diff --git a/src/grid2d.h b/src/grid2d.h index df7ac4e4fa..dc4c306bfe 100644 --- a/src/grid2d.h +++ b/src/grid2d.h @@ -22,12 +22,12 @@ class Grid2d : protected Pointers { public: enum { KSPACE = 0, PAIR = 1, FIX = 2 }; // calling classes - Grid2d(class LAMMPS *, MPI_Comm, int, int, double, int, double, + Grid2d(class LAMMPS *, MPI_Comm, int, int, double, int, double, int &, int &, int &, int &, int &, int &, int &, int &); Grid2d(class LAMMPS *, MPI_Comm, int, int, int, int, int, int, int, int, int, int); Grid2d(class LAMMPS *, MPI_Comm, int, int, int, int, int, int, int, int, int, int, - int, int, int, int, int); + int, int, int, int, int); ~Grid2d() override; void get_size(int &, int &); void get_bounds(int &, int &, int &, int &); diff --git a/src/grid3d.cpp b/src/grid3d.cpp index ae42a6dcb0..fb7334e1f1 100644 --- a/src/grid3d.cpp +++ b/src/grid3d.cpp @@ -55,7 +55,7 @@ static constexpr int OFFSET = 16384; ------------------------------------------------------------------------- */ Grid3d::Grid3d(LAMMPS *lmp, MPI_Comm gcomm, - int gnx, int gny, int gnz, + int gnx, int gny, int gnz, double maxdist, int extra, double shift, int &ixlo, int &ixhi, int &iylo, int &iyhi, int &izlo, int &izhi, int &oxlo, int &oxhi, int &oylo, int &oyhi, int &ozlo, int &ozhi) @@ -72,7 +72,7 @@ Grid3d::Grid3d(LAMMPS *lmp, MPI_Comm gcomm, ny = gny; nz = gnz; - ngrid[0] = nx; ngrid[1] = ny; ngrid[2] = nz; + ngrid[0] = nx; ngrid[1] = ny; ngrid[2] = nz; if (comm->layout == Comm::LAYOUT_TILED) layout = TILED; else layout = REGULAR; @@ -132,12 +132,12 @@ Grid3d::Grid3d(LAMMPS *lmp, MPI_Comm gcomm, ozlo = MAX(1,ozlo); ozhi = MIN(gnx-1,ozhi); } - + // error check on size of grid stored by this proc - bigint total = (bigint) + bigint total = (bigint) (oxhi - oxlo + 1) * (oyhi - oylo + 1) * (ozhi - ozlo + 1); - if (total > MAXSMALLINT) + if (total > MAXSMALLINT) error->one(FLERR, "Too many owned+ghost grid3d points"); // store grid bounds and proc neighs @@ -186,7 +186,7 @@ Grid3d::Grid3d(LAMMPS *lmp, MPI_Comm gcomm, ny = gny; nz = gnz; - ngrid[0] = nx; ngrid[1] = ny; ngrid[2] = nz; + ngrid[0] = nx; ngrid[1] = ny; ngrid[2] = nz; if (comm->layout == Comm::LAYOUT_TILED) layout = TILED; else layout = REGULAR; @@ -242,7 +242,7 @@ Grid3d::Grid3d(LAMMPS *lmp, MPI_Comm gcomm, int flag, ny = gny; nz = gnz; - ngrid[0] = nx; ngrid[1] = ny; ngrid[2] = nz; + ngrid[0] = nx; ngrid[1] = ny; ngrid[2] = nz; if (comm->layout == Comm::LAYOUT_TILED) layout = TILED; else layout = REGULAR; @@ -380,7 +380,7 @@ void Grid3d::get_size(int &nxgrid, int &nygrid, int &nzgrid) /* ---------------------------------------------------------------------- */ -void Grid3d::get_bounds(int &xlo, int &xhi, int &ylo, int &yhi, +void Grid3d::get_bounds(int &xlo, int &xhi, int &ylo, int &yhi, int &zlo, int &zhi) { xlo = inxlo; diff --git a/src/grid3d.h b/src/grid3d.h index 38e5887f8b..9f751bbeb7 100644 --- a/src/grid3d.h +++ b/src/grid3d.h @@ -22,13 +22,13 @@ class Grid3d : protected Pointers { public: enum { KSPACE = 0, PAIR = 1, FIX = 2 }; // calling classes - Grid3d(class LAMMPS *, MPI_Comm, int, int, int, double, int, double, - int &, int &, int &, int &, int &, int &, + Grid3d(class LAMMPS *, MPI_Comm, int, int, int, double, int, double, + int &, int &, int &, int &, int &, int &, int &, int &, int &, int &, int &, int &); - Grid3d(class LAMMPS *, MPI_Comm, int, int, int, int, int, int, int, int, int, + Grid3d(class LAMMPS *, MPI_Comm, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); - Grid3d(class LAMMPS *, MPI_Comm, int, int, int, int, - int, int, int, int, int, int, int, int, int, int, int, int, + Grid3d(class LAMMPS *, MPI_Comm, int, int, int, int, + int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); ~Grid3d() override; void get_size(int &, int &, int &); @@ -185,7 +185,7 @@ class Grid3d : protected Pointers { // internal methods // ------------------------------------------- - void store(int, int, int, int, int, int, int, int, int, int, int, int, + void store(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); virtual void setup_regular(int &, int &); virtual void setup_tiled(int &, int &); diff --git a/src/utils.cpp b/src/utils.cpp index 43925fd69c..cbcb5c1a23 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -771,17 +771,17 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod return ptrs to 3 substrings ------------------------------------------------------------------------- */ -void utils::grid_parse(const char *file, int line, const std::string &name, +void utils::grid_parse(const char *file, int line, const std::string &name, char *&id, char *&gridname, char *&dataname, Error *error) { char *copy = strdup(name); char *ptr1 = strchr(copy,':'); - if (!ptr1) + if (!ptr1) error->all(FLERR,"Grid reference {} does not contain 2 ':' chars",name); *ptr1 = '\0'; char *ptr2 = strchr(ptr1+1,':'); - if (!ptr2) + if (!ptr2) error->all(FLERR,"Grid reference {} does not contain 2 ':' chars",name); *ptr2 = '\0';