From d874e8a2be9c445ae10cd48e8175d7d059a3aebd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Jun 2020 08:45:18 -0400 Subject: [PATCH] remove TAGINT_FORMAT from ntopo styles --- src/ntopo_angle_all.cpp | 24 +++++++++--------------- src/ntopo_angle_partial.cpp | 24 +++++++++--------------- src/ntopo_angle_template.cpp | 27 +++++++++++---------------- src/ntopo_bond_all.cpp | 21 ++++++++------------- src/ntopo_bond_partial.cpp | 21 ++++++++------------- src/ntopo_bond_template.cpp | 22 +++++++++------------- src/ntopo_dihedral_all.cpp | 27 ++++++++++----------------- src/ntopo_dihedral_partial.cpp | 27 ++++++++++----------------- src/ntopo_dihedral_template.cpp | 31 ++++++++++++------------------- src/ntopo_improper_all.cpp | 29 +++++++++++------------------ src/ntopo_improper_partial.cpp | 20 +++++++++----------- src/ntopo_improper_template.cpp | 33 +++++++++++++-------------------- 12 files changed, 119 insertions(+), 187 deletions(-) diff --git a/src/ntopo_angle_all.cpp b/src/ntopo_angle_all.cpp index e0c20609a1..71521e6891 100644 --- a/src/ntopo_angle_all.cpp +++ b/src/ntopo_angle_all.cpp @@ -21,6 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -58,15 +59,11 @@ void NTopoAngleAll::build() atom3 = atom->map(angle_atom3[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Angle atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - angle_atom1[i][m],angle_atom2[i][m],angle_atom3[i][m], - me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Angle atoms {} {} {} missing on " + "proc {} at step {}",angle_atom1[i][m], + angle_atom2[i][m],angle_atom3[i][m], + me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); @@ -90,10 +87,7 @@ void NTopoAngleAll::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Angle atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Angle atoms missing at step {}", + update->ntimestep)); } diff --git a/src/ntopo_angle_partial.cpp b/src/ntopo_angle_partial.cpp index a6fd900825..c72073718e 100644 --- a/src/ntopo_angle_partial.cpp +++ b/src/ntopo_angle_partial.cpp @@ -21,6 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -59,15 +60,11 @@ void NTopoAnglePartial::build() atom3 = atom->map(angle_atom3[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Angle atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - angle_atom1[i][m],angle_atom2[i][m],angle_atom3[i][m], - me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Angle atoms {} {} {} missing on " + "proc {} at step {}",angle_atom1[i][m], + angle_atom2[i][m],angle_atom3[i][m], + me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); @@ -91,10 +88,7 @@ void NTopoAnglePartial::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Angle atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Angle atoms missing at step {}", + update->ntimestep)); } diff --git a/src/ntopo_angle_template.cpp b/src/ntopo_angle_template.cpp index 8cbcf8bcbd..d6303a0ad4 100644 --- a/src/ntopo_angle_template.cpp +++ b/src/ntopo_angle_template.cpp @@ -23,6 +23,7 @@ #include "molecule.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -76,16 +77,13 @@ void NTopoAngleTemplate::build() atom3 = atom->map(angle_atom3[iatom][m]+tagprev); if (atom1 == -1 || atom2 == -1 || atom3 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Angle atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - angle_atom1[iatom][m]+tagprev,angle_atom2[iatom][m]+tagprev, - angle_atom3[iatom][m]+tagprev, - me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Angle atoms {} {} {} missing on " + "proc {} at step {}", + angle_atom1[iatom][m]+tagprev, + angle_atom2[iatom][m]+tagprev, + angle_atom3[iatom][m]+tagprev, + me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); @@ -110,10 +108,7 @@ void NTopoAngleTemplate::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Angle atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Angle atoms missing at step {}", + update->ntimestep)); } diff --git a/src/ntopo_bond_all.cpp b/src/ntopo_bond_all.cpp index 5309754554..9fac01bdba 100644 --- a/src/ntopo_bond_all.cpp +++ b/src/ntopo_bond_all.cpp @@ -21,6 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -55,13 +56,10 @@ void NTopoBondAll::build() atom1 = atom->map(bond_atom[i][m]); if (atom1 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Bond atoms " TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - tag[i],bond_atom[i][m],me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Bond atoms {} {} missing on " + "proc {} at step {}",tag[i], + bond_atom[i][m],me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); @@ -82,10 +80,7 @@ void NTopoBondAll::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Bond atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Bond atoms missing at step {}", + update->ntimestep)); } diff --git a/src/ntopo_bond_partial.cpp b/src/ntopo_bond_partial.cpp index 1cbf5eed11..138f8f4330 100644 --- a/src/ntopo_bond_partial.cpp +++ b/src/ntopo_bond_partial.cpp @@ -21,6 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -56,13 +57,10 @@ void NTopoBondPartial::build() atom1 = atom->map(bond_atom[i][m]); if (atom1 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Bond atoms " TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - tag[i],bond_atom[i][m],me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Bond atoms {} {} missing on " + "proc {} at step {}",tag[i], + bond_atom[i][m],me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); @@ -83,10 +81,7 @@ void NTopoBondPartial::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Bond atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Bond atoms missing at step {}", + update->ntimestep)); } diff --git a/src/ntopo_bond_template.cpp b/src/ntopo_bond_template.cpp index cd7b85aa19..a651715320 100644 --- a/src/ntopo_bond_template.cpp +++ b/src/ntopo_bond_template.cpp @@ -23,6 +23,7 @@ #include "molecule.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -72,13 +73,11 @@ void NTopoBondTemplate::build() atom1 = atom->map(bond_atom[iatom][m]+tagprev); if (atom1 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Bond atoms " TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - tag[i],bond_atom[iatom][m]+tagprev,me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Bond atoms {} {} missing on " + "proc {} at step {}",tag[i], + bond_atom[iatom][m]+tagprev, + me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); @@ -100,10 +99,7 @@ void NTopoBondTemplate::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Bond atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Bond atoms missing at step {}", + update->ntimestep)); } diff --git a/src/ntopo_dihedral_all.cpp b/src/ntopo_dihedral_all.cpp index 5af2d526e0..81193605c1 100644 --- a/src/ntopo_dihedral_all.cpp +++ b/src/ntopo_dihedral_all.cpp @@ -21,6 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -60,17 +61,12 @@ void NTopoDihedralAll::build() atom4 = atom->map(dihedral_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Dihedral atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - dihedral_atom1[i][m],dihedral_atom2[i][m], - dihedral_atom3[i][m],dihedral_atom4[i][m], - me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Dihedral atoms {} {} {} {} missing on " + "proc {} at step {}", + dihedral_atom1[i][m],dihedral_atom2[i][m], + dihedral_atom3[i][m],dihedral_atom4[i][m], + me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); @@ -97,10 +93,7 @@ void NTopoDihedralAll::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Dihedral atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Dihedral atoms missing at step {}", + update->ntimestep)); } diff --git a/src/ntopo_dihedral_partial.cpp b/src/ntopo_dihedral_partial.cpp index faac57aa51..855fa800b6 100644 --- a/src/ntopo_dihedral_partial.cpp +++ b/src/ntopo_dihedral_partial.cpp @@ -21,6 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -62,17 +63,12 @@ void NTopoDihedralPartial::build() atom4 = atom->map(dihedral_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Dihedral atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - dihedral_atom1[i][m],dihedral_atom2[i][m], - dihedral_atom3[i][m],dihedral_atom4[i][m], - me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Dihedral atoms {} {} {} {} missing on " + "proc {} at step {}", + dihedral_atom1[i][m],dihedral_atom2[i][m], + dihedral_atom3[i][m],dihedral_atom4[i][m], + me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); @@ -99,10 +95,7 @@ void NTopoDihedralPartial::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Dihedral atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Dihedral atoms missing at step {}", + update->ntimestep)); } diff --git a/src/ntopo_dihedral_template.cpp b/src/ntopo_dihedral_template.cpp index bce8ecf4bc..06fac50400 100644 --- a/src/ntopo_dihedral_template.cpp +++ b/src/ntopo_dihedral_template.cpp @@ -23,6 +23,7 @@ #include "molecule.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -78,19 +79,14 @@ void NTopoDihedralTemplate::build() atom4 = atom->map(dihedral_atom4[iatom][m]+tagprev); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Dihedral atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - dihedral_atom1[iatom][m]+tagprev, - dihedral_atom2[iatom][m]+tagprev, - dihedral_atom3[iatom][m]+tagprev, - dihedral_atom4[iatom][m]+tagprev, - me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Dihedral atoms {} {} {} {} missing on " + "proc {} at step {}", + dihedral_atom1[iatom][m]+tagprev, + dihedral_atom2[iatom][m]+tagprev, + dihedral_atom3[iatom][m]+tagprev, + dihedral_atom4[iatom][m]+tagprev, + me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); @@ -118,10 +114,7 @@ void NTopoDihedralTemplate::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Dihedral atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Dihedral atoms missing at step {}", + update->ntimestep)); } diff --git a/src/ntopo_improper_all.cpp b/src/ntopo_improper_all.cpp index 0cbecbf962..e839e9161b 100644 --- a/src/ntopo_improper_all.cpp +++ b/src/ntopo_improper_all.cpp @@ -21,6 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -60,23 +61,18 @@ void NTopoImproperAll::build() atom4 = atom->map(improper_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Improper atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - improper_atom1[i][m],improper_atom2[i][m], - improper_atom3[i][m],improper_atom4[i][m], - me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Improper atoms {} {} {} {} missing on " + "proc {} at step {}", + improper_atom1[i][m],improper_atom2[i][m], + improper_atom3[i][m],improper_atom4[i][m], + me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); atom2 = domain->closest_image(i,atom2); atom3 = domain->closest_image(i,atom3); - atom4 = domain-> closest_image(i,atom4); + atom4 = domain->closest_image(i,atom4); if (newton_bond || (i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) { if (nimproperlist == maximproper) { @@ -97,10 +93,7 @@ void NTopoImproperAll::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Improper atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Improper atoms missing at step {}", + update->ntimestep)); } diff --git a/src/ntopo_improper_partial.cpp b/src/ntopo_improper_partial.cpp index 17e5d4cf62..f2afc68387 100644 --- a/src/ntopo_improper_partial.cpp +++ b/src/ntopo_improper_partial.cpp @@ -21,6 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -62,17 +63,14 @@ void NTopoImproperPartial::build() atom4 = atom->map(improper_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Improper atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - improper_atom1[i][m],improper_atom2[i][m], - improper_atom3[i][m],improper_atom4[i][m], - me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Improper atoms {} {} {} {}" + " missing on proc {} at step {}", + improper_atom1[i][m], + improper_atom2[i][m], + improper_atom3[i][m], + improper_atom4[i][m], + me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); diff --git a/src/ntopo_improper_template.cpp b/src/ntopo_improper_template.cpp index a80fe60e1d..060ba173fd 100644 --- a/src/ntopo_improper_template.cpp +++ b/src/ntopo_improper_template.cpp @@ -23,6 +23,7 @@ #include "molecule.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -78,25 +79,20 @@ void NTopoImproperTemplate::build() atom4 = atom->map(improper_atom4[iatom][m]+tagprev); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { nmissing++; - if (lostbond == Thermo::ERROR) { - char str[128]; - sprintf(str,"Improper atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT - " missing on proc %d at step " BIGINT_FORMAT, - improper_atom1[iatom][m]+tagprev, - improper_atom2[iatom][m]+tagprev, - improper_atom3[iatom][m]+tagprev, - improper_atom4[iatom][m]+tagprev, - me,update->ntimestep); - error->one(FLERR,str); - } + if (lostbond == Thermo::ERROR) + error->one(FLERR,fmt::format("Improper atoms {} {} {} {}" + " missing on proc {} at step {}", + improper_atom1[iatom][m]+tagprev, + improper_atom2[iatom][m]+tagprev, + improper_atom3[iatom][m]+tagprev, + improper_atom4[iatom][m]+tagprev, + me,update->ntimestep)); continue; } atom1 = domain->closest_image(i,atom1); atom2 = domain->closest_image(i,atom2); atom3 = domain->closest_image(i,atom3); - atom4 = domain-> closest_image(i,atom4); + atom4 = domain->closest_image(i,atom4); if (newton_bond || (i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4)) { if (nimproperlist == maximproper) { @@ -118,10 +114,7 @@ void NTopoImproperTemplate::build() int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all) { - char str[128]; - sprintf(str, - "Improper atoms missing at step " BIGINT_FORMAT,update->ntimestep); - if (me == 0) error->warning(FLERR,str); - } + if (all && (me == 0)) + error->warning(FLERR,fmt::format("Improper atoms missing at step {}", + update->ntimestep)); }