xnn.gnn.models.egt#
Edge-augmented graph transformer over the bonds of a molecule.
The edge-augmented graph transformer (EGT; Hussain, Zaki & Subramanian, KDD 2022, https://doi.org/10.1145/3534678.3539296) lets edge channels steer and gate the attention between nodes and updates the edges from the attention logits. Here the attention is local, between bonded atoms only, as in ByteFF (Zheng et al., Chem. Sci. 16, 2730 (2025)), where the network reads the two-dimensional molecular graph and its outputs parameterize a classical force field.
MolecularGraphTransformer embeds the integer atom and bond features of
xnn.gnn.featurizers.molgraph, averages the embeddings over classes of
equivalent atoms and bonds, runs the attention layers and returns per-atom and
per-directed-edge hidden states (the two directions of a bond averaged).
Module Attributes
elements (atomic number - 1), neighbors, formal charges (-2..2), ring bonds, smallest ring size. |
|
elements (atomic number - 1), neighbors, formal charges (-2..2), ring bonds, smallest ring size. |
|
elements (atomic number - 1), neighbors, formal charges (-2..2), ring bonds, smallest ring size. |
|
elements (atomic number - 1), neighbors, formal charges (-2..2), ring bonds, smallest ring size. |
|
in ring (0/1), bond order (single, double, triple, aromatic). |
|
in ring (0/1), bond order (single, double, triple, aromatic). |
Functions
|
Each row of |
Classes
|
One local EGT layer: edge-biased, edge-gated multi-head attention between bonded atoms, pre-norm residual updates of nodes and edges. |
|
Embeddings of the atom and bond features, mixed by MLPs and averaged over equivalent atoms and bonds. |
|
Atom and bond hidden states of molecules from their two-dimensional graphs. |