File: 20_set_potentials_path.patch

package info (click to toggle)
lammps 20220106.git7586adbb6a%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 348,064 kB
  • sloc: cpp: 831,421; python: 24,896; xml: 14,949; f90: 10,845; ansic: 7,967; sh: 4,226; perl: 4,064; fortran: 2,424; makefile: 1,501; objc: 238; lisp: 163; csh: 16; awk: 14; tcl: 6
file content (53 lines) | stat: -rw-r--r-- 2,734 bytes parent folder | download
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
Description: _set_potentials_path
Index: lammps-0~20220106.git7586adbb6a/src/ML-IAP/mliap_model_python.cpp
===================================================================
--- lammps-0~20220106.git7586adbb6a.orig/src/ML-IAP/mliap_model_python.cpp
+++ lammps-0~20220106.git7586adbb6a/src/ML-IAP/mliap_model_python.cpp
@@ -61,7 +61,7 @@ MLIAPModelPython::MLIAPModelPython(LAMMP
   PyList_Append(py_path, PY_STRING_FROM_STRING("."));
 
   // if LAMMPS_POTENTIALS environment variable is set, add it to PYTHONPATH as well
-  const char *potentials_path = getenv("LAMMPS_POTENTIALS");
+  const char *potentials_path = "/usr/share/lammps/potentials";
   if (potentials_path != NULL) { PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); }
   PyGILState_Release(gstate);
 
Index: lammps-0~20220106.git7586adbb6a/src/PYTHON/pair_python.cpp
===================================================================
--- lammps-0~20220106.git7586adbb6a.orig/src/PYTHON/pair_python.cpp
+++ lammps-0~20220106.git7586adbb6a/src/PYTHON/pair_python.cpp
@@ -59,7 +59,7 @@ PairPython::PairPython(LAMMPS *lmp) : Pa
   // if LAMMPS_POTENTIALS environment variable is set,
   // add it to PYTHONPATH as well
 
-  const char *potentials_path = getenv("LAMMPS_POTENTIALS");
+  const char *potentials_path = "/usr/share/lammps/potentials";
   if (potentials_path != nullptr) {
     PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path));
   }
Index: lammps-0~20220106.git7586adbb6a/src/utils.cpp
===================================================================
--- lammps-0~20220106.git7586adbb6a.orig/src/utils.cpp
+++ lammps-0~20220106.git7586adbb6a/src/utils.cpp
@@ -1106,7 +1106,7 @@ std::string utils::get_potential_file_pa
     return filepath;
   } else {
     // try the environment variable directory
-    const char *var = getenv("LAMMPS_POTENTIALS");
+    const char *var = "/usr/share/lammps/potentials";
 
     if (var != nullptr) {
 #if defined(_WIN32)
Index: lammps-0~20220106.git7586adbb6a/unittest/utils/test_utils.cpp
===================================================================
--- lammps-0~20220106.git7586adbb6a.orig/unittest/utils/test_utils.cpp
+++ lammps-0~20220106.git7586adbb6a/unittest/utils/test_utils.cpp
@@ -799,7 +799,7 @@ TEST(Utils, potential_file)
     ASSERT_THAT(utils::get_potential_file_path("ctest1.txt"), Eq("ctest1.txt"));
     ASSERT_THAT(utils::get_potential_file_path("no_such_file.txt"), Eq(""));
 
-    const char *folder = getenv("LAMMPS_POTENTIALS");
+    const char *folder = "/usr/share/lammps/potentials";
     if (folder != nullptr) {
         std::string path = utils::path_join(folder, "Cu_u3.eam");
         EXPECT_THAT(utils::get_potential_file_path("Cu_u3.eam"), Eq(path));