diff --git a/cmake/iwyu/iwyu-extra-map.imp b/cmake/iwyu/iwyu-extra-map.imp index 4fadea73fb..c36b5ffd95 100644 --- a/cmake/iwyu/iwyu-extra-map.imp +++ b/cmake/iwyu/iwyu-extra-map.imp @@ -1,7 +1,10 @@ [ - { include: [ "", private, "", public ] }, - { include: [ "", public, "", public ] }, { include: [ "@", private, "", public ] }, { include: [ "@", private, "\"gtest/gtest.h\"", public ] }, { include: [ "@", private, "\"gmock/gmock.h\"", public ] }, + { include: [ "@", private, "\"gmock/gmock.h\"", public ] }, + { include: [ "@<(cell|c_loops|container).hh>", private, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "", private, "", public ] }, ] diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index 581a8dba99..3c2acbaa7e 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -58,13 +58,16 @@ Report missing and unneeded '#include' statements (CMake only) The conventions for how and when to use and order include statements in LAMMPS are documented in :doc:`Modify_style`. To assist with following these conventions one can use the `Include What You Use tool `_. -This is still under development and for large and complex projects like LAMMPS +This tool is still under development and for large and complex projects like LAMMPS there are some false positives, so suggested changes need to be verified manually. -It is recommended to use at least version 0.14, which has much fewer incorrect -reports than earlier versions. +It is recommended to use at least version 0.16, which has much fewer incorrect +reports than earlier versions. To install the IWYU toolkit, you need to have +the clang compiler **and** its development package installed. Download the IWYU +version that matches the version of the clang compiler, configure, build, and +install it. -The necessary steps to generate the report can be enabled via a -CMake variable: +The necessary steps to generate the report can be enabled via a CMake variable +during CMake configuration. .. code-block:: bash diff --git a/doc/src/Modify_style.rst b/doc/src/Modify_style.rst index 3c56a9397d..50e7afb370 100644 --- a/doc/src/Modify_style.rst +++ b/doc/src/Modify_style.rst @@ -305,19 +305,22 @@ you are uncertain, please ask. FILE pointers and only be done on MPI rank 0. Use the :cpp:func:`utils::logmesg` convenience function where possible. -- header files should only include the absolute minimum number of - include files and **must not** contain any ``using`` statements; - rather the include statements should be put into the corresponding - implementation files. For implementation files, the - "include-what-you-use" principle should be employed. However, when - including the ``pointers.h`` header (or one of the base classes - derived from it) certain headers will be included and thus need to be - specified. These are: `mpi.h`, `cstddef`, `cstdio`, `cstdlib`, - `string`, `utils.h`, `fmt/format.h`, `climits`, `cinttypes`. This also - means any header can assume that `FILE`, `NULL`, and `INT_MAX` are - defined. +- Header files, especially those defining a "style", should only use + the absolute minimum number of include files and **must not** contain + any ``using`` statements. Typically that would be only the header for + the base class. Instead any include statements should be put into the + corresponding implementation files and forward declarations be used. + For implementation files, the "include what you use" principle should + be employed. However, there is the notable exception that when the + ``pointers.h`` header is included (or one of the base classes derived + from it) certain headers will always be included and thus do not need + to be explicitly specified. + These are: `mpi.h`, `cstddef`, `cstdio`, `cstdlib`, `string`, `utils.h`, + `vector`, `fmt/format.h`, `climits`, `cinttypes`. + This also means any such file can assume that `FILE`, `NULL`, and + `INT_MAX` are defined. -- header files that define a new LAMMPS style (i.e. that have a +- Header files that define a new LAMMPS style (i.e. that have a ``SomeStyle(some/name,SomeName);`` macro in them) should only use the include file for the base class and otherwise use forward declarations and pointers; when interfacing to a library use the PIMPL (pointer @@ -325,7 +328,7 @@ you are uncertain, please ask. that contains all library specific data (and thus requires the library header) but use a forward declaration and define the struct only in the implementation file. This is a **strict** requirement since this - is where type clashes between packages and hard to fine bugs have + is where type clashes between packages and hard to find bugs have regularly manifested in the past. - Please use clang-format only to reformat files that you have diff --git a/src/AWPMD/pair_awpmd_cut.cpp b/src/AWPMD/pair_awpmd_cut.cpp index aa740a15ed..682a0dd3d6 100644 --- a/src/AWPMD/pair_awpmd_cut.cpp +++ b/src/AWPMD/pair_awpmd_cut.cpp @@ -39,7 +39,6 @@ #include #include #include -#include using namespace LAMMPS_NS; diff --git a/src/BOCS/fix_bocs.cpp b/src/BOCS/fix_bocs.cpp index 89ff3d8e4e..a3ec4b6b56 100644 --- a/src/BOCS/fix_bocs.cpp +++ b/src/BOCS/fix_bocs.cpp @@ -37,7 +37,6 @@ #include #include -#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/BROWNIAN/fix_brownian.cpp b/src/BROWNIAN/fix_brownian.cpp index b811ede721..4994b304e1 100644 --- a/src/BROWNIAN/fix_brownian.cpp +++ b/src/BROWNIAN/fix_brownian.cpp @@ -20,17 +20,11 @@ #include "fix_brownian.h" #include "atom.h" -#include "comm.h" #include "domain.h" #include "error.h" -#include "force.h" -#include "math_extra.h" -#include "memory.h" #include "random_mars.h" -#include "update.h" #include -#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/BROWNIAN/fix_brownian_asphere.cpp b/src/BROWNIAN/fix_brownian_asphere.cpp index fccc6b5040..c2904aea64 100644 --- a/src/BROWNIAN/fix_brownian_asphere.cpp +++ b/src/BROWNIAN/fix_brownian_asphere.cpp @@ -21,17 +21,10 @@ #include "atom.h" #include "atom_vec_ellipsoid.h" -#include "comm.h" #include "domain.h" #include "error.h" -#include "force.h" #include "math_extra.h" -#include "memory.h" #include "random_mars.h" -#include "update.h" - -#include -#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/BROWNIAN/fix_brownian_base.cpp b/src/BROWNIAN/fix_brownian_base.cpp index 0fa928bebf..369d36bf70 100644 --- a/src/BROWNIAN/fix_brownian_base.cpp +++ b/src/BROWNIAN/fix_brownian_base.cpp @@ -17,15 +17,12 @@ Contributing author: Sam Cameron (University of Bristol) ------------------------------------------------------------------------- */ -#include "fix_brownian.h" +#include "fix_brownian_base.h" -#include "atom.h" #include "comm.h" #include "domain.h" #include "error.h" #include "force.h" -#include "math_extra.h" -#include "memory.h" #include "random_mars.h" #include "update.h" diff --git a/src/BROWNIAN/fix_brownian_sphere.cpp b/src/BROWNIAN/fix_brownian_sphere.cpp index cf835dcdc1..c6664b18ef 100644 --- a/src/BROWNIAN/fix_brownian_sphere.cpp +++ b/src/BROWNIAN/fix_brownian_sphere.cpp @@ -20,17 +20,12 @@ #include "fix_brownian_sphere.h" #include "atom.h" -#include "comm.h" #include "domain.h" #include "error.h" -#include "force.h" #include "math_extra.h" -#include "memory.h" #include "random_mars.h" -#include "update.h" #include -#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/BROWNIAN/fix_propel_self.cpp b/src/BROWNIAN/fix_propel_self.cpp index f2ff366be4..ea7a3c6834 100644 --- a/src/BROWNIAN/fix_propel_self.cpp +++ b/src/BROWNIAN/fix_propel_self.cpp @@ -23,14 +23,11 @@ #include "atom.h" #include "atom_vec_ellipsoid.h" -#include "comm.h" #include "domain.h" #include "error.h" -#include "force.h" #include "math_extra.h" -#include "memory.h" -#include "update.h" +#include #include using namespace LAMMPS_NS; diff --git a/src/CG-DNA/atom_vec_oxdna.cpp b/src/CG-DNA/atom_vec_oxdna.cpp index 2da35b37b3..e1c99d7ca5 100644 --- a/src/CG-DNA/atom_vec_oxdna.cpp +++ b/src/CG-DNA/atom_vec_oxdna.cpp @@ -14,7 +14,6 @@ #include "atom_vec_oxdna.h" #include "atom.h" -#include "comm.h" #include "error.h" #include "force.h" diff --git a/src/CG-DNA/pair_oxdna_stk.cpp b/src/CG-DNA/pair_oxdna_stk.cpp index 2f1a0bf1b6..4980408986 100644 --- a/src/CG-DNA/pair_oxdna_stk.cpp +++ b/src/CG-DNA/pair_oxdna_stk.cpp @@ -19,7 +19,6 @@ #include "atom.h" #include "atom_vec_ellipsoid.h" -#include "atom_vec_oxdna.h" #include "comm.h" #include "error.h" #include "force.h" @@ -30,7 +29,6 @@ #include #include -#include using namespace LAMMPS_NS; using namespace MFOxdna; diff --git a/src/CG-DNA/pair_oxrna2_excv.cpp b/src/CG-DNA/pair_oxrna2_excv.cpp index 2c1e4ca89f..422c7e2d89 100644 --- a/src/CG-DNA/pair_oxrna2_excv.cpp +++ b/src/CG-DNA/pair_oxrna2_excv.cpp @@ -17,8 +17,6 @@ #include "pair_oxrna2_excv.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- diff --git a/src/CG-DNA/pair_oxrna2_stk.cpp b/src/CG-DNA/pair_oxrna2_stk.cpp index 4d733f53b5..18cd798fc7 100644 --- a/src/CG-DNA/pair_oxrna2_stk.cpp +++ b/src/CG-DNA/pair_oxrna2_stk.cpp @@ -19,7 +19,6 @@ #include "atom.h" #include "atom_vec_ellipsoid.h" -#include "atom_vec_oxdna.h" #include "comm.h" #include "error.h" #include "force.h" @@ -31,7 +30,6 @@ #include #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/CG-SDK/pair_lj_sdk_coul_msm.cpp b/src/CG-SDK/pair_lj_sdk_coul_msm.cpp index b05f4043fb..fb7a1fdddc 100644 --- a/src/CG-SDK/pair_lj_sdk_coul_msm.cpp +++ b/src/CG-SDK/pair_lj_sdk_coul_msm.cpp @@ -18,13 +18,15 @@ ------------------------------------------------------------------------- */ #include "pair_lj_sdk_coul_msm.h" -#include -#include + #include "atom.h" +#include "error.h" #include "force.h" #include "kspace.h" #include "neigh_list.h" -#include "error.h" + +#include +#include #include "lj_sdk_common.h" diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index 13cfdc7550..7b5406a7e9 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -25,7 +25,6 @@ #include "math_const.h" #include "memory.h" #include "neighbor.h" -#include "update.h" #include #include diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index f9e4c7bee5..72e146f76d 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -25,7 +25,6 @@ #include "math_const.h" #include "memory.h" #include "neighbor.h" -#include "update.h" #include #include diff --git a/src/COLLOID/fix_wall_colloid.cpp b/src/COLLOID/fix_wall_colloid.cpp index b4441d94e4..6f6374e2ac 100644 --- a/src/COLLOID/fix_wall_colloid.cpp +++ b/src/COLLOID/fix_wall_colloid.cpp @@ -18,10 +18,11 @@ #include "fix_wall_colloid.h" -#include #include "atom.h" #include "error.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/COLVARS/colvarproxy_lammps.cpp b/src/COLVARS/colvarproxy_lammps.cpp index b1c9877599..dd1f7eb06d 100644 --- a/src/COLVARS/colvarproxy_lammps.cpp +++ b/src/COLVARS/colvarproxy_lammps.cpp @@ -10,13 +10,6 @@ #include "colvarproxy_lammps.h" -#include -#include -#include -#include -#include -#include -#include #include "lammps.h" #include "error.h" @@ -26,6 +19,12 @@ #include "colvarmodule.h" #include "colvarproxy.h" +#include +#include +#include +#include +#include + #define HASH_FAIL -1 //////////////////////////////////////////////////////////////////////// diff --git a/src/COLVARS/colvarproxy_lammps.h b/src/COLVARS/colvarproxy_lammps.h index b7b2799802..e10838cc15 100644 --- a/src/COLVARS/colvarproxy_lammps.h +++ b/src/COLVARS/colvarproxy_lammps.h @@ -12,11 +12,6 @@ #include "colvarproxy_lammps_version.h" // IWYU pragma: export -#include -#include -#include -#include - #include "colvarmodule.h" #include "colvarproxy.h" #include "colvartypes.h" diff --git a/src/COLVARS/fix_colvars.cpp b/src/COLVARS/fix_colvars.cpp index cf20c28a7e..5ee77768c6 100644 --- a/src/COLVARS/fix_colvars.cpp +++ b/src/COLVARS/fix_colvars.cpp @@ -44,7 +44,6 @@ #include #include #include -#include static const char colvars_pub[] = "fix colvars command:\n\n" diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index aab9be34e8..38229a71bb 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -12,27 +11,25 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "domain.h" #include "dump_atom_gz.h" + +#include "domain.h" #include "error.h" +#include "file_writer.h" #include "update.h" #include using namespace LAMMPS_NS; -DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : - DumpAtom(lmp, narg, arg) +DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtom(lmp, narg, arg) { - if (!compressed) - error->all(FLERR,"Dump atom/gz only writes compressed files"); + if (!compressed) error->all(FLERR, "Dump atom/gz only writes compressed files"); } /* ---------------------------------------------------------------------- */ -DumpAtomGZ::~DumpAtomGZ() -{ -} +DumpAtomGZ::~DumpAtomGZ() {} /* ---------------------------------------------------------------------- generic opening of a dump file @@ -55,16 +52,15 @@ void DumpAtomGZ::openfile() if (multifile) { char *filestar = filecurrent; filecurrent = new char[strlen(filestar) + 16]; - char *ptr = strchr(filestar,'*'); + char *ptr = strchr(filestar, '*'); *ptr = '\0'; if (padflag == 0) - sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", - filestar,update->ntimestep,ptr+1); + sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1); else { - char bif[8],pad[16]; - strcpy(bif,BIGINT_FORMAT); - sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); - sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + char bif[8], pad[16]; + strcpy(bif, BIGINT_FORMAT); + sprintf(pad, "%%s%%0%d%s%%s", padflag, &bif[1]); + sprintf(filecurrent, pad, filestar, update->ntimestep, ptr + 1); } *ptr = '*'; if (maxfiles > 0) { @@ -94,7 +90,7 @@ void DumpAtomGZ::openfile() // delete string with timestep replaced - if (multifile) delete [] filecurrent; + if (multifile) delete[] filecurrent; } /* ---------------------------------------------------------------------- */ @@ -106,12 +102,10 @@ void DumpAtomGZ::write_header(bigint ndump) if ((multiproc) || (!multiproc && me == 0)) { if (unit_flag && !unit_count) { ++unit_count; - header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); + header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style); } - if (time_flag) { - header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); - } + if (time_flag) { header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); } header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump); @@ -145,14 +139,14 @@ void DumpAtomGZ::write_data(int n, double *mybuf) for (int i = 0; i < n; i++) { int written = 0; if (image_flag == 1) { - written = snprintf(vbuffer, VBUFFER_SIZE, format, - static_cast (mybuf[m]), static_cast (mybuf[m+1]), - mybuf[m+2],mybuf[m+3],mybuf[m+4], static_cast (mybuf[m+5]), - static_cast (mybuf[m+6]), static_cast (mybuf[m+7])); + written = snprintf(vbuffer, VBUFFER_SIZE, format, static_cast(mybuf[m]), + static_cast(mybuf[m + 1]), mybuf[m + 2], mybuf[m + 3], mybuf[m + 4], + static_cast(mybuf[m + 5]), static_cast(mybuf[m + 6]), + static_cast(mybuf[m + 7])); } else { - written = snprintf(vbuffer, VBUFFER_SIZE, format, - static_cast (mybuf[m]), static_cast (mybuf[m+1]), - mybuf[m+2],mybuf[m+3],mybuf[m+4]); + written = + snprintf(vbuffer, VBUFFER_SIZE, format, static_cast(mybuf[m]), + static_cast(mybuf[m + 1]), mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]); } if (written > 0) { writer.write(vbuffer, written); @@ -174,9 +168,7 @@ void DumpAtomGZ::write() if (multifile) { writer.close(); } else { - if (flush_flag && writer.isopen()) { - writer.flush(); - } + if (flush_flag && writer.isopen()) { writer.flush(); } } } } @@ -188,14 +180,14 @@ int DumpAtomGZ::modify_param(int narg, char **arg) int consumed = DumpAtom::modify_param(narg, arg); if (consumed == 0) { try { - if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[0], "compression_level") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); writer.setCompressionLevel(compression_level); return 2; } } catch (FileWriterException &e) { - error->one(FLERR,"Illegal dump_modify command: {}", e.what()); + error->one(FLERR, "Illegal dump_modify command: {}", e.what()); } } return consumed; diff --git a/src/COMPRESS/dump_atom_zstd.cpp b/src/COMPRESS/dump_atom_zstd.cpp index bb837fc7ef..aa9d14b324 100644 --- a/src/COMPRESS/dump_atom_zstd.cpp +++ b/src/COMPRESS/dump_atom_zstd.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -19,6 +18,7 @@ #ifdef LAMMPS_ZSTD #include "domain.h" + #include "dump_atom_zstd.h" #include "error.h" #include "file_writer.h" @@ -26,21 +26,16 @@ #include - using namespace LAMMPS_NS; -DumpAtomZstd::DumpAtomZstd(LAMMPS *lmp, int narg, char **arg) : - DumpAtom(lmp, narg, arg) +DumpAtomZstd::DumpAtomZstd(LAMMPS *lmp, int narg, char **arg) : DumpAtom(lmp, narg, arg) { - if (!compressed) - error->all(FLERR,"Dump atom/zstd only writes compressed files"); + if (!compressed) error->all(FLERR, "Dump atom/zstd only writes compressed files"); } /* ---------------------------------------------------------------------- */ -DumpAtomZstd::~DumpAtomZstd() -{ -} +DumpAtomZstd::~DumpAtomZstd() {} /* ---------------------------------------------------------------------- generic opening of a dump file @@ -63,16 +58,15 @@ void DumpAtomZstd::openfile() if (multifile) { char *filestar = filecurrent; filecurrent = new char[strlen(filestar) + 16]; - char *ptr = strchr(filestar,'*'); + char *ptr = strchr(filestar, '*'); *ptr = '\0'; if (padflag == 0) - sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", - filestar,update->ntimestep,ptr+1); + sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1); else { - char bif[8],pad[16]; - strcpy(bif,BIGINT_FORMAT); - sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); - sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + char bif[8], pad[16]; + strcpy(bif, BIGINT_FORMAT); + sprintf(pad, "%%s%%0%d%s%%s", padflag, &bif[1]); + sprintf(filecurrent, pad, filestar, update->ntimestep, ptr + 1); } *ptr = '*'; if (maxfiles > 0) { @@ -102,7 +96,7 @@ void DumpAtomZstd::openfile() // delete string with timestep replaced - if (multifile) delete [] filecurrent; + if (multifile) delete[] filecurrent; } /* ---------------------------------------------------------------------- */ @@ -114,12 +108,10 @@ void DumpAtomZstd::write_header(bigint ndump) if ((multiproc) || (!multiproc && me == 0)) { if (unit_flag && !unit_count) { ++unit_count; - header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); + header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style); } - if (time_flag) { - header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); - } + if (time_flag) { header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); } header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump); @@ -153,14 +145,14 @@ void DumpAtomZstd::write_data(int n, double *mybuf) for (int i = 0; i < n; i++) { int written = 0; if (image_flag == 1) { - written = snprintf(vbuffer, VBUFFER_SIZE, format, - static_cast (mybuf[m]), static_cast (mybuf[m+1]), - mybuf[m+2],mybuf[m+3],mybuf[m+4], static_cast (mybuf[m+5]), - static_cast (mybuf[m+6]), static_cast (mybuf[m+7])); + written = snprintf(vbuffer, VBUFFER_SIZE, format, static_cast(mybuf[m]), + static_cast(mybuf[m + 1]), mybuf[m + 2], mybuf[m + 3], mybuf[m + 4], + static_cast(mybuf[m + 5]), static_cast(mybuf[m + 6]), + static_cast(mybuf[m + 7])); } else { - written = snprintf(vbuffer, VBUFFER_SIZE, format, - static_cast (mybuf[m]), static_cast (mybuf[m+1]), - mybuf[m+2],mybuf[m+3],mybuf[m+4]); + written = + snprintf(vbuffer, VBUFFER_SIZE, format, static_cast(mybuf[m]), + static_cast(mybuf[m + 1]), mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]); } if (written > 0) { writer.write(vbuffer, written); @@ -182,9 +174,7 @@ void DumpAtomZstd::write() if (multifile) { writer.close(); } else { - if (flush_flag && writer.isopen()) { - writer.flush(); - } + if (flush_flag && writer.isopen()) { writer.flush(); } } } } @@ -196,20 +186,23 @@ int DumpAtomZstd::modify_param(int narg, char **arg) int consumed = DumpAtom::modify_param(narg, arg); if (consumed == 0) { try { - if (strcmp(arg[0],"checksum") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); - else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); - else error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[0], "checksum") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); + if (strcmp(arg[1], "yes") == 0) + writer.setChecksum(true); + else if (strcmp(arg[1], "no") == 0) + writer.setChecksum(false); + else + error->all(FLERR, "Illegal dump_modify command"); return 2; - } else if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + } else if (strcmp(arg[0], "compression_level") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); writer.setCompressionLevel(compression_level); return 2; } } catch (FileWriterException &e) { - error->one(FLERR,"Illegal dump_modify command: {}", e.what()); + error->one(FLERR, "Illegal dump_modify command: {}", e.what()); } } return consumed; diff --git a/src/COMPRESS/dump_cfg_gz.cpp b/src/COMPRESS/dump_cfg_gz.cpp index 37c4fb3536..ea51ce87c3 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -12,10 +11,12 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +#include "dump_cfg_gz.h" + #include "atom.h" #include "domain.h" -#include "dump_cfg_gz.h" #include "error.h" +#include "file_writer.h" #include "update.h" #include @@ -23,18 +24,14 @@ using namespace LAMMPS_NS; #define UNWRAPEXPAND 10.0 -DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : - DumpCFG(lmp, narg, arg) +DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : DumpCFG(lmp, narg, arg) { - if (!compressed) - error->all(FLERR,"Dump cfg/gz only writes compressed files"); + if (!compressed) error->all(FLERR, "Dump cfg/gz only writes compressed files"); } /* ---------------------------------------------------------------------- */ -DumpCFGGZ::~DumpCFGGZ() -{ -} +DumpCFGGZ::~DumpCFGGZ() {} /* ---------------------------------------------------------------------- generic opening of a dump file @@ -57,16 +54,15 @@ void DumpCFGGZ::openfile() if (multifile) { char *filestar = filecurrent; filecurrent = new char[strlen(filestar) + 16]; - char *ptr = strchr(filestar,'*'); + char *ptr = strchr(filestar, '*'); *ptr = '\0'; if (padflag == 0) - sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", - filestar,update->ntimestep,ptr+1); + sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1); else { - char bif[8],pad[16]; - strcpy(bif,BIGINT_FORMAT); - sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); - sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + char bif[8], pad[16]; + strcpy(bif, BIGINT_FORMAT); + sprintf(pad, "%%s%%0%d%s%%s", padflag, &bif[1]); + sprintf(filecurrent, pad, filestar, update->ntimestep, ptr + 1); } *ptr = '*'; if (maxfiles > 0) { @@ -96,7 +92,7 @@ void DumpCFGGZ::openfile() // delete string with timestep replaced - if (multifile) delete [] filecurrent; + if (multifile) delete[] filecurrent; } /* ---------------------------------------------------------------------- */ @@ -111,24 +107,25 @@ void DumpCFGGZ::write_header(bigint n) // so molecules are not split across periodic box boundaries double scale = 1.0; - if (atom->peri_flag) scale = atom->pdscale; - else if (unwrapflag == 1) scale = UNWRAPEXPAND; + if (atom->peri_flag) + scale = atom->pdscale; + else if (unwrapflag == 1) + scale = UNWRAPEXPAND; std::string header = fmt::format("Number of particles = {}\n", n); header += fmt::format("A = {0:g} Angstrom (basic length-scale)\n", scale); - header += fmt::format("H0(1,1) = {0:g} A\n",domain->xprd); + header += fmt::format("H0(1,1) = {0:g} A\n", domain->xprd); header += fmt::format("H0(1,2) = 0 A \n"); header += fmt::format("H0(1,3) = 0 A \n"); - header += fmt::format("H0(2,1) = {0:g} A \n",domain->xy); - header += fmt::format("H0(2,2) = {0:g} A\n",domain->yprd); + header += fmt::format("H0(2,1) = {0:g} A \n", domain->xy); + header += fmt::format("H0(2,2) = {0:g} A\n", domain->yprd); header += fmt::format("H0(2,3) = 0 A \n"); - header += fmt::format("H0(3,1) = {0:g} A \n",domain->xz); - header += fmt::format("H0(3,2) = {0:g} A \n",domain->yz); - header += fmt::format("H0(3,3) = {0:g} A\n",domain->zprd); + header += fmt::format("H0(3,1) = {0:g} A \n", domain->xz); + header += fmt::format("H0(3,2) = {0:g} A \n", domain->yz); + header += fmt::format("H0(3,3) = {0:g} A\n", domain->zprd); header += fmt::format(".NO_VELOCITY.\n"); - header += fmt::format("entry_count = {}\n",nfield-2); - for (int i = 0; i < nfield-5; i++) - header += fmt::format("auxiliary[{}] = {}\n",i,auxname[i]); + header += fmt::format("entry_count = {}\n", nfield - 2); + for (int i = 0; i < nfield - 5; i++) header += fmt::format("auxiliary[{}] = {}\n", i, auxname[i]); writer.write(header.c_str(), header.length()); } @@ -153,13 +150,13 @@ void DumpCFGGZ::write_data(int n, double *mybuf) written = snprintf(vbuffer, VBUFFER_SIZE, "%s \n", typenames[(int) mybuf[m]]); } else if (j >= 2) { if (vtype[j] == Dump::INT) - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); else if (vtype[j] == Dump::DOUBLE) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); else if (vtype[j] == Dump::STRING) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); else if (vtype[j] == Dump::BIGINT) - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } if (written > 0) { writer.write(vbuffer, written); @@ -180,17 +177,17 @@ void DumpCFGGZ::write_data(int n, double *mybuf) } else if (j == 1) { written = snprintf(vbuffer, VBUFFER_SIZE, "%s \n", typenames[(int) mybuf[m]]); } else if (j >= 2 && j <= 4) { - double unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; + double unwrap_coord = (mybuf[m] - 0.5) / UNWRAPEXPAND + 0.5; written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], unwrap_coord); } else if (j >= 5) { if (vtype[j] == Dump::INT) - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); else if (vtype[j] == Dump::DOUBLE) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); else if (vtype[j] == Dump::STRING) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); else if (vtype[j] == Dump::BIGINT) - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } if (written > 0) { writer.write(vbuffer, written); @@ -214,9 +211,7 @@ void DumpCFGGZ::write() if (multifile) { writer.close(); } else { - if (flush_flag && writer.isopen()) { - writer.flush(); - } + if (flush_flag && writer.isopen()) { writer.flush(); } } } } @@ -228,14 +223,14 @@ int DumpCFGGZ::modify_param(int narg, char **arg) int consumed = DumpCFG::modify_param(narg, arg); if (consumed == 0) { try { - if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[0], "compression_level") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); writer.setCompressionLevel(compression_level); return 2; } } catch (FileWriterException &e) { - error->one(FLERR,"Illegal dump_modify command: {}", e.what()); + error->one(FLERR, "Illegal dump_modify command: {}", e.what()); } } return consumed; diff --git a/src/COMPRESS/dump_cfg_zstd.cpp b/src/COMPRESS/dump_cfg_zstd.cpp index eb725491bb..15ea1e540c 100644 --- a/src/COMPRESS/dump_cfg_zstd.cpp +++ b/src/COMPRESS/dump_cfg_zstd.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -18,10 +17,12 @@ #ifdef LAMMPS_ZSTD +#include "dump_cfg_zstd.h" + #include "atom.h" #include "domain.h" -#include "dump_cfg_zstd.h" #include "error.h" +#include "file_writer.h" #include "update.h" #include @@ -29,20 +30,14 @@ using namespace LAMMPS_NS; #define UNWRAPEXPAND 10.0 -DumpCFGZstd::DumpCFGZstd(LAMMPS *lmp, int narg, char **arg) : - DumpCFG(lmp, narg, arg) +DumpCFGZstd::DumpCFGZstd(LAMMPS *lmp, int narg, char **arg) : DumpCFG(lmp, narg, arg) { - if (!compressed) - error->all(FLERR,"Dump cfg/zstd only writes compressed files"); + if (!compressed) error->all(FLERR, "Dump cfg/zstd only writes compressed files"); } - /* ---------------------------------------------------------------------- */ -DumpCFGZstd::~DumpCFGZstd() -{ -} - +DumpCFGZstd::~DumpCFGZstd() {} /* ---------------------------------------------------------------------- generic opening of a dump file @@ -65,16 +60,15 @@ void DumpCFGZstd::openfile() if (multifile) { char *filestar = filecurrent; filecurrent = new char[strlen(filestar) + 16]; - char *ptr = strchr(filestar,'*'); + char *ptr = strchr(filestar, '*'); *ptr = '\0'; if (padflag == 0) - sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", - filestar,update->ntimestep,ptr+1); + sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1); else { - char bif[8],pad[16]; - strcpy(bif,BIGINT_FORMAT); - sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); - sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + char bif[8], pad[16]; + strcpy(bif, BIGINT_FORMAT); + sprintf(pad, "%%s%%0%d%s%%s", padflag, &bif[1]); + sprintf(filecurrent, pad, filestar, update->ntimestep, ptr + 1); } *ptr = '*'; if (maxfiles > 0) { @@ -95,9 +89,7 @@ void DumpCFGZstd::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { - if (append_flag) { - error->one(FLERR, "dump cfg/zstd currently doesn't support append"); - } + if (append_flag) { error->one(FLERR, "dump cfg/zstd currently doesn't support append"); } try { writer.open(filecurrent); @@ -108,7 +100,7 @@ void DumpCFGZstd::openfile() // delete string with timestep replaced - if (multifile) delete [] filecurrent; + if (multifile) delete[] filecurrent; } /* ---------------------------------------------------------------------- */ @@ -123,24 +115,25 @@ void DumpCFGZstd::write_header(bigint n) // so molecules are not split across periodic box boundaries double scale = 1.0; - if (atom->peri_flag) scale = atom->pdscale; - else if (unwrapflag == 1) scale = UNWRAPEXPAND; + if (atom->peri_flag) + scale = atom->pdscale; + else if (unwrapflag == 1) + scale = UNWRAPEXPAND; std::string header = fmt::format("Number of particles = {}\n", n); header += fmt::format("A = {0:g} Angstrom (basic length-scale)\n", scale); - header += fmt::format("H0(1,1) = {0:g} A\n",domain->xprd); + header += fmt::format("H0(1,1) = {0:g} A\n", domain->xprd); header += fmt::format("H0(1,2) = 0 A \n"); header += fmt::format("H0(1,3) = 0 A \n"); - header += fmt::format("H0(2,1) = {0:g} A \n",domain->xy); - header += fmt::format("H0(2,2) = {0:g} A\n",domain->yprd); + header += fmt::format("H0(2,1) = {0:g} A \n", domain->xy); + header += fmt::format("H0(2,2) = {0:g} A\n", domain->yprd); header += fmt::format("H0(2,3) = 0 A \n"); - header += fmt::format("H0(3,1) = {0:g} A \n",domain->xz); - header += fmt::format("H0(3,2) = {0:g} A \n",domain->yz); - header += fmt::format("H0(3,3) = {0:g} A\n",domain->zprd); + header += fmt::format("H0(3,1) = {0:g} A \n", domain->xz); + header += fmt::format("H0(3,2) = {0:g} A \n", domain->yz); + header += fmt::format("H0(3,3) = {0:g} A\n", domain->zprd); header += fmt::format(".NO_VELOCITY.\n"); - header += fmt::format("entry_count = {}\n",nfield-2); - for (int i = 0; i < nfield-5; i++) - header += fmt::format("auxiliary[{}] = {}\n",i,auxname[i]); + header += fmt::format("entry_count = {}\n", nfield - 2); + for (int i = 0; i < nfield - 5; i++) header += fmt::format("auxiliary[{}] = {}\n", i, auxname[i]); writer.write(header.c_str(), header.length()); } @@ -165,13 +158,13 @@ void DumpCFGZstd::write_data(int n, double *mybuf) written = snprintf(vbuffer, VBUFFER_SIZE, "%s \n", typenames[(int) mybuf[m]]); } else if (j >= 2) { if (vtype[j] == Dump::INT) - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); else if (vtype[j] == Dump::DOUBLE) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); else if (vtype[j] == Dump::STRING) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); else if (vtype[j] == Dump::BIGINT) - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } if (written > 0) { writer.write(vbuffer, written); @@ -192,17 +185,17 @@ void DumpCFGZstd::write_data(int n, double *mybuf) } else if (j == 1) { written = snprintf(vbuffer, VBUFFER_SIZE, "%s \n", typenames[(int) mybuf[m]]); } else if (j >= 2 && j <= 4) { - double unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; + double unwrap_coord = (mybuf[m] - 0.5) / UNWRAPEXPAND + 0.5; written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], unwrap_coord); } else if (j >= 5) { if (vtype[j] == Dump::INT) - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); else if (vtype[j] == Dump::DOUBLE) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); else if (vtype[j] == Dump::STRING) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); else if (vtype[j] == Dump::BIGINT) - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } if (written > 0) { writer.write(vbuffer, written); @@ -226,9 +219,7 @@ void DumpCFGZstd::write() if (multifile) { writer.close(); } else { - if (flush_flag && writer.isopen()) { - writer.flush(); - } + if (flush_flag && writer.isopen()) { writer.flush(); } } } } @@ -240,14 +231,17 @@ int DumpCFGZstd::modify_param(int narg, char **arg) int consumed = DumpCFG::modify_param(narg, arg); if (consumed == 0) { try { - if (strcmp(arg[0],"checksum") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); - else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); - else error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[0], "checksum") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); + if (strcmp(arg[1], "yes") == 0) + writer.setChecksum(true); + else if (strcmp(arg[1], "no") == 0) + writer.setChecksum(false); + else + error->all(FLERR, "Illegal dump_modify command"); return 2; - } else if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + } else if (strcmp(arg[0], "compression_level") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); writer.setCompressionLevel(compression_level); return 2; diff --git a/src/COMPRESS/dump_custom_gz.cpp b/src/COMPRESS/dump_custom_gz.cpp index 3fa9fb4516..7cbab10cb4 100644 --- a/src/COMPRESS/dump_custom_gz.cpp +++ b/src/COMPRESS/dump_custom_gz.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -12,27 +11,25 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "domain.h" #include "dump_custom_gz.h" + +#include "domain.h" #include "error.h" +#include "file_writer.h" #include "update.h" #include using namespace LAMMPS_NS; -DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : - DumpCustom(lmp, narg, arg) +DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : DumpCustom(lmp, narg, arg) { - if (!compressed) - error->all(FLERR,"Dump custom/gz only writes compressed files"); + if (!compressed) error->all(FLERR, "Dump custom/gz only writes compressed files"); } /* ---------------------------------------------------------------------- */ -DumpCustomGZ::~DumpCustomGZ() -{ -} +DumpCustomGZ::~DumpCustomGZ() {} /* ---------------------------------------------------------------------- generic opening of a dump file @@ -55,16 +52,15 @@ void DumpCustomGZ::openfile() if (multifile) { char *filestar = filecurrent; filecurrent = new char[strlen(filestar) + 16]; - char *ptr = strchr(filestar,'*'); + char *ptr = strchr(filestar, '*'); *ptr = '\0'; if (padflag == 0) - sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", - filestar,update->ntimestep,ptr+1); + sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1); else { - char bif[8],pad[16]; - strcpy(bif,BIGINT_FORMAT); - sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); - sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + char bif[8], pad[16]; + strcpy(bif, BIGINT_FORMAT); + sprintf(pad, "%%s%%0%d%s%%s", padflag, &bif[1]); + sprintf(filecurrent, pad, filestar, update->ntimestep, ptr + 1); } *ptr = '*'; if (maxfiles > 0) { @@ -94,7 +90,7 @@ void DumpCustomGZ::openfile() // delete string with timestep replaced - if (multifile) delete [] filecurrent; + if (multifile) delete[] filecurrent; } void DumpCustomGZ::write_header(bigint ndump) @@ -104,12 +100,10 @@ void DumpCustomGZ::write_header(bigint ndump) if ((multiproc) || (!multiproc && me == 0)) { if (unit_flag && !unit_count) { ++unit_count; - header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); + header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style); } - if (time_flag) { - header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); - } + if (time_flag) { header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); } header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump); @@ -144,13 +138,13 @@ void DumpCustomGZ::write_data(int n, double *mybuf) for (int j = 0; j < nfield; j++) { int written = 0; if (vtype[j] == Dump::INT) { - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } else if (vtype[j] == Dump::DOUBLE) { written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); } else if (vtype[j] == Dump::STRING) { written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], typenames[(int) mybuf[m]]); } else if (vtype[j] == Dump::BIGINT) { - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } if (written > 0) { @@ -174,9 +168,7 @@ void DumpCustomGZ::write() if (multifile) { writer.close(); } else { - if (flush_flag && writer.isopen()) { - writer.flush(); - } + if (flush_flag && writer.isopen()) { writer.flush(); } } } } @@ -188,14 +180,14 @@ int DumpCustomGZ::modify_param(int narg, char **arg) int consumed = DumpCustom::modify_param(narg, arg); if (consumed == 0) { try { - if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[0], "compression_level") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); writer.setCompressionLevel(compression_level); return 2; } } catch (FileWriterException &e) { - error->one(FLERR,"Illegal dump_modify command: {}", e.what()); + error->one(FLERR, "Illegal dump_modify command: {}", e.what()); } } return consumed; diff --git a/src/COMPRESS/dump_custom_zstd.cpp b/src/COMPRESS/dump_custom_zstd.cpp index 9580644567..3824709d5e 100644 --- a/src/COMPRESS/dump_custom_zstd.cpp +++ b/src/COMPRESS/dump_custom_zstd.cpp @@ -18,8 +18,10 @@ #ifdef LAMMPS_ZSTD -#include "domain.h" #include "dump_custom_zstd.h" + +#include "file_writer.h" +#include "domain.h" #include "error.h" #include "update.h" diff --git a/src/COMPRESS/dump_custom_zstd.h b/src/COMPRESS/dump_custom_zstd.h index fb8c7c7543..a687cfb928 100644 --- a/src/COMPRESS/dump_custom_zstd.h +++ b/src/COMPRESS/dump_custom_zstd.h @@ -28,7 +28,6 @@ DumpStyle(custom/zstd,DumpCustomZstd); #include "dump_custom.h" #include "zstd_file_writer.h" -#include namespace LAMMPS_NS { diff --git a/src/COMPRESS/dump_local_gz.cpp b/src/COMPRESS/dump_local_gz.cpp index 4d5faeeb9e..206e2aeb09 100644 --- a/src/COMPRESS/dump_local_gz.cpp +++ b/src/COMPRESS/dump_local_gz.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -12,27 +11,25 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "domain.h" #include "dump_local_gz.h" + +#include "domain.h" #include "error.h" +#include "file_writer.h" #include "update.h" #include using namespace LAMMPS_NS; -DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : - DumpLocal(lmp, narg, arg) +DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocal(lmp, narg, arg) { - if (!compressed) - error->all(FLERR,"Dump local/gz only writes compressed files"); + if (!compressed) error->all(FLERR, "Dump local/gz only writes compressed files"); } /* ---------------------------------------------------------------------- */ -DumpLocalGZ::~DumpLocalGZ() -{ -} +DumpLocalGZ::~DumpLocalGZ() {} /* ---------------------------------------------------------------------- generic opening of a dump file @@ -55,16 +52,15 @@ void DumpLocalGZ::openfile() if (multifile) { char *filestar = filecurrent; filecurrent = new char[strlen(filestar) + 16]; - char *ptr = strchr(filestar,'*'); + char *ptr = strchr(filestar, '*'); *ptr = '\0'; if (padflag == 0) - sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", - filestar,update->ntimestep,ptr+1); + sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1); else { - char bif[8],pad[16]; - strcpy(bif,BIGINT_FORMAT); - sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); - sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + char bif[8], pad[16]; + strcpy(bif, BIGINT_FORMAT); + sprintf(pad, "%%s%%0%d%s%%s", padflag, &bif[1]); + sprintf(filecurrent, pad, filestar, update->ntimestep, ptr + 1); } *ptr = '*'; if (maxfiles > 0) { @@ -94,7 +90,7 @@ void DumpLocalGZ::openfile() // delete string with timestep replaced - if (multifile) delete [] filecurrent; + if (multifile) delete[] filecurrent; } void DumpLocalGZ::write_header(bigint ndump) @@ -104,12 +100,10 @@ void DumpLocalGZ::write_header(bigint ndump) if ((multiproc) || (!multiproc && me == 0)) { if (unit_flag && !unit_count) { ++unit_count; - header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); + header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style); } - if (time_flag) { - header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); - } + if (time_flag) { header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); } header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); header += fmt::format("ITEM: NUMBER OF {}\n{}\n", label, ndump); @@ -135,7 +129,7 @@ void DumpLocalGZ::write_header(bigint ndump) void DumpLocalGZ::write_data(int n, double *mybuf) { if (buffer_flag == 1) { - writer.write(mybuf, sizeof(char)*n); + writer.write(mybuf, sizeof(char) * n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -144,11 +138,11 @@ void DumpLocalGZ::write_data(int n, double *mybuf) for (int j = 0; j < size_one; j++) { int written = 0; if (vtype[j] == Dump::INT) { - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } else if (vtype[j] == Dump::DOUBLE) { written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); } else if (vtype[j] == Dump::BIGINT) { - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } else { written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); } @@ -174,9 +168,7 @@ void DumpLocalGZ::write() if (multifile) { writer.close(); } else { - if (flush_flag && writer.isopen()) { - writer.flush(); - } + if (flush_flag && writer.isopen()) { writer.flush(); } } } } @@ -188,14 +180,14 @@ int DumpLocalGZ::modify_param(int narg, char **arg) int consumed = DumpLocal::modify_param(narg, arg); if (consumed == 0) { try { - if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[0], "compression_level") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); writer.setCompressionLevel(compression_level); return 2; } } catch (FileWriterException &e) { - error->one(FLERR,"Illegal dump_modify command: {}", e.what()); + error->one(FLERR, "Illegal dump_modify command: {}", e.what()); } } return consumed; diff --git a/src/COMPRESS/dump_local_zstd.cpp b/src/COMPRESS/dump_local_zstd.cpp index 4f386a8231..cf233aff19 100644 --- a/src/COMPRESS/dump_local_zstd.cpp +++ b/src/COMPRESS/dump_local_zstd.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -18,28 +17,25 @@ #ifdef LAMMPS_ZSTD -#include "domain.h" #include "dump_local_zstd.h" + +#include "domain.h" #include "error.h" +#include "file_writer.h" #include "update.h" #include using namespace LAMMPS_NS; -DumpLocalZstd::DumpLocalZstd(LAMMPS *lmp, int narg, char **arg) : - DumpLocal(lmp, narg, arg) +DumpLocalZstd::DumpLocalZstd(LAMMPS *lmp, int narg, char **arg) : DumpLocal(lmp, narg, arg) { - if (!compressed) - error->all(FLERR,"Dump local/zstd only writes compressed files"); + if (!compressed) error->all(FLERR, "Dump local/zstd only writes compressed files"); } - /* ---------------------------------------------------------------------- */ -DumpLocalZstd::~DumpLocalZstd() -{ -} +DumpLocalZstd::~DumpLocalZstd() {} /* ---------------------------------------------------------------------- generic opening of a dump file @@ -62,16 +58,15 @@ void DumpLocalZstd::openfile() if (multifile) { char *filestar = filecurrent; filecurrent = new char[strlen(filestar) + 16]; - char *ptr = strchr(filestar,'*'); + char *ptr = strchr(filestar, '*'); *ptr = '\0'; if (padflag == 0) - sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", - filestar,update->ntimestep,ptr+1); + sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1); else { - char bif[8],pad[16]; - strcpy(bif,BIGINT_FORMAT); - sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); - sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + char bif[8], pad[16]; + strcpy(bif, BIGINT_FORMAT); + sprintf(pad, "%%s%%0%d%s%%s", padflag, &bif[1]); + sprintf(filecurrent, pad, filestar, update->ntimestep, ptr + 1); } *ptr = '*'; if (maxfiles > 0) { @@ -92,9 +87,7 @@ void DumpLocalZstd::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { - if (append_flag) { - error->one(FLERR, "dump cfg/zstd currently doesn't support append"); - } + if (append_flag) { error->one(FLERR, "dump cfg/zstd currently doesn't support append"); } try { writer.open(filecurrent); @@ -105,7 +98,7 @@ void DumpLocalZstd::openfile() // delete string with timestep replaced - if (multifile) delete [] filecurrent; + if (multifile) delete[] filecurrent; } void DumpLocalZstd::write_header(bigint ndump) @@ -115,12 +108,10 @@ void DumpLocalZstd::write_header(bigint ndump) if ((multiproc) || (!multiproc && me == 0)) { if (unit_flag && !unit_count) { ++unit_count; - header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); + header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style); } - if (time_flag) { - header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); - } + if (time_flag) { header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); } header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); header += fmt::format("ITEM: NUMBER OF {}\n{}\n", label, ndump); @@ -146,7 +137,7 @@ void DumpLocalZstd::write_header(bigint ndump) void DumpLocalZstd::write_data(int n, double *mybuf) { if (buffer_flag == 1) { - writer.write(mybuf, sizeof(char)*n); + writer.write(mybuf, sizeof(char) * n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -155,11 +146,11 @@ void DumpLocalZstd::write_data(int n, double *mybuf) for (int j = 0; j < size_one; j++) { int written = 0; if (vtype[j] == Dump::INT) { - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } else if (vtype[j] == Dump::DOUBLE) { written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); } else if (vtype[j] == Dump::BIGINT) { - written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast (mybuf[m])); + written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } else { written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], mybuf[m]); } @@ -185,9 +176,7 @@ void DumpLocalZstd::write() if (multifile) { writer.close(); } else { - if (flush_flag && writer.isopen()) { - writer.flush(); - } + if (flush_flag && writer.isopen()) { writer.flush(); } } } } @@ -199,20 +188,23 @@ int DumpLocalZstd::modify_param(int narg, char **arg) int consumed = DumpLocal::modify_param(narg, arg); if (consumed == 0) { try { - if (strcmp(arg[0],"checksum") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); - else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); - else error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[0], "checksum") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); + if (strcmp(arg[1], "yes") == 0) + writer.setChecksum(true); + else if (strcmp(arg[1], "no") == 0) + writer.setChecksum(false); + else + error->all(FLERR, "Illegal dump_modify command"); return 2; - } else if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + } else if (strcmp(arg[0], "compression_level") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); writer.setCompressionLevel(compression_level); return 2; } } catch (FileWriterException &e) { - error->one(FLERR,"Illegal dump_modify command: {}", e.what()); + error->one(FLERR, "Illegal dump_modify command: {}", e.what()); } } return consumed; diff --git a/src/COMPRESS/dump_xyz_gz.cpp b/src/COMPRESS/dump_xyz_gz.cpp index ac4efebe4b..a1acad7fc2 100644 --- a/src/COMPRESS/dump_xyz_gz.cpp +++ b/src/COMPRESS/dump_xyz_gz.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -13,26 +12,23 @@ ------------------------------------------------------------------------- */ #include "dump_xyz_gz.h" + #include "error.h" +#include "file_writer.h" #include "update.h" #include using namespace LAMMPS_NS; -DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : - DumpXYZ(lmp, narg, arg) +DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZ(lmp, narg, arg) { - if (!compressed) - error->all(FLERR,"Dump xyz/gz only writes compressed files"); + if (!compressed) error->all(FLERR, "Dump xyz/gz only writes compressed files"); } - /* ---------------------------------------------------------------------- */ -DumpXYZGZ::~DumpXYZGZ() -{ -} +DumpXYZGZ::~DumpXYZGZ() {} /* ---------------------------------------------------------------------- generic opening of a dump file @@ -55,16 +51,15 @@ void DumpXYZGZ::openfile() if (multifile) { char *filestar = filecurrent; filecurrent = new char[strlen(filestar) + 16]; - char *ptr = strchr(filestar,'*'); + char *ptr = strchr(filestar, '*'); *ptr = '\0'; if (padflag == 0) - sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", - filestar,update->ntimestep,ptr+1); + sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1); else { - char bif[8],pad[16]; - strcpy(bif,BIGINT_FORMAT); - sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); - sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + char bif[8], pad[16]; + strcpy(bif, BIGINT_FORMAT); + sprintf(pad, "%%s%%0%d%s%%s", padflag, &bif[1]); + sprintf(filecurrent, pad, filestar, update->ntimestep, ptr + 1); } *ptr = '*'; if (maxfiles > 0) { @@ -94,7 +89,7 @@ void DumpXYZGZ::openfile() // delete string with timestep replaced - if (multifile) delete [] filecurrent; + if (multifile) delete[] filecurrent; } void DumpXYZGZ::write_header(bigint ndump) @@ -117,9 +112,9 @@ void DumpXYZGZ::write_data(int n, double *mybuf) char vbuffer[VBUFFER_SIZE]; int m = 0; for (int i = 0; i < n; i++) { - int written = snprintf(vbuffer, VBUFFER_SIZE, format, - typenames[static_cast (mybuf[m+1])], - mybuf[m+2],mybuf[m+3],mybuf[m+4]); + int written = + snprintf(vbuffer, VBUFFER_SIZE, format, typenames[static_cast(mybuf[m + 1])], + mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]); if (written > 0) { writer.write(vbuffer, written); } else if (written < 0) { @@ -139,9 +134,7 @@ void DumpXYZGZ::write() if (multifile) { writer.close(); } else { - if (flush_flag && writer.isopen()) { - writer.flush(); - } + if (flush_flag && writer.isopen()) { writer.flush(); } } } } @@ -153,14 +146,14 @@ int DumpXYZGZ::modify_param(int narg, char **arg) int consumed = DumpXYZ::modify_param(narg, arg); if (consumed == 0) { try { - if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[0], "compression_level") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); writer.setCompressionLevel(compression_level); return 2; } } catch (FileWriterException &e) { - error->one(FLERR,"Illegal dump_modify command: {}", e.what()); + error->one(FLERR, "Illegal dump_modify command: {}", e.what()); } } return consumed; diff --git a/src/COMPRESS/dump_xyz_zstd.cpp b/src/COMPRESS/dump_xyz_zstd.cpp index f1ca6586d4..d5c79d181b 100644 --- a/src/COMPRESS/dump_xyz_zstd.cpp +++ b/src/COMPRESS/dump_xyz_zstd.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -19,27 +18,23 @@ #ifdef LAMMPS_ZSTD #include "dump_xyz_zstd.h" + #include "error.h" +#include "file_writer.h" #include "update.h" #include using namespace LAMMPS_NS; -DumpXYZZstd::DumpXYZZstd(LAMMPS *lmp, int narg, char **arg) : - DumpXYZ(lmp, narg, arg) +DumpXYZZstd::DumpXYZZstd(LAMMPS *lmp, int narg, char **arg) : DumpXYZ(lmp, narg, arg) { - if (!compressed) - error->all(FLERR,"Dump xyz/zstd only writes compressed files"); + if (!compressed) error->all(FLERR, "Dump xyz/zstd only writes compressed files"); } - /* ---------------------------------------------------------------------- */ -DumpXYZZstd::~DumpXYZZstd() -{ -} - +DumpXYZZstd::~DumpXYZZstd() {} /* ---------------------------------------------------------------------- generic opening of a dump file @@ -62,16 +57,15 @@ void DumpXYZZstd::openfile() if (multifile) { char *filestar = filecurrent; filecurrent = new char[strlen(filestar) + 16]; - char *ptr = strchr(filestar,'*'); + char *ptr = strchr(filestar, '*'); *ptr = '\0'; if (padflag == 0) - sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", - filestar,update->ntimestep,ptr+1); + sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1); else { - char bif[8],pad[16]; - strcpy(bif,BIGINT_FORMAT); - sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); - sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + char bif[8], pad[16]; + strcpy(bif, BIGINT_FORMAT); + sprintf(pad, "%%s%%0%d%s%%s", padflag, &bif[1]); + sprintf(filecurrent, pad, filestar, update->ntimestep, ptr + 1); } *ptr = '*'; if (maxfiles > 0) { @@ -92,9 +86,7 @@ void DumpXYZZstd::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { - if (append_flag) { - error->one(FLERR, "dump cfg/zstd currently doesn't support append"); - } + if (append_flag) { error->one(FLERR, "dump cfg/zstd currently doesn't support append"); } try { writer.open(filecurrent); @@ -105,7 +97,7 @@ void DumpXYZZstd::openfile() // delete string with timestep replaced - if (multifile) delete [] filecurrent; + if (multifile) delete[] filecurrent; } void DumpXYZZstd::write_header(bigint ndump) @@ -128,9 +120,9 @@ void DumpXYZZstd::write_data(int n, double *mybuf) char vbuffer[VBUFFER_SIZE]; int m = 0; for (int i = 0; i < n; i++) { - int written = snprintf(vbuffer, VBUFFER_SIZE, format, - typenames[static_cast (mybuf[m+1])], - mybuf[m+2],mybuf[m+3],mybuf[m+4]); + int written = + snprintf(vbuffer, VBUFFER_SIZE, format, typenames[static_cast(mybuf[m + 1])], + mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]); if (written > 0) { writer.write(vbuffer, written); } else if (written < 0) { @@ -150,9 +142,7 @@ void DumpXYZZstd::write() if (multifile) { writer.close(); } else { - if (flush_flag && writer.isopen()) { - writer.flush(); - } + if (flush_flag && writer.isopen()) { writer.flush(); } } } } @@ -164,20 +154,23 @@ int DumpXYZZstd::modify_param(int narg, char **arg) int consumed = DumpXYZ::modify_param(narg, arg); if (consumed == 0) { try { - if (strcmp(arg[0],"checksum") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); - else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); - else error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[0], "checksum") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); + if (strcmp(arg[1], "yes") == 0) + writer.setChecksum(true); + else if (strcmp(arg[1], "no") == 0) + writer.setChecksum(false); + else + error->all(FLERR, "Illegal dump_modify command"); return 2; - } else if (strcmp(arg[0],"compression_level") == 0) { - if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + } else if (strcmp(arg[0], "compression_level") == 0) { + if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); writer.setCompressionLevel(compression_level); return 2; } } catch (FileWriterException &e) { - error->one(FLERR,"Illegal dump_modify command: {}", e.what()); + error->one(FLERR, "Illegal dump_modify command: {}", e.what()); } } return consumed; diff --git a/src/COMPRESS/gz_file_writer.h b/src/COMPRESS/gz_file_writer.h index 48ad0f42a8..3de1d0d2b8 100644 --- a/src/COMPRESS/gz_file_writer.h +++ b/src/COMPRESS/gz_file_writer.h @@ -20,7 +20,6 @@ #include "file_writer.h" -#include #include #include diff --git a/src/CORESHELL/pair_born_coul_dsf_cs.cpp b/src/CORESHELL/pair_born_coul_dsf_cs.cpp index 42df5d4fb5..bb9b9693e4 100644 --- a/src/CORESHELL/pair_born_coul_dsf_cs.cpp +++ b/src/CORESHELL/pair_born_coul_dsf_cs.cpp @@ -18,13 +18,14 @@ ------------------------------------------------------------------------- */ #include "pair_born_coul_dsf_cs.h" -#include + #include "atom.h" -#include "comm.h" #include "force.h" -#include "neigh_list.h" #include "math_const.h" #include "math_special.h" +#include "neigh_list.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/CORESHELL/pair_born_coul_wolf_cs.cpp b/src/CORESHELL/pair_born_coul_wolf_cs.cpp index 237c167552..a671091f0d 100644 --- a/src/CORESHELL/pair_born_coul_wolf_cs.cpp +++ b/src/CORESHELL/pair_born_coul_wolf_cs.cpp @@ -14,12 +14,14 @@ #include "pair_born_coul_wolf_cs.h" -#include + #include "atom.h" #include "comm.h" #include "force.h" -#include "neigh_list.h" #include "math_const.h" +#include "neigh_list.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/CORESHELL/pair_coul_wolf_cs.cpp b/src/CORESHELL/pair_coul_wolf_cs.cpp index 6f83b66ed8..19798dd034 100644 --- a/src/CORESHELL/pair_coul_wolf_cs.cpp +++ b/src/CORESHELL/pair_coul_wolf_cs.cpp @@ -13,13 +13,14 @@ ------------------------------------------------------------------------- */ #include "pair_coul_wolf_cs.h" -#include + #include "atom.h" -#include "comm.h" #include "force.h" #include "neigh_list.h" #include "math_const.h" +#include + using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/DIELECTRIC/atom_vec_dielectric.cpp b/src/DIELECTRIC/atom_vec_dielectric.cpp index cc182251e9..2d6d6d00b1 100644 --- a/src/DIELECTRIC/atom_vec_dielectric.cpp +++ b/src/DIELECTRIC/atom_vec_dielectric.cpp @@ -17,6 +17,9 @@ #include "atom.h" #include "citeme.h" +#include +#include + using namespace LAMMPS_NS; static const char cite_user_dielectric_package[] = diff --git a/src/DIELECTRIC/compute_efield_atom.cpp b/src/DIELECTRIC/compute_efield_atom.cpp index e5626c9c6c..6f4bfd742a 100644 --- a/src/DIELECTRIC/compute_efield_atom.cpp +++ b/src/DIELECTRIC/compute_efield_atom.cpp @@ -33,6 +33,8 @@ #include "pppm_dielectric.h" #include "update.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp index 2ea5536722..538ce15575 100644 --- a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp @@ -41,11 +41,9 @@ #include "comm.h" #include "error.h" #include "force.h" -#include "group.h" #include "kspace.h" #include "math_const.h" #include "memory.h" -#include "modify.h" #include "msm_dielectric.h" #include "pair_coul_cut_dielectric.h" #include "pair_coul_long_dielectric.h" @@ -54,7 +52,6 @@ #include "pair_lj_cut_coul_msm_dielectric.h" #include "pppm_dielectric.h" #include "random_park.h" -#include "timer.h" #include "update.h" #include diff --git a/src/DIELECTRIC/fix_polarize_bem_icc.cpp b/src/DIELECTRIC/fix_polarize_bem_icc.cpp index da9b8eb055..4c137878a2 100644 --- a/src/DIELECTRIC/fix_polarize_bem_icc.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_icc.cpp @@ -33,7 +33,6 @@ #include "group.h" #include "kspace.h" #include "math_const.h" -#include "memory.h" #include "msm_dielectric.h" #include "pair_coul_cut_dielectric.h" #include "pair_coul_long_dielectric.h" diff --git a/src/DIELECTRIC/fix_polarize_functional.cpp b/src/DIELECTRIC/fix_polarize_functional.cpp index 34c1ba2f60..2d67bca0a7 100644 --- a/src/DIELECTRIC/fix_polarize_functional.cpp +++ b/src/DIELECTRIC/fix_polarize_functional.cpp @@ -33,13 +33,11 @@ #include "domain.h" #include "error.h" #include "force.h" -#include "group.h" #include "kspace.h" #include "math_const.h" #include "math_extra.h" #include "math_special.h" #include "memory.h" -#include "modify.h" #include "msm_dielectric.h" #include "neigh_list.h" #include "neigh_request.h" @@ -50,8 +48,6 @@ #include "pair_lj_cut_coul_long_dielectric.h" #include "pair_lj_cut_coul_msm_dielectric.h" #include "pppm_dielectric.h" -#include "random_park.h" -#include "timer.h" #include "update.h" #include diff --git a/src/DIELECTRIC/msm_dielectric.cpp b/src/DIELECTRIC/msm_dielectric.cpp index 8ee1c19ac3..329218a94f 100644 --- a/src/DIELECTRIC/msm_dielectric.cpp +++ b/src/DIELECTRIC/msm_dielectric.cpp @@ -23,15 +23,9 @@ #include "comm.h" #include "domain.h" #include "error.h" -#include "force.h" #include "gridcomm.h" #include "math_const.h" #include "memory.h" -#include "neighbor.h" -#include "pair.h" - -#include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/DIELECTRIC/pair_coul_cut_dielectric.cpp b/src/DIELECTRIC/pair_coul_cut_dielectric.cpp index 9c3be2a80a..9596ce5be2 100644 --- a/src/DIELECTRIC/pair_coul_cut_dielectric.cpp +++ b/src/DIELECTRIC/pair_coul_cut_dielectric.cpp @@ -19,7 +19,6 @@ #include "atom.h" #include "atom_vec_dielectric.h" -#include "comm.h" #include "error.h" #include "force.h" #include "math_const.h" @@ -29,7 +28,6 @@ #include "neighbor.h" #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/DIELECTRIC/pair_coul_long_dielectric.cpp b/src/DIELECTRIC/pair_coul_long_dielectric.cpp index a079c3abf7..4bf7d48c2b 100644 --- a/src/DIELECTRIC/pair_coul_long_dielectric.cpp +++ b/src/DIELECTRIC/pair_coul_long_dielectric.cpp @@ -19,7 +19,6 @@ #include "atom.h" #include "atom_vec_dielectric.h" -#include "comm.h" #include "error.h" #include "force.h" #include "kspace.h" @@ -30,7 +29,6 @@ #include "neighbor.h" #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.cpp b/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.cpp index e4b330d485..3e840459b7 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.cpp @@ -19,7 +19,6 @@ #include "atom.h" #include "atom_vec_dielectric.h" -#include "comm.h" #include "error.h" #include "force.h" #include "math_const.h" diff --git a/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.cpp b/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.cpp index 8c90e1f84b..5220be7b62 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.cpp @@ -19,7 +19,6 @@ #include "atom.h" #include "atom_vec_dielectric.h" -#include "comm.h" #include "error.h" #include "force.h" #include "math_const.h" @@ -29,7 +28,6 @@ #include "neighbor.h" #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.cpp b/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.cpp index bbb8bba728..b256dd5a6c 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.cpp @@ -19,7 +19,6 @@ #include "atom.h" #include "atom_vec_dielectric.h" -#include "comm.h" #include "error.h" #include "force.h" #include "kspace.h" diff --git a/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.cpp b/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.cpp index e22ee4b665..b729abef8b 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.cpp @@ -19,10 +19,8 @@ #include "atom.h" #include "atom_vec_dielectric.h" -#include "comm.h" #include "error.h" #include "force.h" -#include "integrate.h" #include "kspace.h" #include "math_const.h" #include "memory.h" @@ -31,6 +29,7 @@ #include "neighbor.h" #include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp b/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp index 922e24f0ea..25a533632b 100644 --- a/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp @@ -19,19 +19,14 @@ #include "atom.h" #include "atom_vec_dielectric.h" -#include "comm.h" #include "error.h" #include "force.h" -#include "integrate.h" -#include "kspace.h" #include "math_const.h" #include "math_extra.h" #include "memory.h" #include "neigh_list.h" #include "neigh_request.h" #include "neighbor.h" -#include "respa.h" -#include "update.h" #include #include diff --git a/src/DIELECTRIC/pppm_dielectric.cpp b/src/DIELECTRIC/pppm_dielectric.cpp index f044387852..597f51010e 100644 --- a/src/DIELECTRIC/pppm_dielectric.cpp +++ b/src/DIELECTRIC/pppm_dielectric.cpp @@ -23,15 +23,11 @@ #include "comm.h" #include "domain.h" #include "error.h" -#include "fft3d_wrap.h" #include "force.h" #include "gridcomm.h" #include "math_const.h" #include "math_special.h" #include "memory.h" -#include "neighbor.h" -#include "pair.h" -#include "remap_wrap.h" #include diff --git a/src/DIELECTRIC/pppm_disp_dielectric.cpp b/src/DIELECTRIC/pppm_disp_dielectric.cpp index 8c423543c2..2a7febd304 100644 --- a/src/DIELECTRIC/pppm_disp_dielectric.cpp +++ b/src/DIELECTRIC/pppm_disp_dielectric.cpp @@ -21,21 +21,14 @@ #include "angle.h" #include "atom.h" #include "atom_vec_dielectric.h" -#include "bond.h" -#include "comm.h" #include "domain.h" #include "error.h" -#include "fft3d_wrap.h" #include "force.h" #include "gridcomm.h" #include "math_const.h" #include "memory.h" -#include "neighbor.h" -#include "pair.h" -#include "remap_wrap.h" #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/DPD-MESO/pair_edpd.cpp b/src/DPD-MESO/pair_edpd.cpp index 53469e4e3d..836ea27e8b 100644 --- a/src/DPD-MESO/pair_edpd.cpp +++ b/src/DPD-MESO/pair_edpd.cpp @@ -31,7 +31,6 @@ #include "update.h" #include -#include #include using namespace LAMMPS_NS; diff --git a/src/DPD-REACT/fix_rx.cpp b/src/DPD-REACT/fix_rx.cpp index a37a6ad7b6..526c2d508f 100644 --- a/src/DPD-REACT/fix_rx.cpp +++ b/src/DPD-REACT/fix_rx.cpp @@ -34,7 +34,6 @@ #include // DBL_EPSILON #include #include -#include // std::vector<> using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/EXTRA-DUMP/dump_dcd.cpp b/src/EXTRA-DUMP/dump_dcd.cpp index 971c120fa5..97c9bec646 100644 --- a/src/EXTRA-DUMP/dump_dcd.cpp +++ b/src/EXTRA-DUMP/dump_dcd.cpp @@ -18,17 +18,19 @@ ------------------------------------------------------------------------- */ #include "dump_dcd.h" -#include -#include -#include -#include "domain.h" + #include "atom.h" -#include "update.h" -#include "output.h" -#include "group.h" -#include "memory.h" +#include "domain.h" #include "error.h" #include "fmt/chrono.h" +#include "group.h" +#include "memory.h" +#include "output.h" +#include "update.h" + +#include +#include +#include using namespace LAMMPS_NS; diff --git a/src/EXTRA-FIX/fix_ttm_grid.cpp b/src/EXTRA-FIX/fix_ttm_grid.cpp index f3e84c4693..7b3f434907 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.cpp +++ b/src/EXTRA-FIX/fix_ttm_grid.cpp @@ -32,6 +32,7 @@ #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.cpp b/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.cpp index 5c43193d85..419cfe5d3f 100644 --- a/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.cpp +++ b/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.cpp @@ -18,16 +18,15 @@ #include "dihedral_cosine_shift_exp.h" -#include #include "atom.h" #include "comm.h" -#include "neighbor.h" -#include "force.h" -#include "update.h" -#include "memory.h" -#include "math_const.h" #include "error.h" +#include "force.h" +#include "math_const.h" +#include "memory.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; diff --git a/src/EXTRA-MOLECULE/dihedral_fourier.cpp b/src/EXTRA-MOLECULE/dihedral_fourier.cpp index b88c866e7c..4303e67755 100644 --- a/src/EXTRA-MOLECULE/dihedral_fourier.cpp +++ b/src/EXTRA-MOLECULE/dihedral_fourier.cpp @@ -19,16 +19,15 @@ #include "dihedral_fourier.h" -#include #include "atom.h" #include "comm.h" -#include "neighbor.h" +#include "error.h" #include "force.h" -#include "update.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/EXTRA-MOLECULE/dihedral_helix.cpp b/src/EXTRA-MOLECULE/dihedral_helix.cpp index 4726dd3bce..4bbf8edcf4 100644 --- a/src/EXTRA-MOLECULE/dihedral_helix.cpp +++ b/src/EXTRA-MOLECULE/dihedral_helix.cpp @@ -26,7 +26,6 @@ #include "math_const.h" #include "memory.h" #include "neighbor.h" -#include "update.h" #include diff --git a/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp b/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp index 5e2a69fb2f..41a3d66ba6 100644 --- a/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp +++ b/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp @@ -19,15 +19,14 @@ #include "dihedral_nharmonic.h" -#include #include "atom.h" -#include "neighbor.h" #include "comm.h" -#include "force.h" -#include "update.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; diff --git a/src/EXTRA-MOLECULE/dihedral_quadratic.cpp b/src/EXTRA-MOLECULE/dihedral_quadratic.cpp index 5f531fa785..9b1ae5f9cb 100644 --- a/src/EXTRA-MOLECULE/dihedral_quadratic.cpp +++ b/src/EXTRA-MOLECULE/dihedral_quadratic.cpp @@ -19,16 +19,15 @@ #include "dihedral_quadratic.h" -#include #include "atom.h" -#include "neighbor.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "update.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp index 5c7bc30862..b132104bdd 100644 --- a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp +++ b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp @@ -27,7 +27,6 @@ #include "math_const.h" #include "memory.h" #include "neighbor.h" -#include "update.h" #include #include // IWYU pragma: keep diff --git a/src/EXTRA-MOLECULE/improper_cossq.cpp b/src/EXTRA-MOLECULE/improper_cossq.cpp index 2952a15d8b..ea5bd1b43e 100644 --- a/src/EXTRA-MOLECULE/improper_cossq.cpp +++ b/src/EXTRA-MOLECULE/improper_cossq.cpp @@ -26,7 +26,6 @@ #include "math_const.h" #include "memory.h" #include "neighbor.h" -#include "update.h" #include diff --git a/src/EXTRA-MOLECULE/improper_fourier.cpp b/src/EXTRA-MOLECULE/improper_fourier.cpp index eeb1cbb7dc..56200fec8c 100644 --- a/src/EXTRA-MOLECULE/improper_fourier.cpp +++ b/src/EXTRA-MOLECULE/improper_fourier.cpp @@ -19,15 +19,14 @@ #include "improper_fourier.h" -#include #include "atom.h" #include "comm.h" -#include "neighbor.h" -#include "force.h" -#include "update.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; diff --git a/src/KSPACE/fft3d_wrap.h b/src/KSPACE/fft3d_wrap.h index 58a6957a2b..1deccc801b 100644 --- a/src/KSPACE/fft3d_wrap.h +++ b/src/KSPACE/fft3d_wrap.h @@ -14,7 +14,7 @@ #ifndef LMP_FFT3D_WRAP_H #define LMP_FFT3D_WRAP_H -#include "fft3d.h" +#include "fft3d.h" // IWYU pragma: export #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index e2a677c2a0..397259ee21 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -50,11 +50,10 @@ #include "neighbor.h" #include "potential_file_reader.h" #include "tabular_function.h" -#include "utils.h" +#include "tokenizer.h" #include #include -#include using namespace LAMMPS_NS; using MathSpecial::square; diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index aa269ae6ea..f12d369e0d 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -36,7 +36,6 @@ #include "tokenizer.h" #include -#include using namespace LAMMPS_NS; using namespace MathExtra; diff --git a/src/MDI/fix_mdi_engine.cpp b/src/MDI/fix_mdi_engine.cpp index 4c8e9cccf4..8024623e43 100644 --- a/src/MDI/fix_mdi_engine.cpp +++ b/src/MDI/fix_mdi_engine.cpp @@ -25,13 +25,13 @@ #include "domain.h" #include "error.h" #include "force.h" +#include "integrate.h" #include "irregular.h" -#include "library.h" #include "memory.h" #include "modify.h" #include "update.h" -#include "verlet.h" +#include #include #include diff --git a/src/MDI/fix_mdi_engine.h b/src/MDI/fix_mdi_engine.h index e3d6b37772..c42a4a10ed 100644 --- a/src/MDI/fix_mdi_engine.h +++ b/src/MDI/fix_mdi_engine.h @@ -21,7 +21,7 @@ FixStyle(mdi/engine, FixMDIEngine); #define LMP_FIX_MDI_ENGINE_H #include "fix.h" -#include "mdi.h" +#include "mdi.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/MDI/mdi_engine.cpp b/src/MDI/mdi_engine.cpp index f1143fbe28..4be739d187 100644 --- a/src/MDI/mdi_engine.cpp +++ b/src/MDI/mdi_engine.cpp @@ -20,16 +20,14 @@ #include "atom.h" #include "error.h" +#include "integrate.h" #include "fix_mdi_engine.h" -#include "force.h" #include "mdi.h" #include "min.h" -#include "minimize.h" #include "modify.h" #include "output.h" #include "timer.h" #include "update.h" -#include "verlet.h" #include #include diff --git a/src/MEAM/meam_impl.cpp b/src/MEAM/meam_impl.cpp index d518e5fa79..499a2b1520 100644 --- a/src/MEAM/meam_impl.cpp +++ b/src/MEAM/meam_impl.cpp @@ -20,8 +20,6 @@ #include "memory.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/MEAM/meam_setup_done.cpp b/src/MEAM/meam_setup_done.cpp index 2cd2c93abe..1d7598d2c0 100644 --- a/src/MEAM/meam_setup_done.cpp +++ b/src/MEAM/meam_setup_done.cpp @@ -17,7 +17,6 @@ #include "memory.h" #include -#include #include using namespace LAMMPS_NS; diff --git a/src/MEAM/meam_setup_param.cpp b/src/MEAM/meam_setup_param.cpp index 946a245e63..081612f70e 100644 --- a/src/MEAM/meam_setup_param.cpp +++ b/src/MEAM/meam_setup_param.cpp @@ -15,13 +15,13 @@ #include "meam.h" #include "math_const.h" + #include #include using namespace LAMMPS_NS; using namespace MathConst; -// // do a sanity check on index parameters void MEAM::meam_checkindex(int num, int lim, int nidx, int* idx /*idx(3)*/, int* ierr) diff --git a/src/MEAM/pair_meam.h b/src/MEAM/pair_meam.h index 06be670eb9..347869c293 100644 --- a/src/MEAM/pair_meam.h +++ b/src/MEAM/pair_meam.h @@ -23,8 +23,6 @@ PairStyle(meam/c,PairMEAM); #include "pair.h" -#include - namespace LAMMPS_NS { class PairMEAM : public Pair { diff --git a/src/MGPT/pair_mgpt.cpp b/src/MGPT/pair_mgpt.cpp index fb956cabaf..bf7e74ae85 100644 --- a/src/MGPT/pair_mgpt.cpp +++ b/src/MGPT/pair_mgpt.cpp @@ -35,6 +35,7 @@ #include #include +#include #include using namespace LAMMPS_NS; diff --git a/src/MGPT/pair_mgpt.h b/src/MGPT/pair_mgpt.h index e2ccda14da..106c2cc8f0 100644 --- a/src/MGPT/pair_mgpt.h +++ b/src/MGPT/pair_mgpt.h @@ -31,7 +31,6 @@ PairStyle(mgpt,PairMGPT); #ifndef LMP_PAIR_MGPT_H #define LMP_PAIR_MGPT_H -#include #include #include "pair.h" diff --git a/src/MISC/fix_pair_tracker.cpp b/src/MISC/fix_pair_tracker.cpp index db5f293c7d..07c44c0d3c 100644 --- a/src/MISC/fix_pair_tracker.cpp +++ b/src/MISC/fix_pair_tracker.cpp @@ -14,14 +14,12 @@ #include "fix_pair_tracker.h" #include "atom.h" -#include "atom_vec.h" #include "error.h" -#include "group.h" #include "memory.h" -#include "modify.h" #include "tokenizer.h" #include "update.h" +#include #include using namespace LAMMPS_NS; diff --git a/src/MISC/pair_tracker.cpp b/src/MISC/pair_tracker.cpp index 003f2f3dd0..0e55cf367d 100644 --- a/src/MISC/pair_tracker.cpp +++ b/src/MISC/pair_tracker.cpp @@ -28,6 +28,9 @@ #include "neighbor.h" #include "update.h" +#include +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/ML-HDNNP/pair_hdnnp.cpp b/src/ML-HDNNP/pair_hdnnp.cpp index eabc0bcfa0..c27f93c132 100644 --- a/src/ML-HDNNP/pair_hdnnp.cpp +++ b/src/ML-HDNNP/pair_hdnnp.cpp @@ -30,6 +30,8 @@ #include "neighbor.h" #include "update.h" +#include + #include "InterfaceLammps.h" // n2p2 interface header using namespace LAMMPS_NS; diff --git a/src/ML-IAP/mliap_descriptor_so3.cpp b/src/ML-IAP/mliap_descriptor_so3.cpp index d28a2fdc42..d816bd0638 100644 --- a/src/ML-IAP/mliap_descriptor_so3.cpp +++ b/src/ML-IAP/mliap_descriptor_so3.cpp @@ -25,7 +25,6 @@ #include "pair_mliap.h" #include "tokenizer.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/ML-IAP/mliap_model_nn.cpp b/src/ML-IAP/mliap_model_nn.cpp index f001807ae5..10ef97300e 100644 --- a/src/ML-IAP/mliap_model_nn.cpp +++ b/src/ML-IAP/mliap_model_nn.cpp @@ -17,15 +17,16 @@ ------------------------------------------------------------------------- */ #include "mliap_model_nn.h" -#include "pair_mliap.h" + #include "mliap_data.h" +#include "pair_mliap.h" #include "comm.h" #include "error.h" #include "memory.h" #include "tokenizer.h" -#include +#include using namespace LAMMPS_NS; diff --git a/src/ML-IAP/mliap_model_nn.h b/src/ML-IAP/mliap_model_nn.h index 2795678c05..5a45a34b5f 100644 --- a/src/ML-IAP/mliap_model_nn.h +++ b/src/ML-IAP/mliap_model_nn.h @@ -16,6 +16,8 @@ #include "mliap_model.h" +#include + namespace LAMMPS_NS { class MLIAPModelNN : public MLIAPModel { diff --git a/src/ML-IAP/mliap_model_quadratic.cpp b/src/ML-IAP/mliap_model_quadratic.cpp index 638b4a22f7..a881c7848c 100644 --- a/src/ML-IAP/mliap_model_quadratic.cpp +++ b/src/ML-IAP/mliap_model_quadratic.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "mliap_model_quadratic.h" -#include "pair_mliap.h" + #include "mliap_data.h" #include "error.h" #include diff --git a/src/ML-IAP/mliap_so3.cpp b/src/ML-IAP/mliap_so3.cpp index b600b29ebd..0733ffa198 100644 --- a/src/ML-IAP/mliap_so3.cpp +++ b/src/ML-IAP/mliap_so3.cpp @@ -17,7 +17,6 @@ #include "mliap_so3.h" -#include "comm.h" #include "error.h" #include "math_const.h" #include "math_special.h" diff --git a/src/ML-PACE/pair_pace.cpp b/src/ML-PACE/pair_pace.cpp index fba622546e..f0d6547083 100644 --- a/src/ML-PACE/pair_pace.cpp +++ b/src/ML-PACE/pair_pace.cpp @@ -23,7 +23,6 @@ Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, ^4: University of British Columbia, Vancouver, BC, Canada */ - // // Created by Lysogorskiy Yury on 27.02.20. // @@ -42,6 +41,7 @@ Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, #include "update.h" #include +#include #include "ace_evaluator.h" #include "ace_recursive.h" diff --git a/src/ML-RANN/pair_rann.cpp b/src/ML-RANN/pair_rann.cpp index faab2d1b2f..d251f87dfb 100644 --- a/src/ML-RANN/pair_rann.cpp +++ b/src/ML-RANN/pair_rann.cpp @@ -33,9 +33,7 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "atom.h" #include "citeme.h" -#include "comm.h" #include "error.h" -#include "force.h" #include "math_special.h" #include "memory.h" #include "neighbor.h" @@ -46,6 +44,8 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include #include +#include +#include #include "rann_activation_linear.h" #include "rann_activation_sig_i.h" diff --git a/src/ML-RANN/pair_rann.h b/src/ML-RANN/pair_rann.h index adc3431ba7..71b4dcd4e6 100644 --- a/src/ML-RANN/pair_rann.h +++ b/src/ML-RANN/pair_rann.h @@ -39,9 +39,6 @@ PairStyle(rann,PairRANN); #include "pair.h" -#include -#include - namespace LAMMPS_NS { namespace RANN { diff --git a/src/ML-RANN/rann_fingerprint.cpp b/src/ML-RANN/rann_fingerprint.cpp index b90e04f9a5..1b6e15466c 100644 --- a/src/ML-RANN/rann_fingerprint.cpp +++ b/src/ML-RANN/rann_fingerprint.cpp @@ -29,6 +29,9 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 */ #include "rann_fingerprint.h" +#include "pair_rann.h" + +#include using namespace LAMMPS_NS::RANN; diff --git a/src/ML-RANN/rann_fingerprint.h b/src/ML-RANN/rann_fingerprint.h index 628a4c025a..eb23ea04fb 100644 --- a/src/ML-RANN/rann_fingerprint.h +++ b/src/ML-RANN/rann_fingerprint.h @@ -32,9 +32,11 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #ifndef LMP_RANN_FINGERPRINT_H #define LMP_RANN_FINGERPRINT_H -#include "pair_rann.h" +#include +#include namespace LAMMPS_NS { +class PairRANN; namespace RANN { class Fingerprint { public: diff --git a/src/ML-RANN/rann_fingerprint_bond.cpp b/src/ML-RANN/rann_fingerprint_bond.cpp index f5912324cd..dd2a309415 100644 --- a/src/ML-RANN/rann_fingerprint_bond.cpp +++ b/src/ML-RANN/rann_fingerprint_bond.cpp @@ -30,7 +30,9 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 */ #include "rann_fingerprint_bond.h" +#include "pair_rann.h" +#include using namespace LAMMPS_NS::RANN; diff --git a/src/ML-RANN/rann_fingerprint_bondscreened.cpp b/src/ML-RANN/rann_fingerprint_bondscreened.cpp index c9ba15963c..0e9d562f6e 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreened.cpp +++ b/src/ML-RANN/rann_fingerprint_bondscreened.cpp @@ -30,6 +30,9 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 */ #include "rann_fingerprint_bondscreened.h" +#include "pair_rann.h" + +#include using namespace LAMMPS_NS::RANN; diff --git a/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp b/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp index 49829b41a1..5fb81dc5b1 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp +++ b/src/ML-RANN/rann_fingerprint_bondscreenedspin.cpp @@ -29,7 +29,9 @@ do not necessarily reflect the views of the United States Army.​” DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 */ #include "rann_fingerprint_bondscreenedspin.h" +#include "pair_rann.h" +#include using namespace LAMMPS_NS::RANN; diff --git a/src/ML-RANN/rann_fingerprint_bondspin.cpp b/src/ML-RANN/rann_fingerprint_bondspin.cpp index 452846cfb1..77749fa3c7 100644 --- a/src/ML-RANN/rann_fingerprint_bondspin.cpp +++ b/src/ML-RANN/rann_fingerprint_bondspin.cpp @@ -29,7 +29,9 @@ do not necessarily reflect the views of the United States Army.​” DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 */ #include "rann_fingerprint_bondspin.h" +#include "pair_rann.h" +#include using namespace LAMMPS_NS::RANN; diff --git a/src/ML-RANN/rann_fingerprint_radial.cpp b/src/ML-RANN/rann_fingerprint_radial.cpp index 93cab2f363..29eeb07a65 100644 --- a/src/ML-RANN/rann_fingerprint_radial.cpp +++ b/src/ML-RANN/rann_fingerprint_radial.cpp @@ -30,8 +30,9 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 */ #include "rann_fingerprint_radial.h" +#include "pair_rann.h" - +#include using namespace LAMMPS_NS::RANN; diff --git a/src/ML-RANN/rann_fingerprint_radialscreened.cpp b/src/ML-RANN/rann_fingerprint_radialscreened.cpp index a933703db8..9ac98d183c 100644 --- a/src/ML-RANN/rann_fingerprint_radialscreened.cpp +++ b/src/ML-RANN/rann_fingerprint_radialscreened.cpp @@ -30,8 +30,9 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 */ #include "rann_fingerprint_radialscreened.h" +#include "pair_rann.h" - +#include using namespace LAMMPS_NS::RANN; diff --git a/src/ML-RANN/rann_fingerprint_radialscreenedspin.cpp b/src/ML-RANN/rann_fingerprint_radialscreenedspin.cpp index ecd0e4a2f0..3caeaa84da 100644 --- a/src/ML-RANN/rann_fingerprint_radialscreenedspin.cpp +++ b/src/ML-RANN/rann_fingerprint_radialscreenedspin.cpp @@ -29,8 +29,9 @@ do not necessarily reflect the views of the United States Army.​” DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 */ #include "rann_fingerprint_radialscreenedspin.h" +#include "pair_rann.h" - +#include using namespace LAMMPS_NS::RANN; diff --git a/src/ML-RANN/rann_fingerprint_radialspin.cpp b/src/ML-RANN/rann_fingerprint_radialspin.cpp index 137f7ac162..b48fad80d0 100644 --- a/src/ML-RANN/rann_fingerprint_radialspin.cpp +++ b/src/ML-RANN/rann_fingerprint_radialspin.cpp @@ -29,8 +29,9 @@ do not necessarily reflect the views of the United States Army.​” DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 */ #include "rann_fingerprint_radialspin.h" +#include "pair_rann.h" - +#include using namespace LAMMPS_NS::RANN; diff --git a/src/ML-SNAP/pair_snap.cpp b/src/ML-SNAP/pair_snap.cpp index 645dc7a213..d7cd953615 100644 --- a/src/ML-SNAP/pair_snap.cpp +++ b/src/ML-SNAP/pair_snap.cpp @@ -26,6 +26,7 @@ #include "tokenizer.h" #include +#include using namespace LAMMPS_NS; diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index 5ab866fa33..a582987de1 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -24,7 +24,6 @@ #include "force.h" #include "memory.h" #include "neighbor.h" -#include "update.h" #include diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index 958db6d0c5..5527dd600c 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -18,15 +18,14 @@ #include "dihedral_multi_harmonic.h" -#include #include "atom.h" -#include "neighbor.h" #include "comm.h" -#include "force.h" -#include "update.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index d09fbc32d3..2f99019ef7 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -18,15 +18,14 @@ #include "dihedral_opls.h" -#include #include "atom.h" #include "comm.h" -#include "neighbor.h" -#include "force.h" -#include "update.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index 91dac5b173..a6ed5ea2d9 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -14,15 +14,14 @@ #include "improper_cvff.h" -#include #include "atom.h" #include "comm.h" -#include "neighbor.h" -#include "force.h" -#include "update.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; diff --git a/src/MOLECULE/improper_harmonic.cpp b/src/MOLECULE/improper_harmonic.cpp index 4b93d8653e..b0414e301b 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -14,16 +14,15 @@ #include "improper_harmonic.h" -#include #include "atom.h" #include "comm.h" -#include "neighbor.h" +#include "error.h" #include "force.h" -#include "update.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 0cf2351cef..2c4c686cc3 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -18,16 +18,15 @@ #include "improper_umbrella.h" -#include #include "atom.h" #include "comm.h" -#include "neighbor.h" +#include "error.h" #include "force.h" -#include "update.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "neighbor.h" +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/MOLFILE/molfile_interface.cpp b/src/MOLFILE/molfile_interface.cpp index 1cdc698a97..8e1174d8f4 100644 --- a/src/MOLFILE/molfile_interface.cpp +++ b/src/MOLFILE/molfile_interface.cpp @@ -19,7 +19,6 @@ #include "molfile_interface.h" #include "molfile_plugin.h" -#include #include #include #include diff --git a/src/OPENMP/dihedral_charmm_omp.cpp b/src/OPENMP/dihedral_charmm_omp.cpp index 4835669158..7efd6d367b 100644 --- a/src/OPENMP/dihedral_charmm_omp.cpp +++ b/src/OPENMP/dihedral_charmm_omp.cpp @@ -16,18 +16,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "dihedral_charmm_omp.h" -#include + #include "atom.h" #include "comm.h" -#include "neighbor.h" - #include "force.h" +#include "neighbor.h" #include "pair.h" -#include "update.h" -#include "error.h" +#include + +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/dihedral_class2_omp.cpp b/src/OPENMP/dihedral_class2_omp.cpp index 2f922b0bdf..f843def3ec 100644 --- a/src/OPENMP/dihedral_class2_omp.cpp +++ b/src/OPENMP/dihedral_class2_omp.cpp @@ -20,11 +20,9 @@ #include "atom.h" #include "comm.h" -#include "error.h" #include "force.h" #include "neighbor.h" #include "suffix.h" -#include "update.h" #include diff --git a/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp b/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp index b4dbc4538a..9da2a5b8b5 100644 --- a/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp +++ b/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp @@ -16,17 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "dihedral_cosine_shift_exp_omp.h" + #include "atom.h" #include "comm.h" +#include "force.h" #include "neighbor.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/dihedral_fourier_omp.cpp b/src/OPENMP/dihedral_fourier_omp.cpp index e735f01953..a7c5264fa5 100644 --- a/src/OPENMP/dihedral_fourier_omp.cpp +++ b/src/OPENMP/dihedral_fourier_omp.cpp @@ -16,17 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "dihedral_fourier_omp.h" -#include + #include "atom.h" #include "comm.h" +#include "force.h" #include "neighbor.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/dihedral_harmonic_omp.cpp b/src/OPENMP/dihedral_harmonic_omp.cpp index c780bf0b30..6bbfd6ff12 100644 --- a/src/OPENMP/dihedral_harmonic_omp.cpp +++ b/src/OPENMP/dihedral_harmonic_omp.cpp @@ -16,17 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "dihedral_harmonic_omp.h" + #include "atom.h" #include "comm.h" +#include "force.h" #include "neighbor.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/dihedral_helix_omp.cpp b/src/OPENMP/dihedral_helix_omp.cpp index a2f2778935..c73622ed9d 100644 --- a/src/OPENMP/dihedral_helix_omp.cpp +++ b/src/OPENMP/dihedral_helix_omp.cpp @@ -20,16 +20,14 @@ #include "atom.h" #include "comm.h" -#include "error.h" #include "force.h" #include "math_const.h" #include "neighbor.h" -#include "suffix.h" -#include "update.h" #include #include "omp_compat.h" +#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/OPENMP/dihedral_multi_harmonic_omp.cpp b/src/OPENMP/dihedral_multi_harmonic_omp.cpp index 19519ea644..cf7e991c9d 100644 --- a/src/OPENMP/dihedral_multi_harmonic_omp.cpp +++ b/src/OPENMP/dihedral_multi_harmonic_omp.cpp @@ -16,17 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "dihedral_multi_harmonic_omp.h" + #include "atom.h" #include "comm.h" +#include "force.h" #include "neighbor.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/dihedral_nharmonic_omp.cpp b/src/OPENMP/dihedral_nharmonic_omp.cpp index 66f7ab5fe9..f2ec46190e 100644 --- a/src/OPENMP/dihedral_nharmonic_omp.cpp +++ b/src/OPENMP/dihedral_nharmonic_omp.cpp @@ -16,17 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "dihedral_nharmonic_omp.h" + #include "atom.h" #include "comm.h" -#include "neighbor.h" #include "force.h" -#include "update.h" -#include "error.h" +#include "neighbor.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/dihedral_opls_omp.cpp b/src/OPENMP/dihedral_opls_omp.cpp index e24d658350..543485aa0f 100644 --- a/src/OPENMP/dihedral_opls_omp.cpp +++ b/src/OPENMP/dihedral_opls_omp.cpp @@ -16,17 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "dihedral_opls_omp.h" + #include "atom.h" #include "comm.h" +#include "force.h" #include "neighbor.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/dihedral_quadratic_omp.cpp b/src/OPENMP/dihedral_quadratic_omp.cpp index 30ab8ff413..f6582d3bc0 100644 --- a/src/OPENMP/dihedral_quadratic_omp.cpp +++ b/src/OPENMP/dihedral_quadratic_omp.cpp @@ -16,18 +16,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "dihedral_quadratic_omp.h" + #include "atom.h" #include "comm.h" -#include "neighbor.h" #include "force.h" -#include "update.h" #include "math_const.h" -#include "error.h" +#include "neighbor.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/OPENMP/domain_omp.cpp b/src/OPENMP/domain_omp.cpp index 40be2f997a..af4d41a585 100644 --- a/src/OPENMP/domain_omp.cpp +++ b/src/OPENMP/domain_omp.cpp @@ -20,6 +20,8 @@ #include "error.h" #include "omp_compat.h" +#include + using namespace LAMMPS_NS; typedef struct { diff --git a/src/OPENMP/fix_gravity_omp.cpp b/src/OPENMP/fix_gravity_omp.cpp index c9f9104547..7354ec2aa4 100644 --- a/src/OPENMP/fix_gravity_omp.cpp +++ b/src/OPENMP/fix_gravity_omp.cpp @@ -16,14 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "fix_gravity_omp.h" + #include "atom.h" #include "update.h" #include "input.h" #include "modify.h" #include "variable.h" +#include "omp_compat.h" + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/OPENMP/fix_neigh_history_omp.cpp b/src/OPENMP/fix_neigh_history_omp.cpp index 50599b2669..8dd3816ec7 100644 --- a/src/OPENMP/fix_neigh_history_omp.cpp +++ b/src/OPENMP/fix_neigh_history_omp.cpp @@ -12,21 +12,23 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "fix_neigh_history_omp.h" -#include -#include "my_page.h" + #include "atom.h" #include "comm.h" +#include "error.h" +#include "memory.h" +#include "my_page.h" #include "neigh_list.h" #include "pair.h" -#include "memory.h" -#include "error.h" #if defined(_OPENMP) #include #endif +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/OPENMP/improper_class2_omp.cpp b/src/OPENMP/improper_class2_omp.cpp index ae3bad0f19..ad53ecd735 100644 --- a/src/OPENMP/improper_class2_omp.cpp +++ b/src/OPENMP/improper_class2_omp.cpp @@ -16,17 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "improper_class2_omp.h" + #include "atom.h" #include "comm.h" +#include "force.h" #include "neighbor.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/improper_cossq_omp.cpp b/src/OPENMP/improper_cossq_omp.cpp index 0a41ec45e2..24d7919995 100644 --- a/src/OPENMP/improper_cossq_omp.cpp +++ b/src/OPENMP/improper_cossq_omp.cpp @@ -20,15 +20,13 @@ #include "atom.h" #include "comm.h" -#include "error.h" #include "force.h" #include "neighbor.h" -#include "suffix.h" -#include "update.h" #include #include "omp_compat.h" +#include "suffix.h" using namespace LAMMPS_NS; #define TOLERANCE 0.05 diff --git a/src/OPENMP/improper_cvff_omp.cpp b/src/OPENMP/improper_cvff_omp.cpp index cb71bb802b..3cceb856a9 100644 --- a/src/OPENMP/improper_cvff_omp.cpp +++ b/src/OPENMP/improper_cvff_omp.cpp @@ -16,17 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "improper_cvff_omp.h" + #include "atom.h" #include "comm.h" +#include "force.h" #include "neighbor.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/improper_fourier_omp.cpp b/src/OPENMP/improper_fourier_omp.cpp index 3f5e270633..ef92e49e67 100644 --- a/src/OPENMP/improper_fourier_omp.cpp +++ b/src/OPENMP/improper_fourier_omp.cpp @@ -20,16 +20,13 @@ #include "atom.h" #include "comm.h" -#include "error.h" #include "force.h" #include "neighbor.h" -#include "suffix.h" - -#include "update.h" #include #include "omp_compat.h" +#include "suffix.h" using namespace LAMMPS_NS; #define TOLERANCE 0.05 diff --git a/src/OPENMP/improper_harmonic_omp.cpp b/src/OPENMP/improper_harmonic_omp.cpp index 5b96aad793..97d8ad174d 100644 --- a/src/OPENMP/improper_harmonic_omp.cpp +++ b/src/OPENMP/improper_harmonic_omp.cpp @@ -16,17 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "improper_harmonic_omp.h" + #include "atom.h" #include "comm.h" +#include "force.h" #include "neighbor.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/improper_umbrella_omp.cpp b/src/OPENMP/improper_umbrella_omp.cpp index cfd9778be0..91c9237826 100644 --- a/src/OPENMP/improper_umbrella_omp.cpp +++ b/src/OPENMP/improper_umbrella_omp.cpp @@ -16,17 +16,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "improper_umbrella_omp.h" + #include "atom.h" #include "comm.h" +#include "force.h" #include "neighbor.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include +#include "omp_compat.h" #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/OPENMP/npair_half_bin_atomonly_newton_omp.cpp b/src/OPENMP/npair_half_bin_atomonly_newton_omp.cpp index bd8999560c..2add88d358 100644 --- a/src/OPENMP/npair_half_bin_atomonly_newton_omp.cpp +++ b/src/OPENMP/npair_half_bin_atomonly_newton_omp.cpp @@ -15,7 +15,6 @@ #include "npair_half_bin_atomonly_newton_omp.h" #include "atom.h" -#include "atom_vec.h" #include "error.h" #include "my_page.h" #include "neigh_list.h" diff --git a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp index eadcde2154..65fca6ed17 100644 --- a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp @@ -12,15 +12,14 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "npair_half_size_multi_old_newtoff_omp.h" -#include "npair_omp.h" -#include "neigh_list.h" #include "atom.h" -#include "atom_vec.h" -#include "my_page.h" #include "error.h" +#include "my_page.h" +#include "neigh_list.h" +#include "npair_omp.h" +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp index eb154dce3a..907ce7dca8 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp @@ -12,15 +12,15 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "npair_half_size_multi_old_newton_omp.h" -#include "npair_omp.h" -#include "neigh_list.h" -#include "atom.h" -#include "atom_vec.h" -#include "my_page.h" -#include "error.h" +#include "atom.h" +#include "error.h" +#include "my_page.h" +#include "neigh_list.h" +#include "npair_omp.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp index e67c1463f7..a2bbf9cae0 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp @@ -12,15 +12,15 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "npair_half_size_multi_old_newton_tri_omp.h" -#include "npair_omp.h" -#include "neigh_list.h" -#include "atom.h" -#include "atom_vec.h" -#include "my_page.h" -#include "error.h" +#include "atom.h" +#include "error.h" +#include "my_page.h" +#include "neigh_list.h" +#include "npair_omp.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp index 2bcc710d42..43e2fb15e4 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp @@ -19,13 +19,10 @@ #include "atom.h" #include "comm.h" -#include "error.h" #include "force.h" #include "math_const.h" #include "memory.h" #include "neigh_list.h" -#include "neigh_request.h" -#include "neighbor.h" #include diff --git a/src/OPENMP/pair_lj_sdk_coul_msm_omp.cpp b/src/OPENMP/pair_lj_sdk_coul_msm_omp.cpp index b9e62b7bdf..53c058fba1 100644 --- a/src/OPENMP/pair_lj_sdk_coul_msm_omp.cpp +++ b/src/OPENMP/pair_lj_sdk_coul_msm_omp.cpp @@ -19,6 +19,7 @@ #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" #include "neigh_list.h" diff --git a/src/OPENMP/pair_reaxff_omp.h b/src/OPENMP/pair_reaxff_omp.h index 3e8ebac284..4424c90b39 100644 --- a/src/OPENMP/pair_reaxff_omp.h +++ b/src/OPENMP/pair_reaxff_omp.h @@ -22,7 +22,7 @@ PairStyle(reax/c/omp,PairReaxFFOMP); #define LMP_PAIR_REAXFF_OMP_H #include "pair_reaxff.h" -#include "thr_omp.h" +#include "thr_omp.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 49e8ce6218..fa96ef0f26 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -30,8 +30,8 @@ #include "neigh_list.h" #include "neighbor.h" -#include #include +#include using namespace LAMMPS_NS; diff --git a/src/PLUGIN/plugin.cpp b/src/PLUGIN/plugin.cpp index 78538be2ff..270c9958f5 100644 --- a/src/PLUGIN/plugin.cpp +++ b/src/PLUGIN/plugin.cpp @@ -19,9 +19,9 @@ #include "error.h" #include "input.h" #include "force.h" -#include "lammps.h" #include "modify.h" +#include #include #include diff --git a/src/PLUGIN/plugin.h b/src/PLUGIN/plugin.h index 5f54a4dc58..d98430bae6 100644 --- a/src/PLUGIN/plugin.h +++ b/src/PLUGIN/plugin.h @@ -21,7 +21,7 @@ CommandStyle(plugin,Plugin); #define LMP_PLUGIN_H #include "command.h" -#include "lammpsplugin.h" +#include "lammpsplugin.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/PTM/compute_ptm_atom.cpp b/src/PTM/compute_ptm_atom.cpp index 74880adcd5..3e7ea775ac 100644 --- a/src/PTM/compute_ptm_atom.cpp +++ b/src/PTM/compute_ptm_atom.cpp @@ -35,7 +35,6 @@ under #include #include #include -#include #include "ptm_constants.h" #include "ptm_functions.h" diff --git a/src/PYTHON/fix_python_invoke.cpp b/src/PYTHON/fix_python_invoke.cpp index 15242d4868..78ffe99ad3 100644 --- a/src/PYTHON/fix_python_invoke.cpp +++ b/src/PYTHON/fix_python_invoke.cpp @@ -18,7 +18,6 @@ #include "fix_python_invoke.h" -#include "comm.h" #include "error.h" #include "lmppython.h" #include "python_compat.h" diff --git a/src/PYTHON/fix_python_move.cpp b/src/PYTHON/fix_python_move.cpp index eef2c4083f..cdfce4a969 100644 --- a/src/PYTHON/fix_python_move.cpp +++ b/src/PYTHON/fix_python_move.cpp @@ -18,13 +18,11 @@ #include "fix_python_move.h" -#include "comm.h" #include "error.h" #include "lmppython.h" #include "python_compat.h" #include "python_utils.h" -#include #include // IWYU pragma: export using namespace LAMMPS_NS; diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index 5b4e841927..43b6f9ea6c 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -28,7 +28,7 @@ #include "python_utils.h" #include "update.h" -#include +#include #include // IWYU pragma: export using namespace LAMMPS_NS; diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index a0d012bb5b..59d086d3e3 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -28,6 +28,7 @@ #include "pair.h" #include "suffix.h" #include "text_file_reader.h" +#include "tokenizer.h" #include "update.h" #include diff --git a/src/QEQ/fix_qeq_point.cpp b/src/QEQ/fix_qeq_point.cpp index 6c22ab85cf..e836c0dad8 100644 --- a/src/QEQ/fix_qeq_point.cpp +++ b/src/QEQ/fix_qeq_point.cpp @@ -32,6 +32,7 @@ #include "update.h" #include +#include using namespace LAMMPS_NS; diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index ff8c87ba4e..4cc254a361 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -33,6 +33,7 @@ #include "update.h" #include +#include using namespace LAMMPS_NS; diff --git a/src/QMMM/fix_qmmm.cpp b/src/QMMM/fix_qmmm.cpp index 1f24728eca..4222a82247 100644 --- a/src/QMMM/fix_qmmm.cpp +++ b/src/QMMM/fix_qmmm.cpp @@ -16,17 +16,17 @@ Contributing author: Axel Kohlmeyer (ICTP) ------------------------------------------------------------------------- */ - -#include #include "fix_qmmm.h" + #include "atom.h" -#include "domain.h" #include "comm.h" -#include "update.h" -#include "force.h" +#include "domain.h" #include "error.h" #include "group.h" #include "memory.h" +#include "update.h" + +#include #include "libqmmm.h" diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index 06c9414fbd..ad80b030f3 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -42,6 +42,7 @@ #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/REAXFF/reaxff_api.h b/src/REAXFF/reaxff_api.h index 68eb7d25a2..043a1ebbf6 100644 --- a/src/REAXFF/reaxff_api.h +++ b/src/REAXFF/reaxff_api.h @@ -21,7 +21,7 @@ #ifndef LMP_REAXFF_API_H #define LMP_REAXFF_API_H -#include "reaxff_types.h" +#include "reaxff_types.h" // IWYU pragma: export #include diff --git a/src/REAXFF/reaxff_control.cpp b/src/REAXFF/reaxff_control.cpp index c84c3afe9d..2020e8a5c3 100644 --- a/src/REAXFF/reaxff_control.cpp +++ b/src/REAXFF/reaxff_control.cpp @@ -31,7 +31,6 @@ #include "utils.h" #include "text_file_reader.h" -#include #include #include #include diff --git a/src/REAXFF/reaxff_ffield.cpp b/src/REAXFF/reaxff_ffield.cpp index f43ab440ff..6297f4cf94 100644 --- a/src/REAXFF/reaxff_ffield.cpp +++ b/src/REAXFF/reaxff_ffield.cpp @@ -34,6 +34,8 @@ #include #include +#include +#include #include using LAMMPS_NS::utils::open_potential; diff --git a/src/REAXFF/reaxff_forces.cpp b/src/REAXFF/reaxff_forces.cpp index ec783102b4..a4edfeee5c 100644 --- a/src/REAXFF/reaxff_forces.cpp +++ b/src/REAXFF/reaxff_forces.cpp @@ -27,7 +27,6 @@ #include "reaxff_api.h" -#include #include #include diff --git a/src/REAXFF/reaxff_reset_tools.cpp b/src/REAXFF/reaxff_reset_tools.cpp index 30a58e84a5..bebb2e2cfc 100644 --- a/src/REAXFF/reaxff_reset_tools.cpp +++ b/src/REAXFF/reaxff_reset_tools.cpp @@ -29,7 +29,6 @@ #include "error.h" -#include #include namespace ReaxFF { diff --git a/src/REAXFF/reaxff_tool_box.cpp b/src/REAXFF/reaxff_tool_box.cpp index 550668197c..5ebed0360e 100644 --- a/src/REAXFF/reaxff_tool_box.cpp +++ b/src/REAXFF/reaxff_tool_box.cpp @@ -28,7 +28,6 @@ #include #include -#include #include "error.h" diff --git a/src/REAXFF/reaxff_types.h b/src/REAXFF/reaxff_types.h index 6bd752f58a..c124a2639d 100644 --- a/src/REAXFF/reaxff_types.h +++ b/src/REAXFF/reaxff_types.h @@ -23,8 +23,8 @@ #include "lmptype.h" -#include "reaxff_defs.h" -#include "reaxff_inline.h" +#include "reaxff_defs.h" // IWYU pragma: export +#include "reaxff_inline.h" // IWYU pragma: export // forward declarations namespace LAMMPS_NS { diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 0ed3a0b95e..9e6e32772d 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -15,7 +15,6 @@ #include "neb.h" #include "atom.h" -#include "comm.h" #include "domain.h" #include "error.h" #include "finish.h" diff --git a/src/SMTBQ/pair_smtbq.cpp b/src/SMTBQ/pair_smtbq.cpp index ff2da85789..4b7a1f2ac5 100644 --- a/src/SMTBQ/pair_smtbq.cpp +++ b/src/SMTBQ/pair_smtbq.cpp @@ -58,7 +58,6 @@ #include #include -#include #include #include diff --git a/src/SPIN/compute_spin.cpp b/src/SPIN/compute_spin.cpp index cebc0d9573..174cec7d59 100644 --- a/src/SPIN/compute_spin.cpp +++ b/src/SPIN/compute_spin.cpp @@ -36,7 +36,6 @@ #include "update.h" #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/TALLY/compute_heat_flux_virial_tally.cpp b/src/TALLY/compute_heat_flux_virial_tally.cpp index ddf56cb4d8..61f00bac7f 100644 --- a/src/TALLY/compute_heat_flux_virial_tally.cpp +++ b/src/TALLY/compute_heat_flux_virial_tally.cpp @@ -22,8 +22,6 @@ #include "pair.h" #include "update.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index 04277ed3c0..5808b8d17c 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -18,9 +18,6 @@ #include "compute_voronoi_atom.h" -#include -#include -#include #include "atom.h" #include "group.h" #include "update.h" @@ -30,9 +27,10 @@ #include "comm.h" #include "variable.h" #include "input.h" -#include "force.h" -#include +#include +#include +#include using namespace LAMMPS_NS; using namespace voro; diff --git a/src/YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/YAFF/pair_lj_switch3_coulgauss_long.cpp index 2b366560ca..7d12ecbe04 100644 --- a/src/YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -27,7 +27,6 @@ #include "memory.h" #include "neighbor.h" #include "neigh_list.h" -#include "update.h" #include #include diff --git a/src/YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/YAFF/pair_mm3_switch3_coulgauss_long.cpp index ec9e1d8c5a..84c33e6b9a 100644 --- a/src/YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -27,7 +27,6 @@ #include "memory.h" #include "neighbor.h" #include "neigh_list.h" -#include "update.h" #include #include diff --git a/src/atom.cpp b/src/atom.cpp index 1d30a3bb5e..4f7049b078 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -35,7 +35,6 @@ #include "library.h" #include -#include #include #ifdef LMP_INTEL @@ -269,7 +268,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) #define ATOM_CLASS #define AtomStyle(key,Class) \ (*avec_map)[#key] = &avec_creator; -#include "style_atom.h" +#include "style_atom.h" // IWYU pragma: keep #undef AtomStyle #undef ATOM_CLASS } diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index 4670b88af8..a1ef126069 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -112,7 +112,7 @@ void AtomVecBody::process_args(int narg, char **arg) #define BodyStyle(key,Class) \ } else if (strcmp(arg[0],#key) == 0) { \ bptr = new Class(lmp,narg,arg); -#include "style_body.h" +#include "style_body.h" // IWYU pragma: keep #undef BodyStyle #undef BODY_CLASS diff --git a/src/citeme.cpp b/src/citeme.cpp index 85f7f478a6..c0ab27e37e 100644 --- a/src/citeme.cpp +++ b/src/citeme.cpp @@ -16,7 +16,7 @@ #include "comm.h" #include "universe.h" -#include +#include // IWYU pragma: keep using namespace LAMMPS_NS; diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index 3179a039b0..8f5cab723b 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -31,7 +31,6 @@ #include #include -#include using namespace LAMMPS_NS; diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index e9175094f8..482b90c4c2 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -32,7 +32,6 @@ #include #include -#include using namespace LAMMPS_NS; diff --git a/src/compute_dipole.cpp b/src/compute_dipole.cpp index b67c3df3ce..7486baefd6 100644 --- a/src/compute_dipole.cpp +++ b/src/compute_dipole.cpp @@ -16,10 +16,10 @@ #include "atom.h" #include "domain.h" #include "error.h" -#include "group.h" #include "update.h" #include +#include using namespace LAMMPS_NS; diff --git a/src/compute_vacf.cpp b/src/compute_vacf.cpp index 90dcbf8d4f..64d5ddb3f7 100644 --- a/src/compute_vacf.cpp +++ b/src/compute_vacf.cpp @@ -21,8 +21,6 @@ #include "fix_store.h" #include "error.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 7853e44c04..16c67927bf 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -28,8 +28,8 @@ #include "region.h" #include "update.h" #include "variable.h" -#include "fmt/format.h" -#include "utils.h" + +#include using namespace LAMMPS_NS; diff --git a/src/fix_store_state.cpp b/src/fix_store_state.cpp index ab2234e222..e4d1634a07 100644 --- a/src/fix_store_state.cpp +++ b/src/fix_store_state.cpp @@ -19,17 +19,16 @@ #include "compute.h" #include "update.h" #include "domain.h" -#include "force.h" #include "modify.h" #include "fix.h" #include "group.h" #include "input.h" #include "variable.h" -#include "variable.h" -#include "utils.h" #include "memory.h" #include "error.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/force.cpp b/src/force.cpp index c7dc198e83..b1128b48c3 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -80,7 +80,7 @@ void _noopt Force::create_factories() #define PAIR_CLASS #define PairStyle(key,Class) \ (*pair_map)[#key] = &pair_creator; -#include "style_pair.h" +#include "style_pair.h" // IWYU pragma: keep #undef PairStyle #undef PAIR_CLASS @@ -89,7 +89,7 @@ void _noopt Force::create_factories() #define BOND_CLASS #define BondStyle(key,Class) \ (*bond_map)[#key] = &bond_creator; -#include "style_bond.h" +#include "style_bond.h" // IWYU pragma: keep #undef BondStyle #undef BOND_CLASS @@ -98,7 +98,7 @@ void _noopt Force::create_factories() #define ANGLE_CLASS #define AngleStyle(key,Class) \ (*angle_map)[#key] = &angle_creator; -#include "style_angle.h" +#include "style_angle.h" // IWYU pragma: keep #undef AngleStyle #undef ANGLE_CLASS @@ -107,7 +107,7 @@ void _noopt Force::create_factories() #define DIHEDRAL_CLASS #define DihedralStyle(key,Class) \ (*dihedral_map)[#key] = &dihedral_creator; -#include "style_dihedral.h" +#include "style_dihedral.h" // IWYU pragma: keep #undef DihedralStyle #undef DIHEDRAL_CLASS @@ -116,7 +116,7 @@ void _noopt Force::create_factories() #define IMPROPER_CLASS #define ImproperStyle(key,Class) \ (*improper_map)[#key] = &improper_creator; -#include "style_improper.h" +#include "style_improper.h" // IWYU pragma: keep #undef ImproperStyle #undef IMPROPER_CLASS @@ -125,7 +125,7 @@ void _noopt Force::create_factories() #define KSPACE_CLASS #define KSpaceStyle(key,Class) \ (*kspace_map)[#key] = &kspace_creator; -#include "style_kspace.h" +#include "style_kspace.h" // IWYU pragma: keep #undef KSpaceStyle #undef KSPACE_CLASS } diff --git a/src/group.cpp b/src/group.cpp index ab058b49da..57c701a7fa 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -37,7 +37,6 @@ #include #include #include -#include using namespace LAMMPS_NS; diff --git a/src/info.cpp b/src/info.cpp index 626d3d3fd1..137bf44b1a 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -48,6 +48,8 @@ #include #include #include +#include +#include #include #ifdef _WIN32 diff --git a/src/input.cpp b/src/input.cpp index 6cb0a56585..f67438d635 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -38,7 +38,7 @@ #include "output.h" #include "pair.h" #include "special.h" -#include "style_command.h" +#include "style_command.h" // IWYU pragma: keep #include "thermo.h" #include "timer.h" #include "universe.h" @@ -126,7 +126,7 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp) #define COMMAND_CLASS #define CommandStyle(key,Class) \ (*command_map)[#key] = &command_creator; -#include "style_command.h" +#include "style_command.h" // IWYU pragma: keep #undef CommandStyle #undef COMMAND_CLASS diff --git a/src/lammps.cpp b/src/lammps.cpp index b6c7fdcdef..25f73d2723 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -1185,7 +1185,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Atom styles:\n"); #define ATOM_CLASS #define AtomStyle(key,Class) print_style(fp,#key,pos); -#include "style_atom.h" +#include "style_atom.h" // IWYU pragma: keep #undef ATOM_CLASS fprintf(fp,"\n\n"); @@ -1193,7 +1193,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Integrate styles:\n"); #define INTEGRATE_CLASS #define IntegrateStyle(key,Class) print_style(fp,#key,pos); -#include "style_integrate.h" +#include "style_integrate.h" // IWYU pragma: keep #undef INTEGRATE_CLASS fprintf(fp,"\n\n"); @@ -1201,7 +1201,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Minimize styles:\n"); #define MINIMIZE_CLASS #define MinimizeStyle(key,Class) print_style(fp,#key,pos); -#include "style_minimize.h" +#include "style_minimize.h" // IWYU pragma: keep #undef MINIMIZE_CLASS fprintf(fp,"\n\n"); @@ -1209,7 +1209,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Pair styles:\n"); #define PAIR_CLASS #define PairStyle(key,Class) print_style(fp,#key,pos); -#include "style_pair.h" +#include "style_pair.h" // IWYU pragma: keep #undef PAIR_CLASS fprintf(fp,"\n\n"); @@ -1217,7 +1217,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Bond styles:\n"); #define BOND_CLASS #define BondStyle(key,Class) print_style(fp,#key,pos); -#include "style_bond.h" +#include "style_bond.h" // IWYU pragma: keep #undef BOND_CLASS fprintf(fp,"\n\n"); @@ -1225,7 +1225,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Angle styles:\n"); #define ANGLE_CLASS #define AngleStyle(key,Class) print_style(fp,#key,pos); -#include "style_angle.h" +#include "style_angle.h" // IWYU pragma: keep #undef ANGLE_CLASS fprintf(fp,"\n\n"); @@ -1233,7 +1233,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Dihedral styles:\n"); #define DIHEDRAL_CLASS #define DihedralStyle(key,Class) print_style(fp,#key,pos); -#include "style_dihedral.h" +#include "style_dihedral.h" // IWYU pragma: keep #undef DIHEDRAL_CLASS fprintf(fp,"\n\n"); @@ -1241,7 +1241,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Improper styles:\n"); #define IMPROPER_CLASS #define ImproperStyle(key,Class) print_style(fp,#key,pos); -#include "style_improper.h" +#include "style_improper.h" // IWYU pragma: keep #undef IMPROPER_CLASS fprintf(fp,"\n\n"); @@ -1249,7 +1249,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* KSpace styles:\n"); #define KSPACE_CLASS #define KSpaceStyle(key,Class) print_style(fp,#key,pos); -#include "style_kspace.h" +#include "style_kspace.h" // IWYU pragma: keep #undef KSPACE_CLASS fprintf(fp,"\n\n"); @@ -1257,7 +1257,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Fix styles\n"); #define FIX_CLASS #define FixStyle(key,Class) print_style(fp,#key,pos); -#include "style_fix.h" +#include "style_fix.h" // IWYU pragma: keep #undef FIX_CLASS fprintf(fp,"\n\n"); @@ -1265,7 +1265,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Compute styles:\n"); #define COMPUTE_CLASS #define ComputeStyle(key,Class) print_style(fp,#key,pos); -#include "style_compute.h" +#include "style_compute.h" // IWYU pragma: keep #undef COMPUTE_CLASS fprintf(fp,"\n\n"); @@ -1273,7 +1273,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Region styles:\n"); #define REGION_CLASS #define RegionStyle(key,Class) print_style(fp,#key,pos); -#include "style_region.h" +#include "style_region.h" // IWYU pragma: keep #undef REGION_CLASS fprintf(fp,"\n\n"); @@ -1281,7 +1281,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Dump styles:\n"); #define DUMP_CLASS #define DumpStyle(key,Class) print_style(fp,#key,pos); -#include "style_dump.h" +#include "style_dump.h" // IWYU pragma: keep #undef DUMP_CLASS fprintf(fp,"\n\n"); @@ -1289,7 +1289,7 @@ void _noopt LAMMPS::help() fprintf(fp,"* Command styles\n"); #define COMMAND_CLASS #define CommandStyle(key,Class) print_style(fp,#key,pos); -#include "style_command.h" +#include "style_command.h" // IWYU pragma: keep #undef COMMAND_CLASS fprintf(fp,"\n\n"); diff --git a/src/library.cpp b/src/library.cpp index 1acb61c66d..13f480ed03 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -52,7 +52,6 @@ #include "variable.h" #include -#include #if defined(LAMMPS_EXCEPTIONS) #include "exceptions.h" diff --git a/src/main.cpp b/src/main.cpp index 32420324ef..568da132e2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,10 +28,6 @@ #include #endif -#if defined(LAMMPS_EXCEPTIONS) -#include "exceptions.h" -#endif - // import MolSSI Driver Interface library #if defined(LMP_MDI) #include diff --git a/src/modify.cpp b/src/modify.cpp index 4d2fb68a81..6253d567b1 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -13,8 +13,8 @@ ------------------------------------------------------------------------- */ #include "modify.h" -#include "style_compute.h" -#include "style_fix.h" +#include "style_compute.h" // IWYU pragma: keep +#include "style_fix.h" // IWYU pragma: keep #include "atom.h" #include "comm.h" @@ -95,7 +95,7 @@ void _noopt Modify::create_factories() #define FIX_CLASS #define FixStyle(key,Class) \ (*fix_map)[#key] = &fix_creator; -#include "style_fix.h" +#include "style_fix.h" // IWYU pragma: keep #undef FixStyle #undef FIX_CLASS @@ -106,7 +106,7 @@ void _noopt Modify::create_factories() #define COMPUTE_CLASS #define ComputeStyle(key,Class) \ (*compute_map)[#key] = &compute_creator; -#include "style_compute.h" +#include "style_compute.h" // IWYU pragma: keep #undef ComputeStyle #undef COMPUTE_CLASS } diff --git a/src/molecule.cpp b/src/molecule.cpp index 138b4e0749..1a3acf53ba 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -26,7 +26,6 @@ #include "memory.h" #include "tokenizer.h" -#include #include #include diff --git a/src/molecule.h b/src/molecule.h index c7b54b921a..14db9f3197 100644 --- a/src/molecule.h +++ b/src/molecule.h @@ -16,8 +16,6 @@ #include "pointers.h" -#include - namespace LAMMPS_NS { class Molecule : protected Pointers { diff --git a/src/nbin_multi.cpp b/src/nbin_multi.cpp index c58f2b9a94..f5e79bcda6 100644 --- a/src/nbin_multi.cpp +++ b/src/nbin_multi.cpp @@ -22,6 +22,8 @@ #include "error.h" #include "memory.h" +#include + using namespace LAMMPS_NS; #define SMALL 1.0e-6 diff --git a/src/neighbor.cpp b/src/neighbor.cpp index d6fc0ac4dc..d58823063c 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -41,10 +41,10 @@ #include "pair.h" #include "pair_hybrid.h" #include "respa.h" -#include "style_nbin.h" -#include "style_npair.h" -#include "style_nstencil.h" -#include "style_ntopo.h" +#include "style_nbin.h" // IWYU pragma: keep +#include "style_npair.h" // IWYU pragma: keep +#include "style_nstencil.h" // IWYU pragma: keep +#include "style_ntopo.h" // IWYU pragma: keep #include "tokenizer.h" #include "update.h" @@ -681,7 +681,7 @@ void Neighbor::init_styles() #define NBIN_CLASS #define NBinStyle(key,Class,bitmasks) nbclass++; -#include "style_nbin.h" +#include "style_nbin.h" // IWYU pragma: keep #undef NBinStyle #undef NBIN_CLASS @@ -695,7 +695,7 @@ void Neighbor::init_styles() binnames[nbclass] = (char *) #key; \ binclass[nbclass] = &bin_creator; \ binmasks[nbclass++] = bitmasks; -#include "style_nbin.h" +#include "style_nbin.h" // IWYU pragma: keep #undef NBinStyle #undef NBIN_CLASS @@ -705,7 +705,7 @@ void Neighbor::init_styles() #define NSTENCIL_CLASS #define NStencilStyle(key,Class,bitmasks) nsclass++; -#include "style_nstencil.h" +#include "style_nstencil.h" // IWYU pragma: keep #undef NStencilStyle #undef NSTENCIL_CLASS @@ -719,7 +719,7 @@ void Neighbor::init_styles() stencilnames[nsclass] = (char *) #key; \ stencilclass[nsclass] = &stencil_creator; \ stencilmasks[nsclass++] = bitmasks; -#include "style_nstencil.h" +#include "style_nstencil.h" // IWYU pragma: keep #undef NStencilStyle #undef NSTENCIL_CLASS @@ -729,7 +729,7 @@ void Neighbor::init_styles() #define NPAIR_CLASS #define NPairStyle(key,Class,bitmasks) npclass++; -#include "style_npair.h" +#include "style_npair.h" // IWYU pragma: keep #undef NPairStyle #undef NPAIR_CLASS @@ -743,7 +743,7 @@ void Neighbor::init_styles() pairnames[npclass] = (char *) #key; \ pairclass[npclass] = &pair_creator; \ pairmasks[npclass++] = bitmasks; -#include "style_npair.h" +#include "style_npair.h" // IWYU pragma: keep #undef NPairStyle #undef NPAIR_CLASS } diff --git a/src/npair_half_size_multi_old_newtoff.cpp b/src/npair_half_size_multi_old_newtoff.cpp index 26bde10b0e..d98b0a635d 100644 --- a/src/npair_half_size_multi_old_newtoff.cpp +++ b/src/npair_half_size_multi_old_newtoff.cpp @@ -16,7 +16,6 @@ #include "atom.h" #include "error.h" -#include "molecule.h" #include "my_page.h" #include "neigh_list.h" diff --git a/src/npair_half_size_multi_old_newton.cpp b/src/npair_half_size_multi_old_newton.cpp index 7f63679bc1..8ea894db4c 100644 --- a/src/npair_half_size_multi_old_newton.cpp +++ b/src/npair_half_size_multi_old_newton.cpp @@ -16,7 +16,6 @@ #include "atom.h" #include "error.h" -#include "molecule.h" #include "my_page.h" #include "neigh_list.h" diff --git a/src/npair_half_size_multi_old_newton_tri.cpp b/src/npair_half_size_multi_old_newton_tri.cpp index f71a470479..cf7495de1b 100644 --- a/src/npair_half_size_multi_old_newton_tri.cpp +++ b/src/npair_half_size_multi_old_newton_tri.cpp @@ -16,7 +16,6 @@ #include "atom.h" #include "error.h" -#include "molecule.h" #include "my_page.h" #include "neigh_list.h" diff --git a/src/nstencil.cpp b/src/nstencil.cpp index e79bd69d29..944c94f983 100644 --- a/src/nstencil.cpp +++ b/src/nstencil.cpp @@ -21,6 +21,8 @@ #include "domain.h" #include "memory.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- diff --git a/src/nstencil_full_multi_2d.cpp b/src/nstencil_full_multi_2d.cpp index 22912c5866..52ae88d09e 100644 --- a/src/nstencil_full_multi_2d.cpp +++ b/src/nstencil_full_multi_2d.cpp @@ -13,12 +13,8 @@ ------------------------------------------------------------------------- */ #include "nstencil_full_multi_2d.h" -#include "neighbor.h" + #include "neigh_list.h" -#include "nbin.h" -#include "memory.h" -#include "atom.h" -#include using namespace LAMMPS_NS; diff --git a/src/nstencil_full_multi_3d.cpp b/src/nstencil_full_multi_3d.cpp index f317253baa..d48cf0c8d7 100644 --- a/src/nstencil_full_multi_3d.cpp +++ b/src/nstencil_full_multi_3d.cpp @@ -13,12 +13,8 @@ ------------------------------------------------------------------------- */ #include "nstencil_full_multi_3d.h" -#include "neighbor.h" + #include "neigh_list.h" -#include "nbin.h" -#include "memory.h" -#include "atom.h" -#include using namespace LAMMPS_NS; diff --git a/src/nstencil_half_multi_2d.cpp b/src/nstencil_half_multi_2d.cpp index 08d3ed7d6d..81713e183d 100644 --- a/src/nstencil_half_multi_2d.cpp +++ b/src/nstencil_half_multi_2d.cpp @@ -13,12 +13,8 @@ ------------------------------------------------------------------------- */ #include "nstencil_half_multi_2d.h" -#include "neighbor.h" + #include "neigh_list.h" -#include "nbin.h" -#include "memory.h" -#include "atom.h" -#include using namespace LAMMPS_NS; diff --git a/src/nstencil_half_multi_2d_tri.cpp b/src/nstencil_half_multi_2d_tri.cpp index 4de841897e..d53c503fad 100644 --- a/src/nstencil_half_multi_2d_tri.cpp +++ b/src/nstencil_half_multi_2d_tri.cpp @@ -13,12 +13,8 @@ ------------------------------------------------------------------------- */ #include "nstencil_half_multi_2d_tri.h" -#include "neighbor.h" + #include "neigh_list.h" -#include "nbin.h" -#include "memory.h" -#include "atom.h" -#include using namespace LAMMPS_NS; diff --git a/src/nstencil_half_multi_3d.cpp b/src/nstencil_half_multi_3d.cpp index 3465663e47..ca4b4c4111 100644 --- a/src/nstencil_half_multi_3d.cpp +++ b/src/nstencil_half_multi_3d.cpp @@ -13,12 +13,8 @@ ------------------------------------------------------------------------- */ #include "nstencil_half_multi_3d.h" -#include "neighbor.h" + #include "neigh_list.h" -#include "nbin.h" -#include "memory.h" -#include "atom.h" -#include using namespace LAMMPS_NS; diff --git a/src/nstencil_half_multi_3d_tri.cpp b/src/nstencil_half_multi_3d_tri.cpp index d7f9a8e01a..60df9199a2 100644 --- a/src/nstencil_half_multi_3d_tri.cpp +++ b/src/nstencil_half_multi_3d_tri.cpp @@ -13,12 +13,8 @@ ------------------------------------------------------------------------- */ #include "nstencil_half_multi_3d_tri.h" -#include "neighbor.h" + #include "neigh_list.h" -#include "nbin.h" -#include "memory.h" -#include "atom.h" -#include using namespace LAMMPS_NS; diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index edcd04df08..95cec11eff 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -18,16 +18,17 @@ #include "pair_buck_coul_cut.h" -#include #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "neigh_list.h" +#include "neighbor.h" +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 5fc95b78b9..bbd3bd3359 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -32,7 +32,6 @@ #include "mpiio.h" #include "pair.h" #include "special.h" -#include "universe.h" #include "update.h" #include diff --git a/src/text_file_reader.h b/src/text_file_reader.h index e1f875a4e6..98657a937e 100644 --- a/src/text_file_reader.h +++ b/src/text_file_reader.h @@ -18,7 +18,7 @@ #ifndef LMP_TEXT_FILE_READER_H #define LMP_TEXT_FILE_READER_H -#include "tokenizer.h" +#include "tokenizer.h" // IWYU pragma: export #include diff --git a/src/tokenizer.h b/src/tokenizer.h index e2a060d218..7f45a512dd 100644 --- a/src/tokenizer.h +++ b/src/tokenizer.h @@ -20,9 +20,9 @@ #include "lmptype.h" -#include // IWYU pragma: export -#include // IWYU pragma: export -#include // IWYU pragma: export +#include +#include +#include namespace LAMMPS_NS { diff --git a/src/utils.h b/src/utils.h index c261ab3229..37d52f2614 100644 --- a/src/utils.h +++ b/src/utils.h @@ -21,9 +21,7 @@ #include -#include -#include -#include +#include // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/velocity.cpp b/src/velocity.cpp index fa09f451df..a42c820d8c 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -17,7 +17,6 @@ #include "atom.h" #include "comm.h" #include "compute.h" -#include "compute_temp.h" #include "domain.h" #include "error.h" #include "fix.h" diff --git a/src/write_dump.cpp b/src/write_dump.cpp index f5b351fae1..89c976fe09 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "write_dump.h" -#include "style_dump.h" +#include "style_dump.h" // IWYU pragma: keep #include "comm.h" #include "dump.h" @@ -64,7 +64,7 @@ void WriteDump::command(int narg, char **arg) #define DumpStyle(key,Class) \ } else if (strcmp(arg[1],#key) == 0) { \ dump = new Class(lmp,modindex+2,dumpargs); -#include "style_dump.h" +#include "style_dump.h" // IWYU pragma: keep #undef DUMP_CLASS } else error->all(FLERR,utils::check_packages_for_style("dump",arg[1],lmp)); diff --git a/tools/lammps-shell/lammps-shell.cpp b/tools/lammps-shell/lammps-shell.cpp index f77bd5442f..c740419601 100644 --- a/tools/lammps-shell/lammps-shell.cpp +++ b/tools/lammps-shell/lammps-shell.cpp @@ -8,13 +8,9 @@ #include "library.h" #include "utils.h" -#include -#include #include #include #include -#include -#include #if !defined(_WIN32) #include