avoid XXXINT_FORMAT macros in fix reaxff/bonds

This commit is contained in:
Axel Kohlmeyer
2022-03-30 17:44:18 -04:00
parent c7a9a3e2f6
commit 993441b25a

View File

@ -56,8 +56,8 @@ FixReaxFFBonds::FixReaxFFBonds(LAMMPS *lmp, int narg, char **arg) :
if (!fp) error->one(FLERR,"Cannot open compressed file");
} else fp = fopen(arg[4],"w");
if (!fp) error->one(FLERR,fmt::format("Cannot open fix reaxff/bonds file {}: "
"{}",arg[4],utils::getsyserror()));
if (!fp) error->one(FLERR,fmt::format("Cannot open fix reaxff/bonds file {}: {}",
arg[4],utils::getsyserror()));
}
if (atom->tag_consecutive() == 0)
@ -249,14 +249,12 @@ void FixReaxFFBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local,
MPI_Request irequest, irequest2;
if (me == 0) {
fprintf(fp,"# Timestep " BIGINT_FORMAT " \n",ntimestep);
fprintf(fp,"# \n");
fprintf(fp,"# Number of particles %d \n",natoms);
fprintf(fp,"# \n");
fprintf(fp,"# Max number of bonds per atom %d with "
"coarse bond order cutoff %5.3f \n",maxnum,cutof3);
fprintf(fp,"# Particle connection table and bond orders \n");
fprintf(fp,"# id type nb id_1...id_nb mol bo_1...bo_nb abo nlp q \n");
fmt::print(fp,"# Timestep {}\n#\n",ntimestep);
fmt::print(fp,"# Number of particles {}\n#\n",natoms);
fmt::print(fp,"# Max number of bonds per atom {} with coarse bond order cutoff {:5.3f}\n",
maxnum,cutof3);
fmt::print(fp,"# Particle connection table and bond orders\n"
"# id type nb id_1...id_nb mol bo_1...bo_nb abo nlp q\n");
}
j = 2;
@ -278,30 +276,26 @@ void FixReaxFFBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local,
avqtmp = buf[j+3];
numbonds = nint(buf[j+4]);
fprintf(fp," " TAGINT_FORMAT " %d %d",itag,itype,numbonds);
for (k = 5; k < 5+numbonds; k++) {
jtag = static_cast<tagint> (buf[j+k]);
fprintf(fp," " TAGINT_FORMAT,jtag);
}
auto mesg = fmt::format(" {} {} {}",itag,itype,numbonds);
for (k = 5; k < 5+numbonds; k++)
mesg += " " + std::to_string(static_cast<tagint> (buf[j+k]));
j += (5+numbonds);
fprintf(fp," " TAGINT_FORMAT,static_cast<tagint> (buf[j]));
mesg += " " + std::to_string(static_cast<tagint> (buf[j]));
j ++;
for (k = 0; k < numbonds; k++) {
abotmp = buf[j+k];
fprintf(fp,"%14.3f",abotmp);
}
for (k = 0; k < numbonds; k++) mesg += fmt::format("{:14.3f}",buf[j+k]);
j += (1+numbonds);
fprintf(fp,"%14.3f%14.3f%14.3f\n",sbotmp,nlptmp,avqtmp);
mesg += fmt::format("{:14.3f}{:14.3f}{:14.3f}\n",sbotmp,nlptmp,avqtmp);
fmt::print(fp, mesg);
}
}
} else {
MPI_Isend(&buf[0],nbuf_local,MPI_DOUBLE,0,0,world,&irequest2);
MPI_Wait(&irequest2,MPI_STATUS_IGNORE);
}
if (me ==0) fprintf(fp,"# \n");
if (me ==0) fputs("# \n",fp);
}