From 4c1fbc359a414ae82fa0d40e107a0392df307c1b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Nov 2018 05:28:19 -0500 Subject: [PATCH 1/9] use tagint when unpacking atom tags from communication buffers --- src/MOLECULE/atom_vec_molecular.cpp | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/MOLECULE/atom_vec_molecular.cpp b/src/MOLECULE/atom_vec_molecular.cpp index 6e903a936e..cdd3f02505 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; From 7a22b8aa621528327637ab3bc159b467db9c7478 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Nov 2018 05:29:26 -0500 Subject: [PATCH 2/9] check only in currently added data file atoms for dihedral overflow --- src/read_data.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/read_data.cpp b/src/read_data.cpp index 26c406c1d6..1dbb9506c6 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -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; From a942d8b3ba0bfb784bb71e091e7ef5ae1af38c59 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Nov 2018 05:30:23 -0500 Subject: [PATCH 3/9] use memset() for clearing of arrays --- src/read_data.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/read_data.cpp b/src/read_data.cpp index 1dbb9506c6..373ba30151 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 @@ -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 From 952e52982e3c66541a4bb07f465863d81ab5f7d1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 14 Nov 2018 05:37:59 -0500 Subject: [PATCH 4/9] add comment to indicate code intended for backward compatibility only --- src/read_restart.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 252c48d251..6b9ea8d773 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(); From e1603763657826355ff25ee01a5db215d4da32f9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Nov 2018 12:45:15 -0500 Subject: [PATCH 5/9] incomplete first draft. committed for checking the markup in github. --- doc/github-development-workflow.md | 82 ++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 doc/github-development-workflow.md diff --git a/doc/github-development-workflow.md b/doc/github-development-workflow.md new file mode 100644 index 0000000000..b81dbb417e --- /dev/null +++ b/doc/github-development-workflow.md @@ -0,0 +1,82 @@ +# 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) + * [Feature Request Issues](#feature-request-issues) + * [Bug Report Issues](#bug-report-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 (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 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. + +### 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 +developer + +### Pull Request Discussions + +### Checklist for Pull Requests + +## GitHub Issues + +### Feature Request Issues + +### Bug Report Issues + +## Milestones and Release Planning + From db29ec7eee14cef6f256fbe7190f7b262fc0a472 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Nov 2018 14:58:02 -0500 Subject: [PATCH 6/9] complete workflow document --- doc/github-development-workflow.md | 132 +++++++++++++++++++++++++---- 1 file changed, 117 insertions(+), 15 deletions(-) diff --git a/doc/github-development-workflow.md b/doc/github-development-workflow.md index b81dbb417e..31fd3f23f0 100644 --- a/doc/github-development-workflow.md +++ b/doc/github-development-workflow.md @@ -17,28 +17,28 @@ adapt accordingly. Last change 2018-11-15. * [Pull Request Discussions](#pull-request-discussions) * [Checklist for Pull Requests](#checklist-for-pull-requests) * [GitHub Issues](#github-issues) - * [Feature Request Issues](#feature-request-issues) - * [Bug Report Issues](#bug-report-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 (Axel -Kohlmeyer). If this assignment needs to be changed, it shall be done -right after a stable release. +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 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. +"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 @@ -63,20 +63,122 @@ 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 -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 ` instead of `#include `. + 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 -### Feature Request 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. -### Bug Report Issues +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_` 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. + From eae9d27f6d37ec7f935a5e3112fa34b7f78f5fea Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Nov 2018 16:03:33 -0500 Subject: [PATCH 7/9] OpenMP support from the compiler is not a requirement for USER-OMP. Without OpenMP, it is like the OPT package but for many more styles, so it is still useful and should be supported. --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index cc5a3356a6..6d559bebe3 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}") From 1fc3b4618c5d015255ed8d9f1afb76f3fc623950 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Nov 2018 16:31:04 -0500 Subject: [PATCH 8/9] remove dead code and silence compiler warnings --- src/BODY/pair_body_rounded_polygon.cpp | 2 +- src/MISC/pair_nm_cut.cpp | 8 ------- src/MISC/pair_nm_cut_coul_cut.cpp | 8 ------- src/MISC/pair_nm_cut_coul_long.cpp | 8 ------- src/MOLECULE/fix_cmap.cpp | 2 +- src/POEMS/fix_poems.cpp | 22 ++++++-------------- src/REPLICA/fix_hyper_local.cpp | 2 +- src/REPLICA/fix_hyper_local.h | 4 ++-- src/SPIN/pair_spin_exchange.cpp | 2 +- src/USER-CGDNA/pair_oxdna2_coaxstk.cpp | 10 ++------- src/USER-MISC/compute_stress_mop.cpp | 9 ++++---- src/USER-MISC/compute_stress_mop_profile.cpp | 15 +++++++------ src/USER-MISC/compute_stress_mop_profile.h | 1 - src/USER-MISC/fix_ffl.cpp | 8 +++---- src/USER-MISC/fix_filter_corotate.cpp | 11 ++++------ src/USER-OMP/fix_omp.cpp | 2 ++ src/USER-OMP/thr_omp.h | 1 + src/compute_chunk_atom.cpp | 4 ++-- src/compute_dihedral_local.h | 2 +- src/create_bonds.cpp | 2 +- src/displace_atoms.cpp | 4 ++-- src/dump_image.cpp | 2 +- src/fix_deform.cpp | 2 +- src/fix_move.cpp | 2 +- src/input.cpp | 2 +- src/set.cpp | 2 +- src/variable.cpp | 4 ++-- src/velocity.cpp | 4 ++-- src/write_dump.cpp | 2 +- 29 files changed, 51 insertions(+), 96 deletions(-) diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index 6a176f1083..9040817772 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 ce077a7a04..4b1611b137 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 b807bc972b..999fab1d6e 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 325f3da003..fb82436dba 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/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index a889a8d0db..ec2588e61b 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 f345d52aab..a01878bffd 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 dac88a8efa..4868cd75de 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 9fe4d03fb9..967101837e 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 cc074bb97d..72a4c0d7de 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 d31890ea52..569f911eb9 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-MISC/compute_stress_mop.cpp b/src/USER-MISC/compute_stress_mop.cpp index e63dff507f..e496fd4dfa 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 02ad3ea453..9189318381 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,8 +448,8 @@ 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; boxlo = domain->boxlo; diff --git a/src/USER-MISC/compute_stress_mop_profile.h b/src/USER-MISC/compute_stress_mop_profile.h index 648d86cc7f..0ab774f3db 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 e2fb0166a2..d2a57fd2d0 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 56ab2b3df9..717861e06f 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-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index 8be54caada..a4587b1c14 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 0821f8cea0..87d921290e 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 ddad7eb62f..61b653b375 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 d5f6a64183..5c50a66e96 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 751c4746ba..e19b565554 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 04088bec8c..7b29b1d3d5 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 a488f65161..0d63d2e4cb 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 c960c310f6..909ead3e2a 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 2f9fb0ebaa..0a5f506ab2 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 f9dd1ec314..8af8da26be 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/set.cpp b/src/set.cpp index 7eca4e9a9c..34b86ea328 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 1595456f33..af5f647b74 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 3a0b95fb4d..6d6027cc3c 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 bb79c654b4..6c7375012e 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 From 6e225d90fc2926170176821e5ef1b8144bd38e3f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 15 Nov 2018 16:48:38 -0500 Subject: [PATCH 9/9] 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;