diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index e4a42b18f9..bf29f64579 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -19,6 +19,7 @@ #include "string.h" #include "stdlib.h" #include "dihedral_class2.h" +#include "lmptype.h" #include "atom.h" #include "neighbor.h" #include "update.h" @@ -209,9 +210,9 @@ void DihedralClass2::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128]; - sprintf(str,"Dihedral problem: %d %d %d %d %d %d", - me,update->ntimestep, + char str[128],fstr[64]; + sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); + sprintf(str,fstr,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/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index ff24cb55f1..716ced12f5 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -19,6 +19,7 @@ #include "string.h" #include "stdlib.h" #include "improper_class2.h" +#include "lmptype.h" #include "atom.h" #include "neighbor.h" #include "update.h" @@ -156,11 +157,13 @@ void ImproperClass2::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128]; - sprintf(str,"Improper problem: %d %d %d %d %d %d", - me,update->ntimestep, + char str[128],fstr[64]; + sprintf(fstr,"Improper problem: %%d %s %%d %%d %%d %%d", + BIGINT_FORMAT); + sprintf(str,fstr,me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); error->warning(str,0); + error->warning(str,0); fprintf(screen," 1st atom: %d %g %g %g\n", me,x[i1][0],x[i1][1],x[i1][2]); fprintf(screen," 2nd atom: %d %g %g %g\n", diff --git a/src/GPU/pair_cg_cmm_coul_long_gpu.cpp b/src/GPU/pair_cg_cmm_coul_long_gpu.cpp index 8c7825f316..6d74775772 100644 --- a/src/GPU/pair_cg_cmm_coul_long_gpu.cpp +++ b/src/GPU/pair_cg_cmm_coul_long_gpu.cpp @@ -19,6 +19,7 @@ #include "stdio.h" #include "stdlib.h" #include "pair_cg_cmm_coul_long_gpu.h" +#include "lmptype.h" #include "atom.h" #include "atom_vec.h" #include "comm.h" @@ -94,6 +95,10 @@ PairCGCMMCoulLongGPU::~PairCGCMMCoulLongGPU() void PairCGCMMCoulLongGPU::compute(int eflag, int vflag) { + if (update->ntimestep > MAXSMALLINT) + error->all("Timestep too big for GPU pair style"); + int ntimestep = update->ntimestep; + if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; @@ -104,7 +109,7 @@ void PairCGCMMCoulLongGPU::compute(int eflag, int vflag) if (gpu_mode == GPU_NEIGH) { inum = atom->nlocal; - gpulist = cmml_gpu_compute_n(update->ntimestep, neighbor->ago, inum, nall, + gpulist = cmml_gpu_compute_n(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, @@ -112,7 +117,7 @@ void PairCGCMMCoulLongGPU::compute(int eflag, int vflag) atom->q); } else { inum = list->inum; - cmml_gpu_compute(update->ntimestep, neighbor->ago, inum, nall, atom->x, + cmml_gpu_compute(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, list->ilist, list->numneigh, list->firstneigh, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success, atom->q); diff --git a/src/GPU/pair_cg_cmm_gpu.cpp b/src/GPU/pair_cg_cmm_gpu.cpp index 345fbfbf3d..19ba73aebe 100644 --- a/src/GPU/pair_cg_cmm_gpu.cpp +++ b/src/GPU/pair_cg_cmm_gpu.cpp @@ -19,6 +19,7 @@ #include "stdio.h" #include "stdlib.h" #include "pair_cg_cmm_gpu.h" +#include "lmptype.h" #include "atom.h" #include "atom_vec.h" #include "comm.h" @@ -83,6 +84,10 @@ PairCGCMMGPU::~PairCGCMMGPU() void PairCGCMMGPU::compute(int eflag, int vflag) { + if (update->ntimestep > MAXSMALLINT) + error->all("Timestep too big for GPU pair style"); + int ntimestep = update->ntimestep; + if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; @@ -93,14 +98,14 @@ void PairCGCMMGPU::compute(int eflag, int vflag) if (gpu_mode == GPU_NEIGH) { inum = atom->nlocal; - gpulist = cmm_gpu_compute_n(update->ntimestep, neighbor->ago, inum, nall, + gpulist = cmm_gpu_compute_n(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success); } else { inum = list->inum; - cmm_gpu_compute(update->ntimestep, neighbor->ago, inum, nall, atom->x, + cmm_gpu_compute(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, list->ilist, list->numneigh, list->firstneigh, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success); diff --git a/src/GPU/pair_gayberne_gpu.cpp b/src/GPU/pair_gayberne_gpu.cpp index 76079f73ec..9683507690 100644 --- a/src/GPU/pair_gayberne_gpu.cpp +++ b/src/GPU/pair_gayberne_gpu.cpp @@ -19,6 +19,7 @@ #include "stdio.h" #include "stdlib.h" #include "pair_gayberne_gpu.h" +#include "lmptype.h" #include "math_extra.h" #include "atom.h" #include "atom_vec.h" @@ -88,6 +89,10 @@ PairGayBerneGPU::~PairGayBerneGPU() void PairGayBerneGPU::compute(int eflag, int vflag) { + if (update->ntimestep > MAXSMALLINT) + error->all("Timestep too big for GPU pair style"); + int ntimestep = update->ntimestep; + if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; @@ -98,13 +103,13 @@ void PairGayBerneGPU::compute(int eflag, int vflag) if (gpu_mode == GPU_NEIGH) { inum = atom->nlocal; - gpulist = gb_gpu_compute_n(update->ntimestep, neighbor->ago, inum, nall, + gpulist = gb_gpu_compute_n(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, domain->sublo, domain->subhi, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success, atom->quat); } else { inum = list->inum; - olist = gb_gpu_compute(update->ntimestep, neighbor->ago, inum, nall, atom->x, + olist = gb_gpu_compute(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, list->ilist, list->numneigh, list->firstneigh, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success, diff --git a/src/GPU/pair_lj96_cut_gpu.cpp b/src/GPU/pair_lj96_cut_gpu.cpp index 583c2f27b2..095e9d9c06 100644 --- a/src/GPU/pair_lj96_cut_gpu.cpp +++ b/src/GPU/pair_lj96_cut_gpu.cpp @@ -19,6 +19,7 @@ #include "stdio.h" #include "stdlib.h" #include "pair_lj96_cut_gpu.h" +#include "lmptype.h" #include "atom.h" #include "atom_vec.h" #include "comm.h" @@ -82,6 +83,10 @@ PairLJ96CutGPU::~PairLJ96CutGPU() void PairLJ96CutGPU::compute(int eflag, int vflag) { + if (update->ntimestep > MAXSMALLINT) + error->all("Timestep too big for GPU pair style"); + int ntimestep = update->ntimestep; + if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; @@ -92,14 +97,14 @@ void PairLJ96CutGPU::compute(int eflag, int vflag) if (gpu_mode == GPU_NEIGH) { inum = atom->nlocal; - gpulist = lj96_gpu_compute_n(update->ntimestep, neighbor->ago, inum, nall, + gpulist = lj96_gpu_compute_n(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success); } else { inum = list->inum; - lj96_gpu_compute(update->ntimestep, neighbor->ago, inum, nall, atom->x, + lj96_gpu_compute(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, list->ilist, list->numneigh, list->firstneigh, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success); diff --git a/src/GPU/pair_lj_cut_coul_cut_gpu.cpp b/src/GPU/pair_lj_cut_coul_cut_gpu.cpp index 54430cbc32..1c8632c3ad 100644 --- a/src/GPU/pair_lj_cut_coul_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_cut_gpu.cpp @@ -19,6 +19,7 @@ #include "stdio.h" #include "stdlib.h" #include "pair_lj_cut_coul_cut_gpu.h" +#include "lmptype.h" #include "atom.h" #include "atom_vec.h" #include "comm.h" @@ -84,6 +85,10 @@ PairLJCutCoulCutGPU::~PairLJCutCoulCutGPU() void PairLJCutCoulCutGPU::compute(int eflag, int vflag) { + if (update->ntimestep > MAXSMALLINT) + error->all("Timestep too big for GPU pair style"); + int ntimestep = update->ntimestep; + if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; @@ -94,7 +99,7 @@ void PairLJCutCoulCutGPU::compute(int eflag, int vflag) if (gpu_mode == GPU_NEIGH) { inum = atom->nlocal; - gpulist = ljc_gpu_compute_n(update->ntimestep, neighbor->ago, inum, nall, + gpulist = ljc_gpu_compute_n(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, @@ -102,7 +107,7 @@ void PairLJCutCoulCutGPU::compute(int eflag, int vflag) atom->q); } else { inum = list->inum; - ljc_gpu_compute(update->ntimestep, neighbor->ago, inum, nall, atom->x, + ljc_gpu_compute(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, list->ilist, list->numneigh, list->firstneigh, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success, atom->q); diff --git a/src/GPU/pair_lj_cut_coul_long_gpu.cpp b/src/GPU/pair_lj_cut_coul_long_gpu.cpp index 2ae806439c..632f151dc1 100644 --- a/src/GPU/pair_lj_cut_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_long_gpu.cpp @@ -19,6 +19,7 @@ #include "stdio.h" #include "stdlib.h" #include "pair_lj_cut_coul_long_gpu.h" +#include "lmptype.h" #include "atom.h" #include "atom_vec.h" #include "comm.h" @@ -94,6 +95,10 @@ PairLJCutCoulLongGPU::~PairLJCutCoulLongGPU() void PairLJCutCoulLongGPU::compute(int eflag, int vflag) { + if (update->ntimestep > MAXSMALLINT) + error->all("Timestep too big for GPU pair style"); + int ntimestep = update->ntimestep; + if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; @@ -104,7 +109,7 @@ void PairLJCutCoulLongGPU::compute(int eflag, int vflag) if (gpu_mode == GPU_NEIGH) { inum = atom->nlocal; - gpulist = ljcl_gpu_compute_n(update->ntimestep, neighbor->ago, inum, nall, + gpulist = ljcl_gpu_compute_n(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, @@ -112,7 +117,7 @@ void PairLJCutCoulLongGPU::compute(int eflag, int vflag) atom->q); } else { inum = list->inum; - ljcl_gpu_compute(update->ntimestep, neighbor->ago, inum, nall, atom->x, + ljcl_gpu_compute(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, list->ilist, list->numneigh, list->firstneigh, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success, atom->q); diff --git a/src/GPU/pair_lj_cut_gpu.cpp b/src/GPU/pair_lj_cut_gpu.cpp index 1e7d952e17..ba2269d24b 100644 --- a/src/GPU/pair_lj_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_gpu.cpp @@ -19,6 +19,7 @@ #include "stdio.h" #include "stdlib.h" #include "pair_lj_cut_gpu.h" +#include "lmptype.h" #include "atom.h" #include "atom_vec.h" #include "comm.h" @@ -82,6 +83,10 @@ PairLJCutGPU::~PairLJCutGPU() void PairLJCutGPU::compute(int eflag, int vflag) { + if (update->ntimestep > MAXSMALLINT) + error->all("Timestep too big for GPU pair style"); + int ntimestep = update->ntimestep; + if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; @@ -92,14 +97,14 @@ void PairLJCutGPU::compute(int eflag, int vflag) if (gpu_mode == GPU_NEIGH) { inum = atom->nlocal; - gpulist = ljl_gpu_compute_n(update->ntimestep, neighbor->ago, inum, nall, + gpulist = ljl_gpu_compute_n(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success); } else { inum = list->inum; - ljl_gpu_compute(update->ntimestep, neighbor->ago, inum, nall, atom->x, + ljl_gpu_compute(ntimestep, neighbor->ago, inum, nall, atom->x, atom->type, list->ilist, list->numneigh, list->firstneigh, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success); diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index b8f13964f9..7c91cd51cc 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -20,6 +20,7 @@ #include "stdlib.h" #include "string.h" #include "fix_qeq_comb.h" +#include "lmptype.h" #include "atom.h" #include "force.h" #include "group.h" @@ -171,8 +172,11 @@ void FixQEQComb::post_force(int vflag) // charge-equilibration loop - if (me == 0 && fp) - fprintf(fp,"Charge equilibration on step %d\n",update->ntimestep); + if (me == 0 && fp) { + char fstr[64]; + sprintf(fstr,"Charge equilibration on step %s\n",BIGINT_FORMAT); + fprintf(fp,fstr,update->ntimestep); + } heatpq = 0.01; qmass = 0.06; diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index babb22689b..f1c7b7782b 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -14,6 +14,7 @@ #include "math.h" #include "stdlib.h" #include "bond_fene.h" +#include "lmptype.h" #include "atom.h" #include "neighbor.h" #include "domain.h" @@ -85,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]; - sprintf(str,"FENE bond too long: %d %d %d %g", - update->ntimestep,atom->tag[i1],atom->tag[i2],sqrt(rsq)); + 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)); error->warning(str,0); if (rlogarg <= -3.0) error->one("Bad FENE bond"); rlogarg = 0.1; @@ -242,8 +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]; - sprintf(str,"FENE bond too long: %d %g",update->ntimestep,sqrt(rsq)); + char str[128],fstr[64]; + sprintf(fstr,"FENE bond too long: %s %%g",BIGINT_FORMAT); + sprintf(str,fstr,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 9607861569..588bc3f306 100644 --- a/src/MOLECULE/bond_fene_expand.cpp +++ b/src/MOLECULE/bond_fene_expand.cpp @@ -14,6 +14,7 @@ #include "math.h" #include "stdlib.h" #include "bond_fene_expand.h" +#include "lmptype.h" #include "atom.h" #include "neighbor.h" #include "domain.h" @@ -90,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]; - sprintf(str,"FENE bond too long: %d %d %d %g", - update->ntimestep,atom->tag[i1],atom->tag[i2],sqrt(rsq)); + 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)); error->warning(str,0); if (rlogarg <= -3.0) error->one("Bad FENE bond"); rlogarg = 0.1; @@ -256,8 +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]; - sprintf(str,"FENE bond too long: %d %g",update->ntimestep,sqrt(rsq)); + char str[128],fstr[64]; + sprintf(fstr,"FENE bond too long: %s %%g",BIGINT_FORMAT); + sprintf(str,fstr,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 f2b7d4945f..2aae7fd3ef 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -19,6 +19,7 @@ #include "math.h" #include "stdlib.h" #include "dihedral_charmm.h" +#include "lmptype.h" #include "atom.h" #include "comm.h" #include "neighbor.h" @@ -146,9 +147,9 @@ void DihedralCharmm::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128]; - sprintf(str,"Dihedral problem: %d %d %d %d %d %d", - me,update->ntimestep, + char str[128],fstr[64]; + sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); + sprintf(str,fstr,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 6e76a66dd8..a2f62f5b4f 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -19,6 +19,7 @@ #include "math.h" #include "stdlib.h" #include "dihedral_harmonic.h" +#include "lmptype.h" #include "atom.h" #include "comm.h" #include "neighbor.h" @@ -136,9 +137,9 @@ void DihedralHarmonic::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128]; - sprintf(str,"Dihedral problem: %d %d %d %d %d %d", - me,update->ntimestep, + char str[128],fstr[64]; + sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); + sprintf(str,fstr,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 f5b56b3e46..6b9520339c 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -20,6 +20,7 @@ #include "stdlib.h" #include "mpi.h" #include "dihedral_helix.h" +#include "lmptype.h" #include "atom.h" #include "neighbor.h" #include "domain.h" @@ -168,9 +169,9 @@ void DihedralHelix::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128]; - sprintf(str,"Dihedral problem: %d %d %d %d %d %d", - me,update->ntimestep, + char str[128],fstr[64]; + sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); + sprintf(str,fstr,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 e9758cf47e..d369db2032 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -18,6 +18,7 @@ #include "math.h" #include "stdlib.h" #include "dihedral_multi_harmonic.h" +#include "lmptype.h" #include "atom.h" #include "neighbor.h" #include "domain.h" @@ -158,20 +159,22 @@ void DihedralMultiHarmonic::compute(int eflag, int vflag) // error check if (c > 1.0 + TOLERANCE || c < (-1.0 - TOLERANCE)) { + int me; + MPI_Comm_rank(world,&me); if (screen) { - char str[128]; - sprintf(str,"Dihedral problem: %d %d %d %d %d %d", - comm->me,update->ntimestep, + char str[128],fstr[64]; + sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); + sprintf(str,fstr,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", - comm->me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1][0],x[i1][1],x[i1][2]); fprintf(screen," 2nd atom: %d %g %g %g\n", - comm->me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2][0],x[i2][1],x[i2][2]); fprintf(screen," 3rd atom: %d %g %g %g\n", - comm->me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3][0],x[i3][1],x[i3][2]); fprintf(screen," 4th atom: %d %g %g %g\n", - comm->me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4][0],x[i4][1],x[i4][2]); } } diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index bb3579e1cb..576f6ca4e6 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -18,6 +18,7 @@ #include "math.h" #include "stdlib.h" #include "dihedral_opls.h" +#include "lmptype.h" #include "atom.h" #include "comm.h" #include "neighbor.h" @@ -164,20 +165,22 @@ void DihedralOPLS::compute(int eflag, int vflag) // error check if (c > 1.0 + TOLERANCE || c < (-1.0 - TOLERANCE)) { + int me; + MPI_Comm_rank(world,&me); if (screen) { - char str[128]; - sprintf(str,"Dihedral problem: %d %d %d %d %d %d", - comm->me,update->ntimestep, + char str[128],fstr[64]; + sprintf(fstr,"Dihedral problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); + sprintf(str,fstr,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", - comm->me,x[i1][0],x[i1][1],x[i1][2]); + me,x[i1][0],x[i1][1],x[i1][2]); fprintf(screen," 2nd atom: %d %g %g %g\n", - comm->me,x[i2][0],x[i2][1],x[i2][2]); + me,x[i2][0],x[i2][1],x[i2][2]); fprintf(screen," 3rd atom: %d %g %g %g\n", - comm->me,x[i3][0],x[i3][1],x[i3][2]); + me,x[i3][0],x[i3][1],x[i3][2]); fprintf(screen," 4th atom: %d %g %g %g\n", - comm->me,x[i4][0],x[i4][1],x[i4][2]); + me,x[i4][0],x[i4][1],x[i4][2]); } } diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index 6ce9e7fd56..a4a6624496 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -15,6 +15,7 @@ #include "math.h" #include "stdlib.h" #include "improper_cvff.h" +#include "lmptype.h" #include "atom.h" #include "comm.h" #include "neighbor.h" @@ -150,9 +151,9 @@ void ImproperCvff::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128]; - sprintf(str,"Improper problem: %d %d %d %d %d %d", - me,update->ntimestep, + char str[128],fstr[64]; + sprintf(fstr,"Improper problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); + sprintf(str,fstr,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 4487b9e7a4..0174ce3c98 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -15,6 +15,7 @@ #include "math.h" #include "stdlib.h" #include "improper_harmonic.h" +#include "lmptype.h" #include "atom.h" #include "comm.h" #include "neighbor.h" @@ -121,9 +122,9 @@ void ImproperHarmonic::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - char str[128]; - sprintf(str,"Improper problem: %d %d %d %d %d %d", - me,update->ntimestep, + char str[128],fstr[64]; + sprintf(fstr,"Improper problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); + sprintf(str,fstr,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 9d2cc9cbac..3fc2aad607 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -128,9 +128,11 @@ void ImproperUmbrella::compute(int eflag, int vflag) int me; MPI_Comm_rank(world,&me); if (screen) { - fprintf(screen,"Improper problem: %d %d %d %d %d %d\n", - me,update->ntimestep, + char str[128],fstr[64]; + sprintf(fstr,"Improper problem: %%d %s %%d %%d %%d %%d",BIGINT_FORMAT); + sprintf(str,fstr,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", me,x[i1][0],x[i1][1],x[i1][2]); fprintf(screen," 2nd atom: %d %g %g %g\n", diff --git a/src/REAX/fix_reax_bonds.cpp b/src/REAX/fix_reax_bonds.cpp index 5961b8ed08..1798ffc32e 100644 --- a/src/REAX/fix_reax_bonds.cpp +++ b/src/REAX/fix_reax_bonds.cpp @@ -18,6 +18,7 @@ #include "stdlib.h" #include "string.h" #include "fix_reax_bonds.h" +#include "lmptype.h" #include "pair_reax_fortran.h" #include "atom.h" #include "update.h" @@ -98,7 +99,7 @@ void FixReaxBonds::end_of_step() /* ---------------------------------------------------------------------- */ -void FixReaxBonds::OutputReaxBonds(int timestep, FILE *fp) +void FixReaxBonds::OutputReaxBonds(bigint ntimestep, FILE *fp) { int nparticles,nparticles_tot,nbuf,nbuf_local,most,j; int ii,jn,mbond,numbonds,nsbmax,nsbmax_most; @@ -120,7 +121,9 @@ void FixReaxBonds::OutputReaxBonds(int timestep, FILE *fp) MPI_Allreduce(&nsbmax,&nsbmax_most,1,MPI_INT,MPI_MAX,world); if (me == 0) { - fprintf(fp,"# Timestep %d \n",timestep); + char fstr[32]; + sprintf(fstr,"# Timestep %d \n",BIGINT_FORMAT); + fprintf(fp,fstr,ntimestep); fprintf(fp,"# \n"); fprintf(fp,"# Number of particles %d \n",nparticles_tot); fprintf(fp,"# \n"); diff --git a/src/REPLICA/fix_event.h b/src/REPLICA/fix_event.h index 73df5d1575..41ce7f261a 100644 --- a/src/REPLICA/fix_event.h +++ b/src/REPLICA/fix_event.h @@ -20,7 +20,6 @@ namespace LAMMPS_NS { class FixEvent : public Fix { public: - FixEvent(class LAMMPS *, int, char **); virtual ~FixEvent()=0; // Use destructor to make base class virtual int setmask(); diff --git a/src/REPLICA/fix_event_prd.cpp b/src/REPLICA/fix_event_prd.cpp index ad606d9ab0..3fba4da909 100644 --- a/src/REPLICA/fix_event_prd.cpp +++ b/src/REPLICA/fix_event_prd.cpp @@ -18,6 +18,7 @@ #include "stdlib.h" #include "string.h" #include "fix_event_prd.h" +#include "lmptype.h" #include "atom.h" #include "update.h" #include "domain.h" @@ -50,10 +51,10 @@ FixEventPRD::FixEventPRD(LAMMPS *lmp, int narg, char **arg) : update clock = elapsed time since last event, across all replicas ------------------------------------------------------------------------- */ -void FixEventPRD::store_event_prd(int timestep, int delta_clock) +void FixEventPRD::store_event_prd(bigint ntimestep, int delta_clock) { store_event(); - event_timestep = timestep; + event_timestep = ntimestep; clock += delta_clock; event_number++; } diff --git a/src/REPLICA/fix_event_prd.h b/src/REPLICA/fix_event_prd.h index fa97ead781..18f77b324a 100644 --- a/src/REPLICA/fix_event_prd.h +++ b/src/REPLICA/fix_event_prd.h @@ -21,13 +21,14 @@ FixStyle(EVENT/PRD,FixEventPRD) #define LMP_FIX_EVENT_PRD_H #include "fix_event.h" +#include "lmptype.h" namespace LAMMPS_NS { class FixEventPRD : public FixEvent { public: int event_number; // event counter - int event_timestep; // timestep of last event on any replica + bigint event_timestep; // timestep of last event on any replica int clock; // total elapsed timesteps across all replicas int replica_number; // replica where last event occured int correlated_event; // 1 if last event was correlated, 0 otherwise @@ -41,7 +42,7 @@ class FixEventPRD : public FixEvent { // methods specific to FixEventPRD, invoked by PRD - void store_event_prd(int, int); + void store_event_prd(bigint, int); private: diff --git a/src/REPLICA/fix_event_tad.cpp b/src/REPLICA/fix_event_tad.cpp index 5f0dcd069e..108668b638 100644 --- a/src/REPLICA/fix_event_tad.cpp +++ b/src/REPLICA/fix_event_tad.cpp @@ -18,6 +18,7 @@ #include "stdlib.h" #include "string.h" #include "fix_event_tad.h" +#include "lmptype.h" #include "atom.h" #include "update.h" #include "domain.h" @@ -50,10 +51,10 @@ FixEventTAD::FixEventTAD(LAMMPS *lmp, int narg, char **arg) : set event_timestep = when event occurred ------------------------------------------------------------------------- */ -void FixEventTAD::store_event_tad(int timestep) +void FixEventTAD::store_event_tad(bigint ntimestep) { store_event(); - event_timestep = timestep; + event_timestep = ntimestep; } /* ---------------------------------------------------------------------- diff --git a/src/REPLICA/fix_event_tad.h b/src/REPLICA/fix_event_tad.h index 5bf937e221..2b6067e9e2 100644 --- a/src/REPLICA/fix_event_tad.h +++ b/src/REPLICA/fix_event_tad.h @@ -21,13 +21,14 @@ FixStyle(EVENT/TAD,FixEventTAD) #define LMP_FIX_EVENT_TAD_H #include "fix_event.h" +#include "lmptype.h" namespace LAMMPS_NS { class FixEventTAD : public FixEvent { public: int event_number; // event counter - int event_timestep; // timestep of last event + bigint event_timestep; // timestep of last event double tlo; // event time at low temperature double ebarrier; // energy barrier for this event @@ -39,7 +40,7 @@ class FixEventTAD : public FixEvent { // methods specific to FixEventTAD, invoked by TAD - void store_event_tad(int); + void store_event_tad(bigint); private: diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index e44c95f7f0..f021a1f7fa 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -16,6 +16,7 @@ #include "stdlib.h" #include "string.h" #include "neb.h" +#include "lmptype.h" #include "universe.h" #include "atom.h" #include "update.h" @@ -482,8 +483,10 @@ void NEB::print_status() } if (me_universe == 0) { + char fstr[32]; + sprintf(fstr,"%s %%g %%g ",BIGINT_FORMAT); if (universe->uscreen) { - fprintf(universe->uscreen,"%d %g %g ",update->ntimestep, + fprintf(universe->uscreen,fstr,update->ntimestep, fmaxreplica,fmaxatom); fprintf(universe->uscreen,"%g %g %g ", gradvnorm0,gradvnorm1,gradvnormc); @@ -493,7 +496,7 @@ void NEB::print_status() fprintf(universe->uscreen,"\n"); } if (universe->ulogfile) { - fprintf(universe->ulogfile,"%d %g %g ",update->ntimestep, + fprintf(universe->ulogfile,fstr,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 eb28310ffb..07ca60580e 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -424,7 +424,7 @@ void PRD::command(int narg, char **arg) void PRD::dephase() { - int ntimestep_hold = update->ntimestep; + bigint ntimestep_hold = update->ntimestep; update->whichflag = 1; update->nsteps = n_dephase*t_dephase; @@ -486,8 +486,8 @@ void PRD::dynamics() void PRD::quench() { - int ntimestep_hold = update->ntimestep; - int endstep_hold = update->endstep; + bigint ntimestep_hold = update->ntimestep; + bigint endstep_hold = update->endstep; // need to change whichflag so that minimize->setup() calling // modify->setup() will call fix->min_setup() @@ -649,8 +649,10 @@ 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,"%d %.3f %d %d %d %d %d\n", + fprintf(universe->uscreen,fstr, fix_event->event_timestep, timer->elapsed(TIME_LOOP), fix_event->clock, @@ -658,7 +660,7 @@ void PRD::log_event() fix_event->ncoincident, fix_event->replica_number); if (universe->ulogfile) - fprintf(universe->ulogfile,"%d %.3f %d %d %d %d %d\n", + fprintf(universe->ulogfile,fstr, fix_event->event_timestep, timer->elapsed(TIME_LOOP), fix_event->clock, diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index 6948dec0d1..0cbb937075 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -79,7 +79,8 @@ void TAD::command(int narg, char **arg) if (domain->box_exist == 0) error->all("tad command before simulation box is defined"); - if (universe->nworlds == 1) error->all("Cannot use TAD with a single replica for NEB"); + if (universe->nworlds == 1) + error->all("Cannot use TAD with a single replica for NEB"); if (universe->nworlds != universe->nprocs) error->all("Can only use TAD with 1-processor replicas for NEB"); if (atom->sortfreq > 0) @@ -222,11 +223,9 @@ void TAD::command(int narg, char **arg) if (me_universe == 0) { if (universe->uscreen) - fprintf(universe->uscreen,"Step CPU Clock Event " - "\n"); + fprintf(universe->uscreen,"Step CPU Clock Event\n"); if (universe->ulogfile) - fprintf(universe->ulogfile,"Step CPU Clock Event " - "\n"); + fprintf(universe->ulogfile,"Step CPU Clock Event\n"); } ulogfile_lammps = universe->ulogfile; @@ -452,8 +451,8 @@ void TAD::dynamics() void TAD::quench() { - int ntimestep_hold = update->ntimestep; - int endstep_hold = update->endstep; + bigint ntimestep_hold = update->ntimestep; + bigint endstep_hold = update->endstep; // need to change whichflag so that minimize->setup() calling // modify->setup() will call fix->min_setup() @@ -518,14 +517,16 @@ 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,"%d %.3f %.3f %d\n", + fprintf(universe->uscreen,fstr, fix_event->event_timestep, timer->elapsed(TIME_LOOP), fix_event->tlo, fix_event->event_number); if (universe->ulogfile) - fprintf(universe->ulogfile,"%d %.3f %.3f %d\n", + fprintf(universe->ulogfile,fstr, fix_event->event_timestep, timer->elapsed(TIME_LOOP), fix_event->tlo, @@ -913,7 +914,7 @@ void TAD::compute_tlo(int ievent) // first-replica output about each event if (universe->me == 0) { - char str[128]; + char str[128],fstr[128]; double tfrac = 0.0; if (ievent > 0) tfrac = delthi/deltstop; // sprintf(str, @@ -921,15 +922,14 @@ void TAD::compute_tlo(int ievent) // 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); + if (screen) - fprintf(screen, - "New event: t_hi = %d ievent = %d eb = %g dt_lo = %g dt_hi/t_stop = %g \n", - fix_event_list[ievent]->event_timestep, + fprintf(screen,fstr,fix_event_list[ievent]->event_timestep, ievent,ebarrier,deltlo,tfrac); if (logfile) - fprintf(logfile, - "New event: t_hi = %d ievent = %d eb = %g dt_lo = %g dt_hi/t_stop = %g \n", - fix_event_list[ievent]->event_timestep, + fprintf(logfile,fstr,fix_event_list[ievent]->event_timestep, ievent,ebarrier,deltlo,tfrac); } diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 592e012f3e..17fcc41c76 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -19,6 +19,7 @@ #include "stdlib.h" #include "string.h" #include "temper.h" +#include "lmptype.h" #include "universe.h" #include "domain.h" #include "atom.h" @@ -342,15 +343,15 @@ void Temper::scale_velocities(int t_partner, int t_me) void Temper::print_status() { if (universe->uscreen) { - fprintf(universe->uscreen,"%d ",update->ntimestep); + fprintf(universe->uscreen,BIGINT_FORMAT,update->ntimestep); for (int i = 0; i < nworlds; i++) - fprintf(universe->uscreen,"%d ",world2temp[i]); + fprintf(universe->uscreen," %d",world2temp[i]); fprintf(universe->uscreen,"\n"); } if (universe->ulogfile) { - fprintf(universe->ulogfile,"%d ",update->ntimestep); + fprintf(universe->ulogfile,BIGINT_FORMAT,update->ntimestep); for (int i = 0; i < nworlds; i++) - fprintf(universe->ulogfile,"%d ",world2temp[i]); + fprintf(universe->ulogfile," %d",world2temp[i]); fprintf(universe->ulogfile,"\n"); fflush(universe->ulogfile); } diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index ae867aaf68..71ce7698ea 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -692,8 +692,9 @@ void FixSRD::post_force(int vflag) if (ix < 0 || ix >= nbin2x || iy < 0 || iy >= nbin2y || iz < 0 || iz >= nbin2z) { - printf("SRD particle %d on step %d\n", - atom->tag[i],update->ntimestep); + 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", @@ -1150,28 +1151,22 @@ void FixSRD::collisions_single() if (t_remain > dt) { ninside++; - if (insideflag == INSIDE_ERROR) { - char str[128]; - if (type != WALL) - sprintf(str,"SRD particle %d started " - "inside big particle %d on step %d bounce %d\n", + 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, atom->tag[i],atom->tag[j],update->ntimestep,ibounce+1); - else - sprintf(str,"SRD particle %d started " - "inside wall %d on step %d bounce %d\n", - atom->tag[i],j,update->ntimestep,ibounce+1); - error->one(str); - } - if (insideflag == INSIDE_WARN) { - char str[128]; - if (type != WALL) - sprintf(str,"SRD particle %d started " - "inside big particle %d on step %d bounce %d\n", - atom->tag[i],atom->tag[j],update->ntimestep,ibounce+1); - else - sprintf(str,"SRD particle %d started " - "inside wall %d on step %d bounce %d\n", + } 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); } break; @@ -1300,18 +1295,14 @@ void FixSRD::collisions_multi() if (t_remain > dt || t_remain < 0.0) { ninside++; - if (insideflag == INSIDE_ERROR) { - char str[128]; - sprintf(str,"SRD particle %d started " - "inside big particle %d on step %d bounce %d\n", - atom->tag[i],atom->tag[j],update->ntimestep,ibounce+1); - error->one(str); - } - if (insideflag == INSIDE_WARN) { - char str[128]; - sprintf(str,"SRD particle %d started " - "inside big particle %d on step %d bounce %d\n", + 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, atom->tag[i],atom->tag[j],update->ntimestep,ibounce+1); + if (insideflag == INSIDE_ERROR) error->one(str); error->warning(str); } t_first = 0.0; @@ -2081,8 +2072,9 @@ int FixSRD::update_srd(int i, double dt, double *xscoll, double *vsnew, xs[1] < srdlo[1] || xs[1] > srdhi[1] || xs[2] < srdlo[2] || xs[2] > srdhi[2]) { printf("Bad SRD particle move\n"); - printf(" particle %d on proc %d at timestep %d\n", - atom->tag[i],me,update->ntimestep); + 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]); diff --git a/src/SRD/fix_wall_srd.cpp b/src/SRD/fix_wall_srd.cpp index 359ad63d66..9c8eb4ce5a 100644 --- a/src/SRD/fix_wall_srd.cpp +++ b/src/SRD/fix_wall_srd.cpp @@ -230,7 +230,7 @@ void FixWallSRD::wall_params(int flag) if (varflag) modify->clearstep_compute(); - int ntimestep = update->ntimestep; + bigint ntimestep = update->ntimestep; for (int m = 0; m < nwall; m++) { if (wallstyle[m] == VARIABLE) diff --git a/src/SRD/fix_wall_srd.h b/src/SRD/fix_wall_srd.h index c10ec12535..ed5afcde3b 100644 --- a/src/SRD/fix_wall_srd.h +++ b/src/SRD/fix_wall_srd.h @@ -21,6 +21,7 @@ FixStyle(wall/srd,FixWallSRD) #define LMP_FIX_WALL_SRD_H #include "fix.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -47,7 +48,7 @@ class FixWallSRD : public Fix { double dt; double xwalllast[6]; - int laststep; + bigint laststep; double **fwall_all; int force_flag; diff --git a/src/XTC/dump_xtc.cpp b/src/XTC/dump_xtc.cpp index 8dadedc465..89ea2eb1c1 100644 --- a/src/XTC/dump_xtc.cpp +++ b/src/XTC/dump_xtc.cpp @@ -68,7 +68,8 @@ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) // allocate global array for atom coords bigint n = group->count(igroup); - if (n > MAXSMALLINT) error->all("Too many atoms for dump xtc"); + if (n > MAXSMALLINT/3/sizeof(float)) + error->all("Too many atoms for dump xtc"); natoms = static_cast (n); coords = (float *) memory->smalloc(3*natoms*sizeof(float),"dump:coords"); @@ -138,6 +139,9 @@ void DumpXTC::write_header(bigint nbig) { if (nbig > MAXSMALLINT) error->all("Too many atoms for dump xtc"); int n = nbig; + if (update->ntimestep > MAXSMALLINT) + error->all("Too big a timestep for dump xtc"); + int ntimestep = update->ntimestep; // all procs realloc coords if total count grew @@ -154,8 +158,8 @@ void DumpXTC::write_header(bigint nbig) int tmp = XTC_MAGIC; xdr_int(&xd,&tmp); xdr_int(&xd,&n); - xdr_int(&xd,&update->ntimestep); - float time_value = update->ntimestep * update->dt; + xdr_int(&xd,&ntimestep); + float time_value = ntimestep * update->dt; xdr_float(&xd,&time_value); // cell basis vectors diff --git a/src/atom.h b/src/atom.h index 0cb05c7eb9..563bc9b1c0 100644 --- a/src/atom.h +++ b/src/atom.h @@ -108,7 +108,7 @@ class Atom : protected Pointers { // spatial sorting of atoms int sortfreq; // sort atoms every this many steps, 0 = off - int nextsort; // next timestep to sort on + bigint nextsort; // next timestep to sort on // functions diff --git a/src/compute.cpp b/src/compute.cpp index 81cedcd170..27e7ff564c 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -16,6 +16,7 @@ #include "string.h" #include "ctype.h" #include "compute.h" +#include "lmptype.h" #include "atom.h" #include "domain.h" #include "comm.h" @@ -147,7 +148,7 @@ void Compute::reset_extra_compute_fix(char *) search from top downward, since list of times is in decreasing order ------------------------------------------------------------------------- */ -void Compute::addstep(int ntimestep) +void Compute::addstep(bigint ntimestep) { // i = location in list to insert ntimestep @@ -162,8 +163,8 @@ void Compute::addstep(int ntimestep) if (ntime == maxtime) { maxtime += DELTA; - tlist = (int *) - memory->srealloc(tlist,maxtime*sizeof(int),"compute:tlist"); + tlist = (bigint *) + memory->srealloc(tlist,maxtime*sizeof(bigint),"compute:tlist"); } // move remainder of list upward and insert ntimestep @@ -179,7 +180,7 @@ void Compute::addstep(int ntimestep) search from top downward, since list of times is in decreasing order ------------------------------------------------------------------------- */ -int Compute::matchstep(int ntimestep) +int Compute::matchstep(bigint ntimestep) { for (int i = ntime-1; i >= 0; i--) { if (ntimestep < tlist[i]) return 0; diff --git a/src/compute.h b/src/compute.h index f13f2fa9ad..cb7c3152fc 100644 --- a/src/compute.h +++ b/src/compute.h @@ -15,6 +15,7 @@ #define LMP_COMPUTE_H #include "pointers.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -63,14 +64,14 @@ class Compute : protected Pointers { int timeflag; // 1 if Compute stores list of timesteps it's called on int ntime; // # of entries in time list int maxtime; // max # of entries time list can hold - int *tlist; // time list of steps the Compute is called on + bigint *tlist; // list of timesteps the Compute is called on - int invoked_flag; // non-zero if invoked or accessed this step, 0 if not - int invoked_scalar; // last timestep on which compute_scalar() was invoked - int invoked_vector; // ditto for compute_vector() - int invoked_array; // ditto for compute_array() - int invoked_peratom; // ditto for compute_peratom() - int invoked_local; // ditto for compute_local() + int invoked_flag; // non-zero if invoked or accessed this step, 0 if not + bigint invoked_scalar; // last timestep on which compute_scalar() was invoked + bigint invoked_vector; // ditto for compute_vector() + bigint invoked_array; // ditto for compute_array() + bigint invoked_peratom; // ditto for compute_peratom() + bigint invoked_local; // ditto for compute_local() double dof; // degrees-of-freedom for temperature @@ -103,8 +104,8 @@ class Compute : protected Pointers { virtual void reset_extra_compute_fix(char *); - void addstep(int); - int matchstep(int); + void addstep(bigint); + int matchstep(bigint); void clearstep(); virtual double memory_usage() {return 0.0;} diff --git a/src/dump.cpp b/src/dump.cpp index 53c6ff35f2..a382c7fa92 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -359,7 +359,9 @@ void Dump::openfile() filecurrent = new char[strlen(filename) + 16]; char *ptr = strchr(filename,'*'); *ptr = '\0'; - sprintf(filecurrent,"%s%d%s",filename,update->ntimestep,ptr+1); + char fstr[16]; + sprintf(fstr,"%%s%s%%s",BIGINT_FORMAT); + sprintf(filecurrent,fstr,filename,update->ntimestep,ptr+1); *ptr = '*'; } diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index 0d2586db35..11152f5b72 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -162,8 +162,7 @@ void DumpAtom::write_data(int n, double *mybuf) void DumpAtom::header_binary(bigint ndump) { - bigint ntimestep = update->ntimestep; - fwrite(&ntimestep,sizeof(bigint),1,fp); + fwrite(&update->ntimestep,sizeof(bigint),1,fp); fwrite(&ndump,sizeof(bigint),1,fp); fwrite(&domain->triclinic,sizeof(int),1,fp); fwrite(&boxxlo,sizeof(double),1,fp); @@ -183,8 +182,7 @@ void DumpAtom::header_binary(bigint ndump) void DumpAtom::header_binary_triclinic(bigint ndump) { - bigint ntimestep = update->ntimestep; - fwrite(&ntimestep,sizeof(bigint),1,fp); + fwrite(&update->ntimestep,sizeof(bigint),1,fp); fwrite(&ndump,sizeof(bigint),1,fp); fwrite(&domain->triclinic,sizeof(int),1,fp); fwrite(&boxxlo,sizeof(double),1,fp); @@ -208,7 +206,7 @@ void DumpAtom::header_binary_triclinic(bigint ndump) void DumpAtom::header_item(bigint ndump) { fprintf(fp,"ITEM: TIMESTEP\n"); - fprintf(fp,"%d\n",update->ntimestep); + fprintf(fp,BIGINT_FORMAT_NL,update->ntimestep); fprintf(fp,"ITEM: NUMBER OF ATOMS\n"); fprintf(fp,BIGINT_FORMAT_NL,ndump); fprintf(fp,"ITEM: BOX BOUNDS\n"); @@ -223,7 +221,7 @@ void DumpAtom::header_item(bigint ndump) void DumpAtom::header_item_triclinic(bigint ndump) { fprintf(fp,"ITEM: TIMESTEP\n"); - fprintf(fp,"%d\n",update->ntimestep); + fprintf(fp,BIGINT_FORMAT_NL,update->ntimestep); fprintf(fp,"ITEM: NUMBER OF ATOMS\n"); fprintf(fp,BIGINT_FORMAT_NL,ndump); fprintf(fp,"ITEM: BOX BOUNDS xy xz yz\n"); diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 33535ae73e..2ee551c1d7 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -246,8 +246,7 @@ void DumpCustom::write_header(bigint ndump) void DumpCustom::header_binary(bigint ndump) { - bigint ntimestep = update->ntimestep; - fwrite(&ntimestep,sizeof(int),1,fp); + fwrite(&update->ntimestep,sizeof(bigint),1,fp); fwrite(&ndump,sizeof(bigint),1,fp); fwrite(&domain->triclinic,sizeof(int),1,fp); fwrite(&boxxlo,sizeof(double),1,fp); @@ -267,7 +266,7 @@ void DumpCustom::header_binary(bigint ndump) void DumpCustom::header_binary_triclinic(bigint ndump) { - fwrite(&update->ntimestep,sizeof(int),1,fp); + fwrite(&update->ntimestep,sizeof(bigint),1,fp); fwrite(&ndump,sizeof(bigint),1,fp); fwrite(&domain->triclinic,sizeof(int),1,fp); fwrite(&boxxlo,sizeof(double),1,fp); @@ -291,7 +290,7 @@ void DumpCustom::header_binary_triclinic(bigint ndump) void DumpCustom::header_item(bigint ndump) { fprintf(fp,"ITEM: TIMESTEP\n"); - fprintf(fp,"%d\n",update->ntimestep); + fprintf(fp,BIGINT_FORMAT_NL,update->ntimestep); fprintf(fp,"ITEM: NUMBER OF ATOMS\n"); fprintf(fp,BIGINT_FORMAT_NL,ndump); fprintf(fp,"ITEM: BOX BOUNDS\n"); @@ -306,7 +305,7 @@ void DumpCustom::header_item(bigint ndump) void DumpCustom::header_item_triclinic(bigint ndump) { fprintf(fp,"ITEM: TIMESTEP\n"); - fprintf(fp,"%d\n",update->ntimestep); + fprintf(fp,BIGINT_FORMAT_NL,update->ntimestep); fprintf(fp,"ITEM: NUMBER OF ATOMS\n"); fprintf(fp,BIGINT_FORMAT_NL,ndump); fprintf(fp,"ITEM: BOX BOUNDS xy xz yz\n"); @@ -344,7 +343,6 @@ int DumpCustom::count() // invoke Computes for per-atom quantities if (ncompute) { - int ntimestep = update->ntimestep; for (i = 0; i < ncompute; i++) if (!(compute[i]->invoked_flag & INVOKED_PERATOM)) { compute[i]->compute_peratom(); diff --git a/src/dump_dcd.cpp b/src/dump_dcd.cpp index 90f51e0a26..5235ccdf89 100644 --- a/src/dump_dcd.cpp +++ b/src/dump_dcd.cpp @@ -69,7 +69,7 @@ DumpDCD::DumpDCD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) // allocate global array for atom coords bigint n = group->count(igroup); - if (n > MAXSMALLINT) error->all("Too many atoms for dump dcd"); + if (n > MAXSMALLINT/sizeof(float)) error->all("Too many atoms for dump dcd"); natoms = static_cast (n); coords = (float *) memory->smalloc(3*natoms*sizeof(float),"dump:coords"); @@ -125,6 +125,8 @@ void DumpDCD::openfile() void DumpDCD::write_header(bigint n) { if (n != natoms) error->all("Dump dcd of non-matching # of atoms"); + if (update->ntimestep > MAXSMALLINT) + error->all("Too big a timestep for dump dcd"); // first time, write header for entire file @@ -323,14 +325,16 @@ void DumpDCD::write_dcd_header(const char *remarks) time_t cur_time; struct tm *tmbuf; + int ntimestep = update->ntimestep; + out_integer = 84; fwrite_int32(fp,out_integer); strcpy(title_string,"CORD"); fwrite(title_string,4,1,fp); fwrite_int32(fp,0); // NFILE = # of snapshots in file - fwrite_int32(fp,update->ntimestep); // START = timestep of first snapshot + fwrite_int32(fp,ntimestep); // START = timestep of first snapshot fwrite_int32(fp,nevery_save); // SKIP = interval between snapshots - fwrite_int32(fp,update->ntimestep); // NSTEP = timestep of last snapshot + fwrite_int32(fp,ntimestep); // NSTEP = timestep of last snapshot fwrite_int32(fp,0); // NAMD writes NSTEP or ISTART fwrite_int32(fp,0); fwrite_int32(fp,0); diff --git a/src/dump_local.cpp b/src/dump_local.cpp index f4832df096..0230a0ac1c 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -191,7 +191,7 @@ void DumpLocal::write_header(bigint ndump) { if (me == 0) { fprintf(fp,"ITEM: TIMESTEP\n"); - fprintf(fp,"%d\n",update->ntimestep); + fprintf(fp,BIGINT_FORMAT_NL,update->ntimestep); fprintf(fp,"ITEM: NUMBER OF %s\n",label); fprintf(fp,BIGINT_FORMAT_NL,ndump); fprintf(fp,"ITEM: %s %s\n",label,columns); @@ -207,7 +207,6 @@ int DumpLocal::count() // invoke Computes for local quantities if (ncompute) { - int ntimestep = update->ntimestep; for (i = 0; i < ncompute; i++) { if (!(compute[i]->invoked_flag & INVOKED_LOCAL)) { compute[i]->compute_local(); diff --git a/src/fix.h b/src/fix.h index b35653d645..c44cccfa28 100644 --- a/src/fix.h +++ b/src/fix.h @@ -15,6 +15,7 @@ #define LMP_FIX_H #include "pointers.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -29,7 +30,7 @@ class Fix : protected Pointers { int box_change; // 1 if Fix changes box, 0 if not int box_change_size; // 1 if Fix changes box size, 0 if not int box_change_shape; // 1 if Fix changes box shape, 0 if not - int next_reneighbor; // next timestep to force a reneighboring + bigint next_reneighbor; // next timestep to force a reneighboring int thermo_energy; // 1 if fix_modify enabled ThEng, 0 if not int nevery; // how often to call an end_of_step fix int rigid_flag; // 1 if Fix integrates rigid bodies, 0 if not diff --git a/src/fix_ave_atom.cpp b/src/fix_ave_atom.cpp index eb8cf19b22..ef7de11d3e 100644 --- a/src/fix_ave_atom.cpp +++ b/src/fix_ave_atom.cpp @@ -14,6 +14,7 @@ #include "stdlib.h" #include "string.h" #include "fix_ave_atom.h" +#include "lmptype.h" #include "atom.h" #include "domain.h" #include "update.h" @@ -276,7 +277,7 @@ void FixAveAtom::end_of_step() // skip if not step which requires doing something - int ntimestep = update->ntimestep; + bigint ntimestep = update->ntimestep; if (ntimestep != nvalid) return; // zero if first step @@ -435,9 +436,9 @@ int FixAveAtom::unpack_exchange(int nlocal, double *buf) else backup from next multiple of nfreq ------------------------------------------------------------------------- */ -int FixAveAtom::nextvalid() +bigint FixAveAtom::nextvalid() { - int nvalid = (update->ntimestep/peratom_freq)*peratom_freq + peratom_freq; + bigint nvalid = (update->ntimestep/peratom_freq)*peratom_freq + peratom_freq; if (nvalid-peratom_freq == update->ntimestep && nrepeat == 1) nvalid = update->ntimestep; else diff --git a/src/fix_ave_atom.h b/src/fix_ave_atom.h index 7ab406b815..409b78cc25 100644 --- a/src/fix_ave_atom.h +++ b/src/fix_ave_atom.h @@ -22,6 +22,7 @@ FixStyle(ave/atom,FixAveAtom) #include "stdio.h" #include "fix.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -42,13 +43,13 @@ class FixAveAtom : public Fix { private: int nvalues; - int nrepeat,nvalid,irepeat; + int nrepeat,irepeat; + bigint nvalid; int *which,*argindex,*value2index; char **ids; - double **array; - int nextvalid(); + bigint nextvalid(); }; } diff --git a/src/fix_ave_correlate.cpp b/src/fix_ave_correlate.cpp index 941970e521..b962a0d590 100644 --- a/src/fix_ave_correlate.cpp +++ b/src/fix_ave_correlate.cpp @@ -20,6 +20,7 @@ #include "stdlib.h" #include "string.h" #include "fix_ave_correlate.h" +#include "lmptype.h" #include "update.h" #include "modify.h" #include "compute.h" @@ -383,7 +384,7 @@ void FixAveCorrelate::end_of_step() // skip if not step which requires doing something - int ntimestep = update->ntimestep; + bigint ntimestep = update->ntimestep; if (ntimestep != nvalid) return; // accumulate results of computes,fixes,variables to origin @@ -466,7 +467,9 @@ void FixAveCorrelate::end_of_step() // output to file if (fp && me == 0) { - fprintf(fp,"%d %d\n",ntimestep,nrepeat); + char fstr[16]; + sprintf(fstr,"%s %%d\n",BIGINT_FORMAT); + fprintf(fp,fstr,ntimestep,nrepeat); for (i = 0; i < nrepeat; i++) { fprintf(fp,"%d %d %d",i+1,i*nevery,count[i]); if (count[i]) @@ -585,9 +588,9 @@ double FixAveCorrelate::compute_array(int i, int j) startstep is lower bound ------------------------------------------------------------------------- */ -int FixAveCorrelate::nextvalid() +bigint FixAveCorrelate::nextvalid() { - int nvalid = update->ntimestep; + bigint nvalid = update->ntimestep; if (startstep > nvalid) nvalid = startstep; if (nvalid % nevery) nvalid = (nvalid/nevery)*nevery + nevery; return nvalid; diff --git a/src/fix_ave_correlate.h b/src/fix_ave_correlate.h index faacf6eabb..e5dc5046c9 100644 --- a/src/fix_ave_correlate.h +++ b/src/fix_ave_correlate.h @@ -22,6 +22,7 @@ FixStyle(ave/correlate,FixAveCorrelate) #include "stdio.h" #include "fix.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -37,7 +38,8 @@ class FixAveCorrelate : public Fix { private: int me,nvalues; - int nrepeat,nfreq,nvalid; + int nrepeat,nfreq; + bigint nvalid; int *which,*argindex,*value2index; char **ids; FILE *fp; @@ -58,7 +60,7 @@ class FixAveCorrelate : public Fix { double **save_corr; void accumulate(); - int nextvalid(); + bigint nextvalid(); }; } diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index d04fea1c36..b0c2345839 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -14,6 +14,7 @@ #include "stdlib.h" #include "string.h" #include "fix_ave_histo.h" +#include "lmptype.h" #include "atom.h" #include "update.h" #include "modify.h" @@ -568,7 +569,7 @@ void FixAveHisto::end_of_step() // skip if not step which requires doing something - int ntimestep = update->ntimestep; + bigint ntimestep = update->ntimestep; if (ntimestep != nvalid) return; // zero if first step @@ -788,8 +789,9 @@ void FixAveHisto::end_of_step() // output result to file if (fp && me == 0) { - fprintf(fp,"%d %d %g %g %g %g\n", - ntimestep,nbins, + char fstr[32]; + sprintf(fstr,"%s %%d %%g %%g %%g %%g\n",BIGINT_FORMAT); + fprintf(fp,fstr,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++) @@ -989,9 +991,9 @@ void FixAveHisto::allocate_values(int n) else backup from next multiple of nfreq ------------------------------------------------------------------------- */ -int FixAveHisto::nextvalid() +bigint FixAveHisto::nextvalid() { - int nvalid = (update->ntimestep/nfreq)*nfreq + nfreq; + bigint nvalid = (update->ntimestep/nfreq)*nfreq + nfreq; if (nvalid-nfreq == update->ntimestep && nrepeat == 1) nvalid = update->ntimestep; else diff --git a/src/fix_ave_histo.h b/src/fix_ave_histo.h index 64903a973c..7dc63220b0 100644 --- a/src/fix_ave_histo.h +++ b/src/fix_ave_histo.h @@ -22,6 +22,7 @@ FixStyle(ave/histo,FixAveHisto) #include "stdio.h" #include "fix.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -38,7 +39,8 @@ class FixAveHisto : public Fix { private: int me,nvalues; - int nrepeat,nfreq,nvalid,irepeat; + int nrepeat,nfreq,irepeat; + bigint nvalid; int *which,*argindex,*value2index; char **ids; FILE *fp; @@ -65,7 +67,7 @@ class FixAveHisto : public Fix { void bin_atoms(double *, int); void options(int, char **); void allocate_values(int); - int nextvalid(); + bigint nextvalid(); }; } diff --git a/src/fix_ave_spatial.cpp b/src/fix_ave_spatial.cpp index 7b562052aa..760464223b 100644 --- a/src/fix_ave_spatial.cpp +++ b/src/fix_ave_spatial.cpp @@ -18,6 +18,7 @@ #include "stdlib.h" #include "string.h" #include "fix_ave_spatial.h" +#include "lmptype.h" #include "atom.h" #include "update.h" #include "force.h" @@ -494,7 +495,7 @@ void FixAveSpatial::end_of_step() // skip if not step which requires doing something - int ntimestep = update->ntimestep; + bigint ntimestep = update->ntimestep; if (ntimestep != nvalid) return; // zero out arrays that accumulate over many samples @@ -788,7 +789,9 @@ void FixAveSpatial::end_of_step() // output result to file if (fp && me == 0) { - fprintf(fp,"%d %d\n",ntimestep,nbins); + char fstr[16]; + sprintf(fstr,"%s %%d\n",BIGINT_FORMAT); + fprintf(fp,fstr,ntimestep,nbins); if (ndim == 1) for (m = 0; m < nbins; m++) { fprintf(fp," %d %g %g",m+1,coord[m][0], @@ -1268,9 +1271,9 @@ double FixAveSpatial::compute_array(int i, int j) else backup from next multiple of nfreq ------------------------------------------------------------------------- */ -int FixAveSpatial::nextvalid() +bigint FixAveSpatial::nextvalid() { - int nvalid = (update->ntimestep/nfreq)*nfreq + nfreq; + bigint nvalid = (update->ntimestep/nfreq)*nfreq + nfreq; if (nvalid-nfreq == update->ntimestep && nrepeat == 1) nvalid = update->ntimestep; else diff --git a/src/fix_ave_spatial.h b/src/fix_ave_spatial.h index 66dec3eaac..eefd20347e 100644 --- a/src/fix_ave_spatial.h +++ b/src/fix_ave_spatial.h @@ -22,6 +22,7 @@ FixStyle(ave/spatial,FixAveSpatial) #include "stdio.h" #include "fix.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -38,7 +39,8 @@ class FixAveSpatial : public Fix { private: int me,nvalues; - int nrepeat,nfreq,nvalid,irepeat; + int nrepeat,nfreq,irepeat; + bigint nvalid; int ndim,normflag,regionflag,iregion; char *tstring,*sstring,*idregion; int *which,*argindex,*value2index; @@ -72,7 +74,7 @@ class FixAveSpatial : public Fix { void atom2bin1d(); void atom2bin2d(); void atom2bin3d(); - int nextvalid(); + bigint nextvalid(); }; } diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 2edc58074a..a2138243c6 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -18,6 +18,7 @@ #include "stdlib.h" #include "string.h" #include "fix_ave_time.h" +#include "lmptype.h" #include "update.h" #include "modify.h" #include "compute.h" @@ -506,7 +507,7 @@ void FixAveTime::end_of_step() { // skip if not step which requires doing something - int ntimestep = update->ntimestep; + bigint ntimestep = update->ntimestep; if (ntimestep != nvalid) return; if (mode == SCALAR) invoke_scalar(ntimestep); @@ -515,7 +516,7 @@ void FixAveTime::end_of_step() /* ---------------------------------------------------------------------- */ -void FixAveTime::invoke_scalar(int ntimestep) +void FixAveTime::invoke_scalar(bigint ntimestep) { int i,m; double scalar; @@ -629,7 +630,7 @@ void FixAveTime::invoke_scalar(int ntimestep) // output result to file if (fp && me == 0) { - fprintf(fp,"%d",ntimestep); + fprintf(fp,BIGINT_FORMAT,ntimestep); for (i = 0; i < nvalues; i++) fprintf(fp," %g",vector_total[i]/norm); fprintf(fp,"\n"); fflush(fp); @@ -638,7 +639,7 @@ void FixAveTime::invoke_scalar(int ntimestep) /* ---------------------------------------------------------------------- */ -void FixAveTime::invoke_vector(int ntimestep) +void FixAveTime::invoke_vector(bigint ntimestep) { int i,j,m; @@ -769,7 +770,9 @@ void FixAveTime::invoke_vector(int ntimestep) // output result to file if (fp && me == 0) { - fprintf(fp,"%d %d\n",ntimestep,nrows); + char fstr[16]; + sprintf(fstr,"%s %%d\n",BIGINT_FORMAT); + fprintf(fp,fstr,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); @@ -920,9 +923,9 @@ void FixAveTime::allocate_values(int n) else backup from next multiple of nfreq ------------------------------------------------------------------------- */ -int FixAveTime::nextvalid() +bigint FixAveTime::nextvalid() { - int nvalid = (update->ntimestep/nfreq)*nfreq + nfreq; + bigint nvalid = (update->ntimestep/nfreq)*nfreq + nfreq; if (nvalid-nfreq == update->ntimestep && nrepeat == 1) nvalid = update->ntimestep; else diff --git a/src/fix_ave_time.h b/src/fix_ave_time.h index 286511ea26..a8c118d39f 100644 --- a/src/fix_ave_time.h +++ b/src/fix_ave_time.h @@ -22,6 +22,7 @@ FixStyle(ave/time,FixAveTime) #include "stdio.h" #include "fix.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -39,7 +40,8 @@ class FixAveTime : public Fix { private: int me,nvalues; - int nrepeat,nfreq,nvalid,irepeat; + int nrepeat,nfreq,irepeat; + bigint nvalid; int *which,*argindex,*value2index,*offcol; char **ids; FILE *fp; @@ -59,11 +61,11 @@ class FixAveTime : public Fix { double **array_total; double ***array_list; - void invoke_scalar(int); - void invoke_vector(int); + void invoke_scalar(bigint); + void invoke_vector(bigint); void options(int, char **); void allocate_values(int); - int nextvalid(); + bigint nextvalid(); }; } diff --git a/src/fix_shake.cpp b/src/fix_shake.cpp index 96aecdf77c..cf38f11e4d 100644 --- a/src/fix_shake.cpp +++ b/src/fix_shake.cpp @@ -17,6 +17,7 @@ #include "string.h" #include "stdio.h" #include "fix_shake.h" +#include "lmptype.h" #include "atom.h" #include "atom_vec.h" #include "update.h" @@ -390,7 +391,7 @@ void FixShake::setup(int vflag) // setup SHAKE output - int ntimestep = update->ntimestep; + bigint ntimestep = update->ntimestep; next_output = ntimestep + output_every; if (output_every == 0) next_output = update->laststep + 1; if (output_every && ntimestep % output_every != 0) @@ -453,8 +454,10 @@ 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]; - sprintf(str,"Shake atoms %d %d missing on proc %d at step %d", + char str[128],fstr[64]; + sprintf(fstr,"Shake atoms %%d %%d missing on proc %%d at step %s", + BIGINT_FORMAT); + sprintf(str,fstr, shake_atom[i][0],shake_atom[i][1],me,update->ntimestep); error->one(str); } @@ -464,8 +467,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]; - sprintf(str,"Shake atoms %d %d %d missing on proc %d at step %d", + char str[128],fstr[64]; + sprintf(fstr,"Shake atoms %%d %%d %%d missing on proc %%d at step %s", + BIGINT_FORMAT); + sprintf(str,fstr, shake_atom[i][0],shake_atom[i][1],shake_atom[i][2], me,update->ntimestep); error->one(str); @@ -477,8 +482,11 @@ 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]; - sprintf(str,"Shake atoms %d %d %d %d missing on proc %d at step %d", + 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, shake_atom[i][0],shake_atom[i][1], shake_atom[i][2],shake_atom[i][3], me,update->ntimestep); @@ -2139,9 +2147,10 @@ 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,"SHAKE stats (type/ave/delta) on step %d\n", - update->ntimestep); + fprintf(screen,fstr,update->ntimestep); for (i = 1; i < nb; i++) if (b_count_all[i]) fprintf(screen," %d %g %g\n",i, @@ -2152,8 +2161,7 @@ void FixShake::stats() a_ave_all[i]/a_count_all[i],a_max_all[i]-a_min_all[i]); } if (logfile) { - fprintf(logfile,"SHAKE stats (type/ave/delta) on step %d\n", - update->ntimestep); + fprintf(logfile,fstr,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_shake.h b/src/fix_shake.h index ebef049dbb..fc919aaa11 100644 --- a/src/fix_shake.h +++ b/src/fix_shake.h @@ -21,6 +21,7 @@ FixStyle(shake,FixShake) #define LMP_FIX_SHAKE_H #include "fix.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -53,7 +54,7 @@ class FixShake : public Fix { double tolerance; // SHAKE tolerance int max_iter; // max # of SHAKE iterations int output_every; // SHAKE stat output every so often - int next_output; // timestep for next output + bigint next_output; // timestep for next output // settings from input command int *bond_flag,*angle_flag; // bond/angle types to constrain diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index 1dd6bb3831..f976fd18ed 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -21,6 +21,7 @@ #include "stdlib.h" #include "string.h" #include "fix_tmd.h" +#include "lmptype.h" #include "atom.h" #include "update.h" #include "modify.h" @@ -284,8 +285,9 @@ void FixTMD::initial_integrate(int vflag) work_lambda += lambda*(rho_target - rho_old); if (!(update->ntimestep % nfileevery) && (previous_stat != update->ntimestep)) { - fprintf(fp,"%d %g %g %g %g %g %g %g\n", - update->ntimestep,rho_target,rho_old, + 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, gamma_back,gamma_forward,lambda,work_lambda,work_analytical); fflush(fp); previous_stat = update->ntimestep; diff --git a/src/fix_tmd.h b/src/fix_tmd.h index 785bae60ca..ee4a723d89 100644 --- a/src/fix_tmd.h +++ b/src/fix_tmd.h @@ -43,7 +43,8 @@ class FixTMD : public Fix { private: int me; - int nfileevery,previous_stat,compressed; + int nfileevery,compressed; + bigint previous_stat; FILE *fp; double rho_start,rho_stop,rho_old,masstotal; double dtv,dtf; diff --git a/src/fix_ttm.cpp b/src/fix_ttm.cpp index 0cc1a191f5..4edfba1bba 100644 --- a/src/fix_ttm.cpp +++ b/src/fix_ttm.cpp @@ -21,6 +21,7 @@ #include "string.h" #include "stdlib.h" #include "fix_ttm.h" +#include "lmptype.h" #include "atom.h" #include "force.h" #include "update.h" @@ -525,7 +526,7 @@ void FixTTM::end_of_step() total_nnodes,MPI_DOUBLE,MPI_SUM,world); if (me == 0) { - fprintf(fp,"%d ",update->ntimestep); + fprintf(fp,BIGINT_FORMAT,update->ntimestep); double T_a; for (int ixnode = 0; ixnode < nxnodes; ixnode++) @@ -535,7 +536,7 @@ void FixTTM::end_of_step() if (nsum_all[ixnode][iynode][iznode] > 0) T_a = sum_mass_vsq_all[ixnode][iynode][iznode]/ (3.0*force->boltz*nsum_all[ixnode][iynode][iznode]/force->mvv2e); - fprintf(fp,"%f ",T_a); + fprintf(fp," %f",T_a); } fprintf(fp,"\t"); diff --git a/src/integrate.cpp b/src/integrate.cpp index ca5297b59c..5b7d8df198 100644 --- a/src/integrate.cpp +++ b/src/integrate.cpp @@ -13,6 +13,7 @@ #include "stdlib.h" #include "integrate.h" +#include "lmptype.h" #include "update.h" #include "modify.h" #include "compute.h" @@ -93,7 +94,7 @@ void Integrate::ev_setup() vflag = 5 or 6 = both global and per-atom virial ------------------------------------------------------------------------- */ -void Integrate::ev_set(int ntimestep) +void Integrate::ev_set(bigint ntimestep) { int i,flag; diff --git a/src/integrate.h b/src/integrate.h index 8c7d948b37..bcbc711921 100644 --- a/src/integrate.h +++ b/src/integrate.h @@ -15,6 +15,7 @@ #define LMP_INTEGRATE_H #include "pointers.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -42,7 +43,7 @@ class Integrate : protected Pointers { class Compute **vlist_atom; void ev_setup(); - void ev_set(int); + void ev_set(bigint); }; } diff --git a/src/lmptype.h b/src/lmptype.h index 5c5285be8a..8cfb2be4d6 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -61,6 +61,9 @@ typedef int64_t bigint; #define TAGINT_FORMAT_NL "%d\n" #define BIGINT_FORMAT_NL "%lld\n" +#define ATOTAGINT atoi +#define ATOBIGINT atoll + // for molecular problems that exceed 2 billion (2^31) atoms // 32-bit smallint, 64-bit tagint and bigint // NOTE: 64-bit tagint is not yet supported @@ -81,6 +84,9 @@ typedef int64_t bigint; #define BIGINT_FORMAT "%lld" #define TAGINT_FORMAT_NL "%lld\n" #define BIGINT_FORMAT_NL "%lld\n" + +#define ATOTAGINT atoll +#define ATOBIGINT atoll */ // for machines that do not support 64-bit ints @@ -102,6 +108,9 @@ typedef int bigint; #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/min.cpp b/src/min.cpp index a1e0a5bbff..255bdfb605 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -23,6 +23,7 @@ #include "stdlib.h" #include "string.h" #include "min.h" +#include "lmptype.h" #include "atom.h" #include "domain.h" #include "comm.h" @@ -648,7 +649,7 @@ void Min::ev_setup() vflag = 5 or 6 = both global and per-atom virial ------------------------------------------------------------------------- */ -void Min::ev_set(int ntimestep) +void Min::ev_set(bigint ntimestep) { int i,flag; diff --git a/src/min.h b/src/min.h index f4626514e8..7b09903332 100644 --- a/src/min.h +++ b/src/min.h @@ -98,7 +98,7 @@ class Min : protected Pointers { double compute_force_norm_inf(); void ev_setup(); - void ev_set(int); + void ev_set(bigint); char *stopstrings(int); }; diff --git a/src/min_fire.cpp b/src/min_fire.cpp index 135e517427..0c4e73dc26 100644 --- a/src/min_fire.cpp +++ b/src/min_fire.cpp @@ -81,15 +81,16 @@ void MinFire::reset_vectors() int MinFire::iterate(int maxiter) { - int ntimestep,flag,flagall; + bigint ntimestep; double vmax,vdotf,vdotfall,vdotv,vdotvall,fdotf,fdotfall; double scale1,scale2; double dtvone,dtv,dtfm; + int flag,flagall; alpha_final = 0.0; double alpha = ALPHA0; double dtmax = TMAX * dt; - int last_negative = update->ntimestep; + bigint last_negative = update->ntimestep; for (int iter = 0; iter < maxiter; iter++) { ntimestep = ++update->ntimestep; diff --git a/src/min_quickmin.cpp b/src/min_quickmin.cpp index 89a3403d4e..6fb15b175c 100644 --- a/src/min_quickmin.cpp +++ b/src/min_quickmin.cpp @@ -14,6 +14,7 @@ #include "mpi.h" #include "math.h" #include "min_quickmin.h" +#include "lmptype.h" #include "universe.h" #include "atom.h" #include "force.h" @@ -79,12 +80,13 @@ void MinQuickMin::reset_vectors() int MinQuickMin::iterate(int maxiter) { - int ntimestep,flag,flagall; + bigint ntimestep; double vmax,vdotf,vdotfall,fdotf,fdotfall,scale; double dtvone,dtv,dtfm; + int flag,flagall; alpha_final = 0.0; - int last_negative = update->ntimestep; + bigint last_negative = update->ntimestep; for (int iter = 0; iter < maxiter; iter++) { ntimestep = ++update->ntimestep; diff --git a/src/modify.cpp b/src/modify.cpp index f70ee43a37..99cb49cf17 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -831,7 +831,7 @@ void Modify::clearstep_compute() called everywhere that computes are used, after computes are invoked ------------------------------------------------------------------------- */ -void Modify::addstep_compute(int newstep) +void Modify::addstep_compute(bigint newstep) { for (int icompute = 0; icompute < n_timeflag; icompute++) if (compute[list_timeflag[icompute]]->invoked_flag) @@ -845,7 +845,7 @@ void Modify::addstep_compute(int newstep) do not loop only over n_timeflag, since may not be set yet ------------------------------------------------------------------------- */ -void Modify::addstep_compute_all(int newstep) +void Modify::addstep_compute_all(bigint newstep) { for (int icompute = 0; icompute < ncompute; icompute++) if (compute[icompute]->timeflag) compute[icompute]->addstep(newstep); diff --git a/src/modify.h b/src/modify.h index 0601e1b854..f211167a11 100644 --- a/src/modify.h +++ b/src/modify.h @@ -16,6 +16,7 @@ #include "stdio.h" #include "pointers.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -88,8 +89,8 @@ class Modify : protected Pointers { void delete_compute(char *); int find_compute(char *); void clearstep_compute(); - void addstep_compute(int); - void addstep_compute_all(int); + void addstep_compute(bigint); + void addstep_compute_all(bigint); void write_restart(FILE *); int read_restart(FILE *); diff --git a/src/neigh_bond.cpp b/src/neigh_bond.cpp index 57245abd36..6383dae8fd 100644 --- a/src/neigh_bond.cpp +++ b/src/neigh_bond.cpp @@ -12,6 +12,7 @@ ------------------------------------------------------------------------- */ #include "neighbor.h" +#include "lmptype.h" #include "atom.h" #include "force.h" #include "update.h" @@ -41,9 +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]; - sprintf(str,"Bond atoms %d %d missing on proc %d at step %d", - tag[i],bond_atom[i][m],me,update->ntimestep); + 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); error->one(str); } if (newton_bond || i < atom1) { @@ -80,9 +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]; - sprintf(str,"Bond atoms %d %d missing on proc %d at step %d", - tag[i],bond_atom[i][m],me,update->ntimestep); + 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); error->one(str); } if (newton_bond || i < atom1) { @@ -121,8 +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]; - sprintf(str,"Angle atoms %d %d %d missing on proc %d at step %d", + char str[128],fstr[64]; + sprintf(fstr,"Angle atoms %%d %%d %%d missing on proc %%d at step %s", + BIGINT_FORMAT); + sprintf(str,fstr, angle_atom1[i][m],angle_atom2[i][m],angle_atom3[i][m], me,update->ntimestep); error->one(str); @@ -165,8 +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]; - sprintf(str,"Angle atoms %d %d %d missing on proc %d at step %d", + char str[128],fstr[64]; + sprintf(fstr,"Angle atoms %%d %%d %%d missing on proc %%d at step %s", + BIGINT_FORMAT); + sprintf(str,fstr, angle_atom1[i][m],angle_atom2[i][m],angle_atom3[i][m], me,update->ntimestep); error->one(str); @@ -210,8 +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]; - sprintf(str,"Dihedral atoms %d %d %d %d missing on proc %d at step %d", + 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, dihedral_atom1[i][m],dihedral_atom2[i][m], dihedral_atom3[i][m],dihedral_atom4[i][m], me,update->ntimestep); @@ -260,8 +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]; - sprintf(str,"Dihedral atoms %d %d %d %d missing on proc %d at step %d", + 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, dihedral_atom1[i][m],dihedral_atom2[i][m], dihedral_atom3[i][m],dihedral_atom4[i][m], me,update->ntimestep); @@ -309,8 +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]; - sprintf(str,"Improper atoms %d %d %d %d missing on proc %d at step %d", + 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, improper_atom1[i][m],improper_atom2[i][m], improper_atom3[i][m],improper_atom4[i][m], me,update->ntimestep); @@ -359,8 +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]; - sprintf(str,"Improper atoms %d %d %d %d missing on proc %d at step %d", + 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, 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 720c020603..a9b7018487 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -148,7 +148,7 @@ void Output::init() void Output::setup(int flag) { - int ntimestep = update->ntimestep; + bigint ntimestep = update->ntimestep; // perform dump at start of run if current timestep is multiple of every // and last dump was not on this timestep @@ -239,7 +239,7 @@ void Output::setup(int flag) do dump/restart before thermo so thermo CPU time will include them ------------------------------------------------------------------------- */ -void Output::write(int ntimestep) +void Output::write(bigint ntimestep) { // next_dump does not force output on last step of run // wrap dumps that invoke computes with clear/add @@ -273,7 +273,9 @@ void Output::write(int ntimestep) char *file = new char[strlen(restart1) + 16]; char *ptr = strchr(restart1,'*'); *ptr = '\0'; - sprintf(file,"%s%d%s",restart1,ntimestep,ptr+1); + char fstr[16]; + sprintf(fstr,"%%s%s%%s",BIGINT_FORMAT); + sprintf(file,fstr,restart1,ntimestep,ptr+1); *ptr = '*'; restart->write(file); delete [] file; @@ -316,7 +318,7 @@ void Output::write(int ntimestep) force a snapshot to be written for all dumps ------------------------------------------------------------------------- */ -void Output::write_dump(int ntimestep) +void Output::write_dump(bigint ntimestep) { for (int idump = 0; idump < ndump; idump++) { dump[idump]->write(); @@ -328,13 +330,15 @@ void Output::write_dump(int ntimestep) force a restart file to be written ------------------------------------------------------------------------- */ -void Output::write_restart(int ntimestep) +void Output::write_restart(bigint ntimestep) { if (restart_toggle == 0) { char *file = new char[strlen(restart1) + 16]; char *ptr = strchr(restart1,'*'); *ptr = '\0'; - sprintf(file,"%s%d%s",restart1,ntimestep,ptr+1); + char fstr[16]; + sprintf(fstr,"%%s%s%%s",BIGINT_FORMAT); + sprintf(file,fstr,restart1,ntimestep,ptr+1); *ptr = '*'; restart->write(file); delete [] file; @@ -373,10 +377,10 @@ void Output::add_dump(int narg, char **arg) memory->srealloc(dump,max_dump*sizeof(Dump *),"output:dump"); every_dump = (int *) memory->srealloc(every_dump,max_dump*sizeof(int),"output:every_dump"); - next_dump = (int *) - memory->srealloc(next_dump,max_dump*sizeof(int),"output:next_dump"); - last_dump = (int *) - memory->srealloc(last_dump,max_dump*sizeof(int),"output:last_dump"); + next_dump = (bigint *) + memory->srealloc(next_dump,max_dump*sizeof(bigint),"output:next_dump"); + last_dump = (bigint *) + memory->srealloc(last_dump,max_dump*sizeof(bigint),"output:last_dump"); var_dump = (char **) memory->srealloc(var_dump,max_dump*sizeof(char *),"output:var_dump"); ivar_dump = (int *) diff --git a/src/output.h b/src/output.h index 12668c2cfc..9e0c72acbc 100644 --- a/src/output.h +++ b/src/output.h @@ -15,33 +15,34 @@ #define LMP_OUTPUT_H #include "pointers.h" +#include "lmptype.h" namespace LAMMPS_NS { class Output : protected Pointers { public: - int next; // next timestep for any kind of output + bigint next; // next timestep for any kind of output - int next_thermo; // next timestep for thermo output + bigint next_thermo; // next timestep for thermo output int thermo_every; // thermo output every this many steps - int last_thermo; // last timestep thermo was output + bigint last_thermo; // last timestep thermo was output char *var_thermo; // variable name for thermo frequency int ivar_thermo; // variable index for thermo frequency class Thermo *thermo; // Thermodynamic computations int ndump; // # of Dumps defined int max_dump; // max size of Dump list - int next_dump_any; // next timestep for any Dump + bigint next_dump_any; // next timestep for any Dump int *every_dump; // output of each Dump every this many steps - int *next_dump; // next timestep to do each Dump - int *last_dump; // last timestep each a snapshot was output + bigint *next_dump; // next timestep to do each Dump + bigint *last_dump; // last timestep each snapshot was output char **var_dump; // variable name for dump frequency int *ivar_dump; // variable index for dump frequency class Dump **dump; // list of defined Dumps - int next_restart; // next timestep to write a restart file + bigint next_restart; // next timestep to write a restart file int restart_every; // write a restart file every this many steps - int last_restart; // last timestep a restart file was output + bigint last_restart; // last timestep a restart file was output int restart_toggle; // 0 if use restart1 as prefix // 1 if use restart1 as file, 2 for restart2 char *restart1,*restart2; // names for restart files @@ -51,9 +52,9 @@ class Output : protected Pointers { ~Output(); void init(); void setup(int); // initial output before run/min - void write(int); // output for current timestep - void write_dump(int); // force output of dump snapshots - void write_restart(int); // force output of a restart file + void write(bigint); // output for current timestep + void write_dump(bigint); // force output of dump snapshots + void write_restart(bigint); // force output of a restart file void add_dump(int, char **); // add a Dump to Dump list void modify_dump(int, char **); // modify a Dump diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 448763bcd2..15ddcf72ec 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -493,9 +493,7 @@ void ReadRestart::header() delete [] style; } else if (flag == NTIMESTEP) { - // placeholder until ntimestep is 8-bytes - bigint ntimestep = read_bigint(); - update->ntimestep = static_cast (ntimestep); + update->ntimestep = read_bigint(); // set dimension from restart file diff --git a/src/region.h b/src/region.h index f269958b94..c4a1e18a75 100644 --- a/src/region.h +++ b/src/region.h @@ -15,6 +15,7 @@ #define LMP_REGION_H #include "pointers.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -60,7 +61,7 @@ class Region : protected Pointers { char *xstr,*ystr,*zstr,*tstr; int xvar,yvar,zvar,tvar; double dx,dy,dz,theta; - int laststep; + bigint laststep; void forward_transform(double &, double &, double &); void inverse_transform(double &, double &, double &); diff --git a/src/respa.cpp b/src/respa.cpp index 209c7dd163..cb3425b135 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -445,7 +445,7 @@ void Respa::setup_minimal(int flag) void Respa::run(int n) { - int ntimestep; + bigint ntimestep; for (int i = 0; i < n; i++) { diff --git a/src/thermo.cpp b/src/thermo.cpp index a9c846d7f4..b3d6cece7f 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -133,19 +133,18 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // format strings - format_multi = (char *) "---------------- Step %8d ----- " - "CPU = %11.4f (sec) ----------------"; + char *bigint_format = BIGINT_FORMAT; + char *fformat_multi = (char *) "---------------- Step %%8%s ----- " + "CPU = %%11.4f (sec) ----------------"; + + sprintf(format_multi,fformat_multi,&bigint_format[1]); format_float_one_def = (char *) "%12.8g"; format_float_multi_def = (char *) "%14.4f"; format_int_one_def = (char *) "%8d"; format_int_multi_def = (char *) "%14d"; - if (sizeof(bigint) == 8) { - format_bigint_one_def = (char *) "%8ld"; - format_bigint_multi_def = (char *) "%14ld"; - } else if (sizeof(bigint) == 4) { - format_bigint_one_def = (char *) "%8d"; - format_bigint_multi_def = (char *) "%14d"; - } + sprintf(format_bigint_one_def,"%%8%s",&bigint_format[1]); + sprintf(format_bigint_multi_def,"%%14%s",&bigint_format[1]); + format_float_user = NULL; format_int_user = NULL; format_bigint_user = NULL; @@ -281,7 +280,7 @@ void Thermo::compute(int flag) int i; firststep = flag; - int ntimestep = update->ntimestep; + bigint ntimestep = update->ntimestep; // check for lost atoms // turn off normflag if natoms = 0 to avoid divide by 0 @@ -629,11 +628,11 @@ void Thermo::parse_fields(char *str) while (word) { if (strcmp(word,"step") == 0) { - addfield("Step",&Thermo::compute_step,INT); + addfield("Step",&Thermo::compute_step,BIGINT); } else if (strcmp(word,"elapsed") == 0) { - addfield("Elapsed",&Thermo::compute_elapsed,INT); + addfield("Elapsed",&Thermo::compute_elapsed,BIGINT); } else if (strcmp(word,"elaplong") == 0) { - addfield("Elaplong",&Thermo::compute_elapsed_long,INT); + addfield("Elaplong",&Thermo::compute_elapsed_long,BIGINT); } else if (strcmp(word,"dt") == 0) { addfield("Dt",&Thermo::compute_dt,FLOAT); } else if (strcmp(word,"cpu") == 0) { @@ -942,7 +941,6 @@ int Thermo::evaluate_keyword(char *word, double *answer) if (strcmp(word,"step") == 0) { compute_step(); - dvalue = ivalue; } else if (strcmp(word,"elapsed") == 0) { if (update->whichflag == 0) @@ -1356,27 +1354,27 @@ void Thermo::compute_variable() one method for every keyword thermo can output called by compute() or evaluate_keyword() compute will have already been called - set ivalue/dvalue if value is integer/double + set ivalue/dvalue/bivalue if value is int/double/bigint customize a new keyword by adding a method ------------------------------------------------------------------------- */ void Thermo::compute_step() { - ivalue = update->ntimestep; + bivalue = update->ntimestep; } /* ---------------------------------------------------------------------- */ void Thermo::compute_elapsed() { - ivalue = update->ntimestep - update->firststep; + bivalue = update->ntimestep - update->firststep; } /* ---------------------------------------------------------------------- */ void Thermo::compute_elapsed_long() { - ivalue = update->ntimestep - update->beginstep; + bivalue = update->ntimestep - update->beginstep; } /* ---------------------------------------------------------------------- */ diff --git a/src/thermo.h b/src/thermo.h index d1f8b1149b..8b954ebb89 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -46,11 +46,11 @@ class Thermo : protected Pointers { int *vtype; char **format,**format_user; - char *format_multi; char *format_float_one_def,*format_float_multi_def; char *format_int_one_def,*format_int_multi_def; - char *format_bigint_one_def,*format_bigint_multi_def; char *format_float_user,*format_int_user,*format_bigint_user; + char format_multi[128]; + char format_bigint_one_def[8],format_bigint_multi_def[8]; int normvalue; // use this for normflag unless natoms = 0 int normuserflag; // 0 if user has not set, 1 if has @@ -62,7 +62,7 @@ class Thermo : protected Pointers { double last_tpcpu,last_spcpu; double last_time; - int last_step; + bigint last_step; bigint natoms; diff --git a/src/update.cpp b/src/update.cpp index 82b9cf8864..a5a79bdb4a 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -278,8 +278,9 @@ void Update::reset_timestep(int narg, char **arg) for (int i = 0; i < modify->ncompute; i++) if (modify->compute[i]->timeflag) modify->compute[i]->clearstep(); - ntimestep = atoi(arg[0]); + ntimestep = ATOBIGINT(arg[0]); if (ntimestep < 0) error->all("Timestep must be >= 0"); + if (ntimestep > MAXBIGINT) error->all("Too big a timestep"); } /* ---------------------------------------------------------------------- diff --git a/src/update.h b/src/update.h index 43b7eb0ea8..75edc7e2fe 100644 --- a/src/update.h +++ b/src/update.h @@ -15,6 +15,7 @@ #define LMP_UPDATE_H #include "pointers.h" +#include "lmptype.h" namespace LAMMPS_NS { @@ -22,19 +23,19 @@ class Update : protected Pointers { public: double dt; // timestep double etol,ftol; // minimizer tolerances on energy/force - int ntimestep; // current step (dynamics or min iterations) + bigint ntimestep; // current step (dynamics or min iterations) int nsteps; // # of steps to run (dynamics or min iter) int whichflag; // 0 for unset, 1 for dynamics, 2 for min - int firststep,laststep; // 1st & last step of this run - int beginstep,endstep; // 1st and last step of multiple runs + bigint firststep,laststep; // 1st & last step of this run + bigint beginstep,endstep; // 1st and last step of multiple runs int first_update; // 0 before initial update, 1 after int max_eval; // max force evaluations for minimizer int restrict_output; // 1 if output should not write dump/restart int setupflag; // set when setup() is computing forces int multireplica; // 1 if min across replicas, else 0 - int eflag_global,eflag_atom; // timestep global/peratom eng is tallied on - int vflag_global,vflag_atom; // ditto for virial + bigint eflag_global,eflag_atom; // timestep global/peratom eng is tallied on + bigint vflag_global,vflag_atom; // ditto for virial char *unit_style; diff --git a/src/verlet.cpp b/src/verlet.cpp index c7a6180d64..0546e55576 100644 --- a/src/verlet.cpp +++ b/src/verlet.cpp @@ -188,7 +188,8 @@ void Verlet::setup_minimal(int flag) void Verlet::run(int n) { - int nflag,ntimestep,sortflag; + bigint ntimestep; + int nflag,sortflag; int n_post_integrate = modify->n_post_integrate; int n_pre_exchange = modify->n_pre_exchange; diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 23df7fa261..6fdb24998d 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -86,7 +86,9 @@ void WriteRestart::command(int narg, char **arg) if (ptr = strchr(arg[0],'*')) { *ptr = '\0'; - sprintf(file,"%s%d%s",arg[0],update->ntimestep,ptr+1); + char fstr[16]; + sprintf(fstr,"%%s%s%%s",BIGINT_FORMAT); + sprintf(file,fstr,arg[0],update->ntimestep,ptr+1); } else strcpy(file,arg[0]); // init entire system since comm->exchange is done @@ -300,9 +302,7 @@ void WriteRestart::header() write_int(TAGINT,sizeof(tagint)); write_int(BIGINT,sizeof(bigint)); write_char(UNITS,update->unit_style); - // placeholder until ntimestep is 8-byte - bigint ntimestep = update->ntimestep; - write_bigint(NTIMESTEP,ntimestep); + write_bigint(NTIMESTEP,update->ntimestep); write_int(DIMENSION,domain->dimension); write_int(NPROCS,nprocs); write_int(PROCGRID_0,comm->procgrid[0]);