Create graph from ASE atoms

mlip.simulation.utils.create_graph_from_atoms(atoms: Atoms, senders: ndarray, receivers: ndarray, displacement_fun: Callable[[ndarray, ndarray], ndarray] | None, allowed_atomic_numbers: set[int], cell: ndarray | None = None, shifts: ndarray | None = None) GraphsTuple

Creates a graph for a group of atoms (i.e., a chemical system).

This function will leave the shifts of the graph empty and will populate the displacement function in the graph object instead.

Note: Only one of the two arguments “shifts” and “displacement_fun” should be passed to this function, the other one should be None.

Parameters:
  • atoms – The atoms of the system.

  • senders – The sender indexes of the edges for the graph.

  • receivers – The receiver indexes of the edges for the graph.

  • displacement_fun – Optional function that takes in two position vectors and returns the displacement vector between them.

  • allowed_atomic_numbers – A set of allowed atomic numbers known to a model such that the atomic species can be correctly assigned in the graph.

  • cell – The structure’s box.

  • shifts – Vectors defining which periodic box each node is in, so that one can compute the edge vectors from the positions.

Returns:

The graph representing the system.