diff --git a/src/info.cpp b/src/info.cpp index 57930f9d77..160879577f 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -34,6 +34,7 @@ #include "group.h" #include "improper.h" #include "input.h" +#include "json.h" #include "lmpfftsettings.h" #include "modify.h" #include "neighbor.h" @@ -291,6 +292,7 @@ void Info::command(int narg, char **arg) utils::print(out,"\nCompiler: {} with {}\nC++ standard: {}\n", platform::compiler_info(),platform::openmp_standard(),platform::cxx_standard()); fputs(get_fmt_info().c_str(), out); + fputs(get_json_info().c_str(), out); fputs("\nActive compile time flags:\n\n",out); if (has_gzip_support()) fputs("-DLAMMPS_GZIP\n",out); @@ -1320,6 +1322,16 @@ std::string Info::get_fmt_info() /* ---------------------------------------------------------------------- */ +std::string Info::get_json_info() +{ + return fmt::format("Embedded JSON class version: {}.{}.{}\n", + NLOHMANN_JSON_VERSION_MAJOR, + NLOHMANN_JSON_VERSION_MINOR, + NLOHMANN_JSON_VERSION_PATCH); +} + +/* ---------------------------------------------------------------------- */ + void Info::get_memory_info(double *meminfo) { double bytes = 0; diff --git a/src/info.h b/src/info.h index 77566b0dcc..8ef38b3c9d 100644 --- a/src/info.h +++ b/src/info.h @@ -50,6 +50,7 @@ class Info : public Command { const std::string &); static std::string get_fft_info(); static std::string get_fmt_info(); + static std::string get_json_info(); static bool has_gpu_device(); static std::string get_gpu_device_info(); static std::string get_accelerator_info(const std::string &pkg = ""); diff --git a/src/json.h b/src/json.h new file mode 100644 index 0000000000..9a50a76a7f --- /dev/null +++ b/src/json.h @@ -0,0 +1,25 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_JSON_H +#define LMP_JSON_H + +// wrapper around including the JSON parsing and writing class +// Do NOT include in any header file + +#include "../third_party/nlohmann/json.hpp" + +namespace LAMMPS_NS { +using json = ::nlohmann_lmp::json; +} +#endif diff --git a/src/lammps.cpp b/src/lammps.cpp index d1b05aa279..c891cea14d 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -1456,6 +1456,7 @@ void LAMMPS::print_config(FILE *fp) platform::compiler_info(),platform::openmp_standard(), platform::cxx_standard()); fputs(Info::get_fmt_info().c_str(),fp); + fputs(Info::get_json_info().c_str(),fp); int major,minor; std::string infobuf = platform::mpi_info(major,minor); diff --git a/src/main.cpp b/src/main.cpp index aaedc19c1b..5650c53e04 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,7 @@ #include "input.h" #include "library.h" -#include "nlohmann/json.hpp" +#include "json.h" #include #include @@ -32,7 +32,6 @@ #include #endif -using json = nlohmann_lmp::json; using namespace LAMMPS_NS; // for convenience diff --git a/third_party/README b/third_party/README new file mode 100644 index 0000000000..c5426adef6 --- /dev/null +++ b/third_party/README @@ -0,0 +1 @@ +This folder contains copies of third-party software diff --git a/src/nlohmann/json.hpp b/third_party/nlohmann/json.hpp similarity index 100% rename from src/nlohmann/json.hpp rename to third_party/nlohmann/json.hpp diff --git a/unittest/utils/test_json.cpp b/unittest/utils/test_json.cpp index e8cab895c3..8f428cb628 100644 --- a/unittest/utils/test_json.cpp +++ b/unittest/utils/test_json.cpp @@ -12,15 +12,16 @@ ------------------------------------------------------------------------- */ #include "lmptype.h" -#include "nlohmann/json.hpp" + #include "gmock/gmock.h" #include "gtest/gtest.h" #include #include +#include "json.h" + using namespace LAMMPS_NS; using ::testing::Eq; -using json = ::nlohmann_lmp::json; #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val