nvalchemi.distributed.FunctionAdapter#

class nvalchemi.distributed.FunctionAdapter(func, replacement=None)[source]#

Adapt a module-level function named by the real function object.

Ergonomic constructor for PythonAdapter: derives the import path from func itself, so callers write FunctionAdapter(mol_sum, _owned_mol_sum) instead of spelling the module path and attribute name as strings. Returns a PythonAdapter, so install / restore / serialization are unchanged.

Safe by construction: the target is resolved as func.__module__ + func.__name__ and verified to be that exact object. A re-exported name (the same function bound under more than one module — e.g. fairchem’s reduce_node_to_system) can’t be distinguished from the resolved object, so it raises and asks for an explicit PythonAdapter(module_path=..., attr_name=...) naming the binding.

Parameters:
  • func (Any)

  • replacement (Callable[[...], Any] | None)

Return type:

PythonAdapter