MolecularDiffusion.modules.layers.graph_module¶
Classes¶
Class to keep graph attributes nicely packaged. |
|
Mixin Model class implementing some general convenience properties and methods. |
|
Functions¶
|
|
|
Give a mask that filters out edges so that each atom has at most |
|
|
|
Module Contents¶
- class MolecularDiffusion.modules.layers.graph_module.BackboneInterface¶
- abstractmethod forward(data: MolecularDiffusion.modules.layers.atomic_data.AtomicData) dict[str, torch.Tensor]¶
Backbone forward.
- Parameters:
data (AtomicData) – Atomic systems as input
- Returns:
embedding – Return backbone embeddings for the given input
- Return type:
dict[str->torch.Tensor]
- class MolecularDiffusion.modules.layers.graph_module.GraphData¶
Class to keep graph attributes nicely packaged.
- atomic_numbers_full: torch.Tensor¶
- batch_full: torch.Tensor¶
- cell_offsets: torch.Tensor¶
- edge_distance: torch.Tensor¶
- edge_distance_vec: torch.Tensor¶
- edge_index: torch.Tensor¶
- neighbors: torch.Tensor¶
- offset_distances: torch.Tensor¶
- class MolecularDiffusion.modules.layers.graph_module.GraphModelMixin¶
Mixin Model class implementing some general convenience properties and methods.
- generate_graph(data, cutoff=None, max_neighbors=None, use_pbc=None, otf_graph=None, enforce_max_neighbors_strictly=None, use_pbc_single=False, fully_connected=False)¶
- class MolecularDiffusion.modules.layers.graph_module.HeadInterface¶
- abstractmethod forward(data: MolecularDiffusion.modules.layers.atomic_data.AtomicData, emb: dict[str, torch.Tensor]) dict[str, torch.Tensor]¶
Head forward.
- Parameters:
data (AtomicData) – Atomic systems as input
emb (dict[str->torch.Tensor]) – Embeddings of the input as generated by the backbone
- Returns:
outputs – Return one or more targets generated by this head
- Return type:
dict[str->torch.Tensor]
- property use_amp¶
- MolecularDiffusion.modules.layers.graph_module.compute_neighbors(data, edge_index)¶
- MolecularDiffusion.modules.layers.graph_module.get_max_neighbors_mask(natoms, index, atom_distance, max_num_neighbors_threshold, degeneracy_tolerance: float = 0.01, enforce_max_strictly: bool = False)¶
Give a mask that filters out edges so that each atom has at most max_num_neighbors_threshold neighbors. Assumes that index is sorted.
Enforcing the max strictly can force the arbitrary choice between degenerate edges. This can lead to undesired behaviors; for example, bulk formation energies which are not invariant to unit cell choice.
A degeneracy tolerance can help prevent sudden changes in edge existence from small changes in atom position, for example, rounding errors, slab relaxation, temperature, etc.