diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e36d7259a5dc351c7f47744722ee8225d475b8fa..253cee6465852be38810917bf71ea9b01a75ab92 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -304,7 +304,7 @@ pkg_depends(USER-SCAFACOS MPI) find_package(OpenMP QUIET) option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND}) -if(BUILD_OMP OR PKG_USER-OMP OR PKG_KOKKOS OR PKG_USER-INTEL) +if(BUILD_OMP OR PKG_KOKKOS OR PKG_USER-INTEL) find_package(OpenMP REQUIRED) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") diff --git a/doc/github-development-workflow.md b/doc/github-development-workflow.md new file mode 100644 index 0000000000000000000000000000000000000000..31fd3f23f0b3c8c068ead68f33ff78dc6f1b478a --- /dev/null +++ b/doc/github-development-workflow.md @@ -0,0 +1,184 @@ +# Outline of the GitHub Development Workflow + +This purpose of this document is to provide a point of reference for the +core LAMMPS developers and other LAMMPS contibutors to understand the +choices the LAMMPS developers have agreed on. Git and GitHub provide the +tools, but do not set policies, so it is up to the developers to come to +an agreement as to how to define and interpret policies. This document +is likely to change as our experiences and needs change and we try to +adapt accordingly. Last change 2018-11-15. + +## Table of Contents + + * [GitHub Merge Management](#github-merge-management) + * [Pull Requests](#pull-requests) + * [Pull Request Assignments](#pull-request-assignments) + * [Pull Request Reviews](#pull-request-reviews) + * [Pull Request Discussions](#pull-request-discussions) + * [Checklist for Pull Requests](#checklist-for-pull-requests) + * [GitHub Issues](#github-issues) + * [Milestones and Release Planning](#milestones-and-release-planning) + +## GitHub Merge Management + +In the interest of consistency, ONLY ONE of the core LAMMPS developers +should doing the merging itself. This is currently +[@akohlmey](https://github.com/akohlmey) (Axel Kohlmeyer). +If this assignment needs to be changed, it shall be done right after a +stable release. + +## Pull Requests + +ALL changes to the LAMMPS code and documentation, however trivial, MUST +be submitted as a pull request to GitHub. All changes to the "master" +branch must be made exclusively through merging pull requests. The +"unstable" and "stable" branches, respectively are only to be updated +upon patch or stable releases with fast-forward merges based on the +associated tags. Pull requests may also be submitted to (long-running) +feature branches created by LAMMPS developers inside the LAMMPS project, +if needed. Those are not subject to the merge and review restrictions +discussed in this document, though, but get manages as needed on a +case-by-case basis. + +### Pull Request Assignments + +Pull requests can be "chaperoned" by one of the LAMMPS core developers. +This is indicated by who the pull request is assigned to. LAMMPS core +developers can self-assign or they can decide to assign a pull request +to a different LAMMPS developer. Being assigned to a pull request means, +that this pull request may need some work and the assignee is tasked to +determine what this might be needed or not, and may either implement the +required changes or ask the submitter of the pull request to implement +them. Even though, all LAMMPS developers may have write access to pull +requests (if enabled by the submitter, which is the default), only the +submitter or the assignee of a pull request may do so. During this +period the "work_in_progress" label shall be applied to the pull +request. The assignee gets to decide what happens to the pull request +next, e.g. whether it should be assigned to a different developer for +additional checks and changes, or is recommended to be merged. Removing +the "work_in_progress" label and assigning the pull request to the +developer tasked with merging signals that a pull request is ready to be +merged. + +### Pull Request Reviews + +People can be assigned to review a pull request in two ways: + + * They can be assigned manually to review a pull request + by the submitter or a LAMMPS developer + * They can be automatically assigned, because a developers matches + a file pattern in the `.github/CODEOWNERS` file, which associates + developers with the code they contributed and maintain. + +Reviewers are requested to state their appraisal of the proposed changes +and either approve or request changes. People may unassign themselves +from review, if they feel not competent about the changes proposed. At +least one review from a LAMMPS developer with write access is required +before merging in addition to the automated compilation tests. The +feature, that reviews from code owners are "hard" reviews (i.e. they +must all be approved before merging is allowed), is currently disabled +and it is in the discretion of the merge maintainer to assess when +a sufficient degree of approval has been reached. Reviews may be +(automatically) dismissed, when the reviewed code has been changed, +and then approval is required a second time. + +### Pull Request Discussions + +All discussions about a pull request should be kept as much as possible +on the pull request discussion page on GitHub, so that other developers +can later review the entire discussion after the fact and understand the +rationale behind choices made. Exceptions to this policy are technical +discussions, that are centered on tools or policies themselves +(git, github, c++) rather than on the content of the pull request. + +### Checklist for Pull Requests + +Here are some items to check: + * source and text files should not have CR/LF line endings (use dos2unix to remove) + * every new command or style should have documentation. The names of + source files (c++ and manual) should follow the name of the style. + (example: `src/fix_nve.cpp`, `src/fix_nve.h` for `fix nve` command, + implementing the class `FixNVE`, documented in `doc/src/fix_nve.txt`) + * all new style names should be lower case, the must be no dashes, + blanks, or underscores separating words, only forward slashes. + * new style docs should be added to the "overview" files in + `doc/src/Commands_*.txt`, `doc/src/{fixes,computes,pairs,bonds,...}.txt` + and `doc/src/lammps.book` + * new files in packages should be added to `src/.gitignore` + * removed or renamed files in packages should be added to `src/Purge.list` + * C++ source files should use C++ style include files for accessing + C-library APIs, e.g. `#include <cstdlib>` instead of `#include <stdlib.h>`. + And they should use angular brackets instead of double quotes. Full list: + * assert.h -> cassert + * ctype.h -> cctype + * errno.h -> cerrno + * float.h -> cfloat + * limits.h -> climits + * math.h -> cmath + * omplex.h -> complex + * setjmp.h -> csetjmp + * signal.h -> csignal + * stddef.h -> cstddef + * stdint.h -> cstdint + * stdio.h -> cstdio + * stdlib.h -> cstdlib + * string.h -> cstring + * time.h -> ctime + Do not replace (as they are C++-11): `inttypes.h` and `stdint.h`. + * Code should follow the C++-98 standard. C++-11 is only accepted + in individual special purpose packages + * indentation is two spaces per level + * there should be no tabs and no trailing whitespace + * header files, especially of new styles, should not include any + other headers, except the header with the base class or cstdio. + Forward declarations should be used instead when possible. + * iostreams should be avoided. LAMMPS uses stdio from the C-library. + * use of STL in headers and class definitions should be avoided. + * static class members should be avoided at all cost. + * anything storing atom IDs should be using `tagint` and not `int`. + This can be flagged by the compiler only for pointers and only when + compiling LAMMPS with `-DLAMMPS_BIGBIG`. + * when including both `lmptype.h` (and using defines or macros from it) + and `mpi.h`, `lmptype.h` must be included first. + +## GitHub Issues + +The GitHub issue tracker is the location where the LAMMPS developers +and other contributors or LAMMPS users can report issues or bugs with +the LAMMPS code or request new features to be added. Feature requests +are usually indicated by a `[Feature Request]` marker in the subject. +Issues are assigned to a person, if this person is working on this +feature or working to resolve an issue. Issues that have nobody working +on them at the moment, have the label `volunteer needed` attached. + +When an issue, say `#125` is resolved by a specific pull request, +the comment for the pull request shall contain the text `closes #125` +or `fixes #125`, so that the issue is automatically deleted when +the pull request is merged. + +## Milestones and Release Planning + +LAMMPS uses a continuous release development model with incremental +changes, i.e. significant effort is made - including automated pre-merge +testing - that the code in the branch "master" does not get broken. +More extensive testing (including regression testing) is performed after +code is merged to the "master" branch. There are patch releases of +LAMMPS every 1-3 weeks at a point, when the LAMMPS developers feel, that +a sufficient amount of changes have happened, and the post-merge testing +has been successful. These patch releases are marked with a +`patch_<version date>` tag and the "unstable" branch follows only these +versions (and thus is always supposed to be of production quality, +unlike "master", which may be temporary broken, in the case of larger +change sets or unexpected incompatibilities or side effects. + +About 3-4 times each year, there are going to be "stable" releases +of LAMMPS. These have seen additional, manual testing and review of +results from testing with instrumented code and static code analysis. +Also, in the last 2-3 patch releases before a stable release are +"release candidate" versions which only contain bugfixes and +documentation updates. For release planning and the information of +code contributors, issues and pull requests being actively worked on +are assigned a "milestone", which corresponds to the next stable +release or the stable release after that, with a tentative release +date. + diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index 6a176f1083542857951051d2cf6d456991663854..90408177726a33191129fefc791e30f3e60fe1f0 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -107,7 +107,7 @@ void PairBodyRoundedPolygon::compute(int eflag, int vflag) int nei,nej,iefirst,jefirst; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl; double rsq,rsqinv,r,radi,radj,eradi,eradj,rradi,rradj,k_nij,k_naij; - double xi[3],xj[3],facc[3]; + double facc[3]; int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; diff --git a/src/MISC/pair_nm_cut.cpp b/src/MISC/pair_nm_cut.cpp index ce077a7a045f6de8d31eb51d720638357018286d..4b1611b13779bc3f9874583107c59210fdf39c3e 100644 --- a/src/MISC/pair_nm_cut.cpp +++ b/src/MISC/pair_nm_cut.cpp @@ -274,14 +274,6 @@ double PairNMCut::init_one(int i, int j) } MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world); - double rr1 = mm[i][j]*(nn[i][j]-1)*pow(r0[i][j],nn[i][j]); - double rr2 = nn[i][j]*(mm[i][j]-1)*pow(r0[i][j],mm[i][j]); - double p1 = 1-nn[i][j]; - double p2 = 1-mm[i][j]; - - double rrr1 = pow(r0[i][j],nn[i][j])*(1-nn[i][j]); - double rrr2 = pow(r0[i][j],mm[i][j])*(1-mm[i][j]); - double cut3 = cut[i][j]*cut[i][j]*cut[i][j]; ptail_ij = 2.*MY_PI/3.*all[0]*all[1]*e0nm[i][j]*nm[i][j]*cut3 * (pow(r0[i][j]/cut[i][j],nn[i][j])/(nn[i][j]-3) - pow(r0[i][j]/cut[i][j],mm[i][j])/(mm[i][j]-3)); diff --git a/src/MISC/pair_nm_cut_coul_cut.cpp b/src/MISC/pair_nm_cut_coul_cut.cpp index b807bc972bfd9c5ab9e620b2c8e88e763ecd1135..999fab1d6e7065c35b93b4e0ed5292982e787653 100644 --- a/src/MISC/pair_nm_cut_coul_cut.cpp +++ b/src/MISC/pair_nm_cut_coul_cut.cpp @@ -324,14 +324,6 @@ double PairNMCutCoulCut::init_one(int i, int j) } MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world); - double rr1 = mm[i][j]*(nn[i][j]-1)*pow(r0[i][j],nn[i][j]); - double rr2 = nn[i][j]*(mm[i][j]-1)*pow(r0[i][j],mm[i][j]); - double p1 = 1-nn[i][j]; - double p2 = 1-mm[i][j]; - - double rrr1 = pow(r0[i][j],nn[i][j])*(1-nn[i][j]); - double rrr2 = pow(r0[i][j],mm[i][j])*(1-mm[i][j]); - double cut_lj3 = cut_lj[i][j]*cut_lj[i][j]*cut_lj[i][j]; ptail_ij = 2.*MY_PI/3.*all[0]*all[1]*e0nm[i][j]*nm[i][j]*cut_lj3 * (pow(r0[i][j]/cut_lj[i][j],nn[i][j])/(nn[i][j]-3) - pow(r0[i][j]/cut_lj[i][j],mm[i][j])/(mm[i][j]-3)); diff --git a/src/MISC/pair_nm_cut_coul_long.cpp b/src/MISC/pair_nm_cut_coul_long.cpp index 325f3da0033c78dafd85e759112ccd0056dec4d6..fb82436dba8ca6059118d22c6a93c6331abde9e6 100644 --- a/src/MISC/pair_nm_cut_coul_long.cpp +++ b/src/MISC/pair_nm_cut_coul_long.cpp @@ -371,14 +371,6 @@ double PairNMCutCoulLong::init_one(int i, int j) } MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world); - double rr1 = mm[i][j]*(nn[i][j]-1)*pow(r0[i][j],nn[i][j]); - double rr2 = nn[i][j]*(mm[i][j]-1)*pow(r0[i][j],mm[i][j]); - double p1 = 1-nn[i][j]; - double p2 = 1-mm[i][j]; - - double rrr1 = pow(r0[i][j],nn[i][j])*(1-nn[i][j]); - double rrr2 = pow(r0[i][j],mm[i][j])*(1-mm[i][j]); - double cut_lj3 = cut_lj[i][j]*cut_lj[i][j]*cut_lj[i][j]; ptail_ij = 2.*MY_PI/3.*all[0]*all[1]*e0nm[i][j]*nm[i][j]*cut_lj3 * (pow(r0[i][j]/cut_lj[i][j],nn[i][j])/(nn[i][j]-3) - pow(r0[i][j]/cut_lj[i][j],mm[i][j])/(mm[i][j]-3)); diff --git a/src/MOLECULE/atom_vec_molecular.cpp b/src/MOLECULE/atom_vec_molecular.cpp index 6e903a936eb8177db81606880bd23655739f64dc..cdd3f025058f14f2b1bd3b8dc12fc51ba570f502 100644 --- a/src/MOLECULE/atom_vec_molecular.cpp +++ b/src/MOLECULE/atom_vec_molecular.cpp @@ -677,33 +677,33 @@ int AtomVecMolecular::unpack_exchange(double *buf) num_bond[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_bond[nlocal]; k++) { bond_type[nlocal][k] = (int) ubuf(buf[m++]).i; - bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i; + bond_atom[nlocal][k] = (tagint) ubuf(buf[m++]).i; } num_angle[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_angle[nlocal]; k++) { angle_type[nlocal][k] = (int) ubuf(buf[m++]).i; - angle_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; - angle_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; - angle_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i; + angle_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i; + angle_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i; } num_dihedral[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_dihedral[nlocal]; k++) { dihedral_type[nlocal][k] = (int) ubuf(buf[m++]).i; - dihedral_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; - dihedral_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; - dihedral_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; - dihedral_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i; + dihedral_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i; + dihedral_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i; + dihedral_atom4[nlocal][k] = (tagint) ubuf(buf[m++]).i; } num_improper[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_improper[nlocal]; k++) { improper_type[nlocal][k] = (int) ubuf(buf[m++]).i; - improper_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; - improper_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; - improper_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; - improper_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i; + improper_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i; + improper_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i; + improper_atom4[nlocal][k] = (tagint) ubuf(buf[m++]).i; } nspecial[nlocal][0] = (int) ubuf(buf[m++]).i; @@ -840,33 +840,33 @@ int AtomVecMolecular::unpack_restart(double *buf) num_bond[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_bond[nlocal]; k++) { bond_type[nlocal][k] = (int) ubuf(buf[m++]).i; - bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i; + bond_atom[nlocal][k] = (tagint) ubuf(buf[m++]).i; } num_angle[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_angle[nlocal]; k++) { angle_type[nlocal][k] = (int) ubuf(buf[m++]).i; - angle_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; - angle_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; - angle_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i; + angle_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i; + angle_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i; } num_dihedral[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_dihedral[nlocal]; k++) { dihedral_type[nlocal][k] = (int) ubuf(buf[m++]).i; - dihedral_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; - dihedral_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; - dihedral_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; - dihedral_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i; + dihedral_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i; + dihedral_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i; + dihedral_atom4[nlocal][k] = (tagint) ubuf(buf[m++]).i; } num_improper[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_improper[nlocal]; k++) { improper_type[nlocal][k] = (int) ubuf(buf[m++]).i; - improper_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; - improper_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; - improper_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; - improper_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom1[nlocal][k] = (tagint) ubuf(buf[m++]).i; + improper_atom2[nlocal][k] = (tagint) ubuf(buf[m++]).i; + improper_atom3[nlocal][k] = (tagint) ubuf(buf[m++]).i; + improper_atom4[nlocal][k] = (tagint) ubuf(buf[m++]).i; } nspecial[nlocal][0] = nspecial[nlocal][1] = nspecial[nlocal][2] = 0; diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index a889a8d0db71e7eff23f457d4e4ea06be5108770..ec2588e61b8bc9201d6a484000aecb0396c2d773 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -943,7 +943,7 @@ double FixCMAP::dihedral_angle_atan2(double fx, double fy, double fz, { // calculate the dihedral angle - double angle, arg1, arg2; + double angle = 0.0, arg1, arg2; arg1 = absg*(fx*bx+fy*by+fz*bz); arg2 = ax*bx+ay*by+az*bz; diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index f345d52aabfd12e68be37c0e4b115120e7884764..a01878bffd23d5e59224eac7d5eb310dd6912024 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -748,19 +748,9 @@ void FixPOEMS::initial_integrate(int vflag) /* ---------------------------------------------------------------------- */ -void FixPOEMS::post_force(int vflag) +void FixPOEMS::post_force(int /* vflag */) { if (earlyflag) compute_forces_and_torques(); - - /* - for (int ibody = 0; ibody < nbody; ibody++) { - if (ibody == 0) { - printf("PFF %d %g %g %g\n",ibody,fcm[ibody][0],fcm[ibody][1],fcm[ibody][2]); - printf("PFT %d %g %g %g\n",ibody, - torque[ibody][0],torque[ibody][1],torque[ibody][2]); - } - } - */ } /* ---------------------------------------------------------------------- @@ -850,7 +840,7 @@ void FixPOEMS::final_integrate() /* ---------------------------------------------------------------------- */ -void FixPOEMS::initial_integrate_respa(int vflag, int ilevel, int iloop) +void FixPOEMS::initial_integrate_respa(int vflag, int ilevel, int /* iloop */) { dtv = step_respa[ilevel]; dtf = 0.5 * step_respa[ilevel] * force->ftm2v; @@ -862,14 +852,14 @@ void FixPOEMS::initial_integrate_respa(int vflag, int ilevel, int iloop) /* ---------------------------------------------------------------------- */ -void FixPOEMS::post_force_respa(int vflag, int ilevel, int iloop) +void FixPOEMS::post_force_respa(int vflag, int ilevel, int /* iloop */) { if (ilevel == nlevels_respa-1) post_force(vflag); } /* ---------------------------------------------------------------------- */ -void FixPOEMS::final_integrate_respa(int ilevel, int iloop) +void FixPOEMS::final_integrate_respa(int ilevel, int /* iloop */) { dtf = 0.5 * step_respa[ilevel] * force->ftm2v; final_integrate(); @@ -949,7 +939,7 @@ int FixPOEMS::dof(int igroup) thus this routine does nothing for now ------------------------------------------------------------------------- */ -void FixPOEMS::deform(int flag) {} +void FixPOEMS::deform(int /* flag */) {} /* ---------------------------------------------------------------------- */ @@ -1607,7 +1597,7 @@ void FixPOEMS::grow_arrays(int nmax) copy values within local atom-based arrays ------------------------------------------------------------------------- */ -void FixPOEMS::copy_arrays(int i, int j, int delflag) +void FixPOEMS::copy_arrays(int i, int j, int /* delflag */) { natom2body[j] = natom2body[i]; for (int k = 0; k < natom2body[j]; k++) atom2body[j][k] = atom2body[i][k]; diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index dac88a8efa7e1fd3b92247b36e80c0c0497a888b..4868cd75deb0015e68ae9c08779276e9f5bdeff4 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -716,7 +716,7 @@ void FixHyperLocal::pre_reverse(int /* eflag */, int /* vflag */) if (update->ntimestep % histo_print == 0) { MPI_Allreduce(histo,allhisto,histo_count+2,MPI_LMP_BIGINT,MPI_SUM,world); - bigint total; + bigint total = 0; for (i = 0; i < histo_count+2; i++) total += allhisto[i]; if (me == 0) { diff --git a/src/REPLICA/fix_hyper_local.h b/src/REPLICA/fix_hyper_local.h index 9fe4d03fb9c3ff121ab4e6fc38a51930723c7419..967101837e4ea065b40eb6699ffeb3734c93840f 100644 --- a/src/REPLICA/fix_hyper_local.h +++ b/src/REPLICA/fix_hyper_local.h @@ -87,7 +87,7 @@ class FixHyperLocal : public FixHyper { int nevent; // # of events that trigger bond rebuild int nevent_atom; // # of atoms that experienced an event double cutbondsq,dcutsq; - double beta,t_hyper,invqfactorsq; + double beta,invqfactorsq; double mybias; double maxbondlen; // cummulative max length of any bond double maxdriftsq; // max distance any atom drifts from original pos @@ -147,7 +147,7 @@ class FixHyperLocal : public FixHyper { // histogramming of bond boost cooeficients - int histo_flag,histo_every,histo_count,histo_print,histo_steps; + int histo_every,histo_count,histo_print,histo_steps; double histo_delta,invhisto_delta,histo_lo; bigint *histo,*allhisto; }; diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index cc074bb97d9b9dd91d2bfcc8e378d7cd56a7ba5e..72a4c0d7de4f52b514a4f4e187bd359a5c4be503 100644 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -323,7 +323,7 @@ void PairSpinExchange::compute_single_pair(int ii, double fmi[3]) double **x = atom->x; double **sp = atom->sp; double local_cut2; - double xi[3], rij[3]; + double xi[3]; double delx,dely,delz; double spj[3]; diff --git a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp index d31890ea52b9dbfad89e5aec7088fb1826752369..569f911eb9dd3b89f35cc7bba71b59d04e7d553c 100644 --- a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp @@ -103,9 +103,9 @@ PairOxdna2Coaxstk::~PairOxdna2Coaxstk() void PairOxdna2Coaxstk::compute(int eflag, int vflag) { - double delf[3],delt[3],delta[3],deltb[3]; // force, torque increment; + double delf[3],delta[3],deltb[3]; // force, torque increment; double evdwl,fpair,finc,tpair,factor_lj; - double v1tmp[3],v2tmp[3],v3tmp[3]; + double v1tmp[3]; double delr_ss[3],delr_ss_norm[3],rsq_ss,r_ss,rinv_ss; double delr_st[3],delr_st_norm[3],rsq_st,r_st,rinv_st; double theta1,theta1p,t1dir[3],cost1; @@ -114,12 +114,6 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) double theta6,theta6p,t6dir[3],cost6; double cosphi3; - double gamma,gammacub,rinv_ss_cub,fac; - double aybx,azbx,rax,ray,raz,rbx; - double dcdr,dcdrbx; - double dcdaxbx,dcdaybx,dcdazbx; - double dcdrax,dcdray,dcdraz; - // distances COM-backbone site, COM-stacking site double d_cs=-0.4, d_cst=+0.34; // vectors COM-backbone site, COM-stacking site in lab frame diff --git a/src/USER-COLVARS/group_ndx.cpp b/src/USER-COLVARS/group_ndx.cpp index 450c250ffa4fcbe23aef74fd10cda0887ecfb3dd..858336c9d505d460377dac00d4ce488abad818fc 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 97668471c885ce3215324b38daae58b3d4c4cf35..cb8349786f324e8e0fcd86fa27bd30c114d468b8 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.cpp b/src/USER-MISC/compute_stress_mop.cpp index e63dff507f4aab135d8d4db7a6749033ca9262ac..e496fd4dfaba6d72e3969076bc826252fd65831b 100644 --- a/src/USER-MISC/compute_stress_mop.cpp +++ b/src/USER-MISC/compute_stress_mop.cpp @@ -210,7 +210,7 @@ void ComputeStressMop::init() /* ---------------------------------------------------------------------- */ -void ComputeStressMop::init_list(int id, NeighList *ptr) +void ComputeStressMop::init_list(int /* id */, NeighList *ptr) { list = ptr; } @@ -246,9 +246,9 @@ void ComputeStressMop::compute_vector() void ComputeStressMop::compute_pairs() { - int i,j,m,n,ii,jj,inum,jnum,itype,jtype; + int i,j,m,ii,jj,inum,jnum,itype,jtype; double delx,dely,delz; - double rsq,eng,fpair,factor_coul,factor_lj; + double rsq,fpair,factor_coul,factor_lj; int *ilist,*jlist,*numneigh,**firstneigh; double *mass = atom->mass; @@ -363,8 +363,7 @@ void ComputeStressMop::compute_pairs() // counts local particles transfers across the plane if (which[m] == KIN || which[m] == TOTAL){ - double vcm[3]; - double masstotal,sgn; + double sgn; for (int i = 0; i < nlocal; i++){ diff --git a/src/USER-MISC/compute_stress_mop_profile.cpp b/src/USER-MISC/compute_stress_mop_profile.cpp index 02ad3ea453971f27092266e90857d535f7da79a4..76bf487630a2dba8becec567e69cdd89ee8c62fe 100644 --- a/src/USER-MISC/compute_stress_mop_profile.cpp +++ b/src/USER-MISC/compute_stress_mop_profile.cpp @@ -211,7 +211,7 @@ void ComputeStressMopProfile::init() /* ---------------------------------------------------------------------- */ -void ComputeStressMopProfile::init_list(int id, NeighList *ptr) +void ComputeStressMopProfile::init_list(int /* id */, NeighList *ptr) { list = ptr; } @@ -253,11 +253,11 @@ void ComputeStressMopProfile::compute_array() void ComputeStressMopProfile::compute_pairs() { - int i,j,m,n,ii,jj,inum,jnum,itype,jtype,ibin; + int i,j,m,ii,jj,inum,jnum,itype,jtype,ibin; double delx,dely,delz; - double rsq,eng,fpair,factor_coul,factor_lj; + double rsq,fpair,factor_coul,factor_lj; int *ilist,*jlist,*numneigh,**firstneigh; - double pos,pos1,pos_temp; + double pos,pos1; double *mass = atom->mass; int *type = atom->type; @@ -385,8 +385,7 @@ void ComputeStressMopProfile::compute_pairs() if (which[m] == KIN || which[m] == TOTAL){ - double vcm[3]; - double masstotal,sgn; + double sgn; for (int i = 0; i < nlocal; i++){ @@ -449,13 +448,12 @@ void ComputeStressMopProfile::compute_pairs() void ComputeStressMopProfile::setup_bins() { - int i,j,k,m,n; - double lo,hi,coord1,coord2; + 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-MISC/compute_stress_mop_profile.h b/src/USER-MISC/compute_stress_mop_profile.h index 648d86cc7f98d6a289c418627d1760257bf48a20..0ab774f3db387bb3f2b3809bce4a9776767115c7 100644 --- a/src/USER-MISC/compute_stress_mop_profile.h +++ b/src/USER-MISC/compute_stress_mop_profile.h @@ -50,7 +50,6 @@ namespace LAMMPS_NS { double **coord,**coordp; double **values_local,**values_global; - int ndim; double dt,nktv2p,ftm2v; double area; class NeighList *list; diff --git a/src/USER-MISC/fix_ffl.cpp b/src/USER-MISC/fix_ffl.cpp index e2fb0166a28473be73e33ddba4e5c746b2d6679d..d2a57fd2d0106b95e6ecae6712a6f1e17d556f21 100644 --- a/src/USER-MISC/fix_ffl.cpp +++ b/src/USER-MISC/fix_ffl.cpp @@ -108,8 +108,6 @@ FixFFL::FixFFL(LAMMPS *lmp, int narg, char **arg) : } t_target=t_start; - const double kT = t_target * force->boltz / force->mvv2e; - // initialize Marsaglia RNG with processor-unique seed // NB: this means runs will not be the same with different numbers of processors @@ -298,7 +296,7 @@ void FixFFL::ffl_integrate() { } -void FixFFL::initial_integrate(int vflag) { +void FixFFL::initial_integrate(int /* vflag */) { double dtfm; // update v and x of atoms in group @@ -391,7 +389,7 @@ void FixFFL::final_integrate() { } /* ---------------------------------------------------------------------- */ -void FixFFL::initial_integrate_respa(int vflag, int ilevel, int iloop) { +void FixFFL::initial_integrate_respa(int vflag, int ilevel, int /* iloop */) { dtv = step_respa[ilevel]; dtf = 0.5 * step_respa[ilevel] * force->ftm2v; @@ -406,7 +404,7 @@ void FixFFL::initial_integrate_respa(int vflag, int ilevel, int iloop) { } } -void FixFFL::final_integrate_respa(int ilevel, int iloop) { +void FixFFL::final_integrate_respa(int ilevel, int /* iloop */) { dtv = step_respa[ilevel]; dtf = 0.5 * step_respa[ilevel] * force->ftm2v; diff --git a/src/USER-MISC/fix_filter_corotate.cpp b/src/USER-MISC/fix_filter_corotate.cpp index 56ab2b3df9698edd26898fe0c1cbacb8001eebe0..717861e06f10e74ecefc67f52dce7ddee6af25e3 100644 --- a/src/USER-MISC/fix_filter_corotate.cpp +++ b/src/USER-MISC/fix_filter_corotate.cpp @@ -592,14 +592,13 @@ void FixFilterCorotate::pre_neighbor() double c = (del2[0])*(del3[1]) - (del2[1])*(del3[0]); int signum = sgn(a*(del1[0]) + b*(del1[1]) + c*(del1[2])); - if (fabs(signum)!= 1) + if (abs(signum) != 1) error->all(FLERR,"Wrong orientation in cluster of size 4" "in fix filter/corotate!"); clist_q0[i][8] *= signum; clist_q0[i][11] *= signum; - } else if (N == 5) - { + } else if (N == 5) { oxy = atom->map(shake_atom[m][0]); atom1 = atom->map(shake_atom[m][1]); atom2 = atom->map(shake_atom[m][2]); @@ -666,14 +665,12 @@ void FixFilterCorotate::pre_neighbor() double c = (del2[0])*(del3[1]) - (del2[1])*(del3[0]); int signum = sgn(a*(del1[0]) + b*(del1[1]) + c*(del1[2])); - if (fabs(signum)!= 1) + if (abs(signum)!= 1) error->all(FLERR,"Wrong orientation in cluster of size 5" "in fix filter/corotate!"); clist_q0[i][8] *= signum; clist_q0[i][11] *= signum; - } - else - { + } else { error->all(FLERR,"Fix filter/corotate cluster with size > 5" "not yet configured..."); } diff --git a/src/USER-MOFFF/angle_class2_p6.cpp b/src/USER-MOFFF/angle_class2_p6.cpp index c821c9d883ed611661dffb1ddeefea86c6d0ba77..d2a6e21e6be42c3e877e988a0fed430fde9c3aba 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 3f87aeb7574a00b0fa5b83e8a76d038202fc329d..f3580978023edd627399b682173c2e22a08b403c 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 9608d58054fa49d99443f915dbe5c78af055d34a..8404984b53a8d012dd37b73fe6949b05007d3c1e 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 f434d03858b3d370c63e03a2b911e9554d9763e9..46af95470ca5ae7d48f97e964a49f0fb70f0bd81 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 9902896d18ece26a6e49f461e613182b4440b0b5..3c54d6477026582759eba565f73560705514d72e 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; diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index 8be54caada2d4b92f4e5f8ba524b088cbd87bd09..a4587b1c145555607b0cd9bfe9ddade6c78f3e09 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -80,7 +80,9 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) if (nthreads < 1) error->all(FLERR,"Illegal number of OpenMP threads requested"); +#if defined(_OPENMP) int reset_thr = 0; +#endif if (nthreads != comm->nthreads) { #if defined(_OPENMP) reset_thr = 1; diff --git a/src/USER-OMP/thr_omp.h b/src/USER-OMP/thr_omp.h index 0821f8cea039bec9e11ccf180c524746e0a52910..87d921290efd93e5ed14d158188617e5ca0bf50c 100644 --- a/src/USER-OMP/thr_omp.h +++ b/src/USER-OMP/thr_omp.h @@ -185,6 +185,7 @@ static inline void loop_setup_thr(int &ifrom, int &ito, int &tid, tid = 0; ifrom = 0; ito = inum; + nthreads = 1; #endif } diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index ddad7eb62fd6e323756795b376a5fa9daa080915..61b653b3750ab75b184f30803136c7c85c5b47af 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -66,7 +66,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : // chunk style and its args - int iarg; + int iarg = 0; binflag = 0; ncoord = 0; @@ -248,7 +248,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"bound") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - int idim; + int idim = 0; if (strcmp(arg[iarg+1],"x") == 0) idim = 0; else if (strcmp(arg[iarg+1],"y") == 0) idim = 1; else if (strcmp(arg[iarg+1],"z") == 0) idim = 2; diff --git a/src/compute_dihedral_local.h b/src/compute_dihedral_local.h index d5f6a641833435a4f97de69f650df94e357aae63..5c50a66e96f9b047ea4ca9785b1918c4dcce40ac 100644 --- a/src/compute_dihedral_local.h +++ b/src/compute_dihedral_local.h @@ -33,7 +33,7 @@ class ComputeDihedralLocal : public Compute { double memory_usage(); private: - int nvalues,nvar,ncount,setflag,tflag; + int nvalues,nvar,ncount,setflag; int pvar; int *bstyle,*vvar; diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 751c4746ba5286aaa39a2b9089a4e4d1ec217a49..e19b56555420e907c192d29c8c3ca7b59ec66113 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -54,7 +54,7 @@ void CreateBonds::command(int narg, char **arg) int style; - int iarg; + int iarg = 0; if (strcmp(arg[0],"many") == 0) { style = MANY; if (narg != 6) error->all(FLERR,"Illegal create_bonds command"); diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index 04088bec8ce76233552a9f39da188d853eb0e7e1..7b29b1d3d51e0c4877b31b00fd9431c91c3a8a27 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -118,7 +118,7 @@ void DisplaceAtoms::command(int narg, char **arg) if (style == RAMP) { - int d_dim; + int d_dim = 0; if (strcmp(arg[2],"x") == 0) d_dim = 0; else if (strcmp(arg[2],"y") == 0) d_dim = 1; else if (strcmp(arg[2],"z") == 0) d_dim = 2; @@ -136,7 +136,7 @@ void DisplaceAtoms::command(int narg, char **arg) d_hi = zscale*force->numeric(FLERR,arg[4]); } - int coord_dim; + int coord_dim = 0; if (strcmp(arg[5],"x") == 0) coord_dim = 0; else if (strcmp(arg[5],"y") == 0) coord_dim = 1; else if (strcmp(arg[5],"z") == 0) coord_dim = 2; diff --git a/src/dump_image.cpp b/src/dump_image.cpp index a488f65161909a05b598832c3d15a109f346eb21..0d63d2e4cba5b45b7b464d611c55b2d5f608eee4 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -1290,7 +1290,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"amap") == 0) { if (narg < 6) error->all(FLERR,"Illegal dump_modify command"); if (strlen(arg[3]) != 2) error->all(FLERR,"Illegal dump_modify command"); - int factor; + int factor = 0; if (arg[3][0] == 's') factor = 1; else if (arg[3][0] == 'c') factor = 2; else if (arg[3][0] == 'd') factor = 3; diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index c960c310f618fda3816cd658768505161611d2e5..909ead3e2a9052ba27ecc3405d47074344ad5bf0 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -802,7 +802,7 @@ void FixDeform::end_of_step() // tilt_target can be large positive or large negative value // add/subtract box lengths until tilt_target is closest to current value - int idenom; + int idenom = 0; if (i == 5) idenom = 0; else if (i == 4) idenom = 0; else if (i == 3) idenom = 1; diff --git a/src/fix_move.cpp b/src/fix_move.cpp index 2f9fb0ebaa596bdbc37553f6e2f2344c49e6f515..0a5f506ab265ff14b6070b6c537b9ae4bd180f56 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -68,7 +68,7 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : // parse args - int iarg; + int iarg = 0; if (strcmp(arg[3],"linear") == 0) { if (narg < 7) error->all(FLERR,"Illegal fix move command"); diff --git a/src/input.cpp b/src/input.cpp index f9dd1ec314840cc142559f0b1e5b31a62aeb452a..8af8da26be5df0a694a8001584abaf4e2d4c98a4 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1138,7 +1138,7 @@ void Input::partition() { if (narg < 3) error->all(FLERR,"Illegal partition command"); - int yesflag; + int yesflag = 0; if (strcmp(arg[0],"yes") == 0) yesflag = 1; else if (strcmp(arg[0],"no") == 0) yesflag = 0; else error->all(FLERR,"Illegal partition command"); diff --git a/src/read_data.cpp b/src/read_data.cpp index 26c406c1d6822de7a412736b50cc64572d787a12..373ba30151d3ca77df132e2a37a78443742b78cc 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -1248,7 +1248,7 @@ void ReadData::bonds(int firstpass) int *count = NULL; if (firstpass) { memory->create(count,nlocal,"read_data:count"); - for (int i = 0; i < nlocal; i++) count[i] = 0; + memset(count,0,nlocal*sizeof(int)); } // read and process bonds @@ -1331,7 +1331,7 @@ void ReadData::angles(int firstpass) int *count = NULL; if (firstpass) { memory->create(count,nlocal,"read_data:count"); - for (int i = 0; i < nlocal; i++) count[i] = 0; + memset(count,0,nlocal*sizeof(int)); } // read and process angles @@ -1414,7 +1414,7 @@ void ReadData::dihedrals(int firstpass) int *count = NULL; if (firstpass) { memory->create(count,nlocal,"read_data:count"); - for (int i = 0; i < nlocal; i++) count[i] = 0; + memset(count,0,nlocal*sizeof(int)); } // read and process dihedrals @@ -1435,7 +1435,7 @@ void ReadData::dihedrals(int firstpass) if (firstpass) { int max = 0; - for (int i = 0; i < nlocal; i++) max = MAX(max,count[i]); + for (int i = nlocal_previous; i < nlocal; i++) max = MAX(max,count[i]); int maxall; MPI_Allreduce(&max,&maxall,1,MPI_INT,MPI_MAX,world); if (addflag == NONE) maxall += atom->extra_dihedral_per_atom; @@ -1497,7 +1497,7 @@ void ReadData::impropers(int firstpass) int *count = NULL; if (firstpass) { memory->create(count,nlocal,"read_data:count"); - for (int i = 0; i < nlocal; i++) count[i] = 0; + memset(count,0,nlocal*sizeof(int)); } // read and process impropers diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 252c48d251ec8aefb414779752c6699e21d539ec..6b9ea8d77316b867bb193bc2264ee9b392e51b00 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -924,11 +924,13 @@ void ReadRestart::header(int incompatible) atom->extra_dihedral_per_atom = read_int(); } else if (flag == EXTRA_IMPROPER_PER_ATOM) { atom->extra_improper_per_atom = read_int(); - } else if (flag == EXTRA_SPECIAL_PER_ATOM) { - force->special_extra = read_int(); } else if (flag == ATOM_MAXSPECIAL) { atom->maxspecial = read_int(); + // for backward compatibility + } else if (flag == EXTRA_SPECIAL_PER_ATOM) { + force->special_extra = read_int(); + } else error->all(FLERR,"Invalid flag in header section of restart file"); flag = read_int(); diff --git a/src/set.cpp b/src/set.cpp index 7eca4e9a9c64c0db21618933d8747d903441cea6..34b86ea328bcea334c0cf7b99d83ec3db9161a21 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -890,7 +890,7 @@ void Set::set(int keyword) // enforce quat rotation vector in z dir for 2d systems else if (keyword == QUAT) { - double *quat; + double *quat = NULL; if (avec_ellipsoid && atom->ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat; else if (avec_tri && atom->tri[i] >= 0) diff --git a/src/variable.cpp b/src/variable.cpp index 1595456f3314debb00fe13038a51d8d5276f9342..af5f647b74a086cc9978504491efc6033e0b15d7 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -182,7 +182,7 @@ void Variable::set(int narg, char **arg) if (find(arg[0]) >= 0) return; if (nvar == maxvar) grow(); style[nvar] = LOOP; - int nfirst,nlast; + int nfirst = 0,nlast = 0; if (narg == 3 || (narg == 4 && strcmp(arg[3],"pad") == 0)) { nfirst = 1; nlast = force->inumeric(FLERR,arg[2]); @@ -3983,7 +3983,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, strcmp(word,"max") == 0 || strcmp(word,"ave") == 0 || strcmp(word,"trap") == 0 || strcmp(word,"slope") == 0) { - int method; + int method = 0; if (strcmp(word,"sum") == 0) method = SUM; else if (strcmp(word,"min") == 0) method = XMIN; else if (strcmp(word,"max") == 0) method = XMAX; diff --git a/src/velocity.cpp b/src/velocity.cpp index 3a0b95fb4da91ea6e77d6ff24a012e493137d610..6d6027cc3c7aeb8e77e8c2c2896dd8e7bfcb7c90 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -641,7 +641,7 @@ void Velocity::ramp(int /*narg*/, char **arg) // parse args - int v_dim; + int v_dim = 0; if (strcmp(arg[0],"vx") == 0) v_dim = 0; else if (strcmp(arg[0],"vy") == 0) v_dim = 1; else if (strcmp(arg[0],"vz") == 0) v_dim = 2; @@ -662,7 +662,7 @@ void Velocity::ramp(int /*narg*/, char **arg) v_hi = zscale*force->numeric(FLERR,arg[2]); } - int coord_dim; + int coord_dim = 0; if (strcmp(arg[3],"x") == 0) coord_dim = 0; else if (strcmp(arg[3],"y") == 0) coord_dim = 1; else if (strcmp(arg[3],"z") == 0) coord_dim = 2; diff --git a/src/write_dump.cpp b/src/write_dump.cpp index bb79c654b418569101a1f601f31fe93ce420bd97..6c7375012e8a15c569035acfd69f1f2c12aff706 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -45,7 +45,7 @@ void WriteDump::command(int narg, char **arg) // create the Dump instance // create dump command line with extra required args - Dump *dump; + Dump *dump = NULL; char **dumpargs = new char*[modindex+2]; dumpargs[0] = (char *) "WRITE_DUMP"; // dump id