1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
Description: _set_potentials_path
Index: lammps-4Feb2025/src/ML-IAP/mliap_model_python.cpp
===================================================================
--- lammps-4Feb2025.orig/src/ML-IAP/mliap_model_python.cpp
+++ lammps-4Feb2025/src/ML-IAP/mliap_model_python.cpp
@@ -69,6 +69,8 @@ MLIAPModelPython::MLIAPModelPython(LAMMP
if (potentials_path != nullptr) {
PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path));
}
+ const char *debian_potentials_path = "/usr/share/lammps/potentials";
+ PyList_Append(py_path, PY_STRING_FROM_STRING(debian_potentials_path));
PyGILState_Release(gstate);
if (coefffilename) read_coeffs(coefffilename);
Index: lammps-4Feb2025/src/PYTHON/pair_python.cpp
===================================================================
--- lammps-4Feb2025.orig/src/PYTHON/pair_python.cpp
+++ lammps-4Feb2025/src/PYTHON/pair_python.cpp
@@ -63,6 +63,8 @@ PairPython::PairPython(LAMMPS *lmp) : Pa
if (potentials_path != nullptr) {
PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path));
}
+ const char *debian_potentials_path = "/usr/share/lammps/potentials";
+ PyList_Append(py_path, PY_STRING_FROM_STRING(debian_potentials_path));
}
/* ---------------------------------------------------------------------- */
Index: lammps-4Feb2025/src/utils.cpp
===================================================================
--- lammps-4Feb2025.orig/src/utils.cpp
+++ lammps-4Feb2025/src/utils.cpp
@@ -1748,6 +1748,10 @@ std::string utils::get_potential_file_pa
auto filepath = platform::path_join(dir, pot);
if (platform::file_is_readable(filepath)) return filepath;
}
+ const auto debian_dir = "/usr/share/lammps/potentials";
+ auto pot = platform::path_basename(path);
+ auto filepath = platform::path_join(debian_dir, pot);
+ if (platform::file_is_readable(filepath)) return filepath;
}
return "";
}
Index: lammps-4Feb2025/unittest/utils/test_utils.cpp
===================================================================
--- lammps-4Feb2025.orig/unittest/utils/test_utils.cpp
+++ lammps-4Feb2025/unittest/utils/test_utils.cpp
@@ -1053,6 +1053,13 @@ TEST(Utils, potential_file)
EXPECT_THAT(utils::get_potential_units(path, "EAM"), Eq("metal"));
}
+ const char *debian_folder = "/usr/share/lammps/potentials";
+ if (debian_folder != nullptr) {
+ std::string path = platform::path_join(debian_folder, "Cu_u3.eam");
+ EXPECT_THAT(utils::get_potential_file_path("Cu_u3.eam"), Eq(path));
+ EXPECT_THAT(utils::get_potential_units(path, "EAM"), Eq("metal"));
+ }
+
ASSERT_THAT(utils::get_potential_date("ctest1.txt", "Test"), Eq("2020-02-20"));
ASSERT_THAT(utils::get_potential_units("ctest1.txt", "Test"), Eq("real"));
ASSERT_THAT(utils::get_potential_date("ctest2.txt", "Test"), Eq(""));
|