diff --git a/doc/src/Developer_grid.rst b/doc/src/Developer_grid.rst index 8e064589af..e18fc399f9 100644 --- a/doc/src/Developer_grid.rst +++ b/doc/src/Developer_grid.rst @@ -305,7 +305,7 @@ The *setup_grid()* method is called after the first constructor (above) to partition the grid across processors, which determines which grid cells each processor owns. It also calculates how many ghost grid cells in each dimension and each direction each processor -needs to store. +needs to store. Note that this method is NOT called if the second constructor above is used. In that case, the caller assigns owned and ghost cells to each @@ -528,7 +528,7 @@ The *ghost_adjacent()* method returns a 1 if every processor can perform the necessary owned/ghost communication with only its nearest neighbor processors (4 in 2d, 6 in 3d). It returns a 0 if any processor's ghost cells extend further than nearest neighbor -processors. +processors. This can be checked by callers who have the option to change the global grid size to insure more efficient nearest-neighbor-only diff --git a/doc/src/Howto_grid.rst b/doc/src/Howto_grid.rst index 7749b71806..a7b2bc7743 100644 --- a/doc/src/Howto_grid.rst +++ b/doc/src/Howto_grid.rst @@ -50,7 +50,7 @@ grid ` output files as input. Nov 2022) to add a section in the :doc:`Developer ` section of the manual with a detailed description of how to use these classes. - + ---------- These are the commands which currently define or use distributed diff --git a/doc/src/compute_temp.rst b/doc/src/compute_temp.rst index bf07b2a78e..8f6f9f225f 100644 --- a/doc/src/compute_temp.rst +++ b/doc/src/compute_temp.rst @@ -104,9 +104,9 @@ Restrictions Related commands """""""""""""""" -:doc:`compute temp/partial `, :doc:`compute - temp/region `, :doc:`compute pressure - ` +:doc:`compute temp/partial `, +:doc:`compute temp/region `, +:doc:`compute pressure ` Default """"""" diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 84b24721ad..0865880cb2 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -868,7 +868,7 @@ void PPPM::deallocate() memory->destroy(gc_buf2); memory->destroy3d_offset(density_brick,nzlo_out,nylo_out,nxlo_out); - + if (differentiation_flag == 1) { memory->destroy3d_offset(u_brick,nzlo_out,nylo_out,nxlo_out); memory->destroy(sf_precoeff1); @@ -882,7 +882,7 @@ void PPPM::deallocate() memory->destroy3d_offset(vdy_brick,nzlo_out,nylo_out,nxlo_out); memory->destroy3d_offset(vdz_brick,nzlo_out,nylo_out,nxlo_out); } - + memory->destroy(density_fft); memory->destroy(greensfn); memory->destroy(work1); diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index 74f2456a37..a01ffea1dc 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -205,7 +205,7 @@ void PPPMDipole::init() gc_dipole->set_stencil_atom(-nlower,nupper); gc_dipole->set_shift_atom(shiftatom_lo,shiftatom_hi); gc_dipole->set_zfactor(slab_volfactor); - + gc_dipole->setup_grid(nxlo_in,nxhi_in,nylo_in,nyhi_in,nzlo_in,nzhi_in, nxlo_out,nxhi_out,nylo_out,nyhi_out,nzlo_out,nzhi_out); @@ -541,7 +541,7 @@ void PPPMDipole::allocate() gc_dipole->set_stencil_atom(-nlower,nupper); gc_dipole->set_shift_atom(shiftatom_lo,shiftatom_hi); gc_dipole->set_zfactor(slab_volfactor); - + gc_dipole->setup_grid(nxlo_in,nxhi_in,nylo_in,nyhi_in,nzlo_in,nzhi_in, nxlo_out,nxhi_out,nylo_out,nyhi_out,nzlo_out,nzhi_out); diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index d33901b77f..9545fd0d31 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -409,7 +409,7 @@ void PPPMDisp::init() double acc; double acc_6,acc_real_6,acc_kspace_6; - + int iteration = 0; if (function[0]) { @@ -524,7 +524,7 @@ void PPPMDisp::init() final_accuracy_6(acc_6,acc_real_6,acc_kspace_6); } - + // allocate K-space dependent memory allocate(); @@ -559,7 +559,7 @@ void PPPMDisp::init() int ngrid_max,nfft_both_max; MPI_Allreduce(&ngrid,&ngrid_max,1,MPI_INT,MPI_MAX,world); MPI_Allreduce(&nfft_both,&nfft_both_max,1,MPI_INT,MPI_MAX,world); - + if (me == 0) { std::string mesg = fmt::format(" Coulomb G vector (1/distance)= {:.16g}\n", g_ewald); @@ -576,14 +576,14 @@ void PPPMDisp::init() utils::logmesg(lmp,mesg); } } - + // print dipserion stats if (function[1] + function[2] + function[3]) { int ngrid_6_max,nfft_both_6_max; MPI_Allreduce(&ngrid_6,&ngrid_6_max,1,MPI_INT,MPI_MAX,world); MPI_Allreduce(&nfft_both_6,&nfft_both_6_max,1,MPI_INT,MPI_MAX,world); - + if (me == 0) { std::string mesg = fmt::format(" Dispersion G vector (1/distance)= " "{:.16}\n",g_ewald_6); diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index f6b2214a2e..7a3de98921 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -78,9 +78,9 @@ DumpGrid::DumpGrid(LAMMPS *lmp, int narg, char **arg) : dimension = domain->dimension; // for 2d, set nzgrid = 1 for dump grid and grid/vtk files - + if (dimension == 2) nzgrid = 1; - + // computes and fixes which the dump accesses ncompute = 0; @@ -661,11 +661,11 @@ int DumpGrid::parse_fields(int narg, char **arg) // arg is not a valid Grid reference // assume it's an additional dump grid option and return - + if (iflag < 0) return iarg; // grid reference is to a compute or fix - + if (iflag == ArgInfo::COMPUTE) { auto icompute = lmp->modify->get_compute_by_id(id); field2index[iarg] = add_compute(id,icompute); diff --git a/src/dump_grid_vtk.cpp b/src/dump_grid_vtk.cpp index d2a32ec160..6a4b05d9f3 100644 --- a/src/dump_grid_vtk.cpp +++ b/src/dump_grid_vtk.cpp @@ -79,7 +79,7 @@ void DumpGridVTK::write_header(bigint ndump) if (me) return; xyz_grid(); - + fprintf(fp,"\n"); fprintf(fp,"\n"); fprintf(fp,"\n"); // coords of center point of grid cells in each of xyz dimensions - + fprintf(fp,"\n"); for (int i = 0; i <= nxgrid; i++) fprintf(fp,"%g ",xcoord[i]); @@ -103,9 +103,9 @@ void DumpGridVTK::write_header(bigint ndump) for (int i = 0; i <= nzgrid; i++) fprintf(fp,"%g ",zcoord[i]); fprintf(fp,"\n\n"); - + fprintf(fp,"\n"); - + fprintf(fp,"\n"); if (mode == SCALAR) fprintf(fp,"\n"); @@ -155,10 +155,10 @@ void DumpGridVTK::xyz_grid() double dx = domain->prd[0] / nxgrid; double dy = domain->prd[1] / nygrid; double dz = domain->prd[2] / nzgrid; - + for (int ix = 0; ix <= nxgrid; ix++) xcoord[ix] = boxlo[0] + ix*dx; - + for (int iy = 0; iy <= nygrid; iy++) ycoord[iy] = boxlo[1] + iy*dy; diff --git a/src/dump_grid_vtk.h b/src/dump_grid_vtk.h index 8c8c644a19..ca8ffed525 100644 --- a/src/dump_grid_vtk.h +++ b/src/dump_grid_vtk.h @@ -32,7 +32,7 @@ class DumpGridVTK : public DumpGrid { protected: int mode; double *xcoord,*ycoord,*zcoord; - + // methods void init_style() override; diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 95ab2be9f0..3085843e7e 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -126,7 +126,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : gridflag = NO; lineflag = triflag = bodyflag = fixflag = NO; id_grid_compute = id_grid_fix = nullptr; - + if (atom->nbondtypes == 0) bondflag = NO; else { bondflag = YES; @@ -490,7 +490,7 @@ void DumpImage::init_style() error->all(FLERR,"Dump image and grid fix not computed at compatible times"); } } - + // check image variables if (thetastr) { @@ -625,7 +625,7 @@ void DumpImage::write() // pack grid gbuf with grid cell values // ngrid = # of grid cells this proc owns - + if (gridflag) { if (domain->dimension == 2) { if (grid_compute) @@ -700,7 +700,7 @@ void DumpImage::write() for (int ix = nxlo_in; ix <= nxhi_in; ix++) gbuf[n++] = array2d[iy][ix][index]; } - + } else if (domain->dimension == 3) { if (grid_index == 0) { double ***vec3d; @@ -715,7 +715,7 @@ void DumpImage::write() for (int iy = nylo_in; iy <= nyhi_in; iy++) for (int ix = nxlo_in; ix <= nxhi_in; ix++) gbuf[n++] = vec3d[iz][iy][ix]; - + } } else { double ****array3d; @@ -919,7 +919,7 @@ void DumpImage::create_image() // 2 triangles for 2d rectangle, 12 triangles for 3d cube surface // grid_cell_corners_2d/3d calculates orthogonal vs triclinic corner pts // for 3d, outward normals on all 6 faces - + if (gridflag) { int n = 0; if (domain->dimension == 2) { @@ -1358,7 +1358,7 @@ void DumpImage::grid_cell_corners_2d(int ix, int iy) { double *boxlo = domain->boxlo; double *prd = domain->prd; - + if (!domain->triclinic) { double xdelta = prd[0] / nxgrid; double ydelta = prd[1] / nygrid; @@ -1389,12 +1389,12 @@ void DumpImage::grid_cell_corners_2d(int ix, int iy) } /* ---------------------------------------------------------------------- */ - + void DumpImage::grid_cell_corners_3d(int ix, int iy, int iz) { double *boxlo = domain->boxlo; double *prd = domain->prd; - + if (!domain->triclinic) { double xdelta = prd[0] / nxgrid; double ydelta = prd[1] / nygrid; diff --git a/src/dump_image.h b/src/dump_image.h index 0b3a44ead3..efac5e97d3 100644 --- a/src/dump_image.h +++ b/src/dump_image.h @@ -91,7 +91,7 @@ class DumpImage : public DumpCustom { double *gbuf; int ngrid,maxgrid; double gcorners[8][3]; - + class AtomVecLine *avec_line; // ptrs to atom style (sub)classes class AtomVecTri *avec_tri; class AtomVecBody *avec_body; diff --git a/src/fix_ave_grid.cpp b/src/fix_ave_grid.cpp index d0c71821cb..c6040903bb 100644 --- a/src/fix_ave_grid.cpp +++ b/src/fix_ave_grid.cpp @@ -143,13 +143,13 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : // if arg is not a per-atom or per-grid value // then it's an optional arg after the values - + ArgInfo argi(arg[iarg]); if (argi.get_type() == ArgInfo::NONE || argi.get_type() == ArgInfo::UNKNOWN) break; if (argi.get_dim() > 1) error->all(FLERR,"Invalid fix ave/grid command"); // atom value has no colon - + if (!strchr(arg[iarg],':')) { modeatom = 1; ids[nvalues] = argi.copy_name(); diff --git a/src/grid3d.cpp b/src/grid3d.cpp index abb09c617c..ca8d19aacc 100644 --- a/src/grid3d.cpp +++ b/src/grid3d.cpp @@ -537,7 +537,7 @@ void Grid3d::ghost_grid() // OFFSET allows generation of negative indices with static_cast // out xyz lo/hi = index range of owned + ghost cells // if zextra, nz and effective prd[2] are both larger, so dzinv is the same - + double dxinv = nx / prd[0]; double dyinv = ny / prd[1]; double dzinv = nz / prd[2]; diff --git a/src/utils.cpp b/src/utils.cpp index 841877859a..c39a4f7889 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -887,27 +887,27 @@ int utils::check_grid_reference(char *errstr, char *ref, int nevery, auto name = argi.get_name(); switch (argi.get_type()) { - + case ArgInfo::UNKNOWN: { lmp->error->all(FLERR,"%s grid reference %s is invalid",errstr,ref); } break; - + // compute value = c_ID case ArgInfo::COMPUTE: { // split name = idcompute:gname:dname into 3 strings - + auto words = parse_grid_id(FLERR,name,lmp->error); const auto &idcompute = words[0]; const auto &gname = words[1]; const auto &dname = words[2]; - + auto icompute = lmp->modify->get_compute_by_id(idcompute); if (!icompute) lmp->error->all(FLERR,"{} compute ID {} not found",errstr,idcompute); if (icompute->pergrid_flag == 0) lmp->error->all(FLERR,"{} compute {} does not compute per-grid info",errstr,idcompute); - + int dim; igrid = icompute->get_grid_by_name(gname,dim); if (igrid < 0) diff --git a/src/utils.h b/src/utils.h index b88c93f463..218fe2ad5e 100644 --- a/src/utils.h +++ b/src/utils.h @@ -401,7 +401,7 @@ namespace utils { int check_grid_reference(char *errstr, char *ref, int nevery, char *&id, int &igrid, int &idata, int &index, LAMMPS *lmp); - + /*! Parse grid reference into 3 sub-strings * * Format of grid ID reference = id:gname:dname