diff --git a/src/NETCDF/dump_netcdf.cpp b/src/NETCDF/dump_netcdf.cpp index 137d6368c2..d68da35b0b 100644 --- a/src/NETCDF/dump_netcdf.cpp +++ b/src/NETCDF/dump_netcdf.cpp @@ -335,7 +335,7 @@ void DumpNetCDF::openfile() if (thermo) { Thermo *th = output->thermo; for (int i = 0; i < th->nfield; i++) { - NCERRX( nc_inq_varid(ncid, th->keyword[i], &thermovar[i]), th->keyword[i] ); + NCERRX( nc_inq_varid(ncid, th->keyword[i].c_str(), &thermovar[i]), th->keyword[i].c_str() ); } } @@ -448,18 +448,18 @@ void DumpNetCDF::openfile() Thermo *th = output->thermo; for (int i = 0; i < th->nfield; i++) { if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( nc_def_var(ncid, th->keyword[i], type_nc_real, 1, dims, - &thermovar[i]), th->keyword[i] ); + NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), type_nc_real, 1, dims, + &thermovar[i]), th->keyword[i].c_str() ); } else if (th->vtype[i] == Thermo::INT) { - NCERRX( nc_def_var(ncid, th->keyword[i], NC_INT, 1, dims, - &thermovar[i]), th->keyword[i] ); + NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_INT, 1, dims, + &thermovar[i]), th->keyword[i].c_str() ); } else if (th->vtype[i] == Thermo::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] ); + NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_INT64, 1, dims, + &thermovar[i]), th->keyword[i].c_str() ); #else - NCERRX( nc_def_var(ncid, th->keyword[i], NC_LONG, 1, dims, - &thermovar[i]), th->keyword[i] ); + NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_LONG, 1, dims, + &thermovar[i]), th->keyword[i].c_str() ); #endif } } @@ -625,13 +625,13 @@ void DumpNetCDF::write() if (th->vtype[i] == Thermo::FLOAT) { NCERRX( nc_put_var1_double(ncid, thermovar[i], start, &th->dvalue), - th->keyword[i] ); + th->keyword[i].c_str() ); } else if (th->vtype[i] == Thermo::INT) { NCERRX( nc_put_var1_int(ncid, thermovar[i], start, &th->ivalue), - th->keyword[i] ); + th->keyword[i].c_str() ); } else if (th->vtype[i] == Thermo::BIGINT) { NCERRX( nc_put_var1_bigint(ncid, thermovar[i], start, &th->bivalue), - th->keyword[i] ); + th->keyword[i].c_str() ); } } } diff --git a/src/NETCDF/dump_netcdf_mpiio.cpp b/src/NETCDF/dump_netcdf_mpiio.cpp index a1c9d20e61..ac281d26a3 100644 --- a/src/NETCDF/dump_netcdf_mpiio.cpp +++ b/src/NETCDF/dump_netcdf_mpiio.cpp @@ -332,7 +332,7 @@ void DumpNetCDFMPIIO::openfile() if (thermo) { Thermo *th = output->thermo; for (int i = 0; i < th->nfield; i++) { - NCERRX( ncmpi_inq_varid(ncid, th->keyword[i], &thermovar[i]), th->keyword[i] ); + NCERRX( ncmpi_inq_varid(ncid, th->keyword[i].c_str(), &thermovar[i]), th->keyword[i].c_str() ); } } @@ -436,14 +436,14 @@ void DumpNetCDFMPIIO::openfile() Thermo *th = output->thermo; for (int i = 0; i < th->nfield; i++) { if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( ncmpi_def_var(ncid, th->keyword[i], type_nc_real, 1, dims, &thermovar[i]), th->keyword[i] ); + NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); } else if (th->vtype[i] == Thermo::INT) { - NCERRX( ncmpi_def_var(ncid, th->keyword[i], NC_INT, 1, dims, &thermovar[i]), th->keyword[i] ); + NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_INT, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); } else if (th->vtype[i] == Thermo::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] ); + NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); #else - NCERRX( ncmpi_def_var(ncid, th->keyword[i], NC_LONG, 1, dims, &thermovar[i]), th->keyword[i] ); + NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_LONG, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); #endif } } @@ -612,13 +612,13 @@ void DumpNetCDFMPIIO::write() if (th->vtype[i] == Thermo::FLOAT) { NCERRX( ncmpi_put_var1_double(ncid, thermovar[i], start, &th->dvalue), - th->keyword[i] ); + th->keyword[i].c_str() ); } else if (th->vtype[i] == Thermo::INT) { NCERRX( ncmpi_put_var1_int(ncid, thermovar[i], start, &th->ivalue), - th->keyword[i] ); + th->keyword[i].c_str() ); } else if (th->vtype[i] == Thermo::BIGINT) { NCERRX( ncmpi_put_var1_bigint(ncid, thermovar[i], start, &th->bivalue), - th->keyword[i] ); + th->keyword[i].c_str() ); } } }