From 436e02aa6e0b7cee95d35a6cf2d56e051c7b58ee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 6 Mar 2019 16:59:17 -0500 Subject: [PATCH 1/8] small corrections/clarifications to the pull request template --- .github/PULL_REQUEST_TEMPLATE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 83892035c0..9e43aa0244 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,7 +4,7 @@ _Briefly describe the new feature(s), enhancement(s), or bugfix(es) included in **Related Issues** -__If this addresses an open GitHub Issue, mention the issue number here. Use the phrases `fixes #221` or `closes #135`, when you want those issues to be automatically closed when the pull request is merged_ +_If this addresses an open GitHub issue for this project, please mention the issue number here, and describe the relation. Use the phrases `fixes #221` or `closes #135`, when you want an issue to be automatically closed when the pull request is merged_ **Author(s)** @@ -16,7 +16,7 @@ By submitting this pull request, I agree, that my contribution will be included **Backward Compatibility** -_Please state whether any changes in the pull request break backward compatibility for inputs, and - if yes - explain what has been changed and why_ +_Please state whether any changes in the pull request will break backward compatibility for inputs, and - if yes - explain what has been changed and why_ **Implementation Notes** @@ -24,7 +24,7 @@ _Provide any relevant details about how the changes are implemented, how correct **Post Submission Checklist** -_Please check the fields below as they are completed **after** the pull request has been submitted_ +_Please check the fields below as they are completed **after** the pull request has been submitted. Delete lines that don't apply_ - [ ] The feature or features in this pull request is complete - [ ] Licensing information is complete From fe56cf04bca5db169502d59801876eb5401c6a66 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 6 Mar 2019 17:04:14 -0500 Subject: [PATCH 2/8] simplify the detection of whether the source folder is checked out from a local git repo --- cmake/CMakeLists.txt | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ec32049445..1b0272c5e7 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1336,26 +1336,20 @@ set(temp_git_commit "(unknown)") set(temp_git_branch "(unknown)") set(temp_git_describe "(unknown)") set(temp_git_info "false") -if(GIT_FOUND) - execute_process(COMMAND ${GIT_EXECUTABLE} describe HEAD - RESULT_VARIABLE temp_in_git_checkout +if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git) + set(temp_git_info "true") + execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + OUTPUT_VARIABLE temp_git_commit + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE temp_git_branch + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty=-modified + OUTPUT_VARIABLE temp_git_describe ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - if(temp_in_git_checkout EQUAL 0) - set(temp_git_info "true") - execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD - OUTPUT_VARIABLE temp_git_commit - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD - OUTPUT_VARIABLE temp_git_branch - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty=-modified - OUTPUT_VARIABLE temp_git_describe - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() endif() set(temp "${temp}const bool LAMMPS_NS::LAMMPS::has_git_info = ${temp_git_info};\n") From 2918dae87e23745aa7f20f81e2a5b32abe8176f1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 6 Mar 2019 17:12:41 -0500 Subject: [PATCH 3/8] correct variable name and path to find the local .git folder --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 1b0272c5e7..12a34fabc1 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1336,7 +1336,7 @@ set(temp_git_commit "(unknown)") set(temp_git_branch "(unknown)") set(temp_git_describe "(unknown)") set(temp_git_info "false") -if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git) +if(GIT_FOUND AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git) set(temp_git_info "true") execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD OUTPUT_VARIABLE temp_git_commit From 4e632d1b79e59d1b7bdd644a63289487412e7f55 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 6 Mar 2019 17:32:08 -0500 Subject: [PATCH 4/8] implement another suggestion from @junghans --- cmake/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 12a34fabc1..f6f822676e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1338,15 +1338,15 @@ set(temp_git_describe "(unknown)") set(temp_git_info "false") if(GIT_FOUND AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git) set(temp_git_info "true") - execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/../.git rev-parse HEAD OUTPUT_VARIABLE temp_git_commit ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/../.git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE temp_git_branch ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty=-modified + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/../.git describe --dirty=-modified OUTPUT_VARIABLE temp_git_describe ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) From 9408dd6e925c38819b6b207775a5b21ca720f0c6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 6 Mar 2019 18:41:43 -0500 Subject: [PATCH 5/8] use simpler way whether we are inside a git checkout in conventional build --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index f720abe6ec..f1030ae08f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -171,7 +171,7 @@ gitversion: @echo 'Gathering git version information' @echo '#ifndef LMP_GIT_VERSION_H' > ${TMPNAME}.lmpgitversion @echo '#define LMP_GIT_VERSION_H' >> ${TMPNAME}.lmpgitversion - @if (type git && git describe HEAD ) >> /dev/null 2>> /dev/null ; then \ + @if (type git && test -e ../.git ) >> /dev/null 2>> /dev/null ; then \ git='true'; \ commit=$$(git rev-parse HEAD); \ branch=$$(git rev-parse --abbrev-ref HEAD); \ From 3bc815efe85dd1599455d903118b866b2297f065 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 7 Mar 2019 15:11:33 -0500 Subject: [PATCH 6/8] fix a memory leak in fix bocs --- src/USER-BOCS/fix_bocs.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index bf11b1d6ba..7bdb8933e3 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -697,6 +697,11 @@ int FixBocs::read_F_table( char *filename, int p_basis_type ) "of %d in read_F_table",p_basis_type); error->all(FLERR,errmsg); } + // cleanup + for (i = 0; i < N_columns; ++i) { + free(data[i]); + } + free(data); return n_entries; } From a5c93e75a5280464c234ebaa50c652037ee8553e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 7 Mar 2019 15:12:22 -0500 Subject: [PATCH 7/8] ignore src/lmpgitversion.h --- src/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/src/.gitignore b/src/.gitignore index 9670d1ca20..d405cb209e 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -6,6 +6,7 @@ /style_*.h /lmpinstalledpkgs.h +/lmpgitversion.h /*_gpu.h /*_gpu.cpp From e62746ef27dd6e55919383f9da625fc720515967 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 7 Mar 2019 15:38:23 -0500 Subject: [PATCH 8/8] protect group command against options that require unavailble properties resulting in segfaults --- src/group.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/group.cpp b/src/group.cpp index 3bc3f3d7bf..6c19af8bc6 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -207,6 +207,12 @@ void Group::assign(int narg, char **arg) else if (strcmp(arg[1],"molecule") == 0) category = MOLECULE; else if (strcmp(arg[1],"id") == 0) category = ID; + if ((category == MOLECULE) && (!atom->molecular)) + error->all(FLERR,"Group command requires atom attribute molecule"); + + if ((category == ID) && (!atom->tag_enable)) + error->all(FLERR,"Group command requires atom IDs"); + // args = logical condition if (narg > 3 && @@ -362,10 +368,13 @@ void Group::assign(int narg, char **arg) } else if (strcmp(arg[1],"include") == 0) { if (narg != 3) error->all(FLERR,"Illegal group command"); - if (strcmp(arg[2],"molecule") != 0) - error->all(FLERR,"Illegal group command"); + if (strcmp(arg[2],"molecule") == 0) { + if (!atom->molecular) + error->all(FLERR,"Group command requires atom attribute molecule"); - add_molecules(igroup,bit); + add_molecules(igroup,bit); + + } else error->all(FLERR,"Illegal group command"); // style = subtract