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

Method spawn

Lattice/Scripting/ScriptAPI.cpp:62–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62bool ScriptBatch::spawn(const std::string& speciesName, const sol::object& positionObject, const sol::object& optionsObject) {
63 const glm::vec3 position = readVec3Object(positionObject);
64 const SpawnOptions options = parseSpawnOptions(optionsObject);
65 if (const std::optional<AtomData::Type> atomType = findAtomTypeBySymbol(speciesName); atomType.has_value()) {
66 (void)simulation_.appendAtomFast(position, options.velocity, *atomType, options.fixed);
67 return true;
68 }
69 return simulation_.spawnMolecule(speciesName, position, std::nullopt, options.fixed);
70}
71
72bool ScriptBatch::random_spawn(const std::string& speciesName, const sol::object& optionsObject) {
73 return simulation_.randomSpawn(speciesName, parseSpawnOptions(optionsObject));

Callers

nothing calls this directly

Calls 4

readVec3ObjectFunction · 0.85
spawnMoleculeMethod · 0.80
findAtomTypeBySymbolFunction · 0.70
appendAtomFastMethod · 0.45

Tested by

no test coverage detected