34 {
35 std::vector<std::string> paths;
38 if (const char *e = std::getenv("RGPOT_METATOMIC_ENGINE"))
39 if (e && *e)
40 paths.emplace_back(e);
41 if (const char *e = std::getenv("METATOMIC_ENGINE"))
42 if (e && *e)
43 paths.emplace_back(e);
44 paths.emplace_back("librgpot_metatomic_engine.so");
45 paths.emplace_back("libmetatomic_engine.so");
46 auto add_dirs = [&](const char *env) {
47 if (!env)
48 return;
49 std::string s(env);
50 size_t i = 0;
51 while (i < s.size()) {
52 auto j = s.find(':', i);
53 if (j == std::string::npos)
54 j = s.size();
55 if (j > i) {
56 std::string d = s.substr(i, j - i);
57 if (!d.empty() && d.back() != '/')
58 d += '/';
59 paths.push_back(d + "librgpot_metatomic_engine.so");
60 paths.push_back(d + "libmetatomic_engine.so");
61 }
62 i = j + 1;
63 }
64 };
65 add_dirs(std::getenv("EON_POTENTIALS_PATH"));
66 add_dirs(std::getenv("RGPOT_ENGINE_PATH"));
67
68 std::string last_dlerr;
69 for (const auto &p : paths) {
70 m_lib = open_lib(p.c_str());
72 break;
73#ifndef _WIN32
74 if (const char *e = dlerror())
75 last_dlerr = e;
76#endif
77 }
79 std::string msg =
80 "RGPOT(metatomic): librgpot_metatomic_engine.so not found "
81 "(set RGPOT_METATOMIC_ENGINE or EON_POTENTIALS_PATH)";
82 if (!last_dlerr.empty())
83 msg += std::string("; last dlerror: ") + last_dlerr;
84 throw std::runtime_error(msg);
85 }
86
87 auto abi =
88 reinterpret_cast<int (*)()
>(load_sym(
m_lib,
"rgpot_mta_abi_version"));
97 throw std::runtime_error("RGPOT(metatomic): engine C ABI missing/mismatch");
98 }
99 char err[1024]{};
112 throw std::runtime_error(std::string("RGPOT(metatomic): create failed: ") +
113 err);
114 }
115}
const char * extensions_directory
double uncertainty_threshold
int torch_determinism_strict
0=Fast, 1=Strict