diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index e3adb6c268..20e60bab26 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -105,6 +105,7 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) // print summary of settings if (comm->me == 0) { +#if defined(_OPENMP) const char * const nmode = _neighbor ? "multi-threaded" : "serial"; if (screen) { @@ -118,6 +119,10 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) fprintf(logfile,"set %d OpenMP thread(s) per MPI task\n", nthreads); fprintf(logfile,"using %s neighbor list subroutines\n", nmode); } +#else + error->warning(FLERR,"OpenMP support not enabled during compilation; " + "using 1 thread only."); +#endif } // allocate list for per thread accumulator manager class instances diff --git a/src/comm.cpp b/src/comm.cpp index f29d1bf7df..070fd8575a 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -87,7 +87,8 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp) } else if (getenv("OMP_NUM_THREADS") == NULL) { nthreads = 1; if (me == 0) - error->warning(FLERR,"OMP_NUM_THREADS environment is not set."); + error->warning(FLERR,"OMP_NUM_THREADS environment is not set. " + "Defaulting to 1 thread."); } else { nthreads = omp_get_max_threads(); } diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index 9c3bb35e96..3640b11269 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -273,7 +273,7 @@ void ComputeCentroAtom::compute_peratom() double rsq = delx*delx + dely*dely + delz*delz; pairs[n++] = rsq; - if (rsq < rsq2) + if (rsq < rsq2) { if (rsq < rsq1) { rsq2 = rsq1; MathExtra::copy3(r1, r2); @@ -283,6 +283,7 @@ void ComputeCentroAtom::compute_peratom() rsq2 = rsq; MathExtra::sub3(x[jj],x[kk],r2); } + } } } diff --git a/src/info.cpp b/src/info.cpp index ead5a68a75..a791becf0e 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -264,7 +264,8 @@ void Info::command(int narg, char **arg) } fprintf(out,"Nprocs = %d, Nthreads = %d\n", comm->nprocs, comm->nthreads); - fprintf(out,"Processor grid = %d x %d x %d\n",comm->procgrid[0], + if (domain->box_exist) + fprintf(out,"Processor grid = %d x %d x %d\n",comm->procgrid[0], comm->procgrid[1], comm->procgrid[2]); } diff --git a/src/pair_dpd.cpp b/src/pair_dpd.cpp index 9dc16cab4b..99166918c7 100644 --- a/src/pair_dpd.cpp +++ b/src/pair_dpd.cpp @@ -164,12 +164,13 @@ void PairDPD::compute(int eflag, int vflag) void PairDPD::allocate() { + int i,j; allocated = 1; int n = atom->ntypes; memory->create(setflag,n+1,n+1,"pair:setflag"); - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) + for (i = 1; i <= n; i++) + for (j = i; j <= n; j++) setflag[i][j] = 0; memory->create(cutsq,n+1,n+1,"pair:cutsq"); @@ -178,6 +179,9 @@ void PairDPD::allocate() memory->create(a0,n+1,n+1,"pair:a0"); memory->create(gamma,n+1,n+1,"pair:gamma"); memory->create(sigma,n+1,n+1,"pair:sigma"); + for (i = 0; i <= atom->ntypes; i++) + for (j = 0; j <= atom->ntypes; j++) + sigma[i][j] = gamma[i][j] = 0.0; } /* ---------------------------------------------------------------------- diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index 9158e0c842..d4d4f99bf3 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; void WriteCoeff::command(int narg, char **arg) { if (domain->box_exist == 0) - error->all(FLERR,"write_coeff command before simulation box is defined"); + error->all(FLERR,"Write_coeff command before simulation box is defined"); if (narg != 1) error->all(FLERR,"Illegal write_coeff command"); @@ -43,6 +43,9 @@ void WriteCoeff::command(int narg, char **arg) strcpy(file,"tmp."); strcat(file,arg[0]); + // initialize relevant styles + force->init(); + if (comm->me == 0) { char str[256], coeff[256]; FILE *one = fopen(file,"wb+"); @@ -52,7 +55,6 @@ void WriteCoeff::command(int narg, char **arg) } if (force->pair && force->pair->writedata) { - force->pair->init(); fprintf(one,"# pair_style %s\npair_coeff\n",force->pair_style); force->pair->write_data_all(one); fprintf(one,"end\n"); @@ -68,12 +70,14 @@ void WriteCoeff::command(int narg, char **arg) fprintf(one,"end\n"); } if (force->dihedral && force->dihedral->writedata) { - fprintf(one,"# dihedral_style %s\ndihedral_coeff\n",force->dihedral_style); + fprintf(one,"# dihedral_style %s\ndihedral_coeff\n", + force->dihedral_style); force->dihedral->write_data(one); fprintf(one,"end\n"); } if (force->improper && force->improper->writedata) { - fprintf(one,"# improper_style %s\nimproper_coeff\n",force->improper_style); + fprintf(one,"# improper_style %s\nimproper_coeff\n", + force->improper_style); force->improper->write_data(one); fprintf(one,"end\n"); }