From 6e225d90fc2926170176821e5ef1b8144bd38e3f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer <akohlmey@gmail.com> Date: Thu, 15 Nov 2018 16:48:38 -0500 Subject: [PATCH] fix some minor bugs write data file writing and remove dead code and silence compiler warnings --- src/USER-COLVARS/group_ndx.cpp | 4 ++-- src/USER-DPD/fix_rx.cpp | 6 ++++-- src/USER-MISC/compute_stress_mop_profile.cpp | 3 +-- src/USER-MOFFF/angle_class2_p6.cpp | 2 +- src/USER-MOFFF/angle_cosine_buck6d.cpp | 2 +- src/USER-MOFFF/improper_inversion_harmonic.cpp | 5 +++-- src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp | 2 +- src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/USER-COLVARS/group_ndx.cpp b/src/USER-COLVARS/group_ndx.cpp index 450c250ffa..858336c9d5 100644 --- a/src/USER-COLVARS/group_ndx.cpp +++ b/src/USER-COLVARS/group_ndx.cpp @@ -50,7 +50,7 @@ static int cmptagint(const void *p1, const void *p2) static void write_group(FILE *fp, int gid, Atom *atom, Group *group, int me, int np, MPI_Comm world, FILE *screen, FILE *logfile) { - char fmt[8]; + char fmt[16]; tagint *sendlist, *recvlist; bigint num = group->count(gid); int lnum, cols; @@ -73,7 +73,7 @@ static void write_group(FILE *fp, int gid, Atom *atom, Group *group, int me, ++i; j /= 10; } - sprintf(fmt,"%%%dd ", i); + snprintf(fmt,16,"%%%dd ", i); cols = 80 / (i+1); } diff --git a/src/USER-DPD/fix_rx.cpp b/src/USER-DPD/fix_rx.cpp index 97668471c8..cb8349786f 100644 --- a/src/USER-DPD/fix_rx.cpp +++ b/src/USER-DPD/fix_rx.cpp @@ -758,8 +758,10 @@ void FixRX::pre_force(int /*vflag*/) memory->create( diagnosticCounterPerODE[FuncSum], nlocal, "FixRX::diagnosticCounterPerODE"); } - //#pragma omp parallel \ - // reduction(+: nSteps, nIters, nFuncs, nFails ) +#if 0 + #pragma omp parallel \ + reduction(+: nSteps, nIters, nFuncs, nFails ) +#endif { double *rwork = new double[8*nspecies]; diff --git a/src/USER-MISC/compute_stress_mop_profile.cpp b/src/USER-MISC/compute_stress_mop_profile.cpp index 9189318381..76bf487630 100644 --- a/src/USER-MISC/compute_stress_mop_profile.cpp +++ b/src/USER-MISC/compute_stress_mop_profile.cpp @@ -451,10 +451,9 @@ void ComputeStressMopProfile::setup_bins() int i,n; double lo = 0.0, hi = 0.0; - double *boxlo,*boxhi,*prd; + double *boxlo,*boxhi; boxlo = domain->boxlo; boxhi = domain->boxhi; - prd = domain->prd; if (originflag == LOWER) origin = boxlo[dir]; else if (originflag == UPPER) origin = boxhi[dir]; diff --git a/src/USER-MOFFF/angle_class2_p6.cpp b/src/USER-MOFFF/angle_class2_p6.cpp index c821c9d883..d2a6e21e6b 100644 --- a/src/USER-MOFFF/angle_class2_p6.cpp +++ b/src/USER-MOFFF/angle_class2_p6.cpp @@ -429,7 +429,7 @@ void AngleClass2P6::read_restart(FILE *fp) void AngleClass2P6::write_data(FILE *fp) { for (int i = 1; i <= atom->nangletypes; i++) - fprintf(fp,"%d %g %g %g %g\n", + fprintf(fp,"%d %g %g %g %g %g %g\n", i,theta0[i]/MY_PI*180.0,k2[i],k3[i],k4[i],k5[i],k6[i]); fprintf(fp,"\nBondBond Coeffs\n\n"); diff --git a/src/USER-MOFFF/angle_cosine_buck6d.cpp b/src/USER-MOFFF/angle_cosine_buck6d.cpp index 3f87aeb757..f358097802 100644 --- a/src/USER-MOFFF/angle_cosine_buck6d.cpp +++ b/src/USER-MOFFF/angle_cosine_buck6d.cpp @@ -353,7 +353,7 @@ void AngleCosineBuck6d::read_restart(FILE *fp) void AngleCosineBuck6d::write_data(FILE *fp) { for (int i = 1; i <= atom->nangletypes; i++) { - fprintf(fp,"%d %g %d %d\n",i,k[i],multiplicity[i],th0[i]); + fprintf(fp,"%d %g %d %g\n",i,k[i],multiplicity[i],th0[i]); } } diff --git a/src/USER-MOFFF/improper_inversion_harmonic.cpp b/src/USER-MOFFF/improper_inversion_harmonic.cpp index 9608d58054..8404984b53 100644 --- a/src/USER-MOFFF/improper_inversion_harmonic.cpp +++ b/src/USER-MOFFF/improper_inversion_harmonic.cpp @@ -241,8 +241,8 @@ void ImproperInversionHarmonic::invang(const int &i1,const int &i2, f[i4][2] += f4[2]; } - double rb3x, rb3y, rb3z; - if (evflag) + if (evflag) { + double rb3x, rb3y, rb3z; rb3x = vb1x - vb2x; rb3y = vb1y - vb2y; @@ -252,6 +252,7 @@ void ImproperInversionHarmonic::invang(const int &i1,const int &i2, vb3x,vb3y,vb3z, vb2x,vb2y,vb2z, rb3x,rb3y,rb3z); + } } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp index f434d03858..46af95470c 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp @@ -83,7 +83,7 @@ void PairBuck6dCoulGaussDSF::compute(int eflag, int vflag) double r,rsq,r2inv,r6inv,r14inv,rexp,forcecoul,forcebuck6d,factor_coul,factor_lj; double term1,term2,term3,term4,term5; double rcu,rqu,sme,smf,ebuck6d; - double prefactor,erfcc,erfcd,t,arg; + double prefactor,erfcc,erfcd,arg; int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp index 9902896d18..3c54d64770 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp @@ -85,7 +85,7 @@ void PairBuck6dCoulGaussLong::compute(int eflag, int vflag) double grij,expm2,erf; double term1,term2,term3,term4,term5; double rcu,rqu,sme,smf,ebuck6d,ealpha; - double prefactor,erfa,expa,t,arg,falpha; + double prefactor,erfa,expa,arg,falpha; int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; -- GitLab