From 36b7aa73aad8878a17afeddf77541a2f5b064c27 Mon Sep 17 00:00:00 2001
From: Lars Pastewka <lars.pastewka@imtek.uni-freiburg.de>
Date: Wed, 1 Nov 2017 21:19:55 +0100
Subject: [PATCH] MAINT: Use proper data type for bigint when defining NetCDF
 file.

---
 src/USER-NETCDF/dump_netcdf.cpp       | 5 +++++
 src/USER-NETCDF/dump_netcdf_mpiio.cpp | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/src/USER-NETCDF/dump_netcdf.cpp b/src/USER-NETCDF/dump_netcdf.cpp
index af9f94a728..fa222f54c1 100644
--- a/src/USER-NETCDF/dump_netcdf.cpp
+++ b/src/USER-NETCDF/dump_netcdf.cpp
@@ -497,8 +497,13 @@ void DumpNetCDF::openfile()
                                &thermovar[i]), th->keyword[i] );
           }
           else if (th->vtype[i] == BIGINT) {
+#if defined(LAMMPS_SMALLBIG) || defined(LAMMPS_BIGBIG)
+            NCERRX( nc_def_var(ncid, th->keyword[i], NC_INT64, 1, dims,
+                               &thermovar[i]), th->keyword[i] );
+#else
             NCERRX( nc_def_var(ncid, th->keyword[i], NC_LONG, 1, dims,
                                &thermovar[i]), th->keyword[i] );
+#endif
           }
         }
       }
diff --git a/src/USER-NETCDF/dump_netcdf_mpiio.cpp b/src/USER-NETCDF/dump_netcdf_mpiio.cpp
index 890029371e..7b1103bb71 100644
--- a/src/USER-NETCDF/dump_netcdf_mpiio.cpp
+++ b/src/USER-NETCDF/dump_netcdf_mpiio.cpp
@@ -465,8 +465,13 @@ void DumpNetCDFMPIIO::openfile()
                                 &thermovar[i]), th->keyword[i] );
         }
         else if (th->vtype[i] == BIGINT) {
+#if defined(LAMMPS_SMALLBIG) || defined(LAMMPS_BIGBIG)
+          NCERRX( ncmpi_def_var(ncid, th->keyword[i], NC_INT64, 1, dims,
+                                &thermovar[i]), th->keyword[i] );
+#else
           NCERRX( ncmpi_def_var(ncid, th->keyword[i], NC_LONG, 1, dims,
                                 &thermovar[i]), th->keyword[i] );
+#endif
         }
       }
     }
-- 
GitLab