diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index c9d3abed72..3646da36d4 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -24,9 +23,8 @@ #include "domain.h" #include "error.h" #include "force.h" -#include "input.h" -#include "variable.h" #include "group.h" +#include "input.h" #include "memory.h" #include "modify.h" #include "molecule.h" @@ -34,6 +32,7 @@ #include "neighbor.h" #include "random_mars.h" #include "region.h" +#include "variable.h" #include #include @@ -50,10 +49,9 @@ DeleteAtoms::DeleteAtoms(LAMMPS *lmp) : Command(lmp) {} void DeleteAtoms::command(int narg, char **arg) { if (domain->box_exist == 0) - error->all(FLERR,"Delete_atoms command before simulation box is defined"); - if (narg < 1) utils::missing_cmd_args(FLERR,"delete_atoms", error); - if (atom->tag_enable == 0) - error->all(FLERR,"Cannot use delete_atoms unless atoms have IDs"); + error->all(FLERR, "Delete_atoms command before simulation box is defined"); + if (narg < 1) utils::missing_cmd_args(FLERR, "delete_atoms", error); + if (atom->tag_enable == 0) error->all(FLERR, "Cannot use delete_atoms unless atoms have IDs"); // store state before delete @@ -67,27 +65,33 @@ void DeleteAtoms::command(int narg, char **arg) allflag = 0; - if (strcmp(arg[0],"group") == 0) delete_group(narg,arg); - else if (strcmp(arg[0],"region") == 0) delete_region(narg,arg); - else if (strcmp(arg[0],"overlap") == 0) delete_overlap(narg,arg); - else if (strcmp(arg[0],"porosity") == 0) delete_porosity(narg,arg); - else if (strcmp(arg[0],"variable") == 0) delete_variable(narg,arg); - else error->all(FLERR,"Unknown delete_atoms sub-command: {}", arg[0]); + if (strcmp(arg[0], "group") == 0) + delete_group(narg, arg); + else if (strcmp(arg[0], "region") == 0) + delete_region(narg, arg); + else if (strcmp(arg[0], "overlap") == 0) + delete_overlap(narg, arg); + else if (strcmp(arg[0], "porosity") == 0) + delete_porosity(narg, arg); + else if (strcmp(arg[0], "variable") == 0) + delete_variable(narg, arg); + else + error->all(FLERR, "Unknown delete_atoms sub-command: {}", arg[0]); if (allflag) { int igroup = group->find("all"); - if ((igroup >= 0) && - modify->check_rigid_group_overlap(group->bitmask[igroup])) - error->warning(FLERR,"Attempting to delete atoms in rigid bodies"); + if ((igroup >= 0) && modify->check_rigid_group_overlap(group->bitmask[igroup])) + error->warning(FLERR, "Attempting to delete atoms in rigid bodies"); } else { if (modify->check_rigid_list_overlap(dlist)) - error->warning(FLERR,"Attempting to delete atoms in rigid bodies"); + error->warning(FLERR, "Attempting to delete atoms in rigid bodies"); } // if allflag = 1, just reset atom->nlocal // else delete atoms one by one - if (allflag) atom->nlocal = 0; + if (allflag) + atom->nlocal = 0; else { // optionally delete additional bonds or atoms in molecules @@ -104,10 +108,11 @@ void DeleteAtoms::command(int narg, char **arg) int i = 0; while (i < nlocal) { if (dlist[i]) { - avec->copy(nlocal-1,i,1); - dlist[i] = dlist[nlocal-1]; + avec->copy(nlocal - 1, i, 1); + dlist[i] = dlist[nlocal - 1]; nlocal--; - } else i++; + } else + i++; } atom->nlocal = nlocal; @@ -125,38 +130,37 @@ void DeleteAtoms::command(int narg, char **arg) for (int i = 0; i < nlocal; i++) tag[i] = 0; atom->tag_extend(); } else if (comm->me == 0) - error->warning(FLERR,"Ignoring 'compress yes' for molecular system"); + error->warning(FLERR, "Ignoring 'compress yes' for molecular system"); } // reset atom->natoms and also topology counts bigint nblocal = atom->nlocal; - MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nblocal, &atom->natoms, 1, MPI_LMP_BIGINT, MPI_SUM, world); // reset bonus data counts - auto avec_ellipsoid = - dynamic_cast( atom->style_match("ellipsoid")); - auto avec_line = dynamic_cast( atom->style_match("line")); - auto avec_tri = dynamic_cast( atom->style_match("tri")); - auto avec_body = dynamic_cast( atom->style_match("body")); + auto avec_ellipsoid = dynamic_cast(atom->style_match("ellipsoid")); + auto avec_line = dynamic_cast(atom->style_match("line")); + auto avec_tri = dynamic_cast(atom->style_match("tri")); + auto avec_body = dynamic_cast(atom->style_match("body")); bigint nlocal_bonus; if (atom->nellipsoids > 0) { nlocal_bonus = avec_ellipsoid->nlocal_bonus; - MPI_Allreduce(&nlocal_bonus,&atom->nellipsoids,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nlocal_bonus, &atom->nellipsoids, 1, MPI_LMP_BIGINT, MPI_SUM, world); } if (atom->nlines > 0) { nlocal_bonus = avec_line->nlocal_bonus; - MPI_Allreduce(&nlocal_bonus,&atom->nlines,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nlocal_bonus, &atom->nlines, 1, MPI_LMP_BIGINT, MPI_SUM, world); } if (atom->ntris > 0) { nlocal_bonus = avec_tri->nlocal_bonus; - MPI_Allreduce(&nlocal_bonus,&atom->ntris,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nlocal_bonus, &atom->ntris, 1, MPI_LMP_BIGINT, MPI_SUM, world); } if (atom->nbodies > 0) { nlocal_bonus = avec_body->nlocal_bonus; - MPI_Allreduce(&nlocal_bonus,&atom->nbodies,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nlocal_bonus, &atom->nbodies, 1, MPI_LMP_BIGINT, MPI_SUM, world); } // reset atom->map if it exists @@ -186,13 +190,13 @@ void DeleteAtoms::command(int narg, char **arg) if (nangles_previous) mesg += fmt::format("Deleted {} angles, new total = {}\n", ndelete_angles, atom->nangles); if (ndihedrals_previous) - mesg += fmt::format("Deleted {} dihedrals, new total = {}\n", - ndelete_dihedrals,atom->ndihedrals); + mesg += fmt::format("Deleted {} dihedrals, new total = {}\n", ndelete_dihedrals, + atom->ndihedrals); if (nimpropers_previous) - mesg += fmt::format("Deleted {} impropers, new total = {}\n", - ndelete_impropers,atom->nimpropers); + mesg += fmt::format("Deleted {} impropers, new total = {}\n", ndelete_impropers, + atom->nimpropers); } - utils::logmesg(lmp,mesg); + utils::logmesg(lmp, mesg); } } @@ -202,15 +206,15 @@ void DeleteAtoms::command(int narg, char **arg) void DeleteAtoms::delete_group(int narg, char **arg) { - if (narg < 2) utils::missing_cmd_args(FLERR,"delete_atoms group", error); + if (narg < 2) utils::missing_cmd_args(FLERR, "delete_atoms group", error); int igroup = group->find(arg[1]); - if (igroup == -1) error->all(FLERR,"Could not find delete_atoms group ID {}", arg[1]); - options(narg-2,&arg[2]); + if (igroup == -1) error->all(FLERR, "Could not find delete_atoms group ID {}", arg[1]); + options(narg - 2, &arg[2]); // check for special case of group = all - if (strcmp(arg[1],"all") == 0) { + if (strcmp(arg[1], "all") == 0) { allflag = 1; return; } @@ -218,7 +222,7 @@ void DeleteAtoms::delete_group(int narg, char **arg) // allocate and initialize deletion list int nlocal = atom->nlocal; - memory->create(dlist,nlocal,"delete_atoms:dlist"); + memory->create(dlist, nlocal, "delete_atoms:dlist"); for (int i = 0; i < nlocal; i++) dlist[i] = 0; int *mask = atom->mask; @@ -234,24 +238,24 @@ void DeleteAtoms::delete_group(int narg, char **arg) void DeleteAtoms::delete_region(int narg, char **arg) { - if (narg < 2) utils::missing_cmd_args(FLERR,"delete_atoms region", error); + if (narg < 2) utils::missing_cmd_args(FLERR, "delete_atoms region", error); auto iregion = domain->get_region_by_id(arg[1]); - if (!iregion) error->all(FLERR,"Could not find delete_atoms region ID {}", arg[1]); + if (!iregion) error->all(FLERR, "Could not find delete_atoms region ID {}", arg[1]); iregion->prematch(); - options(narg-2,&arg[2]); + options(narg - 2, &arg[2]); // allocate and initialize deletion list int nlocal = atom->nlocal; - memory->create(dlist,nlocal,"delete_atoms:dlist"); + memory->create(dlist, nlocal, "delete_atoms:dlist"); for (int i = 0; i < nlocal; i++) dlist[i] = 0; double **x = atom->x; for (int i = 0; i < nlocal; i++) - if (iregion->match(x[i][0],x[i][1],x[i][2])) dlist[i] = 1; + if (iregion->match(x[i][0], x[i][1], x[i][2])) dlist[i] = 1; } /* ---------------------------------------------------------------------- @@ -263,23 +267,23 @@ void DeleteAtoms::delete_region(int narg, char **arg) void DeleteAtoms::delete_overlap(int narg, char **arg) { - if (narg < 4) utils::missing_cmd_args(FLERR,"delete_atoms overlap", error); + if (narg < 4) utils::missing_cmd_args(FLERR, "delete_atoms overlap", error); // read args - double cut = utils::numeric(FLERR,arg[1],false,lmp); - double cutsq = cut*cut; + double cut = utils::numeric(FLERR, arg[1], false, lmp); + double cutsq = cut * cut; int igroup1 = group->find(arg[2]); int igroup2 = group->find(arg[3]); if (igroup1 < 0 || igroup2 < 0) - error->all(FLERR,"Could not find delete_atoms group ID {}", arg[1]); - options(narg-4,&arg[4]); + error->all(FLERR, "Could not find delete_atoms group ID {}", arg[1]); + options(narg - 4, &arg[4]); int group1bit = group->bitmask[igroup1]; int group2bit = group->bitmask[igroup2]; - if (comm->me == 0) utils::logmesg(lmp,"System init for delete_atoms ...\n"); + if (comm->me == 0) utils::logmesg(lmp, "System init for delete_atoms ...\n"); // request a full neighbor list for use by this command @@ -293,12 +297,10 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) // error check on cutoff // if no pair style, neighbor list will be empty - if (force->pair == nullptr) - error->all(FLERR,"Delete_atoms requires a pair style be defined"); - if (cut > neighbor->cutneighmax) - error->all(FLERR,"Delete_atoms cutoff > max neighbor cutoff"); + if (force->pair == nullptr) error->all(FLERR, "Delete_atoms requires a pair style be defined"); + if (cut > neighbor->cutneighmax) error->all(FLERR, "Delete_atoms cutoff > max neighbor cutoff"); if (cut > neighbor->cutneighmin && comm->me == 0) - error->warning(FLERR,"Delete_atoms cutoff > minimum neighbor cutoff"); + error->warning(FLERR, "Delete_atoms cutoff > minimum neighbor cutoff"); // setup domain, communication and neighboring // acquire ghosts and build standard neighbor lists @@ -310,7 +312,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) if (neighbor->style) neighbor->setup_bins(); comm->exchange(); comm->borders(); - if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + if (domain->triclinic) domain->lamda2x(atom->nlocal + atom->nghost); neighbor->build(1); // build neighbor list this command needs based on the earlier request @@ -322,7 +324,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) // must be after exchange potentially changes nlocal int nlocal = atom->nlocal; - memory->create(dlist,nlocal,"delete_atoms:dlist"); + memory->create(dlist, nlocal, "delete_atoms:dlist"); for (int i = 0; i < nlocal; i++) dlist[i] = 0; // double loop over owned atoms and their full neighbor list @@ -335,10 +337,10 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) double *special_coul = force->special_coul; double *special_lj = force->special_lj; - int i,j,ii,jj,inum,jnum; - double xtmp,ytmp,ztmp,delx,dely,delz,rsq; - int *ilist,*jlist,*numneigh,**firstneigh; - double factor_lj,factor_coul; + int i, j, ii, jj, inum, jnum; + double xtmp, ytmp, ztmp, delx, dely, delz, rsq; + int *ilist, *jlist, *numneigh, **firstneigh; + double factor_lj, factor_coul; inum = list->inum; ilist = list->ilist; @@ -378,7 +380,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) dely = x[j][1] - ytmp; delz = x[j][2] - ztmp; } - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; if (rsq >= cutsq) continue; // only consider deletion if I,J are in groups 1,2 respectively @@ -415,25 +417,25 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) void DeleteAtoms::delete_porosity(int narg, char **arg) { - if (narg < 5) utils::missing_cmd_args(FLERR,"delete_atoms porosity", error); + if (narg < 5) utils::missing_cmd_args(FLERR, "delete_atoms porosity", error); int igroup = group->find(arg[1]); - if (igroup == -1) error->all(FLERR,"Could not find delete_atoms porosity group ID {}", arg[1]); + if (igroup == -1) error->all(FLERR, "Could not find delete_atoms porosity group ID {}", arg[1]); auto iregion = domain->get_region_by_id(arg[2]); - if (!iregion && (strcmp(arg[2],"NULL") != 0)) - error->all(FLERR,"Could not find delete_atoms porosity region ID {}", arg[2]); + if (!iregion && (strcmp(arg[2], "NULL") != 0)) + error->all(FLERR, "Could not find delete_atoms porosity region ID {}", arg[2]); - double porosity_fraction = utils::numeric(FLERR,arg[3],false,lmp); - int seed = utils::inumeric(FLERR,arg[4],false,lmp); - options(narg-5,&arg[5]); + double porosity_fraction = utils::numeric(FLERR, arg[3], false, lmp); + int seed = utils::inumeric(FLERR, arg[4], false, lmp); + options(narg - 5, &arg[5]); - auto random = new RanMars(lmp,seed + comm->me); + auto random = new RanMars(lmp, seed + comm->me); // allocate and initialize deletion list int nlocal = atom->nlocal; - memory->create(dlist,nlocal,"delete_atoms:dlist"); + memory->create(dlist, nlocal, "delete_atoms:dlist"); for (int i = 0; i < nlocal; i++) dlist[i] = 0; // delete fraction of atoms which are in both group and region @@ -446,7 +448,7 @@ void DeleteAtoms::delete_porosity(int narg, char **arg) for (int i = 0; i < nlocal; i++) { if (!(mask[i] & groupbit)) continue; - if (iregion && !iregion->match(x[i][0],x[i][1],x[i][2])) continue; + if (iregion && !iregion->match(x[i][0], x[i][1], x[i][2])) continue; if (random->uniform() <= porosity_fraction) dlist[i] = 1; } @@ -459,24 +461,24 @@ void DeleteAtoms::delete_porosity(int narg, char **arg) void DeleteAtoms::delete_variable(int narg, char **arg) { - if (narg < 2) utils::missing_cmd_args(FLERR,"delete_atoms variable", error); + if (narg < 2) utils::missing_cmd_args(FLERR, "delete_atoms variable", error); int ivar = input->variable->find(arg[1]); if (ivar < 0) error->all(FLERR, "Variable name {} for delete_atoms does not exist", arg[1]); if (!input->variable->atomstyle(ivar)) - error->all(FLERR,"Variable {} for delete_atoms is invalid style", arg[1]); + error->all(FLERR, "Variable {} for delete_atoms is invalid style", arg[1]); // consume remaining options - options(narg-2,&arg[2]); + options(narg - 2, &arg[2]); // aflag = evaluation of per-atom variable const int nlocal = atom->nlocal; double *aflag; - memory->create(dlist,nlocal,"delete_atoms:dlist"); - memory->create(aflag,nlocal,"group:aflag"); - input->variable->compute_atom(ivar,0,aflag,1,0); + memory->create(dlist, nlocal, "delete_atoms:dlist"); + memory->create(aflag, nlocal, "group:aflag"); + input->variable->compute_atom(ivar, 0, aflag, 1, 0); // delete if per-atom variable evaluated to non-zero @@ -495,7 +497,7 @@ void DeleteAtoms::delete_bond() // list of these IDs is sent around ring // at each stage of ring pass, hash is re-populated with received IDs - hash = new std::map(); + hash = new std::map(); // list = set of unique molecule IDs from which I deleted atoms // pass list to all other procs via comm->ring() @@ -507,13 +509,13 @@ void DeleteAtoms::delete_bond() for (int i = 0; i < nlocal; i++) if (dlist[i]) n++; tagint *list; - memory->create(list,n,"delete_atoms:list"); + memory->create(list, n, "delete_atoms:list"); n = 0; for (int i = 0; i < nlocal; i++) if (dlist[i]) list[n++] = tag[i]; - comm->ring(n,sizeof(tagint),list,1,bondring,nullptr,(void *)this); + comm->ring(n, sizeof(tagint), list, 1, bondring, nullptr, (void *) this); delete hash; memory->destroy(list); @@ -529,15 +531,14 @@ void DeleteAtoms::delete_molecule() { // hash = unique molecule IDs from which I deleted atoms - hash = new std::map(); + hash = new std::map(); tagint *molecule = atom->molecule; int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { if (molecule[i] == 0) continue; - if (dlist[i] && hash->find(molecule[i]) == hash->end()) - (*hash)[molecule[i]] = 1; + if (dlist[i] && hash->find(molecule[i]) == hash->end()) (*hash)[molecule[i]] = 1; } // list = set of unique molecule IDs from which I deleted atoms @@ -545,13 +546,13 @@ void DeleteAtoms::delete_molecule() int n = hash->size(); tagint *list; - memory->create(list,n,"delete_atoms:list"); + memory->create(list, n, "delete_atoms:list"); n = 0; - std::map::iterator pos; + std::map::iterator pos; for (pos = hash->begin(); pos != hash->end(); ++pos) list[n++] = pos->first; - comm->ring(n,sizeof(tagint),list,1,molring,nullptr,(void *)this); + comm->ring(n, sizeof(tagint), list, 1, molring, nullptr, (void *) this); delete hash; memory->destroy(list); @@ -589,7 +590,7 @@ void DeleteAtoms::recount_topology() int *molatom = atom->molatom; int nlocal = atom->nlocal; - int imol,iatom; + int imol, iatom; for (int i = 0; i < nlocal; i++) { imol = molindex[i]; @@ -603,19 +604,19 @@ void DeleteAtoms::recount_topology() } if (atom->avec->bonds_allow) { - MPI_Allreduce(&nbonds,&atom->nbonds,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nbonds, &atom->nbonds, 1, MPI_LMP_BIGINT, MPI_SUM, world); if (!force->newton_bond) atom->nbonds /= 2; } if (atom->avec->angles_allow) { - MPI_Allreduce(&nangles,&atom->nangles,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nangles, &atom->nangles, 1, MPI_LMP_BIGINT, MPI_SUM, world); if (!force->newton_bond) atom->nangles /= 3; } if (atom->avec->dihedrals_allow) { - MPI_Allreduce(&ndihedrals,&atom->ndihedrals,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&ndihedrals, &atom->ndihedrals, 1, MPI_LMP_BIGINT, MPI_SUM, world); if (!force->newton_bond) atom->ndihedrals /= 4; } if (atom->avec->impropers_allow) { - MPI_Allreduce(&nimpropers,&atom->nimpropers,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nimpropers, &atom->nimpropers, 1, MPI_LMP_BIGINT, MPI_SUM, world); if (!force->newton_bond) atom->nimpropers /= 4; } } @@ -628,7 +629,7 @@ void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) { auto daptr = (DeleteAtoms *) ptr; auto list = (tagint *) cbuf; - std::map *hash = daptr->hash; + std::map *hash = daptr->hash; int *num_bond = daptr->atom->num_bond; int *num_angle = daptr->atom->num_angle; @@ -665,17 +666,18 @@ void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) // loop over my atoms and their bond topology lists // if any atom in an interaction matches atom ID in hash, delete interaction - int m,n; + int m, n; for (int i = 0; i < nlocal; i++) { if (num_bond) { m = 0; n = num_bond[i]; while (m < n) { if (hash->find(bond_atom[i][m]) != hash->end()) { - bond_type[i][m] = bond_type[i][n-1]; - bond_atom[i][m] = bond_atom[i][n-1]; + bond_type[i][m] = bond_type[i][n - 1]; + bond_atom[i][m] = bond_atom[i][n - 1]; n--; - } else m++; + } else + m++; } num_bond[i] = n; } @@ -687,12 +689,13 @@ void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) if (hash->find(angle_atom1[i][m]) != hash->end() || hash->find(angle_atom2[i][m]) != hash->end() || hash->find(angle_atom3[i][m]) != hash->end()) { - angle_type[i][m] = angle_type[i][n-1]; - angle_atom1[i][m] = angle_atom1[i][n-1]; - angle_atom2[i][m] = angle_atom2[i][n-1]; - angle_atom3[i][m] = angle_atom3[i][n-1]; + angle_type[i][m] = angle_type[i][n - 1]; + angle_atom1[i][m] = angle_atom1[i][n - 1]; + angle_atom2[i][m] = angle_atom2[i][n - 1]; + angle_atom3[i][m] = angle_atom3[i][n - 1]; n--; - } else m++; + } else + m++; } num_angle[i] = n; } @@ -705,13 +708,14 @@ void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) hash->find(dihedral_atom2[i][m]) != hash->end() || hash->find(dihedral_atom3[i][m]) != hash->end() || hash->find(dihedral_atom4[i][m]) != hash->end()) { - dihedral_type[i][m] = dihedral_type[i][n-1]; - dihedral_atom1[i][m] = dihedral_atom1[i][n-1]; - dihedral_atom2[i][m] = dihedral_atom2[i][n-1]; - dihedral_atom3[i][m] = dihedral_atom3[i][n-1]; - dihedral_atom4[i][m] = dihedral_atom4[i][n-1]; + dihedral_type[i][m] = dihedral_type[i][n - 1]; + dihedral_atom1[i][m] = dihedral_atom1[i][n - 1]; + dihedral_atom2[i][m] = dihedral_atom2[i][n - 1]; + dihedral_atom3[i][m] = dihedral_atom3[i][n - 1]; + dihedral_atom4[i][m] = dihedral_atom4[i][n - 1]; n--; - } else m++; + } else + m++; } num_dihedral[i] = n; } @@ -724,13 +728,14 @@ void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) hash->find(improper_atom2[i][m]) != hash->end() || hash->find(improper_atom3[i][m]) != hash->end() || hash->find(improper_atom4[i][m]) != hash->end()) { - improper_type[i][m] = improper_type[i][n-1]; - improper_atom1[i][m] = improper_atom1[i][n-1]; - improper_atom2[i][m] = improper_atom2[i][n-1]; - improper_atom3[i][m] = improper_atom3[i][n-1]; - improper_atom4[i][m] = improper_atom4[i][n-1]; + improper_type[i][m] = improper_type[i][n - 1]; + improper_atom1[i][m] = improper_atom1[i][n - 1]; + improper_atom2[i][m] = improper_atom2[i][n - 1]; + improper_atom3[i][m] = improper_atom3[i][n - 1]; + improper_atom4[i][m] = improper_atom4[i][n - 1]; n--; - } else m++; + } else + m++; } num_improper[i] = n; } @@ -743,10 +748,10 @@ void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) void DeleteAtoms::molring(int n, char *cbuf, void *ptr) { - auto daptr = (DeleteAtoms *)ptr; + auto daptr = (DeleteAtoms *) ptr; auto list = (tagint *) cbuf; int *dlist = daptr->dlist; - std::map *hash = daptr->hash; + std::map *hash = daptr->hash; int nlocal = daptr->atom->nlocal; tagint *molecule = daptr->atom->molecule; @@ -772,24 +777,25 @@ void DeleteAtoms::options(int narg, char **arg) int iarg = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"compress") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"delete_atoms compress", error); - compress_flag = utils::logical(FLERR,arg[iarg+1],false,lmp); + if (strcmp(arg[iarg], "compress") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "delete_atoms compress", error); + compress_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"bond") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"delete_atoms bond", error); + } else if (strcmp(arg[iarg], "bond") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "delete_atoms bond", error); if (atom->molecular == Atom::ATOMIC) - error->all(FLERR,"Cannot use delete_atoms bond yes for non-molecular systems"); + error->all(FLERR, "Cannot use delete_atoms bond yes for non-molecular systems"); if (atom->molecular == Atom::TEMPLATE) - error->all(FLERR,"Cannot use delete_atoms bond yes with atom_style template"); - bond_flag = utils::logical(FLERR,arg[iarg+1],false,lmp); + error->all(FLERR, "Cannot use delete_atoms bond yes with atom_style template"); + bond_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"mol") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"delete_atoms mol", error); + } else if (strcmp(arg[iarg], "mol") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "delete_atoms mol", error); if (atom->molecule_flag == 0) - error->all(FLERR,"Delete_atoms mol yes requires atom attribute molecule"); - mol_flag = utils::logical(FLERR,arg[iarg+1],false,lmp); + error->all(FLERR, "Delete_atoms mol yes requires atom attribute molecule"); + mol_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Unknown delete_atoms option: {}",arg[iarg]); + } else + error->all(FLERR, "Unknown delete_atoms option: {}", arg[iarg]); } }