MCPcopy Create free account
hub / github.com/ElectroZybr/LatticeLab / parseLatticeFillOptions

Method parseLatticeFillOptions

Lattice/Scripting/ScriptAPI.cpp:241–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241::Generators::LatticeFillOptions ScriptAPI::parseLatticeFillOptions(const sol::object& object) const {
242 ::Generators::LatticeFillOptions options;
243 if (!object.is<sol::table>()) {
244 return options;
245 }
246
247 const sol::table table = object.as<sol::table>();
248 options.margin = table.get_or("margin", options.margin);
249 options.fixed = table.get_or("fixed", options.fixed);
250 options.seed = table.get_or("seed", options.seed);
251
252 const std::string structure = table.get_or("structure", std::string{"hex"});
253 if (structure == "bcc") {
254 options.structure = ::Generators::LatticeStructure::Bcc;
255 } else if (structure == "hex") {
256 options.structure = ::Generators::LatticeStructure::Hex;
257 } else {
258 throw std::runtime_error("unsupported lattice_fill structure: " + structure);
259 }
260
261 const std::string mode = table.get_or("mode", std::string{});
262 if (mode == "reset") {
263 options.mode = ::Generators::SpawnMode::Reset;
264 } else if (mode == "add") {
265 options.mode = ::Generators::SpawnMode::Add;
266 } else if (mode == "replace" || mode.empty()) {
267 options.mode = ::Generators::SpawnMode::Replace;
268 } else {
269 throw std::runtime_error("unsupported lattice_fill mode: " + mode);
270 }
271
272 return options;
273}
274
275std::vector<std::string> ScriptAPI::loadMoleculesFrom(const std::filesystem::path& path) {
276 if (!std::filesystem::exists(path)) {

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected