From d29533447a2c2de9d6019e703b54bb434788c8b3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 4 Oct 2024 18:09:06 -0400 Subject: [PATCH 01/42] silence compiler warnings, remove dead code --- src/QEQ/fix_qeq_ctip.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/QEQ/fix_qeq_ctip.cpp b/src/QEQ/fix_qeq_ctip.cpp index 0649c47412..889e0f5ebd 100644 --- a/src/QEQ/fix_qeq_ctip.cpp +++ b/src/QEQ/fix_qeq_ctip.cpp @@ -241,11 +241,9 @@ void FixQEqCTIP::init_matvec() double r = cutoff; double rsq = r*r; - double r6 = rsq*rsq*rsq; double erfcd_cut = exp(-cdamp * cdamp * rsq); double t_cut = 1.0 / (1.0 + EWALD_P * cdamp * r); - double erfcc_cut = (t_cut * (A1 + t_cut * (A2 + t_cut * (A3 + t_cut * (A4 + t_cut * A5)))) * erfcd_cut) / r; inum = list->inum; ilist = list->ilist; @@ -285,9 +283,8 @@ void FixQEqCTIP::compute_H() int inum, jnum, *ilist, *jlist, *numneigh, **firstneigh; int i, j, ii, jj; double dx, dy, dz, r_sqr, r, reff; - double cutoffsq, cutoffcu, cutoff4, cdampcu, erfcc_cut, erfcd_cut, t_cut; + double cutoffsq, erfcd_cut, t_cut; double erfcc, erfcd, t; - int elt1, elt2; double **x = atom->x; int *mask = atom->mask; @@ -299,14 +296,8 @@ void FixQEqCTIP::compute_H() firstneigh = list->firstneigh; cutoffsq = cutoff * cutoff; - cutoffcu = cutoffsq * cutoff; - cutoff4 = cutoffsq * cutoffsq; - cdampcu = cdamp * cdamp * cdamp; - erfcd_cut = exp(-cdamp * cdamp * cutoffsq); t_cut = 1.0 / (1.0 + EWALD_P * cdamp * cutoff); - erfcc_cut = t_cut * (A1 + t_cut * (A2 + t_cut * (A3 + t_cut * (A4 + t_cut * A5)))) * erfcd_cut; - // fill in the H matrix m_fill = 0; From 01e9fb04b6979bd04f75df9f24fb8dd8a38c821a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 01:55:17 -0400 Subject: [PATCH 02/42] must use fabs() for floating point numbers --- src/QEQ/fix_qeq_ctip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QEQ/fix_qeq_ctip.cpp b/src/QEQ/fix_qeq_ctip.cpp index 889e0f5ebd..a541c990ee 100644 --- a/src/QEQ/fix_qeq_ctip.cpp +++ b/src/QEQ/fix_qeq_ctip.cpp @@ -416,7 +416,7 @@ int FixQEqCTIP::calculate_check_Q() qi_check1=(qi_new-qmin[type[i]])*(qi_old-qmin[type[i]]); qi_check2=(qi_new-qmax[type[i]])*(qi_old-qmax[type[i]]); if ( qi_check1 < 0.0 || qi_check2 < 0.0 ) { - qi_check3=abs(qi_new-qi_old); + qi_check3=fabs(qi_new-qi_old); if (qi_check3 > tolerance) n++; } } From c46853703009bc43eaa6a21a0de2079c00fa813b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 01:56:19 -0400 Subject: [PATCH 03/42] correct access to raw vector data and use resize() instead of reserve() for better compatibility --- src/ELECTRODE/fix_electrode_conp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index 5b2dd6b028..30b01e3ba4 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -1546,16 +1546,16 @@ void FixElectrodeConp::gather_list_iele() void FixElectrodeConp::gather_elevec(double *elevec) { assert(matrix_algo); - MPI_Allgatherv(&buf_iele[0], nlocalele, MPI_DOUBLE, buf_gathered, recvcounts, displs, MPI_DOUBLE, - world); + MPI_Allgatherv(buf_iele.data(), nlocalele, MPI_DOUBLE, buf_gathered, recvcounts, displs, + MPI_DOUBLE, world); - for (int i = 0; i < ngroup; i++) { elevec[iele_gathered[i]] = buf_gathered[i]; } + for (int i = 0; i < ngroup; i++) elevec[iele_gathered[i]] = buf_gathered[i]; } void FixElectrodeConp::buffer_and_gather(double *ivec, double *elevec) { assert(matrix_algo); - buf_iele.reserve(nlocalele); // avoid unexpected reallocs + buf_iele.resize(nlocalele); for (int i_iele = 0; i_iele < nlocalele; i_iele++) { buf_iele[i_iele] = ivec[atom->map(taglist[list_iele[i_iele]])]; } From 39f42d4c12f380de352620f5c31048f5b52160b7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 01:56:31 -0400 Subject: [PATCH 04/42] simplify --- cmake/presets/oneapi.cmake | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/cmake/presets/oneapi.cmake b/cmake/presets/oneapi.cmake index 393d1d9b68..3671d42eee 100644 --- a/cmake/presets/oneapi.cmake +++ b/cmake/presets/oneapi.cmake @@ -3,26 +3,6 @@ set(CMAKE_CXX_COMPILER "icpx" CACHE STRING "" FORCE) set(CMAKE_C_COMPILER "icx" CACHE STRING "" FORCE) set(CMAKE_Fortran_COMPILER "ifx" CACHE STRING "" FORCE) -set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE) -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE) -set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) -set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE) -set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE) -set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) -set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE) -set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE) -set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) - set(MPI_CXX "icpx" CACHE STRING "" FORCE) set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) -unset(HAVE_OMP_H_INCLUDE CACHE) -set(OpenMP_C "icx" CACHE STRING "" FORCE) -set(OpenMP_C_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE) -set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE) -set(OpenMP_CXX "icpx" CACHE STRING "" FORCE) -set(OpenMP_CXX_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE) -set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE) -set(OpenMP_Fortran_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE) -set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE) - From cdd538e24efbfcd0e656e5b66d8dce11243ab5a0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 01:57:56 -0400 Subject: [PATCH 05/42] relax epsilon for IntelLLVM compiler --- unittest/force-styles/tests/atomic-pair-meam_2nn.yaml | 2 +- unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml | 2 +- unittest/force-styles/tests/atomic-pair-reaxff_lgvdw.yaml | 2 +- .../force-styles/tests/dihedral-cosine_squared_restricted.yaml | 2 +- unittest/force-styles/tests/fix-timestep-addtorque_const.yaml | 2 +- unittest/force-styles/tests/fix-timestep-gravity.yaml | 2 +- unittest/force-styles/tests/fix-timestep-heat.yaml | 2 +- unittest/force-styles/tests/fix-timestep-shake_bond.yaml | 2 +- unittest/force-styles/tests/fix-timestep-smd_couple.yaml | 2 +- unittest/force-styles/tests/fix-timestep-spring_tether.yaml | 2 +- unittest/force-styles/tests/fix-timestep-wall_lj126_const.yaml | 2 +- unittest/force-styles/tests/kspace-ewald_conp_charge.yaml | 2 +- unittest/force-styles/tests/manybody-pair-uf3.yaml | 2 +- unittest/force-styles/tests/mol-pair-coul_diel.yaml | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/unittest/force-styles/tests/atomic-pair-meam_2nn.yaml b/unittest/force-styles/tests/atomic-pair-meam_2nn.yaml index 0fd77d67ba..4eb285fa73 100644 --- a/unittest/force-styles/tests/atomic-pair-meam_2nn.yaml +++ b/unittest/force-styles/tests/atomic-pair-meam_2nn.yaml @@ -2,7 +2,7 @@ lammps_version: 27 Jun 2024 tags: slow date_generated: Mon Aug 12 23:46:29 2024 -epsilon: 7.5e-12 +epsilon: 2e-11 skip_tests: prerequisites: ! | pair meam diff --git a/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml b/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml index e8a29f76ba..b97c1fad6f 100644 --- a/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml +++ b/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:38 2022 -epsilon: 7.5e-14 +epsilon: 1e-13 skip_tests: prerequisites: ! | pair polymorphic diff --git a/unittest/force-styles/tests/atomic-pair-reaxff_lgvdw.yaml b/unittest/force-styles/tests/atomic-pair-reaxff_lgvdw.yaml index 363f7cf74d..3ccc44fe4b 100644 --- a/unittest/force-styles/tests/atomic-pair-reaxff_lgvdw.yaml +++ b/unittest/force-styles/tests/atomic-pair-reaxff_lgvdw.yaml @@ -2,7 +2,7 @@ lammps_version: 30 Jul 2021 tags: slow, unstable date_generated: Mon Aug 23 20:32:03 2021 -epsilon: 4e-12 +epsilon: 1e-11 skip_tests: prerequisites: ! | pair reaxff diff --git a/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml b/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml index 3f4d217b9a..c2c2b8cc6b 100644 --- a/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml +++ b/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml @@ -2,7 +2,7 @@ lammps_version: 7 Feb 2024 tags: date_generated: Sat Apr 13 11:41:16 2024 -epsilon: 1.0e-11 +epsilon: 5.0e-11 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-addtorque_const.yaml b/unittest/force-styles/tests/fix-timestep-addtorque_const.yaml index 4635ae5485..f239d0ba7c 100644 --- a/unittest/force-styles/tests/fix-timestep-addtorque_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-addtorque_const.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:58 2022 -epsilon: 2.5e-11 +epsilon: 7.5e-11 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-gravity.yaml b/unittest/force-styles/tests/fix-timestep-gravity.yaml index 0fad7548ce..c151723e8a 100644 --- a/unittest/force-styles/tests/fix-timestep-gravity.yaml +++ b/unittest/force-styles/tests/fix-timestep-gravity.yaml @@ -2,7 +2,7 @@ lammps_version: 17 Apr 2024 tags: generated date_generated: Fri Jun 7 18:18:25 2024 -epsilon: 2e-14 +epsilon: 5e-14 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-heat.yaml b/unittest/force-styles/tests/fix-timestep-heat.yaml index 80b679aa1f..563ebf4d97 100644 --- a/unittest/force-styles/tests/fix-timestep-heat.yaml +++ b/unittest/force-styles/tests/fix-timestep-heat.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:58 2022 -epsilon: 2e-14 +epsilon: 5e-14 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-shake_bond.yaml b/unittest/force-styles/tests/fix-timestep-shake_bond.yaml index 49ac1c050a..62230508a4 100644 --- a/unittest/force-styles/tests/fix-timestep-shake_bond.yaml +++ b/unittest/force-styles/tests/fix-timestep-shake_bond.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:18:01 2022 -epsilon: 5e-11 +epsilon: 2e-10 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-smd_couple.yaml b/unittest/force-styles/tests/fix-timestep-smd_couple.yaml index 9b9c5d93bf..3b8d74bffa 100644 --- a/unittest/force-styles/tests/fix-timestep-smd_couple.yaml +++ b/unittest/force-styles/tests/fix-timestep-smd_couple.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:18:01 2022 -epsilon: 2e-14 +epsilon: 1e-13 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-spring_tether.yaml b/unittest/force-styles/tests/fix-timestep-spring_tether.yaml index 4786031d3d..99016d6b5d 100644 --- a/unittest/force-styles/tests/fix-timestep-spring_tether.yaml +++ b/unittest/force-styles/tests/fix-timestep-spring_tether.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:18:01 2022 -epsilon: 2e-14 +epsilon: 1e-13 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-wall_lj126_const.yaml b/unittest/force-styles/tests/fix-timestep-wall_lj126_const.yaml index e0b8bef40f..c7089a2592 100644 --- a/unittest/force-styles/tests/fix-timestep-wall_lj126_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-wall_lj126_const.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:18:01 2022 -epsilon: 2e-14 +epsilon: 1e-13 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/kspace-ewald_conp_charge.yaml b/unittest/force-styles/tests/kspace-ewald_conp_charge.yaml index 9bc190a766..bf6b922151 100644 --- a/unittest/force-styles/tests/kspace-ewald_conp_charge.yaml +++ b/unittest/force-styles/tests/kspace-ewald_conp_charge.yaml @@ -1,7 +1,7 @@ --- lammps_version: 7 Feb 2024 date_generated: Mon Mar 4 09:44:30 2024 -epsilon: 1e-12 +epsilon: 2e-12 skip_tests: gpu kokkos_omp omp prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/manybody-pair-uf3.yaml b/unittest/force-styles/tests/manybody-pair-uf3.yaml index 534b489c78..c5fa99aa84 100644 --- a/unittest/force-styles/tests/manybody-pair-uf3.yaml +++ b/unittest/force-styles/tests/manybody-pair-uf3.yaml @@ -2,7 +2,7 @@ lammps_version: 24 Mar 2022 tags: date_generated: Tue Nov 28 14:51:03 2023 -epsilon: 1e-09 +epsilon: 2e-09 skip_tests: prerequisites: ! | pair uf3 diff --git a/unittest/force-styles/tests/mol-pair-coul_diel.yaml b/unittest/force-styles/tests/mol-pair-coul_diel.yaml index ed63f961c7..9926d78d06 100644 --- a/unittest/force-styles/tests/mol-pair-coul_diel.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_diel.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:29 2022 -epsilon: 2e-13 +epsilon: 2.5e-13 skip_tests: prerequisites: ! | atom full From 248070c4b8d05c362f724b7f797b2ed9a6a0c322 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 02:40:42 -0400 Subject: [PATCH 06/42] use -fp-model precise for IntelLLVM to avoid miscompilation --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index afae18745f..356d98136b 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -118,7 +118,7 @@ endif() # silence excessive warnings for new Intel Compilers if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") - set(CMAKE_TUNE_DEFAULT "-Wno-tautological-constant-compare -Wno-unused-command-line-argument") + set(CMAKE_TUNE_DEFAULT "-fp-model precise -Wno-tautological-constant-compare -Wno-unused-command-line-argument") endif() # silence excessive warnings for PGI/NVHPC compilers From e4dcdcd221c5d8e2d59bf8fd6b8b74c886b31803 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 03:05:04 -0400 Subject: [PATCH 07/42] skip KokkosOpenMP tests when Kokkos includes GPU support --- unittest/force-styles/test_angle_style.cpp | 4 ++++ unittest/force-styles/test_bond_style.cpp | 4 ++++ unittest/force-styles/test_dihedral_style.cpp | 4 ++++ unittest/force-styles/test_fix_timestep.cpp | 4 ++++ unittest/force-styles/test_improper_style.cpp | 4 ++++ unittest/force-styles/test_pair_style.cpp | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/unittest/force-styles/test_angle_style.cpp b/unittest/force-styles/test_angle_style.cpp index e07ec3b689..ebd8170b7c 100644 --- a/unittest/force-styles/test_angle_style.cpp +++ b/unittest/force-styles/test_angle_style.cpp @@ -537,6 +537,10 @@ TEST(AngleStyle, kokkos_omp) if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP(); if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP(); + // if KOKKOS has GPU support enabled, it *must* be used. We cannot test OpenMP only. + if (Info::has_accelerator_feature("KOKKOS", "api", "cuda") || + Info::has_accelerator_feature("KOKKOS", "api", "hip") || + Info::has_accelerator_feature("KOKKOS", "api", "sycl")) GTEST_SKIP(); LAMMPS::argv args = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite", "-k", "on", "t", "4", "-sf", "kk"}; diff --git a/unittest/force-styles/test_bond_style.cpp b/unittest/force-styles/test_bond_style.cpp index 39316ec035..4a3a985ffc 100644 --- a/unittest/force-styles/test_bond_style.cpp +++ b/unittest/force-styles/test_bond_style.cpp @@ -539,6 +539,10 @@ TEST(BondStyle, kokkos_omp) if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP(); if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP(); + // if KOKKOS has GPU support enabled, it *must* be used. We cannot test OpenMP only. + if (Info::has_accelerator_feature("KOKKOS", "api", "cuda") || + Info::has_accelerator_feature("KOKKOS", "api", "hip") || + Info::has_accelerator_feature("KOKKOS", "api", "sycl")) GTEST_SKIP(); LAMMPS::argv args = {"BondStyle", "-log", "none", "-echo", "screen", "-nocite", "-k", "on", "t", "4", "-sf", "kk"}; diff --git a/unittest/force-styles/test_dihedral_style.cpp b/unittest/force-styles/test_dihedral_style.cpp index deda7ffbfd..b538c45f42 100644 --- a/unittest/force-styles/test_dihedral_style.cpp +++ b/unittest/force-styles/test_dihedral_style.cpp @@ -541,6 +541,10 @@ TEST(DihedralStyle, kokkos_omp) if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP(); if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP(); + // if KOKKOS has GPU support enabled, it *must* be used. We cannot test OpenMP only. + if (Info::has_accelerator_feature("KOKKOS", "api", "cuda") || + Info::has_accelerator_feature("KOKKOS", "api", "hip") || + Info::has_accelerator_feature("KOKKOS", "api", "sycl")) GTEST_SKIP(); LAMMPS::argv args = {"DihedralStyle", "-log", "none", "-echo", "screen", "-nocite", "-k", "on", "t", "4", diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index 7d12d0b20c..069f07abad 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -857,6 +857,10 @@ TEST(FixTimestep, kokkos_omp) if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP(); if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP(); + // if KOKKOS has GPU support enabled, it *must* be used. We cannot test OpenMP only. + if (Info::has_accelerator_feature("KOKKOS", "api", "cuda") || + Info::has_accelerator_feature("KOKKOS", "api", "hip") || + Info::has_accelerator_feature("KOKKOS", "api", "sycl")) GTEST_SKIP(); LAMMPS::argv args = {"FixTimestep", "-log", "none", "-echo", "screen", "-nocite", "-k", "on", "t", "4", "-sf", "kk"}; diff --git a/unittest/force-styles/test_improper_style.cpp b/unittest/force-styles/test_improper_style.cpp index bddb986d9c..cddb27a2f7 100644 --- a/unittest/force-styles/test_improper_style.cpp +++ b/unittest/force-styles/test_improper_style.cpp @@ -533,6 +533,10 @@ TEST(ImproperStyle, kokkos_omp) { if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP(); if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + // if KOKKOS has GPU support enabled, it *must* be used. We cannot test OpenMP only. + if (Info::has_accelerator_feature("KOKKOS", "api", "cuda") || + Info::has_accelerator_feature("KOKKOS", "api", "hip") || + Info::has_accelerator_feature("KOKKOS", "api", "sycl")) GTEST_SKIP(); LAMMPS::argv args = {"ImproperStyle", "-log", "none", "-echo", "screen", "-nocite", "-k", "on", "t", "4", diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 884d802aa5..bb1346fe70 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -633,6 +633,10 @@ TEST(PairStyle, kokkos_omp) if (!LAMMPS::is_installed_pkg("KOKKOS")) GTEST_SKIP(); if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); if (!Info::has_accelerator_feature("KOKKOS", "api", "openmp")) GTEST_SKIP(); + // if KOKKOS has GPU support enabled, it *must* be used. We cannot test OpenMP only. + if (Info::has_accelerator_feature("KOKKOS", "api", "cuda") || + Info::has_accelerator_feature("KOKKOS", "api", "hip") || + Info::has_accelerator_feature("KOKKOS", "api", "sycl")) GTEST_SKIP(); LAMMPS::argv args = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-k", "on", "t", "4", "-sf", "kk"}; From ca6e9abefaa53ff48320ac750fa59a7ff07a38f1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 03:37:33 -0400 Subject: [PATCH 08/42] update a few more tests for IntelLLVM --- unittest/force-styles/tests/manybody-pair-pace_product.yaml | 2 +- unittest/force-styles/tests/manybody-pair-pace_recursive.yaml | 2 +- unittest/force-styles/tests/manybody-pair-tersoff.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unittest/force-styles/tests/manybody-pair-pace_product.yaml b/unittest/force-styles/tests/manybody-pair-pace_product.yaml index b178586ab2..6db9f4220a 100644 --- a/unittest/force-styles/tests/manybody-pair-pace_product.yaml +++ b/unittest/force-styles/tests/manybody-pair-pace_product.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:48 2022 -epsilon: 5e-12 +epsilon: 7.5e-09 skip_tests: prerequisites: ! | pair pace diff --git a/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml b/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml index 6105debb67..61f7ce0ac9 100644 --- a/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml +++ b/unittest/force-styles/tests/manybody-pair-pace_recursive.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Mar 2021 date_generated: Wed Apr 7 19:30:07 2021 -epsilon: 5e-12 +epsilon: 7.5e-09 prerequisites: ! | pair pace pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-tersoff.yaml b/unittest/force-styles/tests/manybody-pair-tersoff.yaml index 1df552c043..8b9adecbad 100644 --- a/unittest/force-styles/tests/manybody-pair-tersoff.yaml +++ b/unittest/force-styles/tests/manybody-pair-tersoff.yaml @@ -2,7 +2,7 @@ lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:50 2022 epsilon: 2e-11 -skip_tests: +skip_tests: intel prerequisites: ! | pair tersoff pre_commands: ! | From c3c53705707bda8c5d7258eb84bf208232b7eda9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 03:38:25 -0400 Subject: [PATCH 09/42] use std::vector.data() to access the underlying arrays --- src/ELECTRODE/fix_electrode_conp.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index 30b01e3ba4..afdcab5dca 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -562,7 +562,7 @@ void FixElectrodeConp::setup_post_neighbor() if (mask[i] & group_bits[g]) { iele_to_group[tag_to_iele[tag[i]]] = g; } } } - MPI_Allreduce(MPI_IN_PLACE, &iele_to_group.front(), ngroup, MPI_INT, MPI_MAX, world); + MPI_Allreduce(MPI_IN_PLACE, iele_to_group.data(), ngroup, MPI_INT, MPI_MAX, world); memory->destroy(elastance); memory->destroy(capacitance); @@ -666,8 +666,8 @@ void FixElectrodeConp::invert() std::vector work(lwork); int info_rf, info_ri; - dgetrf_(&m, &n, &capacitance[0][0], &lda, &ipiv.front(), &info_rf); - dgetri_(&n, &capacitance[0][0], &lda, &ipiv.front(), &work.front(), &lwork, &info_ri); + dgetrf_(&m, &n, &capacitance[0][0], &lda, ipiv.data(), &info_rf); + dgetri_(&n, &capacitance[0][0], &lda, ipiv.data(), work.data(), &lwork, &info_ri); if (info_rf != 0 || info_ri != 0) error->all(FLERR, "CONP matrix inversion failed!"); MPI_Barrier(world); if (timer_flag && (comm->me == 0)) @@ -734,7 +734,7 @@ void FixElectrodeConp::setup_pre_exchange() // create_taglist for (int i = 1; i < nprocs; i++) { displs[i] = displs[i - 1] + recvcounts[i - 1]; } int const gnum = displs[nprocs - 1] + recvcounts[nprocs - 1]; std::vector taglist_all(gnum); - MPI_Allgatherv(&taglist_local_group.front(), gnum_local, MPI_LMP_TAGINT, &taglist_all.front(), + MPI_Allgatherv(taglist_local_group.data(), gnum_local, MPI_LMP_TAGINT, taglist_all.data(), recvcounts, displs, MPI_LMP_TAGINT, world); std::sort(taglist_all.begin(), taglist_all.end()); for (tagint t : taglist_all) taglist_bygroup.push_back(t); @@ -820,7 +820,7 @@ void FixElectrodeConp::compute_sd_vectors_ffield() } } for (int g = 0; g < num_of_groups; g++) { - MPI_Allreduce(MPI_IN_PLACE, &sd_vectors[g].front(), ngroup, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, sd_vectors[g].data(), ngroup, MPI_DOUBLE, MPI_SUM, world); } } @@ -879,7 +879,7 @@ void FixElectrodeConp::update_charges() q_local[i_iele] = q_tmp; sb_charges[iele_to_group[iele]] += q_tmp; } - MPI_Allreduce(MPI_IN_PLACE, &sb_charges.front(), num_of_groups, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, sb_charges.data(), num_of_groups, MPI_DOUBLE, MPI_SUM, world); update_psi(); // use for equal-style and conq if (qtotal_var_style != VarStyle::UNSET) update_psi_qtotal(); // use for qtotal; same for thermo @@ -981,7 +981,7 @@ std::vector FixElectrodeConp::gather_ngroup(std::vector x_local) int const iele = list_iele[i]; x[iele] = x_local[i]; } - MPI_Allreduce(MPI_IN_PLACE, &x.front(), ngroup, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, x.data(), ngroup, MPI_DOUBLE, MPI_SUM, world); return x; } @@ -1135,8 +1135,8 @@ void FixElectrodeConp::compute_macro_matrices() } int info_rf, info_ri; - dgetrf_(&m, &n, &tmp.front(), &lda, &ipiv.front(), &info_rf); - dgetri_(&n, &tmp.front(), &lda, &ipiv.front(), &work.front(), &lwork, &info_ri); + dgetrf_(&m, &n, tmp.data(), &lda, ipiv.data(), &info_rf); + dgetri_(&n, tmp.data(), &lda, ipiv.data(), work.data(), &lwork, &info_ri); if (info_rf != 0 || info_ri != 0) error->all(FLERR, "ELECTRODE macro matrix inversion failed!"); for (int i = 0; i < num_of_groups; i++) { for (int j = 0; j < num_of_groups; j++) { @@ -1433,8 +1433,8 @@ void FixElectrodeConp::request_etypes_neighlists() else elyt[type[i] - 1] += 1; } - MPI_Allreduce(MPI_IN_PLACE, &elec.front(), ntypes, MPI_INT, MPI_SUM, world); - MPI_Allreduce(MPI_IN_PLACE, &elyt.front(), ntypes, MPI_INT, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, elec.data(), ntypes, MPI_INT, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, elyt.data(), ntypes, MPI_INT, MPI_SUM, world); etypes.clear(); for (int i = 0; i < ntypes; i++) { if (!elec[i] == !elyt[i]) error->all(FLERR, "Types overlap, cannot use etypes keyword"); From 4da644958ebba05f91a4c37cd0c31c92eeaa377b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 03:39:00 -0400 Subject: [PATCH 10/42] IntelLLVM is not ABI compatible with generic BLAS libraries. Use linalg instead --- cmake/presets/oneapi.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/presets/oneapi.cmake b/cmake/presets/oneapi.cmake index 3671d42eee..d98817e4b0 100644 --- a/cmake/presets/oneapi.cmake +++ b/cmake/presets/oneapi.cmake @@ -6,3 +6,6 @@ set(CMAKE_Fortran_COMPILER "ifx" CACHE STRING "" FORCE) set(MPI_CXX "icpx" CACHE STRING "" FORCE) set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) +# force using internal BLAS/LAPCK since external ones may not be ABI compatible +set(USE_INTERNAL_LINALG ON CACHE BOOL "" FORCE) + From 45440abca4c9865dc2905558c6b326d9687ff4d9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 20:36:23 -0400 Subject: [PATCH 11/42] consistently use std::vector<>.data() to access the underlying data pointer --- src/ELECTRODE/boundary_correction.cpp | 6 +++--- src/ELECTRODE/ewald_electrode.cpp | 16 ++++++++-------- src/ELECTRODE/fix_electrode_conp.cpp | 5 +++-- src/ELECTRODE/fix_electrode_conq.cpp | 6 +++--- src/ELECTRODE/slab_2d.cpp | 18 +++++++++--------- src/ELECTRODE/slab_dipole.cpp | 4 ++-- src/ELECTRODE/wire_dipole.cpp | 8 ++++---- 7 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/ELECTRODE/boundary_correction.cpp b/src/ELECTRODE/boundary_correction.cpp index 1d4eb8e29c..06fa240201 100644 --- a/src/ELECTRODE/boundary_correction.cpp +++ b/src/ELECTRODE/boundary_correction.cpp @@ -37,7 +37,7 @@ std::vector BoundaryCorrection::gather_recvcounts(int n) { int const nprocs = comm->nprocs; std::vector recvcounts = std::vector(nprocs); - MPI_Allgather(&n, 1, MPI_INT, &recvcounts.front(), 1, MPI_INT, world); + MPI_Allgather(&n, 1, MPI_INT, recvcounts.data(), 1, MPI_INT, world); return recvcounts; } @@ -69,7 +69,7 @@ std::vector BoundaryCorrection::gather_jmat(bigint *imat) std::vector jmat = std::vector(ngroup); std::vector recvcounts = gather_recvcounts(ngrouplocal); std::vector displs = gather_displs(recvcounts); - MPI_Allgatherv(&jmat_local.front(), ngrouplocal, MPI_LMP_BIGINT, &jmat.front(), - &recvcounts.front(), &displs.front(), MPI_LMP_BIGINT, world); + MPI_Allgatherv(jmat_local.data(), ngrouplocal, MPI_LMP_BIGINT, jmat.data(), + recvcounts.data(), displs.data(), MPI_LMP_BIGINT, world); return jmat; } diff --git a/src/ELECTRODE/ewald_electrode.cpp b/src/ELECTRODE/ewald_electrode.cpp index d3af5db748..8ac5282a31 100644 --- a/src/ELECTRODE/ewald_electrode.cpp +++ b/src/ELECTRODE/ewald_electrode.cpp @@ -919,8 +919,8 @@ void EwaldElectrode::compute_vector(double *vec, int sensor_grpbit, int source_g q_sin[k] = q_sin_k; } - MPI_Allreduce(MPI_IN_PLACE, &q_cos.front(), kcount, MPI_DOUBLE, MPI_SUM, world); - MPI_Allreduce(MPI_IN_PLACE, &q_sin.front(), kcount, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, q_cos.data(), kcount, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, q_sin.data(), kcount, MPI_DOUBLE, MPI_SUM, world); for (int i = 0; i < nlocal; i++) { if (!(mask[i] & sensor_grpbit)) continue; @@ -1029,27 +1029,27 @@ void EwaldElectrode::compute_matrix(bigint *imat, double **matrix, bool /* timer displs[0] = 0; for (int i = 1; i < nprocs; i++) displs[i] = displs[i - 1] + recvcounts[i - 1]; MPI_Allgatherv(csx, n, MPI_DOUBLE, csx_all, recvcounts, displs, MPI_DOUBLE, world); - MPI_Allgatherv(&snx[0], n, MPI_DOUBLE, snx_all, recvcounts, displs, MPI_DOUBLE, world); + MPI_Allgatherv(snx, n, MPI_DOUBLE, snx_all, recvcounts, displs, MPI_DOUBLE, world); n = (kymax + 1) * ngrouplocal; MPI_Allgather(&n, 1, MPI_INT, recvcounts, 1, MPI_INT, world); displs[0] = 0; for (int i = 1; i < nprocs; i++) displs[i] = displs[i - 1] + recvcounts[i - 1]; - MPI_Allgatherv(&csy[0], n, MPI_DOUBLE, csy_all, recvcounts, displs, MPI_DOUBLE, world); - MPI_Allgatherv(&sny[0], n, MPI_DOUBLE, sny_all, recvcounts, displs, MPI_DOUBLE, world); + MPI_Allgatherv(csy, n, MPI_DOUBLE, csy_all, recvcounts, displs, MPI_DOUBLE, world); + MPI_Allgatherv(sny, n, MPI_DOUBLE, sny_all, recvcounts, displs, MPI_DOUBLE, world); n = (kzmax + 1) * ngrouplocal; MPI_Allgather(&n, 1, MPI_INT, recvcounts, 1, MPI_INT, world); displs[0] = 0; for (int i = 1; i < nprocs; i++) displs[i] = displs[i - 1] + recvcounts[i - 1]; - MPI_Allgatherv(&csz[0], n, MPI_DOUBLE, csz_all, recvcounts, displs, MPI_DOUBLE, world); - MPI_Allgatherv(&snz[0], n, MPI_DOUBLE, snz_all, recvcounts, displs, MPI_DOUBLE, world); + MPI_Allgatherv(csz, n, MPI_DOUBLE, csz_all, recvcounts, displs, MPI_DOUBLE, world); + MPI_Allgatherv(snz, n, MPI_DOUBLE, snz_all, recvcounts, displs, MPI_DOUBLE, world); // gather subsets global matrix indexing MPI_Allgather(&ngrouplocal, 1, MPI_INT, recvcounts, 1, MPI_INT, world); displs[0] = 0; for (int i = 1; i < nprocs; i++) displs[i] = displs[i - 1] + recvcounts[i - 1]; - MPI_Allgatherv(&jmat_local[0], ngrouplocal, MPI_LMP_BIGINT, jmat, recvcounts, displs, + MPI_Allgatherv(jmat_local, ngrouplocal, MPI_LMP_BIGINT, jmat, recvcounts, displs, MPI_LMP_BIGINT, world); memory->destroy(displs); diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index afdcab5dca..a50984fe17 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -645,7 +645,8 @@ void FixElectrodeConp::setup_post_neighbor() void FixElectrodeConp::setup_pre_reverse(int eflag, int vflag) { if (pair->did_tally_callback() && (comm->me == 0)) - error->warning(FLERR, "Computation of virials in fix {} is incompatible with TALLY package", style); + error->warning(FLERR, "Computation of virials in fix {} is incompatible with TALLY package", + style); // correct forces for initial timestep ev_init(eflag, vflag); gausscorr(eflag, vflag, true); @@ -1537,7 +1538,7 @@ void FixElectrodeConp::gather_list_iele() int const nprocs = comm->nprocs; for (int i = 1; i < nprocs; i++) { displs[i] = displs[i - 1] + recvcounts[i - 1]; } - MPI_Allgatherv(&list_iele[0], nlocalele, MPI_INT, iele_gathered, recvcounts, displs, MPI_INT, + MPI_Allgatherv(list_iele.data(), nlocalele, MPI_INT, iele_gathered, recvcounts, displs, MPI_INT, world); } nlocalele_outdated = 0; diff --git a/src/ELECTRODE/fix_electrode_conq.cpp b/src/ELECTRODE/fix_electrode_conq.cpp index 34a5c7e1c1..5e88ac502d 100644 --- a/src/ELECTRODE/fix_electrode_conq.cpp +++ b/src/ELECTRODE/fix_electrode_conq.cpp @@ -85,7 +85,7 @@ std::vector FixElectrodeConq::constraint_correction(std::vector int const n = x.size(); auto sums = std::vector(num_of_groups, 0); for (int i = 0; i < n; i++) sums[iele_to_group_local[i]] += x[i]; - MPI_Allreduce(MPI_IN_PLACE, &sums.front(), num_of_groups, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, sums.data(), num_of_groups, MPI_DOUBLE, MPI_SUM, world); for (int g = 0; g < num_of_groups; g++) { sums[g] -= group_q[g]; sums[g] /= group->count(groups[g]); @@ -103,7 +103,7 @@ std::vector FixElectrodeConq::constraint_projection(std::vector int const n = x.size(); auto sums = std::vector(num_of_groups, 0); for (int i = 0; i < n; i++) sums[iele_to_group_local[i]] += x[i]; - MPI_Allreduce(MPI_IN_PLACE, &sums.front(), num_of_groups, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, sums.data(), num_of_groups, MPI_DOUBLE, MPI_SUM, world); for (int g = 0; g < num_of_groups; g++) sums[g] /= group->count(groups[g]); for (int i = 0; i < n; i++) x[i] -= sums[iele_to_group_local[i]]; return x; @@ -119,6 +119,6 @@ void FixElectrodeConq::recompute_potential(std::vector b, std::vector(num_of_groups, 0); for (int i = 0; i < n; i++) { psi_sums[iele_to_group_local[i]] += (a[i] + b[i]) / evscale; } - MPI_Allreduce(MPI_IN_PLACE, &psi_sums.front(), num_of_groups, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(MPI_IN_PLACE, psi_sums.data(), num_of_groups, MPI_DOUBLE, MPI_SUM, world); for (int g = 0; g < num_of_groups; g++) group_psi[g] = psi_sums[g] / group->count(groups[g]); } diff --git a/src/ELECTRODE/slab_2d.cpp b/src/ELECTRODE/slab_2d.cpp index 12045c28a3..71809c4d0f 100644 --- a/src/ELECTRODE/slab_2d.cpp +++ b/src/ELECTRODE/slab_2d.cpp @@ -50,10 +50,10 @@ void Slab2d::compute_corr(double /*qsum*/, int eflag_atom, int eflag_global, dou std::vector q_all = std::vector(natoms); std::vector recvcounts = gather_recvcounts(nlocal); std::vector displs = gather_displs(recvcounts); - MPI_Allgatherv(q, nlocal, MPI_DOUBLE, &q_all.front(), &recvcounts.front(), &displs.front(), + MPI_Allgatherv(q, nlocal, MPI_DOUBLE, q_all.data(), recvcounts.data(), displs.data(), MPI_DOUBLE, world); - MPI_Allgatherv(&z.front(), nlocal, MPI_DOUBLE, &z_all.front(), &recvcounts.front(), - &displs.front(), MPI_DOUBLE, world); + MPI_Allgatherv(z.data(), nlocal, MPI_DOUBLE, z_all.data(), recvcounts.data(), + displs.data(), MPI_DOUBLE, world); const double g_ewald_inv = 1.0 / g_ewald; double const scale = 1.0; @@ -106,10 +106,10 @@ void Slab2d::vector_corr(double *vec, int sensor_grpbit, int source_grpbit, bool std::vector q_all = std::vector(n_electrolyte); std::vector recvcounts = gather_recvcounts(n_electrolyte_local); std::vector displs = gather_displs(recvcounts); - MPI_Allgatherv(&z_local.front(), n_electrolyte_local, MPI_DOUBLE, &z_all.front(), - &recvcounts.front(), &displs.front(), MPI_DOUBLE, world); - MPI_Allgatherv(&q_local.front(), n_electrolyte_local, MPI_DOUBLE, &q_all.front(), - &recvcounts.front(), &displs.front(), MPI_DOUBLE, world); + MPI_Allgatherv(z_local.data(), n_electrolyte_local, MPI_DOUBLE, z_all.data(), + recvcounts.data(), displs.data(), MPI_DOUBLE, world); + MPI_Allgatherv(q_local.data(), n_electrolyte_local, MPI_DOUBLE, q_all.data(), + recvcounts.data(), displs.data(), MPI_DOUBLE, world); double const g_ewald = force->kspace->g_ewald; double const area = domain->xprd * domain->yprd; double const prefac = 2 * MY_PIS / area; @@ -152,8 +152,8 @@ void Slab2d::matrix_corr(bigint *imat, double **matrix) std::vector recvcounts = gather_recvcounts(ngrouplocal); std::vector displs = gather_displs(recvcounts); std::vector nprd_all = std::vector(ngroup); - MPI_Allgatherv(&nprd_local.front(), ngrouplocal, MPI_DOUBLE, &nprd_all.front(), - &recvcounts.front(), &displs.front(), MPI_DOUBLE, world); + MPI_Allgatherv(nprd_local.data(), ngrouplocal, MPI_DOUBLE, nprd_all.data(), + recvcounts.data(), displs.data(), MPI_DOUBLE, world); double const g_ewald = force->kspace->g_ewald; const double g_ewald_inv = 1.0 / g_ewald; diff --git a/src/ELECTRODE/slab_dipole.cpp b/src/ELECTRODE/slab_dipole.cpp index 07beeccd0e..5ea151c0e8 100644 --- a/src/ELECTRODE/slab_dipole.cpp +++ b/src/ELECTRODE/slab_dipole.cpp @@ -131,8 +131,8 @@ void SlabDipole::matrix_corr(bigint *imat, double **matrix) std::vector recvcounts = gather_recvcounts(ngrouplocal); std::vector displs = gather_displs(recvcounts); std::vector nprd_all = std::vector(ngroup); - MPI_Allgatherv(&nprd_local.front(), ngrouplocal, MPI_DOUBLE, &nprd_all.front(), - &recvcounts.front(), &displs.front(), MPI_DOUBLE, world); + MPI_Allgatherv(nprd_local.data(), ngrouplocal, MPI_DOUBLE, nprd_all.data(), + recvcounts.data(), displs.data(), MPI_DOUBLE, world); std::vector jmat = gather_jmat(imat); const double prefac = MY_4PI / volume; diff --git a/src/ELECTRODE/wire_dipole.cpp b/src/ELECTRODE/wire_dipole.cpp index cbe162a456..ea26b2f4b5 100644 --- a/src/ELECTRODE/wire_dipole.cpp +++ b/src/ELECTRODE/wire_dipole.cpp @@ -142,10 +142,10 @@ void WireDipole::matrix_corr(bigint *imat, double **matrix) std::vector displs = gather_displs(recvcounts); std::vector xprd_all = std::vector(ngroup); std::vector yprd_all = std::vector(ngroup); - MPI_Allgatherv(&xprd_local.front(), ngrouplocal, MPI_DOUBLE, &xprd_all.front(), - &recvcounts.front(), &displs.front(), MPI_DOUBLE, world); - MPI_Allgatherv(&yprd_local.front(), ngrouplocal, MPI_DOUBLE, &yprd_all.front(), - &recvcounts.front(), &displs.front(), MPI_DOUBLE, world); + MPI_Allgatherv(xprd_local.data(), ngrouplocal, MPI_DOUBLE, xprd_all.data(), + recvcounts.data(), displs.data(), MPI_DOUBLE, world); + MPI_Allgatherv(yprd_local.data(), ngrouplocal, MPI_DOUBLE, yprd_all.data(), + recvcounts.data(), displs.data(), MPI_DOUBLE, world); std::vector jmat = gather_jmat(imat); const double prefac = MY_2PI / volume; From e142ad8dfa1c88b07e5dd3b0c96e788a73570584 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 21:55:24 -0400 Subject: [PATCH 12/42] apply clang-format --- src/ELECTRODE/boundary_correction.cpp | 4 ++-- src/ELECTRODE/boundary_correction.h | 6 +++--- src/ELECTRODE/ewald_electrode.cpp | 4 ++-- src/ELECTRODE/fix_electrode_conp.h | 2 +- src/ELECTRODE/slab_2d.cpp | 20 ++++++++++---------- src/ELECTRODE/slab_dipole.cpp | 6 +++--- src/ELECTRODE/wire_dipole.cpp | 10 +++++----- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/ELECTRODE/boundary_correction.cpp b/src/ELECTRODE/boundary_correction.cpp index 06fa240201..d139307829 100644 --- a/src/ELECTRODE/boundary_correction.cpp +++ b/src/ELECTRODE/boundary_correction.cpp @@ -69,7 +69,7 @@ std::vector BoundaryCorrection::gather_jmat(bigint *imat) std::vector jmat = std::vector(ngroup); std::vector recvcounts = gather_recvcounts(ngrouplocal); std::vector displs = gather_displs(recvcounts); - MPI_Allgatherv(jmat_local.data(), ngrouplocal, MPI_LMP_BIGINT, jmat.data(), - recvcounts.data(), displs.data(), MPI_LMP_BIGINT, world); + MPI_Allgatherv(jmat_local.data(), ngrouplocal, MPI_LMP_BIGINT, jmat.data(), recvcounts.data(), + displs.data(), MPI_LMP_BIGINT, world); return jmat; } diff --git a/src/ELECTRODE/boundary_correction.h b/src/ELECTRODE/boundary_correction.h index 615e1d4343..9a8a620165 100644 --- a/src/ELECTRODE/boundary_correction.h +++ b/src/ELECTRODE/boundary_correction.h @@ -25,9 +25,9 @@ namespace LAMMPS_NS { class BoundaryCorrection : protected Pointers { public: BoundaryCorrection(LAMMPS *); - virtual void vector_corr(double *, int, int, bool){}; - virtual void matrix_corr(bigint *, double **){}; - virtual void compute_corr(double, int, int, double &, double *){}; + virtual void vector_corr(double *, int, int, bool) {}; + virtual void matrix_corr(bigint *, double **) {}; + virtual void compute_corr(double, int, int, double &, double *) {}; protected: double get_volume(); diff --git a/src/ELECTRODE/ewald_electrode.cpp b/src/ELECTRODE/ewald_electrode.cpp index 8ac5282a31..78b5309815 100644 --- a/src/ELECTRODE/ewald_electrode.cpp +++ b/src/ELECTRODE/ewald_electrode.cpp @@ -1049,8 +1049,8 @@ void EwaldElectrode::compute_matrix(bigint *imat, double **matrix, bool /* timer MPI_Allgather(&ngrouplocal, 1, MPI_INT, recvcounts, 1, MPI_INT, world); displs[0] = 0; for (int i = 1; i < nprocs; i++) displs[i] = displs[i - 1] + recvcounts[i - 1]; - MPI_Allgatherv(jmat_local, ngrouplocal, MPI_LMP_BIGINT, jmat, recvcounts, displs, - MPI_LMP_BIGINT, world); + MPI_Allgatherv(jmat_local, ngrouplocal, MPI_LMP_BIGINT, jmat, recvcounts, displs, MPI_LMP_BIGINT, + world); memory->destroy(displs); memory->destroy(recvcounts); diff --git a/src/ELECTRODE/fix_electrode_conp.h b/src/ELECTRODE/fix_electrode_conp.h index ca76274c7f..bff5f0789d 100644 --- a/src/ELECTRODE/fix_electrode_conp.h +++ b/src/ELECTRODE/fix_electrode_conp.h @@ -72,7 +72,7 @@ class FixElectrodeConp : public Fix { enum class Algo { MATRIX_INV, MATRIX_CG, CG }; enum class VarStyle { CONST, EQUAL, UNSET }; virtual void update_psi(); - virtual void pre_update(){}; + virtual void pre_update() {}; virtual void recompute_potential(std::vector, std::vector){}; virtual std::vector constraint_projection(std::vector); virtual std::vector constraint_correction(std::vector); diff --git a/src/ELECTRODE/slab_2d.cpp b/src/ELECTRODE/slab_2d.cpp index 71809c4d0f..942e73a303 100644 --- a/src/ELECTRODE/slab_2d.cpp +++ b/src/ELECTRODE/slab_2d.cpp @@ -32,7 +32,7 @@ using namespace MathConst; Slab-geometry correction term (k=0) of EW2D. See Hu, JCTC 10:12 (2014) pp. 5254-5264 or metalwalls ewald and parallelization documentation. ------------------------------------------------------------------------- */ -Slab2d::Slab2d(LAMMPS *lmp) : BoundaryCorrection(lmp){}; +Slab2d::Slab2d(LAMMPS *lmp) : BoundaryCorrection(lmp) {}; void Slab2d::compute_corr(double /*qsum*/, int eflag_atom, int eflag_global, double &energy, double *eatom) @@ -50,10 +50,10 @@ void Slab2d::compute_corr(double /*qsum*/, int eflag_atom, int eflag_global, dou std::vector q_all = std::vector(natoms); std::vector recvcounts = gather_recvcounts(nlocal); std::vector displs = gather_displs(recvcounts); - MPI_Allgatherv(q, nlocal, MPI_DOUBLE, q_all.data(), recvcounts.data(), displs.data(), + MPI_Allgatherv(q, nlocal, MPI_DOUBLE, q_all.data(), recvcounts.data(), displs.data(), MPI_DOUBLE, + world); + MPI_Allgatherv(z.data(), nlocal, MPI_DOUBLE, z_all.data(), recvcounts.data(), displs.data(), MPI_DOUBLE, world); - MPI_Allgatherv(z.data(), nlocal, MPI_DOUBLE, z_all.data(), recvcounts.data(), - displs.data(), MPI_DOUBLE, world); const double g_ewald_inv = 1.0 / g_ewald; double const scale = 1.0; @@ -106,10 +106,10 @@ void Slab2d::vector_corr(double *vec, int sensor_grpbit, int source_grpbit, bool std::vector q_all = std::vector(n_electrolyte); std::vector recvcounts = gather_recvcounts(n_electrolyte_local); std::vector displs = gather_displs(recvcounts); - MPI_Allgatherv(z_local.data(), n_electrolyte_local, MPI_DOUBLE, z_all.data(), - recvcounts.data(), displs.data(), MPI_DOUBLE, world); - MPI_Allgatherv(q_local.data(), n_electrolyte_local, MPI_DOUBLE, q_all.data(), - recvcounts.data(), displs.data(), MPI_DOUBLE, world); + MPI_Allgatherv(z_local.data(), n_electrolyte_local, MPI_DOUBLE, z_all.data(), recvcounts.data(), + displs.data(), MPI_DOUBLE, world); + MPI_Allgatherv(q_local.data(), n_electrolyte_local, MPI_DOUBLE, q_all.data(), recvcounts.data(), + displs.data(), MPI_DOUBLE, world); double const g_ewald = force->kspace->g_ewald; double const area = domain->xprd * domain->yprd; double const prefac = 2 * MY_PIS / area; @@ -152,8 +152,8 @@ void Slab2d::matrix_corr(bigint *imat, double **matrix) std::vector recvcounts = gather_recvcounts(ngrouplocal); std::vector displs = gather_displs(recvcounts); std::vector nprd_all = std::vector(ngroup); - MPI_Allgatherv(nprd_local.data(), ngrouplocal, MPI_DOUBLE, nprd_all.data(), - recvcounts.data(), displs.data(), MPI_DOUBLE, world); + MPI_Allgatherv(nprd_local.data(), ngrouplocal, MPI_DOUBLE, nprd_all.data(), recvcounts.data(), + displs.data(), MPI_DOUBLE, world); double const g_ewald = force->kspace->g_ewald; const double g_ewald_inv = 1.0 / g_ewald; diff --git a/src/ELECTRODE/slab_dipole.cpp b/src/ELECTRODE/slab_dipole.cpp index 5ea151c0e8..de250715fd 100644 --- a/src/ELECTRODE/slab_dipole.cpp +++ b/src/ELECTRODE/slab_dipole.cpp @@ -38,7 +38,7 @@ static constexpr double SMALL = 0.00001; extended to non-neutral systems (J. Chem. Phys. 131, 094107). ------------------------------------------------------------------------- */ -SlabDipole::SlabDipole(LAMMPS *lmp) : BoundaryCorrection(lmp){}; +SlabDipole::SlabDipole(LAMMPS *lmp) : BoundaryCorrection(lmp) {}; void SlabDipole::compute_corr(double qsum, int eflag_atom, int eflag_global, double &energy, double *eatom) @@ -131,8 +131,8 @@ void SlabDipole::matrix_corr(bigint *imat, double **matrix) std::vector recvcounts = gather_recvcounts(ngrouplocal); std::vector displs = gather_displs(recvcounts); std::vector nprd_all = std::vector(ngroup); - MPI_Allgatherv(nprd_local.data(), ngrouplocal, MPI_DOUBLE, nprd_all.data(), - recvcounts.data(), displs.data(), MPI_DOUBLE, world); + MPI_Allgatherv(nprd_local.data(), ngrouplocal, MPI_DOUBLE, nprd_all.data(), recvcounts.data(), + displs.data(), MPI_DOUBLE, world); std::vector jmat = gather_jmat(imat); const double prefac = MY_4PI / volume; diff --git a/src/ELECTRODE/wire_dipole.cpp b/src/ELECTRODE/wire_dipole.cpp index ea26b2f4b5..b5fa0b97fb 100644 --- a/src/ELECTRODE/wire_dipole.cpp +++ b/src/ELECTRODE/wire_dipole.cpp @@ -32,7 +32,7 @@ using namespace MathConst; 704, 101). x and y are non-periodic. ------------------------------------------------------------------------- */ -WireDipole::WireDipole(LAMMPS *lmp) : BoundaryCorrection(lmp){}; +WireDipole::WireDipole(LAMMPS *lmp) : BoundaryCorrection(lmp) {}; void WireDipole::compute_corr(double /*qsum*/, int eflag_atom, int eflag_global, double &energy, double *eatom) @@ -142,10 +142,10 @@ void WireDipole::matrix_corr(bigint *imat, double **matrix) std::vector displs = gather_displs(recvcounts); std::vector xprd_all = std::vector(ngroup); std::vector yprd_all = std::vector(ngroup); - MPI_Allgatherv(xprd_local.data(), ngrouplocal, MPI_DOUBLE, xprd_all.data(), - recvcounts.data(), displs.data(), MPI_DOUBLE, world); - MPI_Allgatherv(yprd_local.data(), ngrouplocal, MPI_DOUBLE, yprd_all.data(), - recvcounts.data(), displs.data(), MPI_DOUBLE, world); + MPI_Allgatherv(xprd_local.data(), ngrouplocal, MPI_DOUBLE, xprd_all.data(), recvcounts.data(), + displs.data(), MPI_DOUBLE, world); + MPI_Allgatherv(yprd_local.data(), ngrouplocal, MPI_DOUBLE, yprd_all.data(), recvcounts.data(), + displs.data(), MPI_DOUBLE, world); std::vector jmat = gather_jmat(imat); const double prefac = MY_2PI / volume; From 6ab0b2c249317e43a5efa87ac1759943e67fa77f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 21:58:47 -0400 Subject: [PATCH 13/42] use std::vector<>.data() to access underlying pointer --- src/MC/fix_sgcmc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MC/fix_sgcmc.cpp b/src/MC/fix_sgcmc.cpp index 77ead0479f..a2115bd5f6 100644 --- a/src/MC/fix_sgcmc.cpp +++ b/src/MC/fix_sgcmc.cpp @@ -274,7 +274,7 @@ void FixSemiGrandCanonicalMC::init() // MPI sum to get global concentrations. speciesCounts.resize(atom->ntypes+1); - MPI_Allreduce(&localSpeciesCounts.front(), &speciesCounts.front(), localSpeciesCounts.size(), + MPI_Allreduce(localSpeciesCounts.data(), speciesCounts.data(), localSpeciesCounts.size(), MPI_INT, MPI_SUM, world); } @@ -411,7 +411,7 @@ void FixSemiGrandCanonicalMC::doMC() // semi-grandcanonical method. // MPI sum of total change in number of particles. - MPI_Allreduce(&deltaN.front(), &deltaNGlobal.front(), deltaN.size(), MPI_INT, MPI_SUM, world); + MPI_Allreduce(deltaN.data(), deltaNGlobal.data(), deltaN.size(), MPI_INT, MPI_SUM, world); // Perform outer MC acceptance test. // This is done in sync by all processors. @@ -476,7 +476,7 @@ void FixSemiGrandCanonicalMC::doMC() if (mask[i] & groupbit) localSpeciesCounts[*type]++; } - MPI_Allreduce(&localSpeciesCounts.front(), &speciesCounts.front(), localSpeciesCounts.size(), MPI_INT, MPI_SUM, world); + MPI_Allreduce(localSpeciesCounts.data(), speciesCounts.data(), localSpeciesCounts.size(), MPI_INT, MPI_SUM, world); } } From 719a64d9dd8d67fc9d5c286761cc844fa87bc7b5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 22:25:07 -0400 Subject: [PATCH 14/42] apply clang-format --- src/bond_hybrid.cpp | 9 +++--- src/compute_msd_chunk.cpp | 3 +- src/compute_reduce_region.cpp | 4 +-- src/create_atoms.cpp | 61 ++++++++++++++++++++++------------- src/create_box.cpp | 56 +++++++++++++++++++------------- src/delete_atoms.cpp | 6 ++-- src/dihedral_write.cpp | 3 +- src/fix_property_atom.cpp | 10 +++--- src/region_plane.cpp | 5 ++- 9 files changed, 93 insertions(+), 64 deletions(-) diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index bd5badb54c..d39af40904 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -96,8 +96,7 @@ void BondHybrid::compute(int eflag, int vflag) bondlist[m][n][0] = bondlist_orig[i][0]; bondlist[m][n][1] = bondlist_orig[i][1]; bondlist[m][n][2] = bondlist_orig[i][2]; - if (partial_flag) - orig_map[m][n] = i; + if (partial_flag) orig_map[m][n] = i; nbondlist[m]++; } } @@ -381,8 +380,10 @@ void BondHybrid::init_style() // bond style quartic will set broken bonds to bond type 0, so we need // to create an entry for it in the bond type to sub-style map - if (has_quartic >= 0) map[0] = has_quartic; - else map[0] = -1; + if (has_quartic >= 0) + map[0] = has_quartic; + else + map[0] = -1; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_msd_chunk.cpp b/src/compute_msd_chunk.cpp index 59aff980f1..d738b835fa 100644 --- a/src/compute_msd_chunk.cpp +++ b/src/compute_msd_chunk.cpp @@ -124,7 +124,8 @@ void ComputeMSDChunk::compute_array() // first time call, allocate per-chunk arrays // thereafter, require nchunk remain the same - if (firstflag) msdnchunk = nchunk; + if (firstflag) + msdnchunk = nchunk; else if (msdnchunk != nchunk) error->all(FLERR, "Compute msd/chunk nchunk is not static"); diff --git a/src/compute_reduce_region.cpp b/src/compute_reduce_region.cpp index bd850e902c..6347bfe4c9 100644 --- a/src/compute_reduce_region.cpp +++ b/src/compute_reduce_region.cpp @@ -34,7 +34,7 @@ ComputeReduceRegion::ComputeReduceRegion(LAMMPS *lmp, int narg, char **arg) : ComputeReduce(lmp, narg, arg) { if (input_mode == LOCAL) - error->all(FLERR,"Compute reduce/region cannot use local data as input"); + error->all(FLERR, "Compute reduce/region cannot use local data as input"); } /* ---------------------------------------------------------------------- @@ -150,7 +150,7 @@ double ComputeReduceRegion::compute_one(int m, int flag) one = fix_array[flag][aidxm1]; } - // evaluate atom-style variable + // evaluate atom-style variable } else if (val.which == ArgInfo::VARIABLE) { if (atom->nmax > maxatom) { diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index d6c402f721..ade6bdc3c1 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -114,7 +114,7 @@ void CreateAtoms::command(int narg, char **arg) xone[1] = utils::numeric(FLERR, arg[3], false, lmp); xone[2] = utils::numeric(FLERR, arg[4], false, lmp); if (domain->dimension == 2 && xone[2] != 0.0) - error->all(FLERR,"Create_atoms single for 2d simulation requires z coord = 0.0"); + error->all(FLERR, "Create_atoms single for 2d simulation requires z coord = 0.0"); iarg = 5; } else if (strcmp(arg[1], "random") == 0) { style = RANDOM; @@ -184,7 +184,8 @@ void CreateAtoms::command(int narg, char **arg) if (imol == -1) error->all(FLERR, "Molecule template ID {} for create_atoms does not exist", arg[iarg + 1]); if ((atom->molecules[imol]->nset > 1) && (comm->me == 0)) - error->warning(FLERR, "Molecule template for create_atoms has multiple molecule sets. " + error->warning(FLERR, + "Molecule template for create_atoms has multiple molecule sets. " "Only the first set will be used."); mode = MOLECULE; onemol = atom->molecules[imol]; @@ -371,9 +372,9 @@ void CreateAtoms::command(int narg, char **arg) if (scaleflag) { if (style == SINGLE) { - xone[0] *= domain->lattice->xlattice; - xone[1] *= domain->lattice->ylattice; - xone[2] *= domain->lattice->zlattice; + xone[0] *= domain->lattice->xlattice; + xone[1] *= domain->lattice->ylattice; + xone[2] *= domain->lattice->zlattice; } else if (style == RANDOM) { if (overlapflag) overlap *= domain->lattice->xlattice; } else if (style == MESH) { @@ -835,7 +836,7 @@ void CreateAtoms::add_random() } } else { if (comm->me == 0) get_xmol(xone); - MPI_Bcast(&xmol[0][0], onemol->natoms*3, MPI_DOUBLE, 0, world); + MPI_Bcast(&xmol[0][0], onemol->natoms * 3, MPI_DOUBLE, 0, world); for (int i = 0; i < nlocal; i++) { for (int j = 0; j < onemol->natoms; j++) { @@ -1207,9 +1208,10 @@ void CreateAtoms::add_lattice() // verify lattice was defined with triclinic/general option if (!domain->triclinic_general && domain->lattice->is_general_triclinic()) - error->all(FLERR,"Create_atoms for non general triclinic box cannot use triclinic/general lattice"); + error->all(FLERR, + "Create_atoms for non general triclinic box cannot use triclinic/general lattice"); if (domain->triclinic_general && !domain->lattice->is_general_triclinic()) - error->all(FLERR,"Create_atoms for general triclinic box requires triclinic/general lattice"); + error->all(FLERR, "Create_atoms for general triclinic box requires triclinic/general lattice"); // convert 8 corners of my subdomain from box coords to lattice coords // for orthogonal, use corner pts of my subbox @@ -1266,38 +1268,54 @@ void CreateAtoms::add_lattice() domain->lattice->bbox(1, bboxlo[0], bboxhi[1], bboxhi[2], xmin, ymin, zmin, xmax, ymax, zmax); domain->lattice->bbox(1, bboxhi[0], bboxhi[1], bboxhi[2], xmin, ymin, zmin, xmax, ymax, zmax); - // for general triclinic, convert 8 corner points of bbox to general triclinic coords - // new set of 8 points is no longer an orthogonal bounding box - // instead invoke lattice->bbox() on each of 8 points + // for general triclinic, convert 8 corner points of bbox to general triclinic coords + // new set of 8 points is no longer an orthogonal bounding box + // instead invoke lattice->bbox() on each of 8 points } else if (domain->triclinic_general) { double point[3]; - point[0] = bboxlo[0]; point[1] = bboxlo[1]; point[2] = bboxlo[2]; + point[0] = bboxlo[0]; + point[1] = bboxlo[1]; + point[2] = bboxlo[2]; domain->restricted_to_general_coords(point); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); - point[0] = bboxhi[0]; point[1] = bboxlo[1]; point[2] = bboxlo[2]; + point[0] = bboxhi[0]; + point[1] = bboxlo[1]; + point[2] = bboxlo[2]; domain->restricted_to_general_coords(point); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); - point[0] = bboxlo[0]; point[1] = bboxhi[1]; point[2] = bboxlo[2]; + point[0] = bboxlo[0]; + point[1] = bboxhi[1]; + point[2] = bboxlo[2]; domain->restricted_to_general_coords(point); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); - point[0] = bboxhi[0]; point[1] = bboxhi[1]; point[2] = bboxlo[2]; + point[0] = bboxhi[0]; + point[1] = bboxhi[1]; + point[2] = bboxlo[2]; domain->restricted_to_general_coords(point); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); - point[0] = bboxlo[0]; point[1] = bboxlo[1]; point[2] = bboxhi[2]; + point[0] = bboxlo[0]; + point[1] = bboxlo[1]; + point[2] = bboxhi[2]; domain->restricted_to_general_coords(point); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); - point[0] = bboxhi[0]; point[1] = bboxlo[1]; point[2] = bboxhi[2]; + point[0] = bboxhi[0]; + point[1] = bboxlo[1]; + point[2] = bboxhi[2]; domain->restricted_to_general_coords(point); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); - point[0] = bboxlo[0]; point[1] = bboxhi[1]; point[2] = bboxhi[2]; + point[0] = bboxlo[0]; + point[1] = bboxhi[1]; + point[2] = bboxhi[2]; domain->restricted_to_general_coords(point); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); - point[0] = bboxhi[0]; point[1] = bboxhi[1]; point[2] = bboxhi[2]; + point[0] = bboxhi[0]; + point[1] = bboxhi[1]; + point[2] = bboxhi[2]; domain->restricted_to_general_coords(point); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); } @@ -1419,7 +1437,7 @@ void CreateAtoms::loop_lattice(int action) domain->general_to_restricted_coords(x); if (dimension == 2) { if (fabs(x[2]) > EPS_ZCOORD) - error->all(FLERR,"Create_atoms atom z coord is non-zero for 2d simulation"); + error->all(FLERR, "Create_atoms atom z coord is non-zero for 2d simulation"); x[2] = 0.0; } } @@ -1510,8 +1528,7 @@ void CreateAtoms::get_xmol(double *center) for (int m = 0; m < natoms; m++) { MathExtra::matvec(rotmat, onemol->dx[m], xnew); MathExtra::add3(xnew, center, xnew); - for (int i = 0; i < 3; i++) - xmol[m][i] = xnew[i]; + for (int i = 0; i < 3; i++) xmol[m][i] = xnew[i]; } } diff --git a/src/create_box.cpp b/src/create_box.cpp index 8a74ffd7bd..93e699e06b 100644 --- a/src/create_box.cpp +++ b/src/create_box.cpp @@ -49,11 +49,13 @@ void CreateBox::command(int narg, char **arg) Region *region = nullptr; int triclinic_general = 0; - if (strcmp(arg[1],"NULL") == 0) triclinic_general = 1; + if (strcmp(arg[1], "NULL") == 0) + triclinic_general = 1; else { region = domain->get_region_by_id(arg[1]); if (!region) error->all(FLERR, "Create_box region {} does not exist", arg[1]); - if (region->bboxflag == 0) error->all(FLERR, "Create_box region does not support a bounding box"); + if (region->bboxflag == 0) + error->all(FLERR, "Create_box region does not support a bounding box"); region->init(); } @@ -77,9 +79,9 @@ void CreateBox::command(int narg, char **arg) domain->boxlo[2] = region->extent_zlo; domain->boxhi[2] = region->extent_zhi; - // region is prism - // seutp restricted triclinic box - // set simulation domain from prism params + // region is prism + // seutp restricted triclinic box + // set simulation domain from prism params } else { domain->triclinic = 1; @@ -97,17 +99,17 @@ void CreateBox::command(int narg, char **arg) if (domain->dimension == 2) { if (domain->boxlo[2] >= 0.0 || domain->boxhi[2] <= 0.0) - error->all(FLERR,"Create_box region zlo/zhi for 2d simulation must straddle 0.0"); + error->all(FLERR, "Create_box region zlo/zhi for 2d simulation must straddle 0.0"); } - // setup general triclinic box (with no region) - // read next box extent arguments to create ABC edge vectors + origin - // define_general_triclinic() converts - // ABC edge vectors + origin to restricted triclinic + // setup general triclinic box (with no region) + // read next box extent arguments to create ABC edge vectors + origin + // define_general_triclinic() converts + // ABC edge vectors + origin to restricted triclinic } else if (triclinic_general) { if (!domain->lattice->is_general_triclinic()) - error->all(FLERR,"Create_box for general triclinic requires triclnic/general lattice"); + error->all(FLERR, "Create_box for general triclinic requires triclnic/general lattice"); if (iarg + 6 > narg) utils::missing_cmd_args(FLERR, "create_box general triclinic", error); @@ -121,42 +123,50 @@ void CreateBox::command(int narg, char **arg) if (domain->dimension == 2) if (clo != -0.5 || chi != 0.5) - error->all(FLERR,"Create_box for general triclinic requires clo = -0.5 and chi = 0.5"); + error->all(FLERR, "Create_box for general triclinic requires clo = -0.5 and chi = 0.5"); // use lattice2box() to generate origin and ABC vectors // origin = abc lo // ABC vectors = hi in one dim - origin - double avec[3],bvec[3],cvec[3],origin[3]; - double px,py,pz; + double avec[3], bvec[3], cvec[3], origin[3]; + double px, py, pz; - px = alo; py = blo; pz = clo; - domain->lattice->lattice2box(px,py,pz); + px = alo; + py = blo; + pz = clo; + domain->lattice->lattice2box(px, py, pz); origin[0] = px; origin[1] = py; origin[2] = pz; - px = ahi; py = blo; pz = clo; - domain->lattice->lattice2box(px,py,pz); + px = ahi; + py = blo; + pz = clo; + domain->lattice->lattice2box(px, py, pz); avec[0] = px - origin[0]; avec[1] = py - origin[1]; avec[2] = pz - origin[2]; - px = alo; py = bhi; pz = clo; - domain->lattice->lattice2box(px,py,pz); + px = alo; + py = bhi; + pz = clo; + domain->lattice->lattice2box(px, py, pz); bvec[0] = px - origin[0]; bvec[1] = py - origin[1]; bvec[2] = pz - origin[2]; - px = alo; py = blo; pz = chi; - domain->lattice->lattice2box(px,py,pz); + px = alo; + py = blo; + pz = chi; + domain->lattice->lattice2box(px, py, pz); cvec[0] = px - origin[0]; cvec[1] = py - origin[1]; cvec[2] = pz - origin[2]; // define general triclinic box within Domain class - domain->define_general_triclinic(avec,bvec,cvec,origin); + domain->define_general_triclinic(avec, bvec, cvec, origin); } // if molecular, zero out topology info diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index 6f887a33e6..35f608461b 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -777,9 +777,9 @@ void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) bond_type[i][m] = bond_type[i][n - 1]; bond_atom[i][m] = bond_atom[i][n - 1]; if (n_histories > 0) - for (auto &ihistory: histories) { - dynamic_cast(ihistory)->shift_history(i,m,n-1); - dynamic_cast(ihistory)->delete_history(i,n-1); + for (auto &ihistory : histories) { + dynamic_cast(ihistory)->shift_history(i, m, n - 1); + dynamic_cast(ihistory)->delete_history(i, n - 1); } n--; } else diff --git a/src/dihedral_write.cpp b/src/dihedral_write.cpp index 1d0f908e2c..51041c46fc 100644 --- a/src/dihedral_write.cpp +++ b/src/dihedral_write.cpp @@ -149,8 +149,7 @@ void DihedralWrite::command(int narg, char **arg) FILE *coeffs; char line[MAXLINE] = {'\0'}; coeffs = fopen(coeffs_file.c_str(), "r"); - if (!coeffs) - error->one(FLERR, "Unable to open temporary file {}: {}", utils::getsyserror()); + if (!coeffs) error->one(FLERR, "Unable to open temporary file {}: {}", utils::getsyserror()); for (int i = 0; i < atom->ndihedraltypes; ++i) { utils::sfgets(FLERR, line, MAXLINE, coeffs, coeffs_file.c_str(), error); writer->input->one(fmt::format("dihedral_coeff {}", line)); diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 2cbdb44ab0..f88d6551b4 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -182,7 +182,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : // optional args while (iarg < narg) { - if (strcmp(arg[iarg], "ghost") == 0) { // skip here, since handled earlier + if (strcmp(arg[iarg], "ghost") == 0) { // skip here, since handled earlier iarg += 2; } else if (strcmp(arg[iarg], "writedata") == 0) { if (iarg + 2 > narg) error->all(FLERR, "Illegal fix property/atom command"); @@ -200,9 +200,12 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : int flag = 0; for (int i = 0; i < nvalue; i++) if (styles[i] == MOLECULE || styles[i] == CHARGE || styles[i] == RMASS || - styles[i] == TEMPERATURE || styles[i] == HEATFLOW) flag = 1; + styles[i] == TEMPERATURE || styles[i] == HEATFLOW) + flag = 1; if (flag && comm->me == 0) - error->warning(FLERR, "Fix property/atom mol, charge, rmass, temperature, or heatflow w/out ghost communication"); + error->warning(FLERR, + "Fix property/atom mol, charge, rmass, temperature, or heatflow w/out ghost " + "communication"); } // store current atom style @@ -216,7 +219,6 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : if (border) atom->add_callback(Atom::BORDER); } - /* ---------------------------------------------------------------------- */ void FixPropertyAtom::post_constructor() diff --git a/src/region_plane.cpp b/src/region_plane.cpp index 6dc162eead..11d96b8266 100644 --- a/src/region_plane.cpp +++ b/src/region_plane.cpp @@ -24,8 +24,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), - xstr(nullptr), ystr(nullptr), zstr(nullptr) +RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : + Region(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr) { xvar = yvar = zvar = 0.0; @@ -203,4 +203,3 @@ void RegPlane::variable_check() error->all(FLERR, "Variable {} for region plane is invalid style", zstr); } } - From 7da8748e90d2b7466a1676517756b81d297017b7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 5 Oct 2024 22:49:13 -0400 Subject: [PATCH 15/42] add region command to list of exceptions needing the accelerator include --- doc/utils/check-styles.py | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/utils/check-styles.py b/doc/utils/check-styles.py index 8a5dae538f..89c8920760 100644 --- a/doc/utils/check-styles.py +++ b/doc/utils/check-styles.py @@ -81,6 +81,7 @@ def require_accel_include(path): # handle exceptions if path == "src/min_style.rst" : needs = True if path == "src/atom_style.rst" : needs = True + if path == "src/region.rst" : needs = True # check file with open(path, 'r') as reader: for line in reader: From 25dfb03386b0577ad98a1419e8db6a13a46f0d72 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 6 Oct 2024 00:25:53 -0400 Subject: [PATCH 16/42] apply clang-format --- src/angle.h | 6 +++--- src/angle_write.h | 2 +- src/bond.h | 4 ++-- src/comm_brick.h | 2 +- src/comm_tiled.h | 14 +++++++------- src/command.h | 2 +- src/compute.h | 2 +- src/compute_chunk.h | 2 +- src/compute_dipole.h | 2 +- src/compute_global_atom.h | 2 +- src/deprecated.h | 2 +- src/dihedral.h | 4 ++-- src/dihedral_write.h | 2 +- src/domain.h | 15 +++++++-------- src/dump_atom.h | 6 +++--- src/dump_custom.h | 6 +++--- src/dump_image.h | 18 +++++++++--------- src/fix_indent.h | 8 ++++---- src/imbalance.h | 2 +- src/improper.h | 12 ++++++------ src/kspace.h | 14 +++++++------- src/lammps.h | 6 +++--- src/region_plane.h | 1 - src/set.h | 2 +- src/utils.h | 3 ++- src/variable.h | 4 ++-- src/write_coeff.h | 2 +- src/write_dump.h | 2 +- 28 files changed, 73 insertions(+), 74 deletions(-) diff --git a/src/angle.h b/src/angle.h index 759f1a1aa9..58ca188df5 100644 --- a/src/angle.h +++ b/src/angle.h @@ -52,12 +52,12 @@ class Angle : protected Pointers { virtual void compute(int, int) = 0; virtual void settings(int, char **); virtual void coeff(int, char **) = 0; - virtual void init_style(){}; + virtual void init_style() {}; virtual double equilibrium_angle(int) = 0; virtual void write_restart(FILE *) = 0; virtual void read_restart(FILE *) = 0; - virtual void write_restart_settings(FILE *){}; - virtual void read_restart_settings(FILE *){}; + virtual void write_restart_settings(FILE *) {}; + virtual void read_restart_settings(FILE *) {}; virtual void write_data(FILE *) {} virtual double single(int, int, int, int) = 0; virtual void born_matrix(int /*atype*/, int /*at1*/, int /*at2*/, int /*at3*/, double &du, diff --git a/src/angle_write.h b/src/angle_write.h index 5c56cd8efc..7496aa31fc 100644 --- a/src/angle_write.h +++ b/src/angle_write.h @@ -26,7 +26,7 @@ namespace LAMMPS_NS { class AngleWrite : public Command { public: - AngleWrite(class LAMMPS *lmp) : Command(lmp){}; + AngleWrite(class LAMMPS *lmp) : Command(lmp) {}; void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/bond.h b/src/bond.h index f52204662c..3b1740b2d4 100644 --- a/src/bond.h +++ b/src/bond.h @@ -61,8 +61,8 @@ class Bond : protected Pointers { virtual double equilibrium_distance(int) = 0; virtual void write_restart(FILE *) = 0; virtual void read_restart(FILE *) = 0; - virtual void write_restart_settings(FILE *){}; - virtual void read_restart_settings(FILE *){}; + virtual void write_restart_settings(FILE *) {}; + virtual void read_restart_settings(FILE *) {}; virtual void write_data(FILE *) {} virtual double single(int, double, int, int, double &) = 0; virtual double memory_usage(); diff --git a/src/comm_brick.h b/src/comm_brick.h index 518e290fa1..809b3856e4 100644 --- a/src/comm_brick.h +++ b/src/comm_brick.h @@ -44,7 +44,7 @@ class CommBrick : public Comm { void forward_comm(class Dump *) override; // forward comm from a Dump void reverse_comm(class Dump *) override; // reverse comm from a Dump - void forward_comm_array(int, double **) override; // forward comm of array + void forward_comm_array(int, double **) override; // forward comm of array void *extract(const char *, int &) override; double memory_usage() override; diff --git a/src/comm_tiled.h b/src/comm_tiled.h index 857cddf033..e150c710fc 100644 --- a/src/comm_tiled.h +++ b/src/comm_tiled.h @@ -44,7 +44,7 @@ class CommTiled : public Comm { void forward_comm(class Dump *) override; // forward comm from a Dump void reverse_comm(class Dump *) override; // reverse comm from a Dump - void forward_comm_array(int, double **) override; // forward comm of array + void forward_comm_array(int, double **) override; // forward comm of array void coord2proc_setup() override; int coord2proc(double *, int &, int &, int &) override; @@ -146,12 +146,12 @@ class CommTiled : public Comm { int point_drop_tiled_recurse(double *, int, int); int closer_subbox_edge(int, double *); - virtual void grow_send(int, int); // reallocate send buffer - virtual void grow_recv(int, int flag = 0); // free/allocate recv buffer - virtual void grow_list(int, int, int); // reallocate sendlist for one swap/proc - void allocate_swap(int); // allocate swap arrays - virtual void grow_swap_send(int, int, int); // grow swap arrays for send and recv - void grow_swap_send_multi(int, int); // grow multi swap arrays for send and recv + virtual void grow_send(int, int); // reallocate send buffer + virtual void grow_recv(int, int flag = 0); // free/allocate recv buffer + virtual void grow_list(int, int, int); // reallocate sendlist for one swap/proc + void allocate_swap(int); // allocate swap arrays + virtual void grow_swap_send(int, int, int); // grow swap arrays for send and recv + void grow_swap_send_multi(int, int); // grow multi swap arrays for send and recv void grow_swap_recv(int, int); void deallocate_swap(int); // deallocate swap arrays }; diff --git a/src/command.h b/src/command.h index 1b5cea5ccb..23f315fc27 100644 --- a/src/command.h +++ b/src/command.h @@ -20,7 +20,7 @@ namespace LAMMPS_NS { class Command : protected Pointers { public: - Command(class LAMMPS *lmp) : Pointers(lmp){}; + Command(class LAMMPS *lmp) : Pointers(lmp) {}; virtual void command(int, char **) = 0; }; diff --git a/src/compute.h b/src/compute.h index 50c69d8d01..0b077d7695 100644 --- a/src/compute.h +++ b/src/compute.h @@ -132,7 +132,7 @@ class Compute : protected Pointers { virtual int pack_reverse_comm(int, int, double *) { return 0; } virtual void unpack_reverse_comm(int, int *, double *) {} - virtual void reset_grid(){}; + virtual void reset_grid() {}; virtual int get_grid_by_name(const std::string &, int &) { return -1; }; virtual void *get_grid_by_index(int) { return nullptr; }; diff --git a/src/compute_chunk.h b/src/compute_chunk.h index 0c94f00bb0..a53cfa6746 100644 --- a/src/compute_chunk.h +++ b/src/compute_chunk.h @@ -43,7 +43,7 @@ class ComputeChunk : public Compute { int firstflag, massneed; ComputeChunkAtom *cchunk; - virtual void allocate(){}; + virtual void allocate() {}; }; } // namespace LAMMPS_NS #endif diff --git a/src/compute_dipole.h b/src/compute_dipole.h index c6ab891d6f..701c60ba06 100644 --- a/src/compute_dipole.h +++ b/src/compute_dipole.h @@ -28,7 +28,7 @@ class ComputeDipole : public Compute { public: ComputeDipole(class LAMMPS *, int, char **); ~ComputeDipole() override; - void init() override{}; + void init() override {}; void compute_vector() override; double compute_scalar() override; diff --git a/src/compute_global_atom.h b/src/compute_global_atom.h index 3a4808bddd..b8d49bf7a5 100644 --- a/src/compute_global_atom.h +++ b/src/compute_global_atom.h @@ -33,7 +33,7 @@ class ComputeGlobalAtom : public Compute { double memory_usage() override; protected: - struct value_t { + struct value_t { int which; int argindex; std::string id; diff --git a/src/deprecated.h b/src/deprecated.h index 085bf5d47d..acb22e9531 100644 --- a/src/deprecated.h +++ b/src/deprecated.h @@ -37,7 +37,7 @@ namespace LAMMPS_NS { class Deprecated : public Command { public: - Deprecated(class LAMMPS *lmp) : Command(lmp){}; + Deprecated(class LAMMPS *lmp) : Command(lmp) {}; void command(int, char **) override; }; diff --git a/src/dihedral.h b/src/dihedral.h index 34210929cd..03a5690a49 100644 --- a/src/dihedral.h +++ b/src/dihedral.h @@ -52,8 +52,8 @@ class Dihedral : protected Pointers { virtual void coeff(int, char **) = 0; virtual void write_restart(FILE *) = 0; virtual void read_restart(FILE *) = 0; - virtual void write_restart_settings(FILE *){}; - virtual void read_restart_settings(FILE *){}; + virtual void write_restart_settings(FILE *) {}; + virtual void read_restart_settings(FILE *) {}; virtual void write_data(FILE *) {} virtual double memory_usage(); virtual void born_matrix(int /*dtype*/, int /*at1*/, int /*at2*/, int /*at3*/, int /*at4*/, diff --git a/src/dihedral_write.h b/src/dihedral_write.h index b17f8d19da..aa4d264fe8 100644 --- a/src/dihedral_write.h +++ b/src/dihedral_write.h @@ -26,7 +26,7 @@ namespace LAMMPS_NS { class DihedralWrite : public Command { public: - DihedralWrite(class LAMMPS *lmp) : Command(lmp){}; + DihedralWrite(class LAMMPS *lmp) : Command(lmp) {}; void command(int, char **) override; }; } // namespace LAMMPS_NS diff --git a/src/domain.h b/src/domain.h index 170156664f..9c745f05b8 100644 --- a/src/domain.h +++ b/src/domain.h @@ -39,8 +39,8 @@ class Domain : protected Pointers { // 2 = shrink-wrap non-periodic // 3 = shrink-wrap non-per w/ min - int triclinic; // 0 = orthog box, 1 = triclinic (restricted or general) - int triclinic_general; // 1 if general <-> restricted tri mapping is stored, 0 if not + int triclinic; // 0 = orthog box, 1 = triclinic (restricted or general) + int triclinic_general; // 1 if general <-> restricted tri mapping is stored, 0 if not // orthogonal box @@ -91,9 +91,9 @@ class Domain : protected Pointers { // general triclinic box // boxlo = lower left corner - double avec[3], bvec[3], cvec[3]; // ABC edge vectors of general triclinic box - double rotate_g2r[3][3]; // rotation matrix from general --> restricted tri - double rotate_r2g[3][3]; // rotation matrix from restricted --> general tri + double avec[3], bvec[3], cvec[3]; // ABC edge vectors of general triclinic box + double rotate_g2r[3][3]; // rotation matrix from general --> restricted tri + double rotate_r2g[3][3]; // rotation matrix from restricted --> general tri // box flags @@ -145,9 +145,8 @@ class Domain : protected Pointers { int ownatom(int, double *, imageint *, int); void define_general_triclinic(double *, double *, double *, double *); - void general_to_restricted_rotation(double *, double *, double *, - double [3][3], - double *, double *, double *); + void general_to_restricted_rotation(double *, double *, double *, double[3][3], double *, + double *, double *); void general_to_restricted_coords(double *); void restricted_to_general_coords(double *); void restricted_to_general_coords(double *, double *); diff --git a/src/dump_atom.h b/src/dump_atom.h index 0b0d3a4f05..45bf8ae7a5 100644 --- a/src/dump_atom.h +++ b/src/dump_atom.h @@ -33,9 +33,9 @@ class DumpAtom : public Dump { const int ENDIAN = 0x0001; protected: - int scale_flag; // 1 if atom coords are scaled, 0 if no - int image_flag; // 1 if append box count to atom coords, 0 if no - int triclinic_general; // 1 if output box & coords for general triclinic, 0 if no + int scale_flag; // 1 if atom coords are scaled, 0 if no + int image_flag; // 1 if append box count to atom coords, 0 if no + int triclinic_general; // 1 if output box & coords for general triclinic, 0 if no std::string columns; // column labels diff --git a/src/dump_custom.h b/src/dump_custom.h index 6b4ca88b0b..c48d3d3189 100644 --- a/src/dump_custom.h +++ b/src/dump_custom.h @@ -34,9 +34,9 @@ class DumpCustom : public Dump { const int ENDIAN = 0x0001; protected: - int nevery; // dump frequency for output - char *idregion; // region ID, nullptr if no region - int triclinic_general; // 1 if output box & per-atom info for general triclinic + int nevery; // dump frequency for output + char *idregion; // region ID, nullptr if no region + int triclinic_general; // 1 if output box & per-atom info for general triclinic int nthresh; // # of defined thresholds int nthreshlast; // # of defined thresholds with value = LAST diff --git a/src/dump_image.h b/src/dump_image.h index efac5e97d3..074397f9b8 100644 --- a/src/dump_image.h +++ b/src/dump_image.h @@ -79,17 +79,17 @@ class DumpImage : public DumpCustom { double *diamtype, *diamelement, *bdiamtype; // per-type diameters double **colortype, **colorelement, **bcolortype; // per-type colors - int gridflag; // 0/1 for draw grid cells + int gridflag; // 0/1 for draw grid cells class Grid2d *grid2d; class Grid3d *grid3d; - char *id_grid_compute,*id_grid_fix; + char *id_grid_compute, *id_grid_fix; class Compute *grid_compute; class Fix *grid_fix; - int grid_igrid,grid_idata,grid_index; - int nxgrid,nygrid,nzgrid; - int nxlo_in,nxhi_in,nylo_in,nyhi_in,nzlo_in,nzhi_in; + int grid_igrid, grid_idata, grid_index; + int nxgrid, nygrid, nzgrid; + int nxlo_in, nxhi_in, nylo_in, nyhi_in, nzlo_in, nzhi_in; double *gbuf; - int ngrid,maxgrid; + int ngrid, maxgrid; double gcorners[8][3]; class AtomVecLine *avec_line; // ptrs to atom style (sub)classes @@ -98,10 +98,10 @@ class DumpImage : public DumpCustom { class Fix *fixptr; // ptr to Fix that provides image data - class Image *image; // class that renders each image + class Image *image; // class that renders each image - int *chooseghost; // extended choose array for comm - double **bufcopy; // buffer for communicating bond/atom info + int *chooseghost; // extended choose array for comm + double **bufcopy; // buffer for communicating bond/atom info int maxbufcopy; void init_style() override; diff --git a/src/fix_indent.h b/src/fix_indent.h index 37e1623df9..833f576b46 100644 --- a/src/fix_indent.h +++ b/src/fix_indent.h @@ -61,10 +61,10 @@ class FixIndent : public Fix { // methods for conical indenter bool PointInsideCone(int, double *, double, double, double, double, double *); - void DistanceExteriorPoint(int, double *, double, double, double, double, - double &, double &, double &); - void DistanceInteriorPoint(int, double *, double, double, double, double, - double &, double &, double &); + void DistanceExteriorPoint(int, double *, double, double, double, double, double &, double &, + double &); + void DistanceInteriorPoint(int, double *, double, double, double, double, double &, double &, + double &); void point_on_line_segment(double *, double *, double *, double *); double closest(double *, double *, double *, double); }; diff --git a/src/imbalance.h b/src/imbalance.h index 5ef19a5cfd..090ecc48d9 100644 --- a/src/imbalance.h +++ b/src/imbalance.h @@ -26,7 +26,7 @@ class Imbalance : protected Pointers { // parse options. return number of arguments consumed (required) virtual int options(int, char **) = 0; // reinitialize internal data (needed for fix balance) (optional) - virtual void init(int){}; + virtual void init(int) {}; // compute and apply weight factors to local atom array (required) virtual void compute(double *) = 0; // print information about the state of this imbalance compute (required) diff --git a/src/improper.h b/src/improper.h index 400e950967..f65ba3bdbc 100644 --- a/src/improper.h +++ b/src/improper.h @@ -37,10 +37,10 @@ class Improper : protected Pointers { // CENTROID_AVAIL = different and implemented // CENTROID_NOTAVAIL = different, not yet implemented - int symmatoms[4]; // symmetry atom(s) of improper style - // value of 0: interchangable atoms - // value of 1: central atom - // values >1: additional atoms of symmetry + int symmatoms[4]; // symmetry atom(s) of improper style + // value of 0: interchangable atoms + // value of 1: central atom + // values >1: additional atoms of symmetry // KOKKOS host/device flag and data masks @@ -57,8 +57,8 @@ class Improper : protected Pointers { virtual void coeff(int, char **) = 0; virtual void write_restart(FILE *) = 0; virtual void read_restart(FILE *) = 0; - virtual void write_restart_settings(FILE *){}; - virtual void read_restart_settings(FILE *){}; + virtual void write_restart_settings(FILE *) {}; + virtual void read_restart_settings(FILE *) {}; virtual void write_data(FILE *) {} virtual double memory_usage(); virtual void born_matrix(int /*dtype*/, int /*at1*/, int /*at2*/, int /*at3*/, int /*at4*/, diff --git a/src/kspace.h b/src/kspace.h index cc7d979d43..769749a0dc 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -112,17 +112,17 @@ class KSpace : protected Pointers { // general child-class methods - virtual void settings(int, char **){}; + virtual void settings(int, char **) {}; virtual void init() = 0; virtual void setup() = 0; - virtual void reset_grid(){}; + virtual void reset_grid() {}; virtual void compute(int, int) = 0; - virtual void compute_group_group(int, int, int){}; + virtual void compute_group_group(int, int, int) {}; - virtual void pack_forward_grid(int, void *, int, int *){}; - virtual void unpack_forward_grid(int, void *, int, int *){}; - virtual void pack_reverse_grid(int, void *, int, int *){}; - virtual void unpack_reverse_grid(int, void *, int, int *){}; + virtual void pack_forward_grid(int, void *, int, int *) {}; + virtual void unpack_forward_grid(int, void *, int, int *) {}; + virtual void pack_reverse_grid(int, void *, int, int *) {}; + virtual void unpack_reverse_grid(int, void *, int, int *) {}; virtual int timing(int, double &, double &) { return 0; } virtual int timing_1d(int, double &) { return 0; } diff --git a/src/lammps.h b/src/lammps.h index 1fdcb2e614..989adb2849 100644 --- a/src/lammps.h +++ b/src/lammps.h @@ -66,7 +66,7 @@ class LAMMPS { int suffix_enable; // 1 if suffixes are enabled, 0 if disabled int pair_only_flag; // 1 if only force field pair styles are accelerated, 0 if all const char *non_pair_suffix() const; - char *exename; // pointer to argv[0] + char *exename; // pointer to argv[0] char ***packargs; // arguments for cmdline package commands int num_package; // number of cmdline package commands @@ -103,9 +103,9 @@ class LAMMPS { void init_pkg_lists(); void help(); /// Default constructor. Declared private to prohibit its use - LAMMPS(){}; + LAMMPS() {}; /// Copy constructor. Declared private to prohibit its use - LAMMPS(const LAMMPS &){}; + LAMMPS(const LAMMPS &) {}; }; } // namespace LAMMPS_NS diff --git a/src/region_plane.h b/src/region_plane.h index 0e4ecda6d4..790564e176 100644 --- a/src/region_plane.h +++ b/src/region_plane.h @@ -44,7 +44,6 @@ class RegPlane : public Region { char *xstr, *ystr, *zstr; void variable_check(); - }; } // namespace LAMMPS_NS diff --git a/src/set.h b/src/set.h index b00dfb9854..e2be5d5c1e 100644 --- a/src/set.h +++ b/src/set.h @@ -26,7 +26,7 @@ namespace LAMMPS_NS { class Set : public Command { public: - Set(class LAMMPS *lmp) : Command(lmp){}; + Set(class LAMMPS *lmp) : Command(lmp) {}; void command(int, char **) override; private: diff --git a/src/utils.h b/src/utils.h index ebf1709505..87a8809c4c 100644 --- a/src/utils.h +++ b/src/utils.h @@ -409,7 +409,8 @@ This functions adds the following case to :cpp:func:`utils::bounds() Date: Sun, 6 Oct 2024 06:55:38 -0400 Subject: [PATCH 17/42] remove dead code --- src/EXTRA-PAIR/pair_coul_ctip.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/EXTRA-PAIR/pair_coul_ctip.cpp b/src/EXTRA-PAIR/pair_coul_ctip.cpp index b22fbce0f3..be07d07e35 100644 --- a/src/EXTRA-PAIR/pair_coul_ctip.cpp +++ b/src/EXTRA-PAIR/pair_coul_ctip.cpp @@ -205,8 +205,6 @@ double PairCoulCTIP::self(Param *param, double qi) } else { return qi * ((s1 - 2 * s4 * s5) + qi * (0.50 * s2 + s5)) + s4 * s4 * s5; } - - return 0.0; } /* ---------------------------------------------------------------------- From a0990abb73589f3bc18118cdb11368e9619597ed Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 6 Oct 2024 07:01:35 -0400 Subject: [PATCH 18/42] nout does not have to be a class member --- src/QEQ/fix_qeq_ctip.cpp | 2 +- src/QEQ/fix_qeq_ctip.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/QEQ/fix_qeq_ctip.cpp b/src/QEQ/fix_qeq_ctip.cpp index a541c990ee..77285f1bc7 100644 --- a/src/QEQ/fix_qeq_ctip.cpp +++ b/src/QEQ/fix_qeq_ctip.cpp @@ -201,7 +201,7 @@ void FixQEqCTIP::extract_ctip() void FixQEqCTIP::pre_force(int /*vflag*/) { - int i,n; + int i, n, nout; if (update->ntimestep % nevery) return; diff --git a/src/QEQ/fix_qeq_ctip.h b/src/QEQ/fix_qeq_ctip.h index 2c2e201123..0d3ffce964 100644 --- a/src/QEQ/fix_qeq_ctip.h +++ b/src/QEQ/fix_qeq_ctip.h @@ -44,7 +44,6 @@ class FixQEqCTIP : public FixQEq { double cdamp; int maxrepeat; - int nout; }; } // namespace LAMMPS_NS #endif From 8c76600d47b81f62fe3b4d1edd1cff0798e0a96c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 6 Oct 2024 15:06:05 -0400 Subject: [PATCH 19/42] anticipate change to C++ standard --- examples/plugins/CMakeLists.txt | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/examples/plugins/CMakeLists.txt b/examples/plugins/CMakeLists.txt index 8771b29121..60cbd01d73 100644 --- a/examples/plugins/CMakeLists.txt +++ b/examples/plugins/CMakeLists.txt @@ -42,8 +42,28 @@ else() endif() endif() -# C++11 is required -set(CMAKE_CXX_STANDARD 11) +# we *require* C++11 without extensions but prefer C++17. +# Kokkos requires at least C++17 (currently) +if(NOT CMAKE_CXX_STANDARD) + if(cxx_std_17 IN_LIST CMAKE_CXX_COMPILE_FEATURES) + set(CMAKE_CXX_STANDARD 17) + else() + set(CMAKE_CXX_STANDARD 11) + endif() +endif() +if(CMAKE_CXX_STANDARD LESS 11) + message(FATAL_ERROR "C++ standard must be set to at least 11") +endif() +if(CMAKE_CXX_STANDARD LESS 17) + message(WARNING "Selecting C++17 standard is preferred over C++${CMAKE_CXX_STANDARD}") +endif() +if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 17)) + set(CMAKE_CXX_STANDARD 17) +endif() +# turn off C++17 check in lmptype.h +if(LAMMPS_CXX11) + add_compile_definitions(LAMMPS_CXX11) +endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) # Need -restrict with Intel compilers From 8a176ac488e00f7e1bdd718443243999dd8b4068 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 6 Oct 2024 15:09:06 -0400 Subject: [PATCH 20/42] use MKL for FFTs and on Intel GPU --- cmake/presets/kokkos-sycl-intel.cmake | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cmake/presets/kokkos-sycl-intel.cmake b/cmake/presets/kokkos-sycl-intel.cmake index 3fc75e4b2d..eba386564d 100644 --- a/cmake/presets/kokkos-sycl-intel.cmake +++ b/cmake/presets/kokkos-sycl-intel.cmake @@ -6,13 +6,24 @@ set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE) set(Kokkos_ENABLE_SYCL ON CACHE BOOL "" FORCE) +set(FFT "MKL" CACHE STRING "" FORCE) +set(FFT_KOKKOS "MKL_GPU" CACHE STRING "" FORCE) + +unset(USE_INTERNAL_LINALG) +unset(USE_INTERNAL_LINALG CACHE) +set(BLAS_VENDOR "Intel10_64_dyn") + # hide deprecation warnings temporarily for stable release set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) set(CMAKE_CXX_COMPILER icpx CACHE STRING "" FORCE) +set(CMAKE_C_COMPILER icx CACHE STRING "" FORCE) +set(CMAKE_Fortran_COMPILER "" CACHE STRING "" FORCE) set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE) # Silence everything set(CMAKE_CXX_FLAGS "-w" CACHE STRING "" FORCE) -set(CMAKE_EXE_LINKER_FLAGS "-fsycl -flink-huge-device-code -fsycl-max-parallel-link-jobs=32 -fsycl-targets=spir64_gen -Xsycl-target-backend \"-device 12.60.7\" " CACHE STRING "" FORCE) -set(CMAKE_TUNE_FLAGS "-O3 -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=spir64_gen" CACHE STRING "" FORCE) +#set(CMAKE_EXE_LINKER_FLAGS "-fsycl -flink-huge-device-code -fsycl-targets=spir64_gen " CACHE STRING "" FORCE) +#set(CMAKE_TUNE_FLAGS "-O3 -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=spir64_gen" CACHE STRING "" FORCE) +set(CMAKE_EXE_LINKER_FLAGS "-fsycl -flink-huge-device-code " CACHE STRING "" FORCE) +set(CMAKE_TUNE_FLAGS "-O3 -fsycl -fsycl-device-code-split=per_kernel " CACHE STRING "" FORCE) From c44831ff90b54beff998f4e355d919ccbc512464 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Mon, 7 Oct 2024 10:40:58 -0600 Subject: [PATCH 21/42] Fix bug when Kokkos atom map is build on host using hash --- src/KOKKOS/atom_map_kokkos.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/KOKKOS/atom_map_kokkos.cpp b/src/KOKKOS/atom_map_kokkos.cpp index 2c4c58ee19..7913efab2e 100644 --- a/src/KOKKOS/atom_map_kokkos.cpp +++ b/src/KOKKOS/atom_map_kokkos.cpp @@ -352,26 +352,17 @@ void AtomKokkos::map_set_host() // use "view" template method to avoid unnecessary deep_copy - auto h_map_hash = k_map_hash.view(); + auto& h_map_hash = k_map_hash.h_view; // must be an alias h_map_hash.clear(); - for (int i = nall - 1; i >= 0; i--) { + for (int i = 0; i < nall; i++) { // search for key // if don't find it, done - previous = -1; global = tag[i]; - ibucket = global % map_nbucket; - index = map_bucket[ibucket]; - while (index > -1) { - if (map_hash[index].global == global) break; - previous = index; - index = map_hash[index].next; - } - if (index == -1) continue; - - int local = map_hash[index].local; + int local = Atom::map_find_hash(global); + if (local == -1) continue; auto insert_result = h_map_hash.insert(global, local); if (insert_result.failed()) error->one(FLERR, "Kokkos::UnorderedMap insertion failed"); @@ -399,7 +390,7 @@ void AtomKokkos::map_one(tagint global, int local) k_map_array.h_view[global] = local; } else { k_map_hash.sync_host(); - auto& h_map_hash = k_map_hash.h_view; + auto& h_map_hash = k_map_hash.h_view; // must be an alias auto insert_result = h_map_hash.insert(global, local); if (insert_result.existing()) @@ -423,6 +414,7 @@ int AtomKokkos::map_find_hash(tagint global) auto index = h_map_hash.find(global); if (h_map_hash.valid_at(index)) local = h_map_hash.value_at(index); + return local; } From 9aaab458e864365d8879b853215ce544b151c13c Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Mon, 7 Oct 2024 10:54:28 -0600 Subject: [PATCH 22/42] Change another shallow copy to alias --- src/KOKKOS/atom_map_kokkos.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KOKKOS/atom_map_kokkos.cpp b/src/KOKKOS/atom_map_kokkos.cpp index 7913efab2e..63df1dd9a9 100644 --- a/src/KOKKOS/atom_map_kokkos.cpp +++ b/src/KOKKOS/atom_map_kokkos.cpp @@ -212,7 +212,7 @@ void AtomKokkos::map_set_device() Kokkos::sort(LMPDeviceType(),l_sorted,MyComp{}); auto d_map_array = k_map_array.d_view; - auto d_map_hash = k_map_hash.d_view; + auto& d_map_hash = k_map_hash.d_view; if (!map_style_array) d_map_hash.clear(); From 6a46fb034d83798d3fd353bc7b58352b262a0636 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Mon, 7 Oct 2024 11:11:12 -0600 Subject: [PATCH 23/42] Tweak comments --- src/KOKKOS/atom_kokkos.h | 2 +- src/KOKKOS/atom_map_kokkos.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/KOKKOS/atom_kokkos.h b/src/KOKKOS/atom_kokkos.h index d978a771de..d1d2586749 100644 --- a/src/KOKKOS/atom_kokkos.h +++ b/src/KOKKOS/atom_kokkos.h @@ -151,7 +151,7 @@ class AtomKokkos : public Atom { static int map_find_hash_kokkos(tagint global, const dual_hash_type &k_map_hash) { int local = -1; - auto& d_map_hash = k_map_hash.const_view(); + auto& d_map_hash = k_map_hash.const_view(); // must be alias auto index = d_map_hash.find(global); if (d_map_hash.valid_at(index)) local = d_map_hash.value_at(index); diff --git a/src/KOKKOS/atom_map_kokkos.cpp b/src/KOKKOS/atom_map_kokkos.cpp index 63df1dd9a9..fbb7c11395 100644 --- a/src/KOKKOS/atom_map_kokkos.cpp +++ b/src/KOKKOS/atom_map_kokkos.cpp @@ -212,7 +212,7 @@ void AtomKokkos::map_set_device() Kokkos::sort(LMPDeviceType(),l_sorted,MyComp{}); auto d_map_array = k_map_array.d_view; - auto& d_map_hash = k_map_hash.d_view; + auto& d_map_hash = k_map_hash.d_view; // must be alias if (!map_style_array) d_map_hash.clear(); @@ -352,7 +352,7 @@ void AtomKokkos::map_set_host() // use "view" template method to avoid unnecessary deep_copy - auto& h_map_hash = k_map_hash.h_view; // must be an alias + auto& h_map_hash = k_map_hash.h_view; // must be alias h_map_hash.clear(); for (int i = 0; i < nall; i++) { @@ -390,7 +390,7 @@ void AtomKokkos::map_one(tagint global, int local) k_map_array.h_view[global] = local; } else { k_map_hash.sync_host(); - auto& h_map_hash = k_map_hash.h_view; // must be an alias + auto& h_map_hash = k_map_hash.h_view; // must be alias auto insert_result = h_map_hash.insert(global, local); if (insert_result.existing()) @@ -408,7 +408,7 @@ void AtomKokkos::map_one(tagint global, int local) int AtomKokkos::map_find_hash(tagint global) { k_map_hash.sync_host(); - auto& h_map_hash = k_map_hash.h_view; + auto& h_map_hash = k_map_hash.h_view; // must be alias int local = -1; auto index = h_map_hash.find(global); From e6118412b187b597dfe161acef5345a6eb597ca8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 7 Oct 2024 13:56:04 -0400 Subject: [PATCH 24/42] remove dead code in fix qeq/ctip --- src/QEQ/fix_qeq_ctip.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/QEQ/fix_qeq_ctip.cpp b/src/QEQ/fix_qeq_ctip.cpp index 77285f1bc7..b86549d2a7 100644 --- a/src/QEQ/fix_qeq_ctip.cpp +++ b/src/QEQ/fix_qeq_ctip.cpp @@ -239,12 +239,6 @@ void FixQEqCTIP::init_matvec() double *q = atom->q, qi; int *type = atom->type; - double r = cutoff; - double rsq = r*r; - - double erfcd_cut = exp(-cdamp * cdamp * rsq); - double t_cut = 1.0 / (1.0 + EWALD_P * cdamp * r); - inum = list->inum; ilist = list->ilist; @@ -283,7 +277,6 @@ void FixQEqCTIP::compute_H() int inum, jnum, *ilist, *jlist, *numneigh, **firstneigh; int i, j, ii, jj; double dx, dy, dz, r_sqr, r, reff; - double cutoffsq, erfcd_cut, t_cut; double erfcc, erfcd, t; double **x = atom->x; @@ -295,10 +288,6 @@ void FixQEqCTIP::compute_H() numneigh = list->numneigh; firstneigh = list->firstneigh; - cutoffsq = cutoff * cutoff; - erfcd_cut = exp(-cdamp * cdamp * cutoffsq); - t_cut = 1.0 / (1.0 + EWALD_P * cdamp * cutoff); - // fill in the H matrix m_fill = 0; for (ii = 0; ii < inum; ii++) { From f02b3aaf9576b99dd5f6b490247969a43c3abcd1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 7 Oct 2024 19:56:04 -0400 Subject: [PATCH 25/42] reset container with .clear() --- src/MC/fix_sgcmc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MC/fix_sgcmc.cpp b/src/MC/fix_sgcmc.cpp index a2115bd5f6..c405421b7f 100644 --- a/src/MC/fix_sgcmc.cpp +++ b/src/MC/fix_sgcmc.cpp @@ -642,7 +642,7 @@ bool FixSemiGrandCanonicalMC::placeSamplingWindow() samplingWindowPosition += 1; // Compile a list of atoms that are inside the sampling window. - samplingWindowAtoms.resize(0); + samplingWindowAtoms.clear(); samplingWindowAtoms.reserve(atom->nlocal); numSamplingWindowAtoms = 0; numFixAtomsLocal = 0; From e5ba430f5f906c354b17b23320aa142d8babf766 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 7 Oct 2024 20:07:09 -0400 Subject: [PATCH 26/42] re-enable KokkosOpenMP test --- unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml | 2 +- unittest/force-styles/tests/mol-pair-hybrid_multiple.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml b/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml index b067187cc6..d9dc27e594 100644 --- a/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml +++ b/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml @@ -2,7 +2,7 @@ lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:30 2022 epsilon: 5e-13 -skip_tests: kokkos_omp +skip_tests: prerequisites: ! | atom full pair lj/cut diff --git a/unittest/force-styles/tests/mol-pair-hybrid_multiple.yaml b/unittest/force-styles/tests/mol-pair-hybrid_multiple.yaml index c46ee40b93..59a5098238 100644 --- a/unittest/force-styles/tests/mol-pair-hybrid_multiple.yaml +++ b/unittest/force-styles/tests/mol-pair-hybrid_multiple.yaml @@ -2,7 +2,7 @@ lammps_version: 8 Apr 2021 date_generated: Mon Apr 19 08:49:08 2021 epsilon: 5e-14 -skip_tests: gpu kokkos_omp +skip_tests: gpu prerequisites: ! | atom full pair lj/cut From b1928596ae0b6cccefeb2a905f07734f0547861d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 8 Oct 2024 14:47:11 -0400 Subject: [PATCH 27/42] should include in utils.h --- src/utils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils.h b/src/utils.h index 87a8809c4c..2fbbd339e5 100644 --- a/src/utils.h +++ b/src/utils.h @@ -21,6 +21,7 @@ #include +#include #include // IWYU pragma: export namespace LAMMPS_NS { From bea76778bd9f19c5ab2d0856a283ed5dcdc91be5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 8 Oct 2024 22:45:37 -0400 Subject: [PATCH 28/42] silence compiler warning --- src/dump.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dump.cpp b/src/dump.cpp index 8cc8d1c7db..c648016abc 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -325,8 +325,9 @@ int Dump::count() void Dump::write() { - imageint *imagehold; - double **xhold,**vhold; + imageint *imagehold = nullptr; + double **xhold = nullptr; + double **vhold = nullptr; // simulation box bounds From e6c9353ccf028b9a9ad928bc8bc8709075af59b4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 9 Oct 2024 00:30:46 -0400 Subject: [PATCH 29/42] add missing dependency --- .../force-styles/tests/fix-timestep-efield_dipole_const.yaml | 1 + .../force-styles/tests/fix-timestep-efield_dipole_variable.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/unittest/force-styles/tests/fix-timestep-efield_dipole_const.yaml b/unittest/force-styles/tests/fix-timestep-efield_dipole_const.yaml index d889968db6..503f7253f1 100644 --- a/unittest/force-styles/tests/fix-timestep-efield_dipole_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-efield_dipole_const.yaml @@ -6,6 +6,7 @@ epsilon: 2e-13 skip_tests: prerequisites: ! | atom full + atom dipole fix efield pre_commands: ! "" post_commands: ! | diff --git a/unittest/force-styles/tests/fix-timestep-efield_dipole_variable.yaml b/unittest/force-styles/tests/fix-timestep-efield_dipole_variable.yaml index f306034640..069526c4c0 100644 --- a/unittest/force-styles/tests/fix-timestep-efield_dipole_variable.yaml +++ b/unittest/force-styles/tests/fix-timestep-efield_dipole_variable.yaml @@ -6,6 +6,7 @@ epsilon: 2e-13 skip_tests: prerequisites: ! | atom full + atom dipole fix efield pre_commands: ! "" post_commands: ! | From 58989765f032bc4f127f26447f80ccd467848bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=BCtter?= Date: Thu, 10 Oct 2024 00:52:36 +0200 Subject: [PATCH 30/42] Install shared libraries on Windows with RUNTIME DESTINATION --- cmake/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index afae18745f..79520fd272 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -823,9 +823,15 @@ foreach(_DEF ${LAMMPS_DEFINES}) set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -D${_DEF}") endforeach() if(BUILD_SHARED_LIBS) - install(TARGETS lammps EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS lammps EXPORT LAMMPS_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) if(NOT BUILD_MPI) - install(TARGETS mpi_stubs EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS mpi_stubs EXPORT LAMMPS_Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() configure_file(pkgconfig/liblammps.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_MACHINE}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) From 2935c17f781ef43c20f34fc6e2cac4f30d98bcd5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 10 Oct 2024 05:19:32 -0400 Subject: [PATCH 31/42] avoid segfault in msm/dielectric --- src/DIELECTRIC/msm_dielectric.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DIELECTRIC/msm_dielectric.cpp b/src/DIELECTRIC/msm_dielectric.cpp index fd09e40acc..46bb9c0415 100644 --- a/src/DIELECTRIC/msm_dielectric.cpp +++ b/src/DIELECTRIC/msm_dielectric.cpp @@ -113,9 +113,11 @@ void MSMDielectric::compute(int eflag, int vflag) if (atom->nmax > nmax) { memory->destroy(part2grid); memory->destroy(efield); + memory->destroy(phi); nmax = atom->nmax; memory->create(part2grid,nmax,3,"msm:part2grid"); memory->create(efield,nmax,3,"msm:efield"); + memory->create(phi,nmax,"msm:phi"); } // find grid points for all my particles From 482a6632e91d9a29d241437a10e4869ade768da7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 10 Oct 2024 05:35:01 -0400 Subject: [PATCH 32/42] consolidate kspace communication enumerators in kspace.h --- src/DIELECTRIC/msm_dielectric.cpp | 2 -- src/DIELECTRIC/pppm_dielectric.cpp | 4 --- src/DIELECTRIC/pppm_disp_dielectric.cpp | 9 ------- src/ELECTRODE/pppm_electrode.cpp | 4 --- src/GPU/pppm_gpu.cpp | 3 --- src/INTEL/pppm_disp_intel.cpp | 8 +----- src/INTEL/pppm_electrode_intel.cpp | 2 -- src/INTEL/pppm_intel.cpp | 3 --- src/KOKKOS/pppm_kokkos.cpp | 3 --- src/KSPACE/msm.cpp | 3 --- src/KSPACE/msm_cg.cpp | 3 --- src/KSPACE/pppm.cpp | 3 --- src/KSPACE/pppm_cg.cpp | 4 --- src/KSPACE/pppm_dipole.cpp | 3 --- src/KSPACE/pppm_dipole_spin.cpp | 4 --- src/KSPACE/pppm_disp.cpp | 9 ------- src/KSPACE/pppm_stagger.cpp | 3 --- src/OPENMP/msm_cg_omp.cpp | 3 --- src/kspace.h | 33 +++++++++++++++++++++++++ 19 files changed, 34 insertions(+), 72 deletions(-) diff --git a/src/DIELECTRIC/msm_dielectric.cpp b/src/DIELECTRIC/msm_dielectric.cpp index 46bb9c0415..d734f46941 100644 --- a/src/DIELECTRIC/msm_dielectric.cpp +++ b/src/DIELECTRIC/msm_dielectric.cpp @@ -29,8 +29,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -enum{REVERSE_RHO,REVERSE_AD,REVERSE_AD_PERATOM}; -enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ MSMDielectric::MSMDielectric(LAMMPS *_lmp) : MSM(_lmp) diff --git a/src/DIELECTRIC/pppm_dielectric.cpp b/src/DIELECTRIC/pppm_dielectric.cpp index e02cc33162..817c787bf0 100644 --- a/src/DIELECTRIC/pppm_dielectric.cpp +++ b/src/DIELECTRIC/pppm_dielectric.cpp @@ -36,10 +36,6 @@ using namespace MathConst; using namespace MathSpecial; static constexpr double SMALL = 0.00001; - -enum { REVERSE_RHO }; -enum { FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM }; - static constexpr FFT_SCALAR ZEROF = 0.0; /* ---------------------------------------------------------------------- */ diff --git a/src/DIELECTRIC/pppm_disp_dielectric.cpp b/src/DIELECTRIC/pppm_disp_dielectric.cpp index e5149ae427..07c021955b 100644 --- a/src/DIELECTRIC/pppm_disp_dielectric.cpp +++ b/src/DIELECTRIC/pppm_disp_dielectric.cpp @@ -38,15 +38,6 @@ using namespace MathConst; static constexpr double SMALL = 0.00001; static constexpr FFT_SCALAR ZEROF = 0.0; -enum{REVERSE_RHO,REVERSE_RHO_GEOM,REVERSE_RHO_ARITH,REVERSE_RHO_NONE}; -enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM, - FORWARD_IK_GEOM,FORWARD_AD_GEOM, - FORWARD_IK_PERATOM_GEOM,FORWARD_AD_PERATOM_GEOM, - FORWARD_IK_ARITH,FORWARD_AD_ARITH, - FORWARD_IK_PERATOM_ARITH,FORWARD_AD_PERATOM_ARITH, - FORWARD_IK_NONE,FORWARD_AD_NONE,FORWARD_IK_PERATOM_NONE, - FORWARD_AD_PERATOM_NONE}; - /* ---------------------------------------------------------------------- */ PPPMDispDielectric::PPPMDispDielectric(LAMMPS *_lmp) : PPPMDisp(_lmp) diff --git a/src/ELECTRODE/pppm_electrode.cpp b/src/ELECTRODE/pppm_electrode.cpp index 8720e540ae..cfce2d09d2 100644 --- a/src/ELECTRODE/pppm_electrode.cpp +++ b/src/ELECTRODE/pppm_electrode.cpp @@ -49,10 +49,6 @@ using namespace MathSpecial; static constexpr int MAXORDER = 7; static constexpr int OFFSET = 16384; static constexpr double EPS_HOC = 1.0e-7; - -enum { REVERSE_RHO }; -enum { FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM }; - static constexpr FFT_SCALAR ZEROF = 0.0; static const char cite_pppm_electrode[] = diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index 517d843c93..a1bf1ffe29 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -39,9 +39,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -enum { REVERSE_RHO_GPU, REVERSE_RHO }; -enum { FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM }; - static constexpr FFT_SCALAR ZEROF = 0.0; // external functions from cuda library for atom decomposition diff --git a/src/INTEL/pppm_disp_intel.cpp b/src/INTEL/pppm_disp_intel.cpp index 50e9c6e469..9c97936897 100644 --- a/src/INTEL/pppm_disp_intel.cpp +++ b/src/INTEL/pppm_disp_intel.cpp @@ -42,13 +42,7 @@ using namespace MathSpecial; static constexpr int OFFSET = 16384; static constexpr FFT_SCALAR ZEROF = 0.0; -enum{GEOMETRIC,ARITHMETIC,SIXTHPOWER}; -enum{REVERSE_RHO, REVERSE_RHO_G, REVERSE_RHO_A, REVERSE_RHO_NONE}; -enum{FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM, - FORWARD_IK_G, FORWARD_AD_G, FORWARD_IK_PERATOM_G, FORWARD_AD_PERATOM_G, - FORWARD_IK_A, FORWARD_AD_A, FORWARD_IK_PERATOM_A, FORWARD_AD_PERATOM_A, - FORWARD_IK_NONE, FORWARD_AD_NONE, FORWARD_IK_PERATOM_NONE, - FORWARD_AD_PERATOM_NONE}; +enum{ GEOMETRIC, ARITHMETIC, SIXTHPOWER }; /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pppm_electrode_intel.cpp b/src/INTEL/pppm_electrode_intel.cpp index 076ea5dd5d..4d822c31ef 100644 --- a/src/INTEL/pppm_electrode_intel.cpp +++ b/src/INTEL/pppm_electrode_intel.cpp @@ -51,8 +51,6 @@ using namespace std; static constexpr int OFFSET = 16384; -enum { REVERSE_RHO }; -enum { FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM }; enum : bool { ELECTRODE = true, ELECTROLYTE = false }; static constexpr FFT_SCALAR ZEROF = 0.0; diff --git a/src/INTEL/pppm_intel.cpp b/src/INTEL/pppm_intel.cpp index 369c824142..65d2ffd43d 100644 --- a/src/INTEL/pppm_intel.cpp +++ b/src/INTEL/pppm_intel.cpp @@ -44,9 +44,6 @@ using namespace MathSpecial; static constexpr int OFFSET = 16384; static constexpr FFT_SCALAR ZEROF = 0.0; -enum { REVERSE_RHO }; -enum { FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM }; - /* ---------------------------------------------------------------------- */ PPPMIntel::PPPMIntel(LAMMPS *lmp) : PPPM(lmp) diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index 273a53ab8f..1bc7d4fe89 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -46,9 +46,6 @@ static constexpr double SMALL = 0.00001; static constexpr double EPS_HOC = 1.0e-7; static constexpr FFT_SCALAR ZEROF = 0.0; -enum { REVERSE_RHO }; -enum { FORWARD_IK, FORWARD_IK_PERATOM }; - /* ---------------------------------------------------------------------- */ template diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 60bb768911..024772e07b 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -39,9 +39,6 @@ using namespace MathConst; static constexpr int MAX_LEVELS = 10; static constexpr int OFFSET = 16384; -enum { REVERSE_RHO, REVERSE_AD, REVERSE_AD_PERATOM }; -enum { FORWARD_RHO, FORWARD_AD, FORWARD_AD_PERATOM }; - /* ---------------------------------------------------------------------- */ MSM::MSM(LAMMPS *lmp) diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index e680c05cb2..93a9ff4a46 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -34,9 +34,6 @@ using namespace LAMMPS_NS; static constexpr int OFFSET = 16384; static constexpr double SMALLQ = 0.00001; -enum{REVERSE_RHO,REVERSE_AD,REVERSE_AD_PERATOM}; -enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; - /* ---------------------------------------------------------------------- */ MSMCG::MSMCG(LAMMPS *lmp) : MSM(lmp), diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 9665d2392d..c8440e4e9b 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -50,9 +50,6 @@ static constexpr double SMALL = 0.00001; static constexpr double EPS_HOC = 1.0e-7; static constexpr FFT_SCALAR ZEROF = 0.0; -enum { REVERSE_RHO }; -enum { FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM }; - /* ---------------------------------------------------------------------- */ PPPM::PPPM(LAMMPS *lmp) : KSpace(lmp), diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index cebf9e0000..2dd5d7157e 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -35,10 +35,6 @@ using namespace MathConst; static constexpr int OFFSET = 16384; static constexpr double SMALLQ = 0.00001; - -enum{REVERSE_RHO}; -enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; - static constexpr FFT_SCALAR ZEROF = 0.0; /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index a0676cc56e..9d41b55336 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -46,9 +46,6 @@ static constexpr double SMALL = 0.00001; static constexpr double EPS_HOC = 1.0e-7; static constexpr FFT_SCALAR ZEROF = 0.0; -enum { REVERSE_MU }; -enum { FORWARD_MU, FORWARD_MU_PERATOM }; - /* ---------------------------------------------------------------------- */ PPPMDipole::PPPMDipole(LAMMPS *lmp) : PPPM(lmp), diff --git a/src/KSPACE/pppm_dipole_spin.cpp b/src/KSPACE/pppm_dipole_spin.cpp index 8f195a8a41..e065298006 100644 --- a/src/KSPACE/pppm_dipole_spin.cpp +++ b/src/KSPACE/pppm_dipole_spin.cpp @@ -36,10 +36,6 @@ using namespace LAMMPS_NS; using namespace MathConst; static constexpr int MAXORDER = 7; - -enum { REVERSE_MU }; -enum { FORWARD_MU, FORWARD_MU_PERATOM }; - static constexpr FFT_SCALAR ZEROF = 0.0; /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index b70dae45f9..d55b349935 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -46,15 +46,6 @@ static constexpr double SMALL = 0.00001; static constexpr double LARGE = 10000.0; static constexpr FFT_SCALAR ZEROF = 0.0; -enum{REVERSE_RHO,REVERSE_RHO_GEOM,REVERSE_RHO_ARITH,REVERSE_RHO_NONE}; -enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM, - FORWARD_IK_GEOM,FORWARD_AD_GEOM, - FORWARD_IK_PERATOM_GEOM,FORWARD_AD_PERATOM_GEOM, - FORWARD_IK_ARITH,FORWARD_AD_ARITH, - FORWARD_IK_PERATOM_ARITH,FORWARD_AD_PERATOM_ARITH, - FORWARD_IK_NONE,FORWARD_AD_NONE,FORWARD_IK_PERATOM_NONE, - FORWARD_AD_PERATOM_NONE}; - /* ---------------------------------------------------------------------- */ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), diff --git a/src/KSPACE/pppm_stagger.cpp b/src/KSPACE/pppm_stagger.cpp index b740d21daa..bd3cf39dad 100644 --- a/src/KSPACE/pppm_stagger.cpp +++ b/src/KSPACE/pppm_stagger.cpp @@ -37,9 +37,6 @@ static constexpr int OFFSET = 16384; static constexpr double EPS_HOC = 1.0e-7; static constexpr FFT_SCALAR ZEROF = 0.0; -enum{ REVERSE_RHO }; -enum{ FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM }; - /* ---------------------------------------------------------------------- */ PPPMStagger::PPPMStagger(LAMMPS *lmp) : diff --git a/src/OPENMP/msm_cg_omp.cpp b/src/OPENMP/msm_cg_omp.cpp index 00230c9ece..2bb7713dce 100644 --- a/src/OPENMP/msm_cg_omp.cpp +++ b/src/OPENMP/msm_cg_omp.cpp @@ -41,9 +41,6 @@ using namespace LAMMPS_NS; static constexpr int OFFSET = 16384; static constexpr double SMALLQ = 0.00001; -enum{REVERSE_RHO,REVERSE_AD,REVERSE_AD_PERATOM}; -enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; - /* ---------------------------------------------------------------------- */ MSMCGOMP::MSMCGOMP(LAMMPS *lmp) : MSMOMP(lmp), diff --git a/src/kspace.h b/src/kspace.h index 769749a0dc..fedc477b81 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -23,6 +23,39 @@ class KSpace : protected Pointers { friend class FixOMP; public: + enum { + REVERSE_RHO, + REVERSE_RHO_GEOM, + REVERSE_RHO_ARITH, + REVERSE_RHO_NONE, + REVERSE_RHO_GPU, + REVERSE_AD, + REVERSE_AD_PERATOM, + REVERSE_MU, + REVERSE_MU_PERATOM + }; + enum { + FORWARD_RHO, + FORWARD_IK, + FORWARD_AD, + FORWARD_MU, + FORWARD_IK_PERATOM, + FORWARD_AD_PERATOM, + FORWARD_MU_PERATOM, + FORWARD_IK_GEOM, + FORWARD_AD_GEOM, + FORWARD_IK_PERATOM_GEOM, + FORWARD_AD_PERATOM_GEOM, + FORWARD_IK_ARITH, + FORWARD_AD_ARITH, + FORWARD_IK_PERATOM_ARITH, + FORWARD_AD_PERATOM_ARITH, + FORWARD_IK_NONE, + FORWARD_AD_NONE, + FORWARD_IK_PERATOM_NONE, + FORWARD_AD_PERATOM_NONE + }; + double energy; // accumulated energies double energy_1, energy_6; double virial[6]; // accumulated virial: xx,yy,zz,xy,xz,yz From 948ee80169ac71551fbd20f34472c1505ac268f3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 10 Oct 2024 05:35:51 -0400 Subject: [PATCH 33/42] potflag and phi are not used --- src/DIELECTRIC/msm_dielectric.cpp | 18 +++------------ src/DIELECTRIC/msm_dielectric.h | 1 - src/DIELECTRIC/pppm_dielectric.cpp | 26 +++++----------------- src/DIELECTRIC/pppm_dielectric.h | 2 -- src/DIELECTRIC/pppm_disp_dielectric.cpp | 29 ++++--------------------- src/DIELECTRIC/pppm_disp_dielectric.h | 2 -- 6 files changed, 12 insertions(+), 66 deletions(-) diff --git a/src/DIELECTRIC/msm_dielectric.cpp b/src/DIELECTRIC/msm_dielectric.cpp index d734f46941..189f4ad342 100644 --- a/src/DIELECTRIC/msm_dielectric.cpp +++ b/src/DIELECTRIC/msm_dielectric.cpp @@ -31,11 +31,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -MSMDielectric::MSMDielectric(LAMMPS *_lmp) : MSM(_lmp) -{ - efield = nullptr; - phi = nullptr; -} +MSMDielectric::MSMDielectric(LAMMPS *_lmp) : MSM(_lmp), efield(nullptr) {} /* ---------------------------------------------------------------------- free all memory @@ -44,7 +40,6 @@ MSMDielectric::MSMDielectric(LAMMPS *_lmp) : MSM(_lmp) MSMDielectric::~MSMDielectric() { memory->destroy(efield); - memory->destroy(phi); } /* ---------------------------------------------------------------------- @@ -111,11 +106,9 @@ void MSMDielectric::compute(int eflag, int vflag) if (atom->nmax > nmax) { memory->destroy(part2grid); memory->destroy(efield); - memory->destroy(phi); nmax = atom->nmax; memory->create(part2grid,nmax,3,"msm:part2grid"); memory->create(efield,nmax,3,"msm:efield"); - memory->create(phi,nmax,"msm:phi"); } // find grid points for all my particles @@ -276,7 +269,7 @@ void MSMDielectric::fieldforce() int i,l,m,n,nx,ny,nz,mx,my,mz; double dx,dy,dz; - double phi_x,phi_y,phi_z,u; + double phi_x,phi_y,phi_z; double dphi_x,dphi_y,dphi_z; double ekx,eky,ekz,etmp; @@ -303,7 +296,7 @@ void MSMDielectric::fieldforce() compute_phis_and_dphis(dx,dy,dz); - u = ekx = eky = ekz = 0.0; + ekx = eky = ekz = 0.0; for (n = nlower; n <= nupper; n++) { mz = n+nz; phi_z = phi1d[2][n]; @@ -317,7 +310,6 @@ void MSMDielectric::fieldforce() phi_x = phi1d[0][l]; dphi_x = dphi1d[0][l]; etmp = egridn[mz][my][mx]; - u += phi_z*phi_y*phi_x*etmp; ekx += dphi_x*phi_y*phi_z*etmp; eky += phi_x*dphi_y*phi_z*etmp; ekz += phi_x*phi_y*dphi_z*etmp; @@ -329,10 +321,6 @@ void MSMDielectric::fieldforce() eky *= delyinv[0]; ekz *= delzinv[0]; - // electrical potential - - phi[i] = u; - // effectively divide by length for a triclinic system if (triclinic) { diff --git a/src/DIELECTRIC/msm_dielectric.h b/src/DIELECTRIC/msm_dielectric.h index b67d64efc5..1f1f02f859 100644 --- a/src/DIELECTRIC/msm_dielectric.h +++ b/src/DIELECTRIC/msm_dielectric.h @@ -32,7 +32,6 @@ class MSMDielectric : public MSM { void compute(int, int) override; double **efield; - double *phi; protected: void fieldforce() override; diff --git a/src/DIELECTRIC/pppm_dielectric.cpp b/src/DIELECTRIC/pppm_dielectric.cpp index 817c787bf0..72d7e908e1 100644 --- a/src/DIELECTRIC/pppm_dielectric.cpp +++ b/src/DIELECTRIC/pppm_dielectric.cpp @@ -40,13 +40,10 @@ static constexpr FFT_SCALAR ZEROF = 0.0; /* ---------------------------------------------------------------------- */ -PPPMDielectric::PPPMDielectric(LAMMPS *_lmp) : PPPM(_lmp) +PPPMDielectric::PPPMDielectric(LAMMPS *_lmp) : PPPM(_lmp), efield(nullptr) { group_group_enable = 0; - efield = nullptr; - phi = nullptr; - potflag = 0; use_qscaled = true; // no warnings about non-neutral systems from qsum_qsq() @@ -61,7 +58,6 @@ PPPMDielectric::PPPMDielectric(LAMMPS *_lmp) : PPPM(_lmp) PPPMDielectric::~PPPMDielectric() { memory->destroy(efield); - memory->destroy(phi); } /* ---------------------------------------------------------------------- @@ -107,11 +103,9 @@ void PPPMDielectric::compute(int eflag, int vflag) if (atom->nmax > nmax) { memory->destroy(part2grid); memory->destroy(efield); - memory->destroy(phi); nmax = atom->nmax; memory->create(part2grid,nmax,3,"pppm/dielectric:part2grid"); memory->create(efield,nmax,3,"pppm/dielectric:efield"); - memory->create(phi,nmax,"pppm/dielectric:phi"); } // find grid points for all my particles @@ -384,7 +378,7 @@ void PPPMDielectric::fieldforce_ik() { int i,l,m,n,nx,ny,nz,mx,my,mz; FFT_SCALAR dx,dy,dz,x0,y0,z0; - FFT_SCALAR ekx,eky,ekz,u; + FFT_SCALAR ekx,eky,ekz; // loop over my charges, interpolate electric field from nearby grid points // (nx,ny,nz) = global coords of grid pt to "lower left" of charge @@ -408,7 +402,7 @@ void PPPMDielectric::fieldforce_ik() compute_rho1d(dx,dy,dz); - u = ekx = eky = ekz = ZEROF; + ekx = eky = ekz = ZEROF; for (n = nlower; n <= nupper; n++) { mz = n+nz; z0 = rho1d[2][n]; @@ -418,7 +412,6 @@ void PPPMDielectric::fieldforce_ik() for (l = nlower; l <= nupper; l++) { mx = l+nx; x0 = y0*rho1d[0][l]; - if (potflag) u += x0*u_brick[mz][my][mx]; ekx -= x0*vdx_brick[mz][my][mx]; eky -= x0*vdy_brick[mz][my][mx]; ekz -= x0*vdz_brick[mz][my][mx]; @@ -426,10 +419,6 @@ void PPPMDielectric::fieldforce_ik() } } - // electrostatic potential - - if (potflag) phi[i] = u; - // convert E-field to force const double efactor = scale * eps[i]; efield[i][0] = efactor*ekx; @@ -451,7 +440,7 @@ void PPPMDielectric::fieldforce_ad() { int i,l,m,n,nx,ny,nz,mx,my,mz; FFT_SCALAR dx,dy,dz; - FFT_SCALAR ekx,eky,ekz,u; + FFT_SCALAR ekx,eky,ekz; double s1,s2,s3; double sf = 0.0; @@ -489,14 +478,13 @@ void PPPMDielectric::fieldforce_ad() compute_rho1d(dx,dy,dz); compute_drho1d(dx,dy,dz); - u = ekx = eky = ekz = ZEROF; + ekx = eky = ekz = ZEROF; for (n = nlower; n <= nupper; n++) { mz = n+nz; for (m = nlower; m <= nupper; m++) { my = m+ny; for (l = nlower; l <= nupper; l++) { mx = l+nx; - u += rho1d[0][l]*rho1d[1][m]*rho1d[2][n]*u_brick[mz][my][mx]; ekx += drho1d[0][l]*rho1d[1][m]*rho1d[2][n]*u_brick[mz][my][mx]; eky += rho1d[0][l]*drho1d[1][m]*rho1d[2][n]*u_brick[mz][my][mx]; ekz += rho1d[0][l]*rho1d[1][m]*drho1d[2][n]*u_brick[mz][my][mx]; @@ -507,10 +495,6 @@ void PPPMDielectric::fieldforce_ad() eky *= hy_inv; ekz *= hz_inv; - // electrical potential - - if (potflag) phi[i] = u; - // convert E-field to force and substract self forces const double qfactor = qqrd2e * scale * eps[i]; diff --git a/src/DIELECTRIC/pppm_dielectric.h b/src/DIELECTRIC/pppm_dielectric.h index c266488561..d0f3b16991 100644 --- a/src/DIELECTRIC/pppm_dielectric.h +++ b/src/DIELECTRIC/pppm_dielectric.h @@ -31,8 +31,6 @@ class PPPMDielectric : public PPPM { void compute(int, int) override; double **efield; - double *phi; - int potflag; // 1/0 if per-atom electrostatic potential phi is needed protected: void slabcorr() override; diff --git a/src/DIELECTRIC/pppm_disp_dielectric.cpp b/src/DIELECTRIC/pppm_disp_dielectric.cpp index 07c021955b..346df8bf93 100644 --- a/src/DIELECTRIC/pppm_disp_dielectric.cpp +++ b/src/DIELECTRIC/pppm_disp_dielectric.cpp @@ -40,7 +40,7 @@ static constexpr FFT_SCALAR ZEROF = 0.0; /* ---------------------------------------------------------------------- */ -PPPMDispDielectric::PPPMDispDielectric(LAMMPS *_lmp) : PPPMDisp(_lmp) +PPPMDispDielectric::PPPMDispDielectric(LAMMPS *_lmp) : PPPMDisp(_lmp), efield(nullptr) { dipoleflag = 0; // turned off for now, until dipole works group_group_enable = 0; @@ -51,10 +51,6 @@ PPPMDispDielectric::PPPMDispDielectric(LAMMPS *_lmp) : PPPMDisp(_lmp) // no warnings about non-neutral systems from qsum_qsq() warn_nonneutral = 2; - efield = nullptr; - phi = nullptr; - potflag = 0; - avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR,"pppm/dielectric requires atom style dielectric"); } @@ -64,7 +60,6 @@ PPPMDispDielectric::PPPMDispDielectric(LAMMPS *_lmp) : PPPMDisp(_lmp) PPPMDispDielectric::~PPPMDispDielectric() { memory->destroy(efield); - memory->destroy(phi); } /* ---------------------------------------------------------------------- @@ -97,14 +92,12 @@ void PPPMDispDielectric::compute(int eflag, int vflag) if (function[0]) { memory->destroy(part2grid); memory->destroy(efield); - memory->destroy(phi); } if (function[1] + function[2] + function[3]) memory->destroy(part2grid_6); nmax = atom->nmax; if (function[0]) { memory->create(part2grid,nmax,3,"pppm/disp:part2grid"); memory->create(efield,nmax,3,"pppm/disp:efield"); - memory->create(phi,nmax,"pppm/disp:phi"); } if (function[1] + function[2] + function[3]) memory->create(part2grid_6,nmax,3,"pppm/disp:part2grid_6"); @@ -657,7 +650,7 @@ void PPPMDispDielectric::fieldforce_c_ik() { int i,l,m,n,nx,ny,nz,mx,my,mz; FFT_SCALAR dx,dy,dz,x0,y0,z0; - FFT_SCALAR ekx,eky,ekz,u; + FFT_SCALAR ekx,eky,ekz; // loop over my charges, interpolate electric field from nearby grid points // (nx,ny,nz) = global coords of grid pt to "lower left" of charge @@ -681,7 +674,7 @@ void PPPMDispDielectric::fieldforce_c_ik() compute_rho1d(dx,dy,dz, order, rho_coeff, rho1d); - u = ekx = eky = ekz = ZEROF; + ekx = eky = ekz = ZEROF; for (n = nlower; n <= nupper; n++) { mz = n+nz; z0 = rho1d[2][n]; @@ -691,7 +684,6 @@ void PPPMDispDielectric::fieldforce_c_ik() for (l = nlower; l <= nupper; l++) { mx = l+nx; x0 = y0*rho1d[0][l]; - if (potflag) u += x0*u_brick[mz][my][mx]; ekx -= x0*vdx_brick[mz][my][mx]; eky -= x0*vdy_brick[mz][my][mx]; ekz -= x0*vdz_brick[mz][my][mx]; @@ -699,10 +691,6 @@ void PPPMDispDielectric::fieldforce_c_ik() } } - // electrostatic potential - - if (potflag) phi[i] = u; - // convert E-field to force const double efactor = scale * eps[i]; @@ -767,14 +755,13 @@ void PPPMDispDielectric::fieldforce_c_ad() compute_rho1d(dx,dy,dz, order, rho_coeff, rho1d); compute_drho1d(dx,dy,dz, order, drho_coeff, drho1d); - u = ekx = eky = ekz = ZEROF; + ekx = eky = ekz = ZEROF; for (n = nlower; n <= nupper; n++) { mz = n+nz; for (m = nlower; m <= nupper; m++) { my = m+ny; for (l = nlower; l <= nupper; l++) { mx = l+nx; - u += rho1d[0][l]*rho1d[1][m]*rho1d[2][n]*u_brick[mz][my][mx]; ekx += drho1d[0][l]*rho1d[1][m]*rho1d[2][n]*u_brick[mz][my][mx]; eky += rho1d[0][l]*drho1d[1][m]*rho1d[2][n]*u_brick[mz][my][mx]; ekz += rho1d[0][l]*rho1d[1][m]*drho1d[2][n]*u_brick[mz][my][mx]; @@ -785,10 +772,6 @@ void PPPMDispDielectric::fieldforce_c_ad() eky *= hy_inv; ekz *= hz_inv; - // electrical potential - - if (potflag) phi[i] = u; - // convert E-field to force and substract self forces const double qfactor = qqrd2e * scale; @@ -866,10 +849,6 @@ void PPPMDispDielectric::fieldforce_c_peratom() } } - // electrostatic potential - - phi[i] = u_pa; - // convert E-field to force const double qfactor = 0.5*force->qqrd2e * scale * q[i]; diff --git a/src/DIELECTRIC/pppm_disp_dielectric.h b/src/DIELECTRIC/pppm_disp_dielectric.h index 7412762818..27172b14af 100644 --- a/src/DIELECTRIC/pppm_disp_dielectric.h +++ b/src/DIELECTRIC/pppm_disp_dielectric.h @@ -33,8 +33,6 @@ class PPPMDispDielectric : public PPPMDisp { void slabcorr(int) override; double **efield; - double *phi; - int potflag; // 1/0 if per-atom electrostatic potential phi is needed protected: void make_rho_c() override; From 56cc9d03bdd35eaa23e0febffea6f40892a04d96 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 10 Oct 2024 06:11:32 -0400 Subject: [PATCH 34/42] skip tests that are unstable on GPU --- unittest/force-styles/tests/mol-pair-lj_cut_coul_cut_soft.yaml | 2 +- unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut_soft.yaml index 485730531f..2c54e2a085 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_cut_soft.yaml @@ -2,7 +2,7 @@ lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:31 2022 epsilon: 5e-13 -skip_tests: +skip_tests: gpu prerequisites: ! | atom full pair lj/cut/coul/cut/soft diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml index a1e89e54c0..e3a2d37841 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml @@ -2,7 +2,7 @@ lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:31 2022 epsilon: 7.5e-12 -skip_tests: +skip_tests: gpu prerequisites: ! | atom full pair lj/cut/coul/long/soft From 393dbdc64046a045265a7dd93c4e17fdbc34e225 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 10 Oct 2024 08:00:38 -0400 Subject: [PATCH 35/42] add missing constants to enumerators --- src/kspace.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/kspace.h b/src/kspace.h index fedc477b81..86e9a29bd2 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -29,6 +29,8 @@ class KSpace : protected Pointers { REVERSE_RHO_ARITH, REVERSE_RHO_NONE, REVERSE_RHO_GPU, + REVERSE_RHO_G, + REVERSE_RHO_A, REVERSE_AD, REVERSE_AD_PERATOM, REVERSE_MU, @@ -53,7 +55,15 @@ class KSpace : protected Pointers { FORWARD_IK_NONE, FORWARD_AD_NONE, FORWARD_IK_PERATOM_NONE, - FORWARD_AD_PERATOM_NONE + FORWARD_AD_PERATOM_NONE, + FORWARD_IK_G, + FORWARD_AD_G, + FORWARD_IK_PERATOM_G, + FORWARD_AD_PERATOM_G, + FORWARD_IK_A, + FORWARD_AD_A, + FORWARD_IK_PERATOM_A, + FORWARD_AD_PERATOM_A }; double energy; // accumulated energies From 505d519be2c288ccee560ead451e97b7284b990e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Mei=C3=9Fner?= Date: Thu, 10 Oct 2024 16:18:05 +0200 Subject: [PATCH 36/42] Update affiliation for ELECTRODE in package details --- doc/src/Packages_details.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index 43429feb03..466d4134cb 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -880,7 +880,7 @@ groups of atoms that interact with the remaining atoms as electrolyte. **Authors:** The ELECTRODE package is written and maintained by Ludwig Ahrens-Iwers (TUHH, Hamburg, Germany), Shern Tee (UQ, Brisbane, Australia) and -Robert Meissner (TUHH, Hamburg, Germany). +Robert Meissner (Helmholtz-Zentrum Hereon, Geesthacht and TUHH, Hamburg, Germany). .. versionadded:: 4May2022 From 766ba94396183a4cd1ce85cdc87ec7d0530980a3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 10 Oct 2024 13:34:24 -0400 Subject: [PATCH 37/42] use script instead of globbing to avoid entering commands in multiple toctrees --- doc/.gitignore | 7 ++ doc/Makefile | 14 ++-- doc/src/{angles.rst => angles.rst.in} | 2 - doc/src/{bonds.rst => bonds.rst.in} | 2 - doc/src/{computes.rst => computes.rst.in} | 2 - doc/src/{dihedrals.rst => dihedrals.rst.in} | 2 - doc/src/{fixes.rst => fixes.rst.in} | 2 - doc/src/{impropers.rst => impropers.rst.in} | 2 - doc/src/{pairs.rst => pairs.rst.in} | 2 - doc/utils/make-globbed-tocs.sh | 75 +++++++++++++++++++++ 10 files changed, 91 insertions(+), 19 deletions(-) rename doc/src/{angles.rst => angles.rst.in} (73%) rename doc/src/{bonds.rst => bonds.rst.in} (73%) rename doc/src/{computes.rst => computes.rst.in} (68%) rename doc/src/{dihedrals.rst => dihedrals.rst.in} (72%) rename doc/src/{fixes.rst => fixes.rst.in} (69%) rename doc/src/{impropers.rst => impropers.rst.in} (72%) rename doc/src/{pairs.rst => pairs.rst.in} (73%) create mode 100755 doc/utils/make-globbed-tocs.sh diff --git a/doc/.gitignore b/doc/.gitignore index 7c953d2432..28e583fa0b 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -17,3 +17,10 @@ *.el /utils/sphinx-config/_static/mathjax /utils/sphinx-config/_static/polyfill.js +/src/pairs.rst +/src/bonds.rst +/src/angles.rst +/src/dihedrals.rst +/src/impropers.rst +/src/computes.rst +/src/fixes.rst diff --git a/doc/Makefile b/doc/Makefile index f9f8336665..dda15151a7 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -83,7 +83,11 @@ $(SPHINXCONFIG)/conf.py: $(SPHINXCONFIG)/conf.py.in -e 's,@LAMMPS_PYTHON_DIR@,$(BUILDDIR)/../python,g' \ -e 's,@LAMMPS_DOC_DIR@,$(BUILDDIR),g' $< > $@ -html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) +globbed-tocs: + @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi + $(SHELL) $(BUILDDIR)/utils/make-globbed-tocs.sh $(RSTDIR) + +html: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @$(MAKE) $(MFLAGS) -C graphviz all @(\ @@ -113,7 +117,7 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @rm -rf html/PDF/.[sg]* @echo "Build finished. The HTML pages are in doc/html." -fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) +fasthtml: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @$(MAKE) $(MFLAGS) -C graphviz all @mkdir -p fasthtml @@ -132,7 +136,7 @@ fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @rm -rf fasthtml/PDF/.[sg]* @echo "Fast HTML build finished. The HTML pages are in doc/fasthtml." -spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt +spelling: xmlgen globbed-tocs $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @(\ . $(VENV)/bin/activate ; \ @@ -143,7 +147,7 @@ spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives ) @echo "Spell check finished." -epub: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) +epub: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @$(MAKE) $(MFLAGS) -C graphviz all @mkdir -p epub/JPG @@ -166,7 +170,7 @@ mobi: epub @ebook-convert LAMMPS.epub LAMMPS.mobi @echo "Conversion finished. The MOBI manual file is created." -pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) +pdf: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @$(MAKE) $(MFLAGS) -C graphviz all @if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX or latexmk were not found! Please check README for further instructions" 1>&2; exit 1; fi diff --git a/doc/src/angles.rst b/doc/src/angles.rst.in similarity index 73% rename from doc/src/angles.rst rename to doc/src/angles.rst.in index c940689d4d..2bf3afc768 100644 --- a/doc/src/angles.rst +++ b/doc/src/angles.rst.in @@ -3,6 +3,4 @@ Angle Styles .. toctree:: :maxdepth: 1 - :glob: - angle_* diff --git a/doc/src/bonds.rst b/doc/src/bonds.rst.in similarity index 73% rename from doc/src/bonds.rst rename to doc/src/bonds.rst.in index 4118e153e9..c66e61ace6 100644 --- a/doc/src/bonds.rst +++ b/doc/src/bonds.rst.in @@ -3,6 +3,4 @@ Bond Styles .. toctree:: :maxdepth: 1 - :glob: - bond_* diff --git a/doc/src/computes.rst b/doc/src/computes.rst.in similarity index 68% rename from doc/src/computes.rst rename to doc/src/computes.rst.in index 8d53b6cf06..9ba0e61576 100644 --- a/doc/src/computes.rst +++ b/doc/src/computes.rst.in @@ -3,6 +3,4 @@ Computes .. toctree:: :maxdepth: 1 - :glob: - compute_* diff --git a/doc/src/dihedrals.rst b/doc/src/dihedrals.rst.in similarity index 72% rename from doc/src/dihedrals.rst rename to doc/src/dihedrals.rst.in index f56e323427..f2818afb17 100644 --- a/doc/src/dihedrals.rst +++ b/doc/src/dihedrals.rst.in @@ -3,6 +3,4 @@ Dihedral Styles .. toctree:: :maxdepth: 1 - :glob: - dihedral_* diff --git a/doc/src/fixes.rst b/doc/src/fixes.rst.in similarity index 69% rename from doc/src/fixes.rst rename to doc/src/fixes.rst.in index eb0215e310..825f278729 100644 --- a/doc/src/fixes.rst +++ b/doc/src/fixes.rst.in @@ -3,6 +3,4 @@ Fixes .. toctree:: :maxdepth: 1 - :glob: - fix_* diff --git a/doc/src/impropers.rst b/doc/src/impropers.rst.in similarity index 72% rename from doc/src/impropers.rst rename to doc/src/impropers.rst.in index a6653fde7d..2ca1e8cf3c 100644 --- a/doc/src/impropers.rst +++ b/doc/src/impropers.rst.in @@ -3,6 +3,4 @@ Improper Styles .. toctree:: :maxdepth: 1 - :glob: - improper_* diff --git a/doc/src/pairs.rst b/doc/src/pairs.rst.in similarity index 73% rename from doc/src/pairs.rst rename to doc/src/pairs.rst.in index b764c74cc7..7ae581382e 100644 --- a/doc/src/pairs.rst +++ b/doc/src/pairs.rst.in @@ -3,6 +3,4 @@ Pair Styles .. toctree:: :maxdepth: 1 - :glob: - pair_* diff --git a/doc/utils/make-globbed-tocs.sh b/doc/utils/make-globbed-tocs.sh new file mode 100755 index 0000000000..29c53cacb3 --- /dev/null +++ b/doc/utils/make-globbed-tocs.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# script to emulate globbed toctrees that allows to skip files that were entered already elsewhere + +if [ $# != 1 ] +then + echo "Usage: $0 " + exit 1 +fi + +RSTDIR="$1" +TMPNAM=${RANDOM} +TMPDIR=${TMPDIR-/tmp} + +# pairs.rst +cp ${RSTDIR}/pairs.rst.in ${TMPDIR}/${TMPNAM}.pairs.rst +for f in $(echo ${RSTDIR}/pair_*.rst | sed -e "s@${RSTDIR}/@@g" -e 's@\.rst@@g' -e 's@pair_\(coeff\|modify\|style\|write\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.pairs.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.pairs.rst ${RSTDIR}/pairs.rst || mv -vf ${TMPDIR}/${TMPNAM}.pairs.rst ${RSTDIR}/pairs.rst +rm -f ${TMPDIR}/${TMPNAM}.pairs.rst + +# bonds.rst +cp ${RSTDIR}/bonds.rst.in ${TMPDIR}/${TMPNAM}.bonds.rst +for f in $(echo ${RSTDIR}/bond_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@bond_\(coeff\|modify\|style\|write\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.bonds.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.bonds.rst ${RSTDIR}/bonds.rst || mv -vf ${TMPDIR}/${TMPNAM}.bonds.rst ${RSTDIR}/bonds.rst +rm -f ${TMPDIR}/${TMPNAM}.bonds.rst + +# angles.rst +cp ${RSTDIR}/angles.rst.in ${TMPDIR}/${TMPNAM}.angles.rst +for f in $(echo ${RSTDIR}/angle_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@angle_\(coeff\|modify\|style\|write\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.angles.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.angles.rst ${RSTDIR}/angles.rst || mv -vf ${TMPDIR}/${TMPNAM}.angles.rst ${RSTDIR}/angles.rst +rm -f ${TMPDIR}/${TMPNAM}.angles.rst + +# dihedrals.rst +cp ${RSTDIR}/dihedrals.rst.in ${TMPDIR}/${TMPNAM}.dihedrals.rst +for f in $(echo ${RSTDIR}/dihedral_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@dihedral_\(coeff\|modify\|style\|write\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.dihedrals.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.dihedrals.rst ${RSTDIR}/dihedrals.rst || mv -vf ${TMPDIR}/${TMPNAM}.dihedrals.rst ${RSTDIR}/dihedrals.rst +rm -f ${TMPDIR}/${TMPNAM}.dihedrals.rst + +# impropers.rst +cp ${RSTDIR}/impropers.rst.in ${TMPDIR}/${TMPNAM}.impropers.rst +for f in $(echo ${RSTDIR}/improper_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@improper_\(coeff\|modify\|style\|write\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.impropers.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.impropers.rst ${RSTDIR}/impropers.rst || mv -vf ${TMPDIR}/${TMPNAM}.impropers.rst ${RSTDIR}/impropers.rst +rm -f ${TMPDIR}/${TMPNAM}.impropers.rst + +# computes.rst +cp ${RSTDIR}/computes.rst.in ${TMPDIR}/${TMPNAM}.computes.rst +for f in $(echo ${RSTDIR}/compute_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@compute_modify@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.computes.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.computes.rst ${RSTDIR}/computes.rst || mv -vf ${TMPDIR}/${TMPNAM}.computes.rst ${RSTDIR}/computes.rst +rm -f ${TMPDIR}/${TMPNAM}.computes.rst + +# fixs.rst +cp ${RSTDIR}/fixes.rst.in ${TMPDIR}/${TMPNAM}.fixes.rst +for f in $(echo ${RSTDIR}/fix_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@fix_\(modify\|modify_atc_commands\)@@g' | sort ) +do \ + echo " $f" >> ${TMPDIR}/${TMPNAM}.fixes.rst +done +cmp -s ${TMPDIR}/${TMPNAM}.fixes.rst ${RSTDIR}/fixes.rst || mv -vf ${TMPDIR}/${TMPNAM}.fixes.rst ${RSTDIR}/fixes.rst +rm -f ${TMPDIR}/${TMPNAM}.fixes.rst From 9835adcbfc3575cd38c92e8a7ea15f95a0059a31 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 10 Oct 2024 13:34:53 -0400 Subject: [PATCH 38/42] allow use of Sphinx version 8.x as interface with breathe seems to have been updated --- doc/utils/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/utils/requirements.txt b/doc/utils/requirements.txt index 6787b9d682..4b9e1a4e48 100644 --- a/doc/utils/requirements.txt +++ b/doc/utils/requirements.txt @@ -1,4 +1,4 @@ -Sphinx >= 5.3.0, <7.5 +Sphinx >= 5.3.0, <9.0 sphinxcontrib-spelling sphinxcontrib-jquery sphinx-design From 7693e9682898fb9f2d29a325d411f8d18da25141 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 10 Oct 2024 17:24:23 -0400 Subject: [PATCH 39/42] change globbed toc script from bash to python --- doc/Makefile | 3 +- doc/src/angles.rst.in | 6 -- doc/src/bonds.rst.in | 6 -- doc/src/computes.rst.in | 6 -- doc/src/dihedrals.rst.in | 6 -- doc/src/fixes.rst.in | 6 -- doc/src/impropers.rst.in | 6 -- doc/src/pairs.rst.in | 6 -- doc/utils/make-globbed-tocs.py | 120 +++++++++++++++++++++++++++++++++ doc/utils/make-globbed-tocs.sh | 75 --------------------- 10 files changed, 121 insertions(+), 119 deletions(-) delete mode 100644 doc/src/angles.rst.in delete mode 100644 doc/src/bonds.rst.in delete mode 100644 doc/src/computes.rst.in delete mode 100644 doc/src/dihedrals.rst.in delete mode 100644 doc/src/fixes.rst.in delete mode 100644 doc/src/impropers.rst.in delete mode 100644 doc/src/pairs.rst.in create mode 100644 doc/utils/make-globbed-tocs.py delete mode 100755 doc/utils/make-globbed-tocs.sh diff --git a/doc/Makefile b/doc/Makefile index dda15151a7..d26e6020a6 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -84,8 +84,7 @@ $(SPHINXCONFIG)/conf.py: $(SPHINXCONFIG)/conf.py.in -e 's,@LAMMPS_DOC_DIR@,$(BUILDDIR),g' $< > $@ globbed-tocs: - @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi - $(SHELL) $(BUILDDIR)/utils/make-globbed-tocs.sh $(RSTDIR) + $(PYTHON) $(BUILDDIR)/utils/make-globbed-tocs.py -d $(RSTDIR) html: xmlgen globbed-tocs $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi diff --git a/doc/src/angles.rst.in b/doc/src/angles.rst.in deleted file mode 100644 index 2bf3afc768..0000000000 --- a/doc/src/angles.rst.in +++ /dev/null @@ -1,6 +0,0 @@ -Angle Styles -############ - -.. toctree:: - :maxdepth: 1 - diff --git a/doc/src/bonds.rst.in b/doc/src/bonds.rst.in deleted file mode 100644 index c66e61ace6..0000000000 --- a/doc/src/bonds.rst.in +++ /dev/null @@ -1,6 +0,0 @@ -Bond Styles -########### - -.. toctree:: - :maxdepth: 1 - diff --git a/doc/src/computes.rst.in b/doc/src/computes.rst.in deleted file mode 100644 index 9ba0e61576..0000000000 --- a/doc/src/computes.rst.in +++ /dev/null @@ -1,6 +0,0 @@ -Computes -######## - -.. toctree:: - :maxdepth: 1 - diff --git a/doc/src/dihedrals.rst.in b/doc/src/dihedrals.rst.in deleted file mode 100644 index f2818afb17..0000000000 --- a/doc/src/dihedrals.rst.in +++ /dev/null @@ -1,6 +0,0 @@ -Dihedral Styles -############### - -.. toctree:: - :maxdepth: 1 - diff --git a/doc/src/fixes.rst.in b/doc/src/fixes.rst.in deleted file mode 100644 index 825f278729..0000000000 --- a/doc/src/fixes.rst.in +++ /dev/null @@ -1,6 +0,0 @@ -Fixes -##### - -.. toctree:: - :maxdepth: 1 - diff --git a/doc/src/impropers.rst.in b/doc/src/impropers.rst.in deleted file mode 100644 index 2ca1e8cf3c..0000000000 --- a/doc/src/impropers.rst.in +++ /dev/null @@ -1,6 +0,0 @@ -Improper Styles -############### - -.. toctree:: - :maxdepth: 1 - diff --git a/doc/src/pairs.rst.in b/doc/src/pairs.rst.in deleted file mode 100644 index 7ae581382e..0000000000 --- a/doc/src/pairs.rst.in +++ /dev/null @@ -1,6 +0,0 @@ -Pair Styles -########### - -.. toctree:: - :maxdepth: 1 - diff --git a/doc/utils/make-globbed-tocs.py b/doc/utils/make-globbed-tocs.py new file mode 100644 index 0000000000..bd0062adbe --- /dev/null +++ b/doc/utils/make-globbed-tocs.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 + +""" +Script to emulate globbed toctrees with the added feature +to avoid adding files that are already included elsewhere. +""" + +import os, re +import filecmp +import tempfile +import shutil +from glob import glob +from argparse import ArgumentParser + +LAMMPS_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..')) + +parser = ArgumentParser(prog='make-globbed-tocs.py', + description="Create toctree files from patterns with exclusions") +parser.add_argument("-v", "--verbose", action='store_true', help="Enable verbose output") +parser.add_argument("-d", "--doc", help="Path to LAMMPS documentation sources") + +args = parser.parse_args() +verbose = args.verbose +if args.doc: + docsrc = os.path.realpath(args.doc) +else: + docsrc = os.path.join(LAMMPS_DIR, 'doc', 'src') + +if not os.path.isdir(docsrc): + sys.exit(f"LAMMPS manual source dir {docsrc} does not exist") + +def glob_tocfile(style, name, head, exclude): + + newname = None + exclude_re = re.compile(exclude) + if verbose: print("Processing style ", style) + with tempfile.NamedTemporaryFile(prefix=style + '.', delete=False) as f: + newname = f.name + if verbose: print("Temporary file: ", newname) + f.write(head.encode('utf-8')) + for doc in sorted(glob(os.path.join(docsrc, style + '_*.rst'))): + d,e = os.path.splitext(os.path.basename(doc)) + if exclude_re.match(d): + if verbose: print("skipping file ", d) + continue + if verbose: print("processing file ", d) + f.write((" " + d + "\n").encode('utf-8')) + + oldname = os.path.join(docsrc, name) + if os.path.exists(oldname) and filecmp.cmp(newname, oldname, shallow=False): + print("File ", name, " is unchanged") + os.remove(newname) + else: + print("Overwriting file ", name, " with new version") + shutil.move(newname, os.path.join(docsrc, name)) + +################################## + +pair_head = """Pair Styles +########### + +.. toctree:: + :maxdepth: 1 + +""" +glob_tocfile('pair', 'pairs.rst', pair_head, r"pair_(coeff|modify|style|write)") + +bond_head = """Bond Styles +########### + +.. toctree:: + :maxdepth: 1 + +""" +glob_tocfile('bond', 'bonds.rst', bond_head, r"bond_(coeff|modify|style|write)") + +angle_head = """Angle Styles +############ + +.. toctree:: + :maxdepth: 1 + +""" +glob_tocfile('angle', 'angles.rst', angle_head, r"angle_(coeff|modify|style|write)") + +dihedral_head = """Dihedral Styles +############### + +.. toctree:: + :maxdepth: 1 + +""" +glob_tocfile('dihedral', 'dihedrals.rst', dihedral_head, r"dihedral_(coeff|modify|style|write)") + +improper_head = """Improper Styles +############### + +.. toctree:: + :maxdepth: 1 + +""" +glob_tocfile('improper', 'impropers.rst', improper_head, r"improper_(coeff|modify|style|write)") + +compute_head = """Compute Styles +############### + +.. toctree:: + :maxdepth: 1 + +""" +glob_tocfile('compute', 'computes.rst', compute_head, r"compute_modify") + +fix_head = """Fix Styles +########## + +.. toctree:: + :maxdepth: 1 + +""" +glob_tocfile('fix', 'fixes.rst', fix_head, r"fix_modify(|_atc_commands)") diff --git a/doc/utils/make-globbed-tocs.sh b/doc/utils/make-globbed-tocs.sh deleted file mode 100755 index 29c53cacb3..0000000000 --- a/doc/utils/make-globbed-tocs.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# script to emulate globbed toctrees that allows to skip files that were entered already elsewhere - -if [ $# != 1 ] -then - echo "Usage: $0 " - exit 1 -fi - -RSTDIR="$1" -TMPNAM=${RANDOM} -TMPDIR=${TMPDIR-/tmp} - -# pairs.rst -cp ${RSTDIR}/pairs.rst.in ${TMPDIR}/${TMPNAM}.pairs.rst -for f in $(echo ${RSTDIR}/pair_*.rst | sed -e "s@${RSTDIR}/@@g" -e 's@\.rst@@g' -e 's@pair_\(coeff\|modify\|style\|write\)@@g' | sort ) -do \ - echo " $f" >> ${TMPDIR}/${TMPNAM}.pairs.rst -done -cmp -s ${TMPDIR}/${TMPNAM}.pairs.rst ${RSTDIR}/pairs.rst || mv -vf ${TMPDIR}/${TMPNAM}.pairs.rst ${RSTDIR}/pairs.rst -rm -f ${TMPDIR}/${TMPNAM}.pairs.rst - -# bonds.rst -cp ${RSTDIR}/bonds.rst.in ${TMPDIR}/${TMPNAM}.bonds.rst -for f in $(echo ${RSTDIR}/bond_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@bond_\(coeff\|modify\|style\|write\)@@g' | sort ) -do \ - echo " $f" >> ${TMPDIR}/${TMPNAM}.bonds.rst -done -cmp -s ${TMPDIR}/${TMPNAM}.bonds.rst ${RSTDIR}/bonds.rst || mv -vf ${TMPDIR}/${TMPNAM}.bonds.rst ${RSTDIR}/bonds.rst -rm -f ${TMPDIR}/${TMPNAM}.bonds.rst - -# angles.rst -cp ${RSTDIR}/angles.rst.in ${TMPDIR}/${TMPNAM}.angles.rst -for f in $(echo ${RSTDIR}/angle_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@angle_\(coeff\|modify\|style\|write\)@@g' | sort ) -do \ - echo " $f" >> ${TMPDIR}/${TMPNAM}.angles.rst -done -cmp -s ${TMPDIR}/${TMPNAM}.angles.rst ${RSTDIR}/angles.rst || mv -vf ${TMPDIR}/${TMPNAM}.angles.rst ${RSTDIR}/angles.rst -rm -f ${TMPDIR}/${TMPNAM}.angles.rst - -# dihedrals.rst -cp ${RSTDIR}/dihedrals.rst.in ${TMPDIR}/${TMPNAM}.dihedrals.rst -for f in $(echo ${RSTDIR}/dihedral_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@dihedral_\(coeff\|modify\|style\|write\)@@g' | sort ) -do \ - echo " $f" >> ${TMPDIR}/${TMPNAM}.dihedrals.rst -done -cmp -s ${TMPDIR}/${TMPNAM}.dihedrals.rst ${RSTDIR}/dihedrals.rst || mv -vf ${TMPDIR}/${TMPNAM}.dihedrals.rst ${RSTDIR}/dihedrals.rst -rm -f ${TMPDIR}/${TMPNAM}.dihedrals.rst - -# impropers.rst -cp ${RSTDIR}/impropers.rst.in ${TMPDIR}/${TMPNAM}.impropers.rst -for f in $(echo ${RSTDIR}/improper_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@improper_\(coeff\|modify\|style\|write\)@@g' | sort ) -do \ - echo " $f" >> ${TMPDIR}/${TMPNAM}.impropers.rst -done -cmp -s ${TMPDIR}/${TMPNAM}.impropers.rst ${RSTDIR}/impropers.rst || mv -vf ${TMPDIR}/${TMPNAM}.impropers.rst ${RSTDIR}/impropers.rst -rm -f ${TMPDIR}/${TMPNAM}.impropers.rst - -# computes.rst -cp ${RSTDIR}/computes.rst.in ${TMPDIR}/${TMPNAM}.computes.rst -for f in $(echo ${RSTDIR}/compute_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@compute_modify@@g' | sort ) -do \ - echo " $f" >> ${TMPDIR}/${TMPNAM}.computes.rst -done -cmp -s ${TMPDIR}/${TMPNAM}.computes.rst ${RSTDIR}/computes.rst || mv -vf ${TMPDIR}/${TMPNAM}.computes.rst ${RSTDIR}/computes.rst -rm -f ${TMPDIR}/${TMPNAM}.computes.rst - -# fixs.rst -cp ${RSTDIR}/fixes.rst.in ${TMPDIR}/${TMPNAM}.fixes.rst -for f in $(echo ${RSTDIR}/fix_*.rst | sed -e "s@${RSTDIR}/@@g" -e "s@\\.rst@@g" -e 's@fix_\(modify\|modify_atc_commands\)@@g' | sort ) -do \ - echo " $f" >> ${TMPDIR}/${TMPNAM}.fixes.rst -done -cmp -s ${TMPDIR}/${TMPNAM}.fixes.rst ${RSTDIR}/fixes.rst || mv -vf ${TMPDIR}/${TMPNAM}.fixes.rst ${RSTDIR}/fixes.rst -rm -f ${TMPDIR}/${TMPNAM}.fixes.rst From 49a850c8aa06f8773e0bd2523bc1e90623952ff4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 10 Oct 2024 17:25:05 -0400 Subject: [PATCH 40/42] add cmake support for make-globbed-toc --- cmake/Modules/Documentation.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/Modules/Documentation.cmake b/cmake/Modules/Documentation.cmake index 7b8f4a5ba0..dfaf7bdb39 100644 --- a/cmake/Modules/Documentation.cmake +++ b/cmake/Modules/Documentation.cmake @@ -110,6 +110,7 @@ if(BUILD_DOC) add_custom_command( OUTPUT html DEPENDS ${DOC_SOURCES} ${DOCENV_DEPS} ${DOXYGEN_XML_DIR}/index.xml ${BUILD_DOC_CONFIG_FILE} + COMMAND ${Python3_EXECUTABLE} ${LAMMPS_DOC_DIR}/utils/make-globbed-tocs.py -d ${LAMMPS_DOC_DIR}/src COMMAND Sphinx::sphinx-build ${SPHINX_EXTRA_OPTS} -b html -c ${DOC_BUILD_DIR} -d ${DOC_BUILD_DIR}/doctrees ${LAMMPS_DOC_DIR}/src ${DOC_BUILD_DIR}/html COMMAND ${CMAKE_COMMAND} -E create_symlink Manual.html ${DOC_BUILD_DIR}/html/index.html COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DOC_DIR}/src/PDF ${DOC_BUILD_DIR}/html/PDF From 9adf51f18eaa178cdb6e7d9240f8a93a68f56d23 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 10 Oct 2024 17:29:33 -0400 Subject: [PATCH 41/42] ignore python wheel build folder --- doc/utils/converters/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/utils/converters/.gitignore b/doc/utils/converters/.gitignore index 11041c7834..cd3cd53819 100644 --- a/doc/utils/converters/.gitignore +++ b/doc/utils/converters/.gitignore @@ -1 +1,2 @@ *.egg-info +/build From df506914881431af186ba8af0ca81ab3d5eba618 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 11 Oct 2024 06:54:46 -0400 Subject: [PATCH 42/42] small correction and clarifications --- doc/src/Intro_portability.rst | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/src/Intro_portability.rst b/doc/src/Intro_portability.rst index 472a2bee88..036529ff9d 100644 --- a/doc/src/Intro_portability.rst +++ b/doc/src/Intro_portability.rst @@ -31,18 +31,19 @@ Operating systems ^^^^^^^^^^^^^^^^^ The primary development platform for LAMMPS is Linux. Thus, the chances -for LAMMPS to compile without problems on Linux machines are the best. +for LAMMPS to compile without problems are the best on Linux machines. Also, compilation and correct execution on macOS and Windows (using -Microsoft Visual C++) is checked automatically for largest part of the -source code. Some (optional) features are not compatible with all +Microsoft Visual C++) is checked automatically for the largest part of +the source code. Some (optional) features are not compatible with all operating systems, either through limitations of the corresponding -LAMMPS source code or through source code or build system -incompatibilities of required libraries. +LAMMPS source code or through incompatibilities of source code or +build system of required external libraries or packages. Executables for Windows may be created natively using either Cygwin or Visual Studio or with a Linux to Windows MinGW cross-compiler. -Additionally, FreeBSD and Solaris have been tested successfully. +Additionally, FreeBSD and Solaris have been tested successfully to +run LAMMPS and produce results consistent with those on Linux. Compilers ^^^^^^^^^