Miscellaneous¶
-
double metatomic_torch::unit_conversion_factor(const std::string &from_unit, const std::string &to_unit)¶
Get the multiplicative conversion factor to use to convert from
from_unittoto_unit. Both units are parsed as expressions (e.g. “kJ/mol/A^2”, “(eV*u)^(1/2)”) and their dimensions must match.Unit expressions are built from base units combined with
*,/,^, and parentheses. Unit lookup is case-insensitive, and whitespace is ignored. For example:"kJ/mol"— energy per mole"eV/Angstrom^3"— pressure"(eV*u)^(1/2)"— momentum (fractional powers)"Hartree/Bohr"— force in atomic units
Supported base units:
Length: angstrom (A), bohr, nanometer (nm), meter (m), centimeter (cm), millimeter (mm), micrometer (um, µm)
Energy: eV, meV, Hartree, Ry (rydberg), Joule (J), kcal, kJ (note: kcal and kJ are bare; write kcal/mol for per-mole)
Time: second (s), millisecond (ms), microsecond (us, µs), nanosecond (ns), picosecond (ps), femtosecond (fs)
Mass: dalton (u), kilogram (kg), gram (g), electron_mass (m_e)
Charge: e, coulomb (c)
Dimensionless: mol
Derived: hbar
Note on quantity validation: The 2-argument form
unit_conversion_factor(from_unit, to_unit)does not take a quantity parameter. Dimensional compatibility is checked automatically by comparing the parsed dimensions of both unit expressions. The deprecated 3-argument form accepts aquantityparameter, but it is ignored for the conversion calculation - it only emits a deprecation warning.
-
double metatomic_torch::unit_conversion_factor(const std::string &quantity, const std::string &from_unit, const std::string &to_unit)¶
- Deprecated:
Use the 2-argument overload instead. The
quantityparameter is ignored; dimensional compatibility is checked by the parser. Emits a one-time runtime deprecation warning.
-
torch::DeviceType metatomic_torch::pick_device(std::vector<std::string> model_devices, torch::optional<std::string> desired_device = torch::nullopt)¶
Select the best device according to the list of
model_devicesfrom a model, the user-provideddesired_deviceand what’s available on the current machine.If
desired_deviceis provided, it is checked against themodel_devicesand the machine availability. If it contains a device index (e.g. “cuda:1”), the base device type (“cuda”) is used for these checks.This function returns a c10::DeviceType (torch::DeviceType). It does NOT decide a device index — callers that need a full torch::Device should construct one from the returned DeviceType (and choose an index explicitly). Or let it default away to zero via Device(DeviceType)
-
std::string metatomic_torch::pick_output(std::string requested_output, torch::Dict<std::string, ModelOutput> outputs, torch::optional<std::string> desired_variant = torch::nullopt)¶
Pick the output for the given
requested_outputfrom the availabilities of the model’soutputs, according to the optionaldesired_variant.