xnn.common.models.ops.refresh_ghosts#

xnn.common.models.ops.refresh_ghosts(x)[source]#

Per-atom rows with the ghost atoms’ rows replaced by their owners’ values.

Under DomainParallel with halo="layer" a process holds its own atoms and copies (ghosts) of the atoms within one cutoff of them. A model that sets refreshes_ghosts calls this on its node features before every layer that reads its neighbors’ features, so the ghosts carry the values their owners computed and one cutoff of ghosts is enough. Differentiable: the gradients of the ghost rows return to their owners. x unchanged outside a domain decomposition and in scripted code.

Parameters:

x (torch.Tensor) – Per-atom rows (N, *feature_dims), the process’s own atoms first.

Returns:

x with its ghost rows refreshed, same shape.

Return type:

torch.Tensor