xnn.dnn.models.qrnn.QRNNPlanner#

class xnn.dnn.models.qrnn.QRNNPlanner(all_pairs, angular_cutoff=inf, species=())[source]#

Bases: object

The triplets of the AEV, enumerated outside the model step for a captured step.

A captured evaluation or training step (xnn.common.train.graphed) needs fixed shapes and no host synchronization, while the triplet count of a structure is known only after enumerating them. The planner enumerates on the CPU the pairs of edges at each center within the angular cutoff (with a small margin: the pairs beyond the cutoff add exact zeros) at the structure’s own positions, and the padded batch carries them as index_plan. With species it also counts the atoms of every element, so that a padded batch fixes the size of each element’s block of the networks. Holds no tensors, so data-loader workers receive it cheaply.

Parameters:
  • all_pairs (bool) – Whether the model sums every atom pair (Coulomb or dispersion term), which needs molecules.

  • angular_cutoff (float, optional) – The cutoff of the angular terms (default: every pair of edges).

  • species (sequence of int, optional) – The elements with networks, in the model’s order (default: no counts).

offsets = {'aev_e1': 'edges', 'aev_e2': 'edges', 'element_counts': None}#

The count each plan entry indexes (for batching the plans of single structures).

pads = True#

Batches are padded by an inert structure to fixed counts.

margin = 1e-05#

Relative margin on the angular cutoff, so that no rounding of the edge lengths drops a pair.

sizes(plan)[source]#

The sizes a padded batch fixes: the triplet count and, with species, the atoms of every element ("element_<Z>").

Parameters:

plan (Dict[str, Tensor])

Return type:

Dict[str, int]

static pad(plan, sizes, dummy_edge)[source]#

plan filled up to sizes["triplets"] with triplets of the padding edge dummy_edge.

Parameters:
Return type:

Dict[str, Tensor]