From d5b494397e8e39a92c0d225c30adab481c0c6c55 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 14 Jan 2011 15:53:06 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5547 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/CLASS2/dihedral_class2.cpp | 6 +- src/MANYBODY/fix_qeq_comb.cpp | 8 +-- src/MOLECULE/bond_fene.cpp | 12 ++-- src/MOLECULE/bond_fene_expand.cpp | 12 ++-- src/MOLECULE/dihedral_charmm.cpp | 6 +- src/MOLECULE/dihedral_harmonic.cpp | 6 +- src/MOLECULE/dihedral_helix.cpp | 6 +- src/MOLECULE/dihedral_multi_harmonic.cpp | 6 +- src/MOLECULE/dihedral_opls.cpp | 6 +- src/MOLECULE/improper_cvff.cpp | 7 ++- src/MOLECULE/improper_harmonic.cpp | 7 ++- src/MOLECULE/improper_umbrella.cpp | 7 ++- src/REAX/fix_reax_bonds.cpp | 6 +- src/REPLICA/neb.cpp | 6 +- src/REPLICA/prd.cpp | 19 +++--- src/REPLICA/tad.cpp | 40 ++++++------ src/SRD/fix_srd.cpp | 78 ++++++++++++------------ src/create_atoms.cpp | 8 +-- src/delete_atoms.cpp | 11 ++-- src/delete_bonds.cpp | 57 ++++++++++------- src/displace_atoms.cpp | 7 +-- src/displace_box.cpp | 7 +-- src/dump.cpp | 5 +- src/dump_atom.cpp | 8 +-- src/dump_custom.cpp | 8 +-- src/dump_local.cpp | 4 +- src/dump_xyz.cpp | 2 +- src/finish.cpp | 15 +++-- src/fix_ave_correlate.cpp | 4 +- src/fix_ave_histo.cpp | 4 +- src/fix_ave_spatial.cpp | 4 +- src/fix_ave_time.cpp | 4 +- src/fix_orient_fcc.cpp | 13 ++-- src/fix_shake.cpp | 35 +++++------ src/fix_tmd.cpp | 6 +- src/lmptype.h | 6 -- src/neigh_bond.cpp | 64 +++++++++---------- src/output.cpp | 8 +-- src/read_data.cpp | 36 ++++------- src/read_restart.cpp | 36 +++++------ src/replicate.cpp | 38 ++++++------ src/thermo.cpp | 20 +++--- src/write_restart.cpp | 4 +- 43 files changed, 318 insertions(+), 334 deletions(-) diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index bf29f64579..9b43673da5 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -210,9 +210,9 @@ void DihedralClass2::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128],fstr[64]; - sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); - sprintf(str,fstr,me,update->ntimestep, + char str[128]; + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " %d %d %d %d", + me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(str,0); fprintf(screen," 1st atom: %d %g %g %g\n", diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 7c91cd51cc..e01a8cefbc 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -172,11 +172,9 @@ void FixQEQComb::post_force(int vflag) // charge-equilibration loop - if (me == 0 && fp) { - char fstr[64]; - sprintf(fstr,"Charge equilibration on step %s\n",BIGINT_FORMAT); - fprintf(fp,fstr,update->ntimestep); - } + if (me == 0 && fp) + fprintf(fp,"Charge equilibration on step " BIGINT_FORMAT "\n", + update->ntimestep); heatpq = 0.01; qmass = 0.06; diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index f1c7b7782b..a2ac3edcf6 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -86,9 +86,9 @@ void BondFENE::compute(int eflag, int vflag) // if r > 2*r0 something serious is wrong, abort if (rlogarg < 0.1) { - char str[128],fstr[64]; - sprintf(fstr,"FENE bond too long: %s %%d %%d %%g",BIGINT_FORMAT); - sprintf(str,fstr,update->ntimestep,atom->tag[i1],atom->tag[i2],sqrt(rsq)); + char str[128]; + sprintf(str,"FENE bond too long: " BIGINT_FORMAT " %d %d %g", + update->ntimestep,atom->tag[i1],atom->tag[i2],sqrt(rsq)); error->warning(str,0); if (rlogarg <= -3.0) error->one("Bad FENE bond"); rlogarg = 0.1; @@ -243,9 +243,9 @@ double BondFENE::single(int type, double rsq, int i, int j) // if r > 2*r0 something serious is wrong, abort if (rlogarg < 0.1) { - char str[128],fstr[64]; - sprintf(fstr,"FENE bond too long: %s %%g",BIGINT_FORMAT); - sprintf(str,fstr,update->ntimestep,sqrt(rsq)); + char str[128]; + sprintf(str,"FENE bond too long: " BIGINT_FORMAT " %g", + update->ntimestep,sqrt(rsq)); error->warning(str,0); if (rlogarg <= -3.0) error->one("Bad FENE bond"); rlogarg = 0.1; diff --git a/src/MOLECULE/bond_fene_expand.cpp b/src/MOLECULE/bond_fene_expand.cpp index 588bc3f306..e628941025 100644 --- a/src/MOLECULE/bond_fene_expand.cpp +++ b/src/MOLECULE/bond_fene_expand.cpp @@ -91,9 +91,9 @@ void BondFENEExpand::compute(int eflag, int vflag) // if r > 2*r0 something serious is wrong, abort if (rlogarg < 0.1) { - char str[128],fstr[64]; - sprintf(fstr,"FENE bond too long: %s %%d %%d %%g",BIGINT_FORMAT); - sprintf(str,fstr,update->ntimestep,atom->tag[i1],atom->tag[i2],sqrt(rsq)); + char str[128]; + sprintf(str,"FENE bond too long: " BIGINT_FORMAT " %d %d %g", + update->ntimestep,atom->tag[i1],atom->tag[i2],sqrt(rsq)); error->warning(str,0); if (rlogarg <= -3.0) error->one("Bad FENE bond"); rlogarg = 0.1; @@ -257,9 +257,9 @@ double BondFENEExpand::single(int type, double rsq, int i, int j) // if r > 2*r0 something serious is wrong, abort if (rlogarg < 0.1) { - char str[128],fstr[64]; - sprintf(fstr,"FENE bond too long: %s %%g",BIGINT_FORMAT); - sprintf(str,fstr,update->ntimestep,sqrt(rsq)); + char str[128]; + sprintf(str,"FENE bond too long: " BIGINT_FORMAT " %g", + update->ntimestep,sqrt(rsq)); error->warning(str,0); if (rlogarg <= -3.0) error->one("Bad FENE bond"); rlogarg = 0.1; diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index 2aae7fd3ef..5bfbd69aac 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -147,9 +147,9 @@ void DihedralCharmm::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128],fstr[64]; - sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); - sprintf(str,fstr,me,update->ntimestep, + char str[128]; + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " %d %d %d %d", + me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(str,0); fprintf(screen," 1st atom: %d %g %g %g\n", diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index a2f62f5b4f..f4dad74653 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -137,9 +137,9 @@ void DihedralHarmonic::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128],fstr[64]; - sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); - sprintf(str,fstr,me,update->ntimestep, + char str[128]; + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " %d %d %d %d", + me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(str,0); fprintf(screen," 1st atom: %d %g %g %g\n", diff --git a/src/MOLECULE/dihedral_helix.cpp b/src/MOLECULE/dihedral_helix.cpp index 6b9520339c..d9c4b78f72 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -169,9 +169,9 @@ void DihedralHelix::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128],fstr[64]; - sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); - sprintf(str,fstr,me,update->ntimestep, + char str[128]; + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " %d %d %d %d", + me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(str,0); fprintf(screen," 1st atom: %d %g %g %g\n", diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index d369db2032..4636089e4e 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -162,9 +162,9 @@ void DihedralMultiHarmonic::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128],fstr[64]; - sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); - sprintf(str,fstr,me,update->ntimestep, + char str[128]; + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " %d %d %d %d", + me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(str,0); fprintf(screen," 1st atom: %d %g %g %g\n", diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index 576f6ca4e6..5ef2d0b7ce 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -168,9 +168,9 @@ void DihedralOPLS::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128],fstr[64]; - sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); - sprintf(str,fstr,me,update->ntimestep, + char str[128]; + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " %d %d %d %d", + me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(str,0); fprintf(screen," 1st atom: %d %g %g %g\n", diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index a4a6624496..b688a59989 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -151,9 +151,10 @@ void ImproperCvff::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128],fstr[64]; - sprintf(fstr,"Improper problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); - sprintf(str,fstr,me,update->ntimestep, + char str[128]; + sprintf(str, + "Improper problem: %d " BIGINT_FORMAT " %d %d %d %d", + me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(str,0); fprintf(screen," 1st atom: %d %g %g %g\n", diff --git a/src/MOLECULE/improper_harmonic.cpp b/src/MOLECULE/improper_harmonic.cpp index 0174ce3c98..527fbf19b8 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -122,9 +122,10 @@ void ImproperHarmonic::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128],fstr[64]; - sprintf(fstr,"Improper problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); - sprintf(str,fstr,me,update->ntimestep, + char str[128]; + sprintf(str, + "Improper problem: %d " BIGINT_FORMAT " %d %d %d %d", + me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(str,0); fprintf(screen," 1st atom: %d %g %g %g\n", diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 3fc2aad607..7695dab63d 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -128,9 +128,10 @@ void ImproperUmbrella::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128],fstr[64]; - sprintf(fstr,"Improper problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); - sprintf(str,fstr,me,update->ntimestep, + char str[128]; + sprintf(str, + "Improper problem: %d " BIGINT_FORMAT " %d %d %d %d", + me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(str,0); fprintf(screen," 1st atom: %d %g %g %g\n", diff --git a/src/REAX/fix_reax_bonds.cpp b/src/REAX/fix_reax_bonds.cpp index 66ebb41463..0607acc5b6 100644 --- a/src/REAX/fix_reax_bonds.cpp +++ b/src/REAX/fix_reax_bonds.cpp @@ -121,13 +121,11 @@ void FixReaxBonds::OutputReaxBonds(bigint ntimestep, FILE *fp) MPI_Allreduce(&nsbmax,&nsbmax_most,1,MPI_INT,MPI_MAX,world); if (me == 0) { - char fstr[32]; - sprintf(fstr,"# Timestep %s \n",BIGINT_FORMAT); - fprintf(fp,fstr,ntimestep); + fprintf(fp,"# Timestep " BIGINT_FORMAT " \n",ntimestep); fprintf(fp,"# \n"); fprintf(fp,"# Number of particles %d \n",nparticles_tot); fprintf(fp,"# \n"); - fprintf(fp,"# Max.number of bonds per atom %d with " + fprintf(fp,"# Max number of bonds per atom %d with " "coarse bond order cutoff %5.3f \n", nsbmax_most,cutof3); fprintf(fp,"# Particle connection table and bond orders \n"); diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 6e7b54660a..fe5e74a1d4 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -487,10 +487,8 @@ void NEB::print_status() } if (me_universe == 0) { - char fstr[32]; - sprintf(fstr,"%s %%g %%g ",BIGINT_FORMAT); if (universe->uscreen) { - fprintf(universe->uscreen,fstr,update->ntimestep, + fprintf(universe->uscreen,BIGINT_FORMAT " %g %g ",update->ntimestep, fmaxreplica,fmaxatom); fprintf(universe->uscreen,"%g %g %g ", gradvnorm0,gradvnorm1,gradvnormc); @@ -500,7 +498,7 @@ void NEB::print_status() fprintf(universe->uscreen,"\n"); } if (universe->ulogfile) { - fprintf(universe->ulogfile,fstr,update->ntimestep, + fprintf(universe->ulogfile,BIGINT_FORMAT " %g %g ",update->ntimestep, fmaxreplica,fmaxatom); fprintf(universe->ulogfile,"%g %g %g ", gradvnorm0,gradvnorm1,gradvnormc); diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index 95ebf5e9cb..28ec841d4d 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -378,14 +378,15 @@ void PRD::command(int narg, char **arg) neighbor->ndanger = ndanger; if (me_universe == 0) { - char str[128]; - sprintf(str,"Loop time of %%g on %%d procs for %%d steps with %s atoms\n", - BIGINT_FORMAT); if (universe->uscreen) - fprintf(universe->uscreen,str, + fprintf(universe->uscreen, + "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT + " atoms\n", timer->array[TIME_LOOP],nprocs_universe,nsteps,atom->natoms); if (universe->ulogfile) - fprintf(universe->ulogfile,str, + fprintf(universe->ulogfile, + "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT + " atoms\n", timer->array[TIME_LOOP],nprocs_universe,nsteps,atom->natoms); } @@ -653,10 +654,9 @@ void PRD::log_event() { timer->array[TIME_LOOP] = time_start; if (universe->me == 0) { - char fstr[32]; - sprintf(fstr,"%s %%.3f %%d %%d %%d %%d %%d\n",BIGINT_FORMAT); if (universe->uscreen) - fprintf(universe->uscreen,fstr, + fprintf(universe->uscreen, + BIGINT_FORMAT " %.3f %d %d %d %d %d\n", fix_event->event_timestep, timer->elapsed(TIME_LOOP), fix_event->clock, @@ -664,7 +664,8 @@ void PRD::log_event() fix_event->ncoincident, fix_event->replica_number); if (universe->ulogfile) - fprintf(universe->ulogfile,fstr, + fprintf(universe->ulogfile, + BIGINT_FORMAT " %.3f %d %d %d %d %d\n", fix_event->event_timestep, timer->elapsed(TIME_LOOP), fix_event->clock, diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index ad4602696f..a70009e474 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -386,14 +386,15 @@ void TAD::command(int narg, char **arg) neighbor->ndanger = ndanger; if (me_universe == 0) { - char str[128]; - sprintf(str,"Loop time of %%g on %%d procs for %%d steps with %s atoms\n", - BIGINT_FORMAT); if (universe->uscreen) - fprintf(universe->uscreen,str, + fprintf(universe->uscreen, + "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT + " atoms\n", timer->array[TIME_LOOP],nprocs_universe,nsteps,atom->natoms); if (universe->ulogfile) - fprintf(universe->ulogfile,str, + fprintf(universe->ulogfile, + "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT + " atoms\n", timer->array[TIME_LOOP],nprocs_universe,nsteps,atom->natoms); } @@ -521,16 +522,14 @@ void TAD::log_event() { timer->array[TIME_LOOP] = time_start; if (universe->me == 0) { - char fstr[32]; - sprintf(fstr,"%s %%.3f %%.3f %%d\n",BIGINT_FORMAT); if (universe->uscreen) - fprintf(universe->uscreen,fstr, + fprintf(universe->uscreen,BIGINT_FORMAT " %.3f %.3f %d\n", fix_event->event_timestep, timer->elapsed(TIME_LOOP), fix_event->tlo, fix_event->event_number); if (universe->ulogfile) - fprintf(universe->ulogfile,fstr, + fprintf(universe->ulogfile,BIGINT_FORMAT " %.3f %.3f %d\n", fix_event->event_timestep, timer->elapsed(TIME_LOOP), fix_event->tlo, @@ -918,22 +917,27 @@ void TAD::compute_tlo(int ievent) // first-replica output about each event if (universe->me == 0) { - char str[128],fstr[128]; double tfrac = 0.0; if (ievent > 0) tfrac = delthi/deltstop; -// sprintf(str, -// "New event: ievent = %d eb = %g t_lo = %g t_hi = %g t_hi/t_stop = %g \n", -// ievent,ebarrier,deltlo,delthi,tfrac); -// error->warning(str); - sprintf(fstr,"New event: t_hi = %s ievent = %%d eb = %%g " - "dt_lo = %%g dt_hi/t_stop = %%g \n",BIGINT_FORMAT); + // char str[128]; + // sprintf(str, + // "New event: ievent = %d eb = %g t_lo = %g t_hi = %g t_hi/t_stop = %g \n", + // ievent,ebarrier,deltlo,delthi,tfrac); + // error->warning(str); + if (screen) - fprintf(screen,fstr,fix_event_list[ievent]->event_timestep, + fprintf(screen, + "New event: t_hi = " BIGINT_FORMAT " ievent = %d eb = %g " + "dt_lo = %g dt_hi/t_stop = %g \n", + fix_event_list[ievent]->event_timestep, ievent,ebarrier,deltlo,tfrac); if (logfile) - fprintf(logfile,fstr,fix_event_list[ievent]->event_timestep, + fprintf(logfile, + "New event: t_hi = " BIGINT_FORMAT " ievent = %d eb = %g " + "dt_lo = %g dt_hi/t_stop = %g \n", + fix_event_list[ievent]->event_timestep, ievent,ebarrier,deltlo,tfrac); } diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index 71ce7698ea..d7ec560fa0 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -692,13 +692,14 @@ void FixSRD::post_force(int vflag) if (ix < 0 || ix >= nbin2x || iy < 0 || iy >= nbin2y || iz < 0 || iz >= nbin2z) { - char fstr[64]; - sprintf(fstr,"SRD particle %%d on step %s\n",BIGINT_FORMAT); - printf(fstr,atom->tag[i],update->ntimestep); - printf("v = %g %g %g\n",v[i][0],v[i][1],v[i][2]); - printf("x = %g %g %g\n",x[i][0],x[i][1],x[i][2]); - printf("ix,iy,iz nx,ny,nz = %d %d %d %d %d %d\n", - ix,iy,iz,nbin2x,nbin2y,nbin2z); + if (screen) { + fprintf(screen,"SRD particle %d on step " BIGINT_FORMAT "\n", + atom->tag[i],update->ntimestep); + fprintf(screen,"v = %g %g %g\n",v[i][0],v[i][1],v[i][2]); + fprintf(screen,"x = %g %g %g\n",x[i][0],x[i][1],x[i][2]); + fprintf(screen,"ix,iy,iz nx,ny,nz = %d %d %d %d %d %d\n", + ix,iy,iz,nbin2x,nbin2y,nbin2z); + } error->one("Fix SRD: bad bin assignment for SRD advection"); } } @@ -1152,20 +1153,19 @@ void FixSRD::collisions_single() if (t_remain > dt) { ninside++; if (insideflag == INSIDE_ERROR || insideflag == INSIDE_WARN) { - char str[128],fstr[128]; - if (type != WALL) { - sprintf(fstr,"SRD particle %%d started " - "inside big particle %%d on step %s bounce %%d\n", - BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + if (type != WALL) + sprintf(str, + "SRD particle %d started " + "inside big particle %d on step " BIGINT_FORMAT + " bounce %d\n", + atom->tag[i],atom->tag[j],update->ntimestep,ibounce+1); + else + sprintf(str, + "SRD particle %d started " + "inside big particle %d on step " BIGINT_FORMAT + " bounce %d\n", atom->tag[i],atom->tag[j],update->ntimestep,ibounce+1); - } else { - sprintf(fstr,"SRD particle %%d started " - "inside wall %%d on step %s bounce %%d\n", - BIGINT_FORMAT); - sprintf(str,fstr, - atom->tag[i],j,update->ntimestep,ibounce+1); - } if (insideflag == INSIDE_ERROR) error->one(str); error->warning(str); } @@ -1296,11 +1296,11 @@ void FixSRD::collisions_multi() if (t_remain > dt || t_remain < 0.0) { ninside++; if (insideflag == INSIDE_ERROR || insideflag == INSIDE_WARN) { - char str[128],fstr[128]; - sprintf(fstr,"SRD particle %%d started " - "inside big particle %%d on step %s bounce %%d\n", - BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + sprintf(str, + "SRD particle %d started " + "inside big particle %d on step " BIGINT_FORMAT + " bounce %d\n", atom->tag[i],atom->tag[j],update->ntimestep,ibounce+1); if (insideflag == INSIDE_ERROR) error->one(str); error->warning(str); @@ -2071,15 +2071,15 @@ int FixSRD::update_srd(int i, double dt, double *xscoll, double *vsnew, if (xs[0] < srdlo[0] || xs[0] > srdhi[0] || xs[1] < srdlo[1] || xs[1] > srdhi[1] || xs[2] < srdlo[2] || xs[2] > srdhi[2]) { - printf("Bad SRD particle move\n"); - char fstr[64]; - sprintf(fstr," particle %%d on proc %%d at timestep %s\n",BIGINT_FORMAT); - printf(fstr,atom->tag[i],me,update->ntimestep); - printf(" xnew %g %g %g\n",xs[0],xs[1],xs[2]); - printf(" srdlo/hi x %g %g\n",srdlo[0],srdhi[0]); - printf(" srdlo/hi y %g %g\n",srdlo[1],srdhi[1]); - printf(" srdlo/hi z %g %g\n",srdlo[2],srdhi[2]); - error->warning("Fix srd particle moved outside valid domain"); + if (screen) { + error->warning("Fix srd particle moved outside valid domain"); + fprintf(screen," particle %d on proc %d at timestep " BIGINT_FORMAT, + atom->tag[i],me,update->ntimestep); + fprintf(screen," xnew %g %g %g\n",xs[0],xs[1],xs[2]); + fprintf(screen," srdlo/hi x %g %g\n",srdlo[0],srdhi[0]); + fprintf(screen," srdlo/hi y %g %g\n",srdlo[1],srdhi[1]); + fprintf(screen," srdlo/hi z %g %g\n",srdlo[2],srdhi[2]); + } } if (triclinic) domain->lamda2x(xs,xs); @@ -2307,11 +2307,11 @@ void FixSRD::parameterize() // print SRD parameters if (me == 0) { - char str[64]; - sprintf(str," SRD/big particles = %s %s\n",BIGINT_FORMAT,BIGINT_FORMAT); if (screen) { fprintf(screen,"SRD info:\n"); - fprintf(screen,str,nsrd,mbig); + fprintf(screen, + " SRD/big particles = " BIGINT_FORMAT " " BIGINT_FORMAT "\n", + nsrd,mbig); fprintf(screen," big particle diameter max/min = %g %g\n", maxbigdiam,minbigdiam); fprintf(screen," SRD temperature & lamda = %g %g\n", @@ -2326,7 +2326,9 @@ void FixSRD::parameterize() } if (logfile) { fprintf(logfile,"SRD info:\n"); - fprintf(logfile,str,nsrd,mbig); + fprintf(logfile, + " SRD/big particles = " BIGINT_FORMAT " " BIGINT_FORMAT "\n", + nsrd,mbig); fprintf(logfile," big particle diameter max/min = %g %g\n", maxbigdiam,minbigdiam); fprintf(logfile," SRD temperature & lamda = %g %g\n", diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 60f823909c..11eda7d7ed 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -176,12 +176,12 @@ void CreateAtoms::command(int narg, char **arg) // print status if (comm->me == 0) { - char str[32]; - sprintf(str,"Created %s atoms\n",BIGINT_FORMAT); if (screen) - fprintf(screen,str,atom->natoms-natoms_previous); + fprintf(screen,"Created " BIGINT_FORMAT " atoms\n", + atom->natoms-natoms_previous); if (logfile) - fprintf(logfile,str,atom->natoms-natoms_previous); + fprintf(logfile,"Created " BIGINT_FORMAT " atoms\n", + atom->natoms-natoms_previous); } // reset simulation now that more atoms are defined diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index f140c52372..d92085ffe0 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -105,11 +105,12 @@ void DeleteAtoms::command(int narg, char **arg) bigint ndelete = natoms_previous - atom->natoms; if (comm->me == 0) { - char str[64]; - sprintf(str,"Deleted %s atoms, new total = %s\n", - BIGINT_FORMAT,BIGINT_FORMAT); - if (screen) fprintf(screen,str,ndelete,atom->natoms); - if (logfile) fprintf(logfile,str,ndelete,atom->natoms); + if (screen) fprintf(screen,"Deleted " BIGINT_FORMAT + " atoms, new total = " BIGINT_FORMAT "\n", + ndelete,atom->natoms); + if (logfile) fprintf(logfile,"Deleted " BIGINT_FORMAT + " atoms, new total = " BIGINT_FORMAT "\n", + ndelete,atom->natoms); } } diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index 0b1ff6daec..0c3a0e14d6 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -447,33 +447,48 @@ void DeleteBonds::command(int narg, char **arg) if (comm->me == 0) { if (atom->avec->bonds_allow) { char str[128]; - sprintf(str," %s total bonds, %s turned on, %s turned off\n", - BIGINT_FORMAT,BIGINT_FORMAT,BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->nbonds,bond_on,bond_off); - if (logfile) fprintf(logfile,str,atom->nbonds,bond_on,bond_off); + if (screen) fprintf(screen, + " " BIGINT_FORMAT " total bonds, " BIGINT_FORMAT + " turned on, " BIGINT_FORMAT " turned off\n", + atom->nbonds,bond_on,bond_off); + if (logfile) fprintf(logfile, + " " BIGINT_FORMAT " total bonds, " BIGINT_FORMAT + " turned on, " BIGINT_FORMAT " turned off\n", + atom->nbonds,bond_on,bond_off); } if (atom->avec->angles_allow) { - char str[128]; - sprintf(str," %s total angles, %s turned on, %s turned off\n", - BIGINT_FORMAT,BIGINT_FORMAT,BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->nangles,angle_on,angle_off); - if (logfile) fprintf(logfile,str,atom->nangles,angle_on,angle_off); + if (screen) fprintf(screen, + " " BIGINT_FORMAT " total angles, " BIGINT_FORMAT + " turned on, " BIGINT_FORMAT " turned off\n", + atom->nangles,angle_on,angle_off); + if (logfile) fprintf(logfile, + " " BIGINT_FORMAT " total angles, " BIGINT_FORMAT + " turned on, " BIGINT_FORMAT " turned off\n", + atom->nangles,angle_on,angle_off); } if (atom->avec->dihedrals_allow) { - char str[128]; - sprintf(str," %s total dihedrals, %s turned on, %s turned off\n", - BIGINT_FORMAT,BIGINT_FORMAT,BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->ndihedrals,dihedral_on,dihedral_off); - if (logfile) fprintf(logfile,str, - atom->ndihedrals,dihedral_on,dihedral_off); + if (screen) fprintf(screen, + " " BIGINT_FORMAT " total dihedrals, " + BIGINT_FORMAT " turned on, " BIGINT_FORMAT + " turned off\n", + atom->ndihedrals,dihedral_on,dihedral_off); + if (logfile) fprintf(logfile, + " " BIGINT_FORMAT " total dihedrals, " + BIGINT_FORMAT " turned on, " BIGINT_FORMAT + " turned off\n", + atom->ndihedrals,dihedral_on,dihedral_off); } if (atom->avec->impropers_allow) { - char str[128]; - sprintf(str," %s total impropers, %s turned on, %s turned off\n", - BIGINT_FORMAT,BIGINT_FORMAT,BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->nimpropers,improper_on,improper_off); - if (logfile) fprintf(logfile,str, - atom->nimpropers,improper_on,improper_off); + if (screen) fprintf(screen, + " " BIGINT_FORMAT " total impropers, " + BIGINT_FORMAT " turned on, " BIGINT_FORMAT + " turned off\n", + atom->nimpropers,improper_on,improper_off); + if (logfile) fprintf(logfile, + " " BIGINT_FORMAT " total impropers, " + BIGINT_FORMAT " turned on, " BIGINT_FORMAT + " turned off\n", + atom->nimpropers,improper_on,improper_off); } } diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index 1e93c919bf..64cb195df6 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -215,10 +215,9 @@ void DisplaceAtoms::command(int narg, char **arg) bigint nblocal = atom->nlocal; MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world); if (natoms != atom->natoms) { - char fstr[64],str[128]; - sprintf(fstr,"Lost atoms via displace_atoms: original %s current %s", - BIGINT_FORMAT,BIGINT_FORMAT); - sprintf(str,fstr,atom->natoms,natoms); + char str[128]; + sprintf(str,"Lost atoms via displace_atoms: original " BIGINT_FORMAT + " current " BIGINT_FORMAT,atom->natoms,natoms); error->all(str); } } diff --git a/src/displace_box.cpp b/src/displace_box.cpp index e80ddbbd3f..e8b88fb314 100644 --- a/src/displace_box.cpp +++ b/src/displace_box.cpp @@ -381,10 +381,9 @@ void DisplaceBox::command(int narg, char **arg) bigint nblocal = atom->nlocal; MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world); if (natoms != atom->natoms) { - char fstr[64],str[128]; - sprintf(fstr,"Lost atoms via displace_box: original %s current %s", - BIGINT_FORMAT,BIGINT_FORMAT); - sprintf(str,fstr,atom->natoms,natoms); + char str[128]; + sprintf(str,"Lost atoms via displace_box: original " BIGINT_FORMAT + " current " BIGINT_FORMAT,atom->natoms,natoms); error->all(str); } } diff --git a/src/dump.cpp b/src/dump.cpp index a382c7fa92..6bd3018a0f 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -359,9 +359,8 @@ void Dump::openfile() filecurrent = new char[strlen(filename) + 16]; char *ptr = strchr(filename,'*'); *ptr = '\0'; - char fstr[16]; - sprintf(fstr,"%%s%s%%s",BIGINT_FORMAT); - sprintf(filecurrent,fstr,filename,update->ntimestep,ptr+1); + sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", + filename,update->ntimestep,ptr+1); *ptr = '*'; } diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index 11152f5b72..9d33cb37b1 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -206,9 +206,9 @@ void DumpAtom::header_binary_triclinic(bigint ndump) void DumpAtom::header_item(bigint ndump) { fprintf(fp,"ITEM: TIMESTEP\n"); - fprintf(fp,BIGINT_FORMAT_NL,update->ntimestep); + fprintf(fp,BIGINT_FORMAT "\n",update->ntimestep); fprintf(fp,"ITEM: NUMBER OF ATOMS\n"); - fprintf(fp,BIGINT_FORMAT_NL,ndump); + fprintf(fp,BIGINT_FORMAT "\n",ndump); fprintf(fp,"ITEM: BOX BOUNDS\n"); fprintf(fp,"%g %g\n",boxxlo,boxxhi); fprintf(fp,"%g %g\n",boxylo,boxyhi); @@ -221,9 +221,9 @@ void DumpAtom::header_item(bigint ndump) void DumpAtom::header_item_triclinic(bigint ndump) { fprintf(fp,"ITEM: TIMESTEP\n"); - fprintf(fp,BIGINT_FORMAT_NL,update->ntimestep); + fprintf(fp,BIGINT_FORMAT "\n",update->ntimestep); fprintf(fp,"ITEM: NUMBER OF ATOMS\n"); - fprintf(fp,BIGINT_FORMAT_NL,ndump); + fprintf(fp,BIGINT_FORMAT "\n",ndump); fprintf(fp,"ITEM: BOX BOUNDS xy xz yz\n"); fprintf(fp,"%g %g %g\n",boxxlo,boxxhi,boxxy); fprintf(fp,"%g %g %g\n",boxylo,boxyhi,boxxz); diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 2ee551c1d7..3e0b2c192f 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -290,9 +290,9 @@ void DumpCustom::header_binary_triclinic(bigint ndump) void DumpCustom::header_item(bigint ndump) { fprintf(fp,"ITEM: TIMESTEP\n"); - fprintf(fp,BIGINT_FORMAT_NL,update->ntimestep); + fprintf(fp,BIGINT_FORMAT "\n",update->ntimestep); fprintf(fp,"ITEM: NUMBER OF ATOMS\n"); - fprintf(fp,BIGINT_FORMAT_NL,ndump); + fprintf(fp,BIGINT_FORMAT "\n",ndump); fprintf(fp,"ITEM: BOX BOUNDS\n"); fprintf(fp,"%g %g\n",boxxlo,boxxhi); fprintf(fp,"%g %g\n",boxylo,boxyhi); @@ -305,9 +305,9 @@ void DumpCustom::header_item(bigint ndump) void DumpCustom::header_item_triclinic(bigint ndump) { fprintf(fp,"ITEM: TIMESTEP\n"); - fprintf(fp,BIGINT_FORMAT_NL,update->ntimestep); + fprintf(fp,BIGINT_FORMAT "\n",update->ntimestep); fprintf(fp,"ITEM: NUMBER OF ATOMS\n"); - fprintf(fp,BIGINT_FORMAT_NL,ndump); + fprintf(fp,BIGINT_FORMAT "\n",ndump); fprintf(fp,"ITEM: BOX BOUNDS xy xz yz\n"); fprintf(fp,"%g %g %g\n",boxxlo,boxxhi,boxxy); fprintf(fp,"%g %g %g\n",boxylo,boxyhi,boxxz); diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 0230a0ac1c..811d06bc22 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -191,9 +191,9 @@ void DumpLocal::write_header(bigint ndump) { if (me == 0) { fprintf(fp,"ITEM: TIMESTEP\n"); - fprintf(fp,BIGINT_FORMAT_NL,update->ntimestep); + fprintf(fp,BIGINT_FORMAT "\n",update->ntimestep); fprintf(fp,"ITEM: NUMBER OF %s\n",label); - fprintf(fp,BIGINT_FORMAT_NL,ndump); + fprintf(fp,BIGINT_FORMAT "\n",ndump); fprintf(fp,"ITEM: %s %s\n",label,columns); } } diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 06c0686e7b..d9814cdf7a 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -61,7 +61,7 @@ void DumpXYZ::init_style() void DumpXYZ::write_header(bigint n) { if (me == 0) { - fprintf(fp,BIGINT_FORMAT_NL,n); + fprintf(fp,BIGINT_FORMAT "\n",n); fprintf(fp,"Atoms\n"); } } diff --git a/src/finish.cpp b/src/finish.cpp index 92496b5b9a..b7efb30dc4 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -89,12 +89,15 @@ void Finish::end(int flag) MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world); if (me == 0) { - char str[128]; - sprintf(str,"Loop time of %%g on %%d procs for %%d steps with %s atoms\n", - BIGINT_FORMAT); - if (screen) fprintf(screen,str,time_loop,nprocs,update->nsteps,natoms); - if (logfile) fprintf(logfile,str,time_loop,nprocs,update->nsteps,natoms); - } + if (screen) fprintf(screen, + "Loop time of %g on %d procs for %d steps with " + BIGINT_FORMAT " atoms\n", + time_loop,nprocs,update->nsteps,natoms); + if (logfile) fprintf(logfile, + "Loop time of %g on %d procs for %d steps with " + BIGINT_FORMAT " atoms\n", + time_loop,nprocs,update->nsteps,natoms); + } if (time_loop == 0.0) time_loop = 1.0; } diff --git a/src/fix_ave_correlate.cpp b/src/fix_ave_correlate.cpp index b962a0d590..4984c587cf 100644 --- a/src/fix_ave_correlate.cpp +++ b/src/fix_ave_correlate.cpp @@ -467,9 +467,7 @@ void FixAveCorrelate::end_of_step() // output to file if (fp && me == 0) { - char fstr[16]; - sprintf(fstr,"%s %%d\n",BIGINT_FORMAT); - fprintf(fp,fstr,ntimestep,nrepeat); + fprintf(fp,BIGINT_FORMAT " %d\n",ntimestep,nrepeat); for (i = 0; i < nrepeat; i++) { fprintf(fp,"%d %d %d",i+1,i*nevery,count[i]); if (count[i]) diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index b0c2345839..984d5022ae 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -789,9 +789,7 @@ void FixAveHisto::end_of_step() // output result to file if (fp && me == 0) { - char fstr[32]; - sprintf(fstr,"%s %%d %%g %%g %%g %%g\n",BIGINT_FORMAT); - fprintf(fp,fstr,ntimestep,nbins, + fprintf(fp,BIGINT_FORMAT " %d %g %g %g %g\n",ntimestep,nbins, stats_total[0],stats_total[1],stats_total[2],stats_total[3]); if (stats_total[0] != 0.0) for (i = 0; i < nbins; i++) diff --git a/src/fix_ave_spatial.cpp b/src/fix_ave_spatial.cpp index 760464223b..511e429faa 100644 --- a/src/fix_ave_spatial.cpp +++ b/src/fix_ave_spatial.cpp @@ -789,9 +789,7 @@ void FixAveSpatial::end_of_step() // output result to file if (fp && me == 0) { - char fstr[16]; - sprintf(fstr,"%s %%d\n",BIGINT_FORMAT); - fprintf(fp,fstr,ntimestep,nbins); + fprintf(fp,BIGINT_FORMAT " %d\n",ntimestep,nbins); if (ndim == 1) for (m = 0; m < nbins; m++) { fprintf(fp," %d %g %g",m+1,coord[m][0], diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index a2138243c6..d3c4f3207b 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -770,9 +770,7 @@ void FixAveTime::invoke_vector(bigint ntimestep) // output result to file if (fp && me == 0) { - char fstr[16]; - sprintf(fstr,"%s %%d\n",BIGINT_FORMAT); - fprintf(fp,fstr,ntimestep,nrows); + fprintf(fp,BIGINT_FORMAT " %d\n",ntimestep,nrows); for (i = 0; i < nrows; i++) { fprintf(fp,"%d",i+1); for (j = 0; j < nvalues; j++) fprintf(fp," %g",array_total[i][j]/norm); diff --git a/src/fix_orient_fcc.cpp b/src/fix_orient_fcc.cpp index cf91d3f0ae..061884ff56 100644 --- a/src/fix_orient_fcc.cpp +++ b/src/fix_orient_fcc.cpp @@ -403,11 +403,14 @@ void FixOrientFCC::post_force(int vflag) MPI_Allreduce(&maxcount,&max,1,MPI_INT,MPI_MAX,world); if (me == 0) { - char str[64]; - sprintf(str,"orient step %%d: %s atoms have %%d neighbors\n", - BIGINT_FORMAT); - if (screen) fprintf(screen,str,update->ntimestep,atom->natoms,total); - if (logfile) fprintf(logfile,str,update->ntimestep,atom->natoms,total); + if (screen) fprintf(screen, + "orient step %d: " BIGINT_FORMAT + " atoms have %d neighbors\n", + update->ntimestep,atom->natoms,total); + if (logfile) fprintf(logfile, + "orient step %d: " BIGINT_FORMAT + " atoms have %d neighbors\n", + update->ntimestep,atom->natoms,total); if (screen) fprintf(screen," neighs: min = %d, max = %d, ave = %g\n", min,max,ave); diff --git a/src/fix_shake.cpp b/src/fix_shake.cpp index cf38f11e4d..70e1fbb4e6 100644 --- a/src/fix_shake.cpp +++ b/src/fix_shake.cpp @@ -454,10 +454,9 @@ void FixShake::pre_neighbor() atom1 = atom->map(shake_atom[i][0]); atom2 = atom->map(shake_atom[i][1]); if (atom1 == -1 || atom2 == -1) { - char str[128],fstr[64]; - sprintf(fstr,"Shake atoms %%d %%d missing on proc %%d at step %s", - BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + sprintf(str, + "Shake atoms %d %d missing on proc %d at step " BIGINT_FORMAT, shake_atom[i][0],shake_atom[i][1],me,update->ntimestep); error->one(str); } @@ -467,10 +466,10 @@ void FixShake::pre_neighbor() atom2 = atom->map(shake_atom[i][1]); atom3 = atom->map(shake_atom[i][2]); if (atom1 == -1 || atom2 == -1 || atom3 == -1) { - char str[128],fstr[64]; - sprintf(fstr,"Shake atoms %%d %%d %%d missing on proc %%d at step %s", - BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + sprintf(str, + "Shake atoms %d %d %d missing on proc %d at step " + BIGINT_FORMAT, shake_atom[i][0],shake_atom[i][1],shake_atom[i][2], me,update->ntimestep); error->one(str); @@ -482,11 +481,10 @@ void FixShake::pre_neighbor() atom3 = atom->map(shake_atom[i][2]); atom4 = atom->map(shake_atom[i][3]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { - char str[128],fstr[64]; - sprintf(fstr, - "Shake atoms %%d %%d %%d %%d missing on proc %%d at step %s", - BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + sprintf(str, + "Shake atoms %d %d %d %d missing on proc %d at step " + BIGINT_FORMAT, shake_atom[i][0],shake_atom[i][1], shake_atom[i][2],shake_atom[i][3], me,update->ntimestep); @@ -2147,10 +2145,11 @@ void FixShake::stats() // print stats only for non-zero counts if (me == 0) { - char fstr[64]; - sprintf(fstr,"SHAKE stats (type/ave/delta) on step %s\n",BIGINT_FORMAT); + if (screen) { - fprintf(screen,fstr,update->ntimestep); + fprintf(screen, + "SHAKE stats (type/ave/delta) on step " BIGINT_FORMAT "\n", + update->ntimestep); for (i = 1; i < nb; i++) if (b_count_all[i]) fprintf(screen," %d %g %g\n",i, @@ -2161,7 +2160,9 @@ void FixShake::stats() a_ave_all[i]/a_count_all[i],a_max_all[i]-a_min_all[i]); } if (logfile) { - fprintf(logfile,fstr,update->ntimestep); + fprintf(logfile, + "SHAKE stats (type/ave/delta) on step " BIGINT_FORMAT "\n", + update->ntimestep); for (i = 0; i < nb; i++) if (b_count_all[i]) fprintf(logfile," %d %g %g\n",i, diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index f976fd18ed..24cb8bc8fc 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -285,9 +285,9 @@ void FixTMD::initial_integrate(int vflag) work_lambda += lambda*(rho_target - rho_old); if (!(update->ntimestep % nfileevery) && (previous_stat != update->ntimestep)) { - char fstr[64]; - sprintf(fstr,"%s %%g %%g %%g %%g %%g %%g %%g\n",BIGINT_FORMAT); - fprintf(fp,fstr,update->ntimestep,rho_target,rho_old, + fprintf(fp, + BIGINT_FORMAT " %g %g %g %g %g %g %g\n", + update->ntimestep,rho_target,rho_old, gamma_back,gamma_forward,lambda,work_lambda,work_analytical); fflush(fp); previous_stat = update->ntimestep; diff --git a/src/lmptype.h b/src/lmptype.h index 6d45da2709..3dc59b0af0 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -58,8 +58,6 @@ typedef int64_t bigint; #define TAGINT_FORMAT "%d" #define BIGINT_FORMAT "%lld" -#define TAGINT_FORMAT_NL "%d\n" -#define BIGINT_FORMAT_NL "%lld\n" #define ATOTAGINT atoi #define ATOBIGINT atoll @@ -82,8 +80,6 @@ typedef int64_t bigint; #define TAGINT_FORMAT "%lld" #define BIGINT_FORMAT "%lld" -#define TAGINT_FORMAT_NL "%lld\n" -#define BIGINT_FORMAT_NL "%lld\n" #define ATOTAGINT atoll #define ATOBIGINT atoll @@ -106,8 +102,6 @@ typedef int bigint; #define TAGINT_FORMAT "%d" #define BIGINT_FORMAT "%d" -#define TAGINT_FORMAT_NL "%d\n" -#define BIGINT_FORMAT_NL "%d\n" #define ATOTAGINT atoi #define ATOBIGINT atoi diff --git a/src/neigh_bond.cpp b/src/neigh_bond.cpp index 6383dae8fd..e89c31cf37 100644 --- a/src/neigh_bond.cpp +++ b/src/neigh_bond.cpp @@ -42,10 +42,10 @@ void Neighbor::bond_all() for (m = 0; m < num_bond[i]; m++) { atom1 = atom->map(bond_atom[i][m]); if (atom1 == -1) { - char str[128],fstr[64]; - sprintf(fstr,"Bond atoms %%d %%d missing on proc %%d at step %s", - BIGINT_FORMAT); - sprintf(str,fstr,tag[i],bond_atom[i][m],me,update->ntimestep); + char str[128]; + sprintf(str, + "Bond atoms %d %d missing on proc %d at step " BIGINT_FORMAT, + tag[i],bond_atom[i][m],me,update->ntimestep); error->one(str); } if (newton_bond || i < atom1) { @@ -82,10 +82,10 @@ void Neighbor::bond_partial() if (bond_type[i][m] <= 0) continue; atom1 = atom->map(bond_atom[i][m]); if (atom1 == -1) { - char str[128],fstr[64]; - sprintf(fstr,"Bond atoms %%d %%d missing on proc %%d at step %s", - BIGINT_FORMAT); - sprintf(str,fstr,tag[i],bond_atom[i][m],me,update->ntimestep); + char str[128]; + sprintf(str, + "Bond atoms %d %d missing on proc %d at step " BIGINT_FORMAT, + tag[i],bond_atom[i][m],me,update->ntimestep); error->one(str); } if (newton_bond || i < atom1) { @@ -124,10 +124,10 @@ void Neighbor::angle_all() atom2 = atom->map(angle_atom2[i][m]); atom3 = atom->map(angle_atom3[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1) { - char str[128],fstr[64]; - sprintf(fstr,"Angle atoms %%d %%d %%d missing on proc %%d at step %s", - BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + sprintf(str, + "Angle atoms %d %d %d missing on proc %d at step " + BIGINT_FORMAT, angle_atom1[i][m],angle_atom2[i][m],angle_atom3[i][m], me,update->ntimestep); error->one(str); @@ -170,10 +170,10 @@ void Neighbor::angle_partial() atom2 = atom->map(angle_atom2[i][m]); atom3 = atom->map(angle_atom3[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1) { - char str[128],fstr[64]; - sprintf(fstr,"Angle atoms %%d %%d %%d missing on proc %%d at step %s", - BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + sprintf(str, + "Angle atoms %d %d %d missing on proc %d at step " + BIGINT_FORMAT, angle_atom1[i][m],angle_atom2[i][m],angle_atom3[i][m], me,update->ntimestep); error->one(str); @@ -217,10 +217,10 @@ void Neighbor::dihedral_all() atom3 = atom->map(dihedral_atom3[i][m]); atom4 = atom->map(dihedral_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { - char str[128],fstr[128]; - sprintf(fstr,"Dihedral atoms %%d %%d %%d %%d " - "missing on proc %%d at step %s",BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + sprintf(str, + "Dihedral atoms %d %d %d %d missing on proc %d at step " + BIGINT_FORMAT, dihedral_atom1[i][m],dihedral_atom2[i][m], dihedral_atom3[i][m],dihedral_atom4[i][m], me,update->ntimestep); @@ -269,10 +269,10 @@ void Neighbor::dihedral_partial() atom3 = atom->map(dihedral_atom3[i][m]); atom4 = atom->map(dihedral_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { - char str[128],fstr[128]; - sprintf(fstr,"Dihedral atoms %%d %%d %%d %%d " - "missing on proc %%d at step %s",BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + sprintf(str, + "Dihedral atoms %d %d %d %d missing on proc %d at step " + BIGINT_FORMAT, dihedral_atom1[i][m],dihedral_atom2[i][m], dihedral_atom3[i][m],dihedral_atom4[i][m], me,update->ntimestep); @@ -320,10 +320,10 @@ void Neighbor::improper_all() atom3 = atom->map(improper_atom3[i][m]); atom4 = atom->map(improper_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { - char str[128],fstr[128]; - sprintf(fstr,"Improper atoms %%d %%d %%d %%d " - "missing on proc %%d at step %s",BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + sprintf(str, + "Improper atoms %d %d %d %d missing on proc %d at step " + BIGINT_FORMAT, improper_atom1[i][m],improper_atom2[i][m], improper_atom3[i][m],improper_atom4[i][m], me,update->ntimestep); @@ -372,10 +372,10 @@ void Neighbor::improper_partial() atom3 = atom->map(improper_atom3[i][m]); atom4 = atom->map(improper_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { - char str[128],fstr[128]; - sprintf(fstr,"Improper atoms %%d %%d %%d %%d " - "missing on proc %%d at step %s",BIGINT_FORMAT); - sprintf(str,fstr, + char str[128]; + sprintf(str, + "Improper atoms %d %d %d %d missing on proc %d at step " + BIGINT_FORMAT, improper_atom1[i][m],improper_atom2[i][m], improper_atom3[i][m],improper_atom4[i][m], me,update->ntimestep); diff --git a/src/output.cpp b/src/output.cpp index a9b7018487..97de70438a 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -273,9 +273,7 @@ void Output::write(bigint ntimestep) char *file = new char[strlen(restart1) + 16]; char *ptr = strchr(restart1,'*'); *ptr = '\0'; - char fstr[16]; - sprintf(fstr,"%%s%s%%s",BIGINT_FORMAT); - sprintf(file,fstr,restart1,ntimestep,ptr+1); + sprintf(file,"%s" BIGINT_FORMAT "%s",restart1,ntimestep,ptr+1); *ptr = '*'; restart->write(file); delete [] file; @@ -336,9 +334,7 @@ void Output::write_restart(bigint ntimestep) char *file = new char[strlen(restart1) + 16]; char *ptr = strchr(restart1,'*'); *ptr = '\0'; - char fstr[16]; - sprintf(fstr,"%%s%s%%s",BIGINT_FORMAT); - sprintf(file,fstr,restart1,ntimestep,ptr+1); + sprintf(file,"%s" BIGINT_FORMAT "%s",restart1,ntimestep,ptr+1); *ptr = '*'; restart->write(file); delete [] file; diff --git a/src/read_data.cpp b/src/read_data.cpp index b38f228698..c1a3f010e5 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -452,10 +452,8 @@ void ReadData::atoms() MPI_Allreduce(&tmp,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world); if (me == 0) { - char str[32]; - sprintf(str," %s atoms\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,natoms); - if (logfile) fprintf(logfile,str,natoms); + if (screen) fprintf(screen," " BIGINT_FORMAT " atoms\n",natoms); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " atoms\n",natoms); } if (natoms != atom->natoms) error->all("Did not assign all atoms correctly"); @@ -545,10 +543,8 @@ void ReadData::velocities() } if (me == 0) { - char str[32]; - sprintf(str," %s velocities\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,natoms); - if (logfile) fprintf(logfile,str,natoms); + if (screen) fprintf(screen," " BIGINT_FORMAT " velocities\n",natoms); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " velocities\n",natoms); } } @@ -591,10 +587,8 @@ void ReadData::bonds() if (!force->newton_bond) factor = 2; if (me == 0) { - char str[32]; - sprintf(str," %s bonds\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,sum/factor); - if (logfile) fprintf(logfile,str,sum/factor); + if (screen) fprintf(screen," " BIGINT_FORMAT " bonds\n",sum/factor); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " bonds\n",sum/factor); } if (sum != factor*atom->nbonds) error->all("Bonds assigned incorrectly"); } @@ -638,10 +632,8 @@ void ReadData::angles() if (!force->newton_bond) factor = 3; if (me == 0) { - char str[32]; - sprintf(str," %s angles\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,sum/factor); - if (logfile) fprintf(logfile,str,sum/factor); + if (screen) fprintf(screen," " BIGINT_FORMAT " angles\n",sum/factor); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " angles\n",sum/factor); } if (sum != factor*atom->nangles) error->all("Angles assigned incorrectly"); } @@ -685,10 +677,8 @@ void ReadData::dihedrals() if (!force->newton_bond) factor = 4; if (me == 0) { - char str[32]; - sprintf(str," %s dihedrals\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,sum/factor); - if (logfile) fprintf(logfile,str,sum/factor); + if (screen) fprintf(screen," " BIGINT_FORMAT " dihedrals\n",sum/factor); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " dihedrals\n",sum/factor); } if (sum != factor*atom->ndihedrals) error->all("Dihedrals assigned incorrectly"); @@ -733,10 +723,8 @@ void ReadData::impropers() if (!force->newton_bond) factor = 4; if (me == 0) { - char str[32]; - sprintf(str," %s impropers\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,sum/factor); - if (logfile) fprintf(logfile,str,sum/factor); + if (screen) fprintf(screen," " BIGINT_FORMAT " impropers\n",sum/factor); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " impropers\n",sum/factor); } if (sum != factor*atom->nimpropers) error->all("Impropers assigned incorrectly"); diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 15ddcf72ec..51b4783069 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -299,38 +299,34 @@ void ReadRestart::command(int narg, char **arg) MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world); if (me == 0) { - char str[32]; - sprintf(str," %s atoms\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,natoms); - if (logfile) fprintf(logfile,str,natoms); + if (screen) fprintf(screen," " BIGINT_FORMAT " atoms\n",natoms); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " atoms\n",natoms); } if (natoms != atom->natoms) error->all("Did not assign all atoms correctly"); if (me == 0) { if (atom->nbonds) { - char str[32]; - sprintf(str," %s bonds\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->nbonds); - if (logfile) fprintf(logfile,str,atom->nbonds); + if (screen) fprintf(screen," " BIGINT_FORMAT " bonds\n",atom->nbonds); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " bonds\n",atom->nbonds); } if (atom->nangles) { - char str[32]; - sprintf(str," %s angles\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->nangles); - if (logfile) fprintf(logfile,str,atom->nangles); + if (screen) fprintf(screen," " BIGINT_FORMAT " angles\n", + atom->nangles); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " angles\n", + atom->nangles); } if (atom->ndihedrals) { - char str[32]; - sprintf(str," %s dihedrals\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->ndihedrals); - if (logfile) fprintf(logfile,str,atom->ndihedrals); + if (screen) fprintf(screen," " BIGINT_FORMAT " dihedrals\n", + atom->ndihedrals); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " dihedrals\n", + atom->ndihedrals); } if (atom->nimpropers) { - char str[32]; - sprintf(str," %s impropers\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->nimpropers); - if (logfile) fprintf(logfile,str,atom->nimpropers); + if (screen) fprintf(screen," " BIGINT_FORMAT " impropers\n", + atom->nimpropers); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " impropers\n", + atom->nimpropers); } } diff --git a/src/replicate.cpp b/src/replicate.cpp index 5ade979e61..d0a15af918 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -370,39 +370,35 @@ void Replicate::command(int narg, char **arg) MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world); if (me == 0) { - char str[32]; - sprintf(str," %s atoms\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,natoms); - if (logfile) fprintf(logfile,str,natoms); + if (screen) fprintf(screen," " BIGINT_FORMAT " atoms\n",natoms); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " atoms\n",natoms); } if (natoms != atom->natoms) error->all("Replicate did not assign all atoms correctly"); - + if (me == 0) { if (atom->nbonds) { - char str[32]; - sprintf(str," %s bonds\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->nbonds); - if (logfile) fprintf(logfile,str,atom->nbonds); + if (screen) fprintf(screen," " BIGINT_FORMAT " bonds\n",atom->nbonds); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " bonds\n",atom->nbonds); } if (atom->nangles) { - char str[32]; - sprintf(str," %s angles\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->nangles); - if (logfile) fprintf(logfile,str,atom->nangles); + if (screen) fprintf(screen," " BIGINT_FORMAT " angles\n", + atom->nangles); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " angles\n", + atom->nangles); } if (atom->ndihedrals) { - char str[32]; - sprintf(str," %s dihedrals\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->ndihedrals); - if (logfile) fprintf(logfile,str,atom->ndihedrals); + if (screen) fprintf(screen," " BIGINT_FORMAT " dihedrals\n", + atom->ndihedrals); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " dihedrals\n", + atom->ndihedrals); } if (atom->nimpropers) { - char str[32]; - sprintf(str," %s impropers\n",BIGINT_FORMAT); - if (screen) fprintf(screen,str,atom->nimpropers); - if (logfile) fprintf(logfile,str,atom->nimpropers); + if (screen) fprintf(screen," " BIGINT_FORMAT " impropers\n", + atom->nimpropers); + if (logfile) fprintf(logfile," " BIGINT_FORMAT " impropers\n", + atom->nimpropers); } } diff --git a/src/thermo.cpp b/src/thermo.cpp index b3d6cece7f..4a7ae0afc8 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -369,19 +369,19 @@ bigint Thermo::lost_check() // error message if (lostflag == ERROR) { - char fstr[64],str[64]; - sprintf(fstr, - "Lost atoms: original %s current %s",BIGINT_FORMAT,BIGINT_FORMAT); - sprintf(str,fstr,atom->natoms,ntotal); + char str[64]; + sprintf(str, + "Lost atoms: original " BIGINT_FORMAT " current " BIGINT_FORMAT, + atom->natoms,ntotal); error->all(str); } // warning message - char fstr[64],str[64]; - sprintf(fstr, - "Lost atoms: original %s current %s",BIGINT_FORMAT,BIGINT_FORMAT); - sprintf(str,fstr,atom->natoms,ntotal); + char str[64]; + sprintf(str, + "Lost atoms: original " BIGINT_FORMAT " current " BIGINT_FORMAT, + atom->natoms,ntotal); if (me == 0) error->warning(str,0); lostbefore = 1; return ntotal; @@ -514,8 +514,8 @@ void Thermo::modify_params(int narg, char **arg) if (ptr == NULL) error->all("Thermo_modify int format does not contain d character"); *ptr = '\0'; - sprintf(format_bigint_user,"%s%s%s",format_int_user, - BIGINT_FORMAT,ptr+1); + sprintf(format_bigint_user,"%s" BIGINT_FORMAT "%s", + format_int_user,ptr+1); *ptr = 'd'; } else if (strcmp(arg[iarg+1],"float") == 0) { if (format_float_user) delete [] format_float_user; diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 6fdb24998d..5b19ada3e1 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -86,9 +86,7 @@ void WriteRestart::command(int narg, char **arg) if (ptr = strchr(arg[0],'*')) { *ptr = '\0'; - char fstr[16]; - sprintf(fstr,"%%s%s%%s",BIGINT_FORMAT); - sprintf(file,fstr,arg[0],update->ntimestep,ptr+1); + sprintf(file,"%s" BIGINT_FORMAT "%s",arg[0],update->ntimestep,ptr+1); } else strcpy(file,arg[0]); // init entire system since comm->exchange is done