From 62b388b48fd34e1d5e2bfbd4af221ad062f4847e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 10 Jun 2023 19:23:11 -0400 Subject: [PATCH 1/2] consolidate LAMMPS data type constants and enums and use the same names --- examples/COUPLE/plugin/liblammpsplugin.h | 5 +++-- fortran/lammps.f90 | 3 ++- python/lammps/constants.py | 8 ++++++-- src/EXTRA-DUMP/dump_yaml.cpp | 6 +++--- src/NETCDF/dump_netcdf.cpp | 12 ++++++------ src/NETCDF/dump_netcdf_mpiio.cpp | 12 ++++++------ src/library.cpp | 6 +++--- src/library.h | 3 ++- src/lmptype.h | 25 ++++++++++++++++++------ tools/swig/lammps.i | 3 ++- unittest/utils/test_lmptype.cpp | 16 +++++++-------- 11 files changed, 60 insertions(+), 39 deletions(-) diff --git a/examples/COUPLE/plugin/liblammpsplugin.h b/examples/COUPLE/plugin/liblammpsplugin.h index 40fba6b9e3..1520ef638d 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.h +++ b/examples/COUPLE/plugin/liblammpsplugin.h @@ -37,12 +37,13 @@ #endif /* The following enums must be kept in sync with the equivalent enums - * or constants in python/lammps/constants.py, fortran/lammps.f90, - * tools/swig/lammps.i, and examples/COUPLE/plugin/liblammpsplugin.h */ + * or constants in src/library.h, src/lmptype.h, python/lammps/constants.py, + * fortran/lammps.f90, and tools/swig/lammps.i */ /* Data type constants for extracting data from atoms, computes and fixes */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index f511e6bb60..669e9c700d 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -44,11 +44,12 @@ MODULE LIBLAMMPS ! Data type constants for extracting data from global, atom, compute, and fix ! ! Must be kept in sync with the equivalent declarations in - ! src/library.h, python/lammps/constants.py, tools/swig/lammps.i, + ! src/library.h, src/lmptype.h, python/lammps/constants.py, tools/swig/lammps.i, ! and examples/COUPLE/plugin/liblammpsplugin.h ! ! These are NOT part of the API (the part the user sees) INTEGER(c_int), PARAMETER :: & + LAMMPS_NONE = -1, & ! no data type assigned (yet) LAMMPS_INT = 0, & ! 32-bit integer (or array) LAMMPS_INT_2D = 1, & ! two-dimensional 32-bit integer array LAMMPS_DOUBLE = 2, & ! 64-bit double (or array) diff --git a/python/lammps/constants.py b/python/lammps/constants.py index 8fd6a9eaf5..1d0d8adb78 100644 --- a/python/lammps/constants.py +++ b/python/lammps/constants.py @@ -13,7 +13,13 @@ # various symbolic constants to be used # in certain calls to select data formats + +# these must be kept in sync with the enums in src/library.h, src/lmptype.h, +# tools/swig/lammps.i, examples/COUPLE/plugin/liblammpsplugin.h, +# and the constants in fortran/lammps.f90 + LAMMPS_AUTODETECT = None +LAMMPS_NONE = -1 LAMMPS_INT = 0 LAMMPS_INT_2D = 1 LAMMPS_DOUBLE = 2 @@ -22,8 +28,6 @@ LAMMPS_INT64 = 4 LAMMPS_INT64_2D = 5 LAMMPS_STRING = 6 -# these must be kept in sync with the enums in src/library.h, tools/swig/lammps.i, -# examples/COUPLE/plugin/liblammpsplugin.h, and the constants in fortran/lammps.f90 LMP_STYLE_GLOBAL = 0 LMP_STYLE_ATOM = 1 LMP_STYLE_LOCAL = 2 diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index 47cab1ee02..3ca5c59edf 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -71,11 +71,11 @@ void DumpYAML::write_header(bigint ndump) thermo_data += "]\n - data: [ "; for (int i = 0; i < nfield; ++i) { - if (fields[i].type == multitype::DOUBLE) + if (fields[i].type == multitype::LAMMPS_DOUBLE) thermo_data += fmt::format("{}, ", fields[i].data.d); - else if (fields[i].type == multitype::INT) + else if (fields[i].type == multitype::LAMMPS_INT) thermo_data += fmt::format("{}, ", fields[i].data.i); - else if (fields[i].type == multitype::BIGINT) + else if (fields[i].type == multitype::LAMMPS_INT64) thermo_data += fmt::format("{}, ", fields[i].data.b); else thermo_data += ", "; diff --git a/src/NETCDF/dump_netcdf.cpp b/src/NETCDF/dump_netcdf.cpp index 0115c0bbe9..a4699897a3 100644 --- a/src/NETCDF/dump_netcdf.cpp +++ b/src/NETCDF/dump_netcdf.cpp @@ -442,11 +442,11 @@ void DumpNetCDF::openfile() const int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { - if (fields[i].type == multitype::DOUBLE) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { NCERRX( nc_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); - } else if (fields[i].type == multitype::INT) { + } else if (fields[i].type == multitype::LAMMPS_INT) { NCERRX( nc_def_var(ncid, keywords[i].c_str(), NC_INT, 1, dims, &thermovar[i]), keywords[i].c_str() ); - } else if (fields[i].type == multitype::BIGINT) { + } else if (fields[i].type == multitype::LAMMPS_INT64) { NCERRX( nc_def_var(ncid, keywords[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), keywords[i].c_str() ); } } @@ -624,11 +624,11 @@ void DumpNetCDF::write() int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { if (filewriter) { - if (fields[i].type == multitype::DOUBLE) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { NCERRX( nc_put_var1_double(ncid, thermovar[i], start, &fields[i].data.d), keywords[i].c_str() ); - } else if (fields[i].type == multitype::INT) { + } else if (fields[i].type == multitype::LAMMPS_INT) { NCERRX( nc_put_var1_int(ncid, thermovar[i], start, &fields[i].data.i), keywords[i].c_str() ); - } else if (fields[i].type == multitype::BIGINT) { + } else if (fields[i].type == multitype::LAMMPS_INT64) { NCERRX( nc_put_var1_bigint(ncid, thermovar[i], start, &fields[i].data.b), keywords[i].c_str() ); } } diff --git a/src/NETCDF/dump_netcdf_mpiio.cpp b/src/NETCDF/dump_netcdf_mpiio.cpp index f9382dacef..2407678386 100644 --- a/src/NETCDF/dump_netcdf_mpiio.cpp +++ b/src/NETCDF/dump_netcdf_mpiio.cpp @@ -432,11 +432,11 @@ void DumpNetCDFMPIIO::openfile() const int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { - if (fields[i].type == multitype::DOUBLE) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); - } else if (fields[i].type == multitype::INT) { + } else if (fields[i].type == multitype::LAMMPS_INT) { NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), NC_INT, 1, dims, &thermovar[i]), keywords[i].c_str() ); - } else if (fields[i].type == multitype::BIGINT) { + } else if (fields[i].type == multitype::LAMMPS_INT64) { NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), keywords[i].c_str() ); } } @@ -617,11 +617,11 @@ void DumpNetCDFMPIIO::write() int nfield = *th->get_nfield(); for (int i = 0; i < nfield; i++) { if (filewriter) { - if (fields[i].type == multitype::DOUBLE) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { NCERRX( ncmpi_put_var1_double(ncid, thermovar[i], start, &fields[i].data.d), keywords[i].c_str() ); - } else if (fields[i].type == multitype::INT) { + } else if (fields[i].type == multitype::LAMMPS_INT) { NCERRX( ncmpi_put_var1_int(ncid, thermovar[i], start, &fields[i].data.i), keywords[i].c_str() ); - } else if (fields[i].type == multitype::BIGINT) { + } else if (fields[i].type == multitype::LAMMPS_INT64) { NCERRX( ncmpi_put_var1_bigint(ncid, thermovar[i], start, &fields[i].data.b), keywords[i].c_str() ); } } diff --git a/src/library.cpp b/src/library.cpp index a94e385148..96af7cbf43 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -836,11 +836,11 @@ void *lammps_last_thermo(void *handle, const char *what, int index) } else if (strcmp(what, "data") == 0) { if ((index < 0) || (index >= nfield)) return nullptr; const auto &field = th->get_fields()[index]; - if (field.type == multitype::INT) { + if (field.type == multitype::LAMMPS_INT) { val = (void *) &field.data.i; - } else if (field.type == multitype::BIGINT) { + } else if (field.type == multitype::LAMMPS_INT64) { val = (void *) &field.data.b; - } else if (field.type == multitype::DOUBLE) { + } else if (field.type == multitype::LAMMPS_DOUBLE) { val = (void *) &field.data.d; } diff --git a/src/library.h b/src/library.h index 5f46e36ccf..30a12ebdef 100644 --- a/src/library.h +++ b/src/library.h @@ -41,10 +41,11 @@ /** Data type constants for extracting data from atoms, computes and fixes * * Must be kept in sync with the equivalent constants in ``python/lammps/constants.py``, - * ``fortran/lammps.f90``, ``tools/swig/lammps.i``, and + * ``fortran/lammps.f90``, ``tools/swig/lammps.i``, ``src/lmptype.h``, and *``examples/COUPLE/plugin/liblammpsplugin.h`` */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ diff --git a/src/lmptype.h b/src/lmptype.h index e559bd9416..2089350f48 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -276,8 +276,21 @@ union ubuf { \endverbatim */ struct multitype { - // same values as LAMMPS_INT, LAMMPS_DOUBLE, and LAMMPS_INT64 in library.h - enum { NONE = -1, INT = 0, DOUBLE = 2, BIGINT = 4 }; + /** Data type constants for extracting data from atoms, computes and fixes + * + * This enum must be kept in sync with the corresponding enum or constants + * in ``python/lammps/constants.py``, ``fortran/lammps.f90``, ``tools/swig/lammps.i``, + * ``src/library.h``, and ``examples/COUPLE/plugin/liblammpsplugin.h`` */ + enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ + LAMMPS_INT = 0, /*!< 32-bit integer (array) */ + LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ + LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ + LAMMPS_DOUBLE_2D = 3, /*!< two-dimensional 64-bit double array */ + LAMMPS_INT64 = 4, /*!< 64-bit integer (array) */ + LAMMPS_INT64_2D = 5, /*!< two-dimensional 64-bit integer array */ + LAMMPS_STRING = 6 /*!< C-String */ + }; int type; union { @@ -286,26 +299,26 @@ struct multitype { int64_t b; } data; - multitype() : type(NONE) { data.d = 0.0; } + multitype() : type(LAMMPS_NONE) { data.d = 0.0; } multitype(const multitype &) = default; multitype(multitype &&) = default; ~multitype() = default; multitype &operator=(const double &_d) { - type = DOUBLE; + type = LAMMPS_DOUBLE; data.d = _d; return *this; } multitype &operator=(const int &_i) { - type = INT; + type = LAMMPS_INT; data.i = _i; return *this; } multitype &operator=(const int64_t &_b) { - type = BIGINT; + type = LAMMPS_INT64; data.b = _b; return *this; } diff --git a/tools/swig/lammps.i b/tools/swig/lammps.i index c4ef0a7109..91a6866107 100644 --- a/tools/swig/lammps.i +++ b/tools/swig/lammps.i @@ -28,9 +28,10 @@ * * Must be kept in sync with the equivalent constants in ``src/library.h``, * ``python/lammps/constants.py``, ``examples/COUPLE/plugin/liblammpsplugin.h``, - * and ``fortran/lammps.f90`` */ + * ``src/lmptype.h``, and ``fortran/lammps.f90`` */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE =-1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ diff --git a/unittest/utils/test_lmptype.cpp b/unittest/utils/test_lmptype.cpp index e5dc871953..383c9d4b2c 100644 --- a/unittest/utils/test_lmptype.cpp +++ b/unittest/utils/test_lmptype.cpp @@ -54,18 +54,18 @@ TEST(Types, multitype) m[4] = -1023; m[5] = -2.225; - EXPECT_EQ(m[0].type, multitype::BIGINT); - EXPECT_EQ(m[1].type, multitype::INT); - EXPECT_EQ(m[2].type, multitype::DOUBLE); + EXPECT_EQ(m[0].type, multitype::LAMMPS_INT64); + EXPECT_EQ(m[1].type, multitype::LAMMPS_INT); + EXPECT_EQ(m[2].type, multitype::LAMMPS_DOUBLE); #if defined(LAMMPS_SMALLSMALL) - EXPECT_EQ(m[3].type, multitype::INT); + EXPECT_EQ(m[3].type, multitype::LAMMPS_INT); #else - EXPECT_EQ(m[3].type, multitype::BIGINT); + EXPECT_EQ(m[3].type, multitype::LAMMPS_INT64); #endif - EXPECT_EQ(m[4].type, multitype::INT); - EXPECT_EQ(m[5].type, multitype::DOUBLE); - EXPECT_EQ(m[6].type, multitype::NONE); + EXPECT_EQ(m[4].type, multitype::LAMMPS_INT); + EXPECT_EQ(m[5].type, multitype::LAMMPS_DOUBLE); + EXPECT_EQ(m[6].type, multitype::LAMMPS_NONE); EXPECT_EQ(m[0].data.b, b1); EXPECT_EQ(m[1].data.i, i1); From 92e069b19deaf39ea79cadd36b5bce53c18e4988 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 10 Jun 2023 21:36:56 -0400 Subject: [PATCH 2/2] add fortran unit tests for lammps_last_thermo --- fortran/lammps.f90 | 8 +- unittest/fortran/test_fortran_get_thermo.f90 | 108 +++++++++++++++++++ unittest/fortran/wrap_get_thermo.cpp | 41 +++++++ 3 files changed, 154 insertions(+), 3 deletions(-) diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index 669e9c700d..ba3997ac8e 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -1127,11 +1127,13 @@ CONTAINS FUNCTION lmp_last_thermo(self,what,index) RESULT(thermo_data) CLASS(lammps), INTENT(IN), TARGET :: self CHARACTER(LEN=*), INTENT(IN) :: what - INTEGER(c_int) :: index + INTEGER :: index + INTEGER(c_int) :: idx TYPE(lammps_data) :: thermo_data, type_data INTEGER(c_int) :: datatype TYPE(c_ptr) :: Cname, Cptr + idx = index - 1 ! set data type for known cases SELECT CASE (what) CASE ('step') @@ -1148,7 +1150,7 @@ CONTAINS datatype = LAMMPS_STRING CASE ('data') Cname = f2c_string('type') - Cptr = lammps_last_thermo(self%handle,Cname,index-1) + Cptr = lammps_last_thermo(self%handle,Cname,idx) type_data%lammps_instance => self type_data%datatype = DATA_INT CALL C_F_POINTER(Cptr, type_data%i32) @@ -1159,7 +1161,7 @@ CONTAINS END SELECT Cname = f2c_string(what) - Cptr = lammps_last_thermo(self%handle,Cname,index-1) + Cptr = lammps_last_thermo(self%handle,Cname,idx) CALL lammps_free(Cname) thermo_data%lammps_instance => self diff --git a/unittest/fortran/test_fortran_get_thermo.f90 b/unittest/fortran/test_fortran_get_thermo.f90 index 7911ab07d5..965e6d58f7 100644 --- a/unittest/fortran/test_fortran_get_thermo.f90 +++ b/unittest/fortran/test_fortran_get_thermo.f90 @@ -152,3 +152,111 @@ FUNCTION f_lammps_get_thermo_zhi() BIND(C) f_lammps_get_thermo_zhi = lmp%get_thermo('zhi') END FUNCTION f_lammps_get_thermo_zhi + +SUBROUTINE f_lammps_last_thermo_setup() BIND(C) + USE liblammps + USE keepstuff, ONLY : lmp, big_input, cont_input, pair_input + IMPLICIT NONE + + CALL lmp%commands_list(big_input) + CALL lmp%commands_list(cont_input) + CALL lmp%commands_list(pair_input) + CALL lmp%command('thermo 10') + CALL lmp%command('run 15 post no') +END SUBROUTINE f_lammps_last_thermo_setup + +FUNCTION f_lammps_last_thermo_step() BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_int64_t + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int) :: f_lammps_last_thermo_step + INTEGER :: size_bigint + INTEGER(c_int), POINTER :: ival + INTEGER(c_int64_t), POINTER :: bval + + size_bigint = lmp%extract_setting('bigint') + IF (size_bigint == 4) THEN + ival = lmp%last_thermo('step',1) + f_lammps_last_thermo_step = INT(ival) + ELSE + bval = lmp%last_thermo('step',1) + f_lammps_last_thermo_step = INT(bval) + END IF +END FUNCTION f_lammps_last_thermo_step + +FUNCTION f_lammps_last_thermo_num() BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int) :: f_lammps_last_thermo_num + INTEGER(c_int), POINTER :: ival + + ival = lmp%last_thermo('num',1) + f_lammps_last_thermo_num = ival +END FUNCTION f_lammps_last_thermo_num + +FUNCTION f_lammps_last_thermo_type(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + INTEGER(c_int) :: f_lammps_last_thermo_type + INTEGER(c_int), POINTER :: ival + + ival = lmp%last_thermo('type',idx) + f_lammps_last_thermo_type = ival +END FUNCTION f_lammps_last_thermo_type + +FUNCTION f_lammps_last_thermo_string(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_ptr, c_null_ptr + USE liblammps + USE keepstuff, ONLY : lmp, f2c_string + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + TYPE(c_ptr) :: f_lammps_last_thermo_string + CHARACTER(LEN=12) :: buffer + + buffer = lmp%last_thermo('keyword',idx) + IF (LEN_TRIM(buffer) > 0) THEN + f_lammps_last_thermo_string = f2c_string(buffer) + ELSE + f_lammps_last_thermo_string = c_null_ptr + END IF +END FUNCTION f_lammps_last_thermo_string + +FUNCTION f_lammps_last_thermo_int(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_int64_t + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + INTEGER(c_int), POINTER :: ival + INTEGER(c_int64_t), POINTER :: bval + INTEGER(c_int) :: f_lammps_last_thermo_int + INTEGER :: size_bigint + + size_bigint = lmp%extract_setting('bigint') + IF (size_bigint == 4) THEN + ival = lmp%last_thermo('data',idx) + f_lammps_last_thermo_int = INT(ival) + ELSE + bval = lmp%last_thermo('data',idx) + f_lammps_last_thermo_int = INT(bval) + END IF +END FUNCTION f_lammps_last_thermo_int + +FUNCTION f_lammps_last_thermo_double(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_double + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + REAL(c_double), POINTER :: dval + REAL(c_double) :: f_lammps_last_thermo_double + + dval = lmp%last_thermo('data',idx) + f_lammps_last_thermo_double = dval +END FUNCTION f_lammps_last_thermo_double diff --git a/unittest/fortran/wrap_get_thermo.cpp b/unittest/fortran/wrap_get_thermo.cpp index 71b51609eb..e18697ba9b 100644 --- a/unittest/fortran/wrap_get_thermo.cpp +++ b/unittest/fortran/wrap_get_thermo.cpp @@ -1,6 +1,7 @@ // unit tests for getting thermodynamic output from a LAMMPS instance through the Fortran wrapper #include "lammps.h" +#include "lmptype.h" #include #include @@ -23,8 +24,18 @@ double f_lammps_get_thermo_ylo(); double f_lammps_get_thermo_yhi(); double f_lammps_get_thermo_zlo(); double f_lammps_get_thermo_zhi(); + +void f_lammps_last_thermo_setup(); +int f_lammps_last_thermo_step(); +int f_lammps_last_thermo_num(); +int f_lammps_last_thermo_type(int); +const char *f_lammps_last_thermo_string(int); +int f_lammps_last_thermo_int(int); +double f_lammps_last_thermo_double(int); } +using LAMMPS_NS::multitype; + class LAMMPS_thermo : public ::testing::Test { protected: LAMMPS_NS::LAMMPS *lmp; @@ -65,3 +76,33 @@ TEST_F(LAMMPS_thermo, get_thermo) EXPECT_DOUBLE_EQ(f_lammps_get_thermo_zlo(), 0.0); EXPECT_DOUBLE_EQ(f_lammps_get_thermo_zhi(), 4.0); }; + +TEST_F(LAMMPS_thermo, last_thermo) +{ + EXPECT_EQ(f_lammps_last_thermo_step(), -1); + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_NONE); + EXPECT_EQ(f_lammps_last_thermo_type(2), multitype::LAMMPS_NONE); + f_lammps_last_thermo_setup(); + EXPECT_EQ(f_lammps_last_thermo_step(), 15); + EXPECT_EQ(f_lammps_last_thermo_num(), 6); + EXPECT_STREQ(f_lammps_last_thermo_string(1), "Step"); + EXPECT_STREQ(f_lammps_last_thermo_string(2), "Temp"); + EXPECT_STREQ(f_lammps_last_thermo_string(3), "E_pair"); + EXPECT_STREQ(f_lammps_last_thermo_string(6), "Press"); +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_INT); +#else + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_INT64); +#endif + EXPECT_EQ(f_lammps_last_thermo_int(1), 15); + EXPECT_EQ(f_lammps_last_thermo_type(2), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(3), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(4), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(5), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(6), multitype::LAMMPS_DOUBLE); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(2), 0.0); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(3), -0.13713425198078993); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(4), 0.0); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(5), -0.13713425198078993); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(6), -0.022421073321023492); +};