From c02c352ca2eb9c4630c6d5fb8ceed583783e2fa5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Jun 2020 21:56:00 -0400 Subject: [PATCH] use {fmt} to write out atomic data --- src/atom_vec.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index fc9c3646cf..b9a8d6b09d 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -25,6 +25,7 @@ #include "error.h" #include "utils.h" #include "tokenizer.h" +#include "fmt/format.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -1837,7 +1838,7 @@ void AtomVec::write_data(FILE *fp, int n, double **buf) int i,j,m,nn,datatype,cols; for (i = 0; i < n; i++) { - fprintf(fp,TAGINT_FORMAT,(tagint) ubuf(buf[i][0]).i); + fmt::print(fp,"{}",(tagint) ubuf(buf[i][0]).i); j = 1; for (nn = 1; nn < ndata_atom; nn++) { @@ -1859,10 +1860,10 @@ void AtomVec::write_data(FILE *fp, int n, double **buf) } } else if (datatype == BIGINT) { if (cols == 0) { - fprintf(fp," " BIGINT_FORMAT,(bigint) ubuf(buf[i][j++]).i); + fmt::print(fp," {}",(bigint) ubuf(buf[i][j++]).i); } else { for (m = 0; m < cols; m++) - fprintf(fp," " BIGINT_FORMAT,(bigint) ubuf(buf[i][j++]).i); + fmt::print(fp," {}",(bigint) ubuf(buf[i][j++]).i); } } } @@ -1985,7 +1986,7 @@ void AtomVec::write_vel(FILE *fp, int n, double **buf) int i,j,m,nn,datatype,cols; for (i = 0; i < n; i++) { - fprintf(fp,TAGINT_FORMAT,(tagint) ubuf(buf[i][0]).i); + fmt::print(fp,"{}",(tagint) ubuf(buf[i][0]).i); j = 1; for (nn = 1; nn < ndata_vel; nn++) { @@ -2007,10 +2008,10 @@ void AtomVec::write_vel(FILE *fp, int n, double **buf) } } else if (datatype == BIGINT) { if (cols == 0) { - fprintf(fp," " BIGINT_FORMAT,(bigint) ubuf(buf[i][j++]).i); + fmt::print(fp," {}",(bigint) ubuf(buf[i][j++]).i); } else { for (m = 0; m < cols; m++) - fprintf(fp," " BIGINT_FORMAT,(bigint) ubuf(buf[i][j++]).i); + fmt::print(fp," {}",(bigint) ubuf(buf[i][j++]).i); } } }