xnn.gnn.models.megnet#

MEGNet: materials graph networks with a global state (Chen et al., Chem. Mater. 31, 3564 (2019)).

A MEGNet model predicts one property per structure (a formation energy per atom, a band gap, a modulus) from a graph of atoms v_i, bonds e_k and a global state u. Every block updates the three in turn (eqs. 1-6 of the paper):

  • e'_k = phi_e(v_i + v_j + e_k + u), for the bond k from atom j to atom i (+ is concatenation);

  • v'_i = phi_v(v_i + mean_k e'_k + u), the mean over the bonds of atom i;

  • u' = phi_u(u + mean_k e'_k + mean_i v'_i), the means over the structure.

The phi are dense networks with the shifted softplus ln(e^x + 1) - ln 2 (eq. 7). Each block after the first starts with two dense layers per kind, and a residual connection spans every block (Fig. 2). The atoms enter as element embeddings, the bonds as Gaussian expansions of their lengths and the state as given features. Set2Set readouts (Vinyals et al., 2015) reduce the atoms and the bonds of every structure, and a dense network maps them and the state to the property.

Multi-fidelity MEGNet (Chen et al., Nat. Comput. Sci. 1, 46 (2021)) is the same network with an integer state: the fidelity of each label (PBE, GLLB-SC, HSE, SCAN, experiment) indexes a trainable fidelity embedding that becomes u. Set n_state_types and give every structure its label in AtomicGraph.state. A disordered site (AtomicGraph.site_species and site_occupancy) takes the occupancy-weighted sum of its species’ element embeddings, as in that paper.

The defaults are those of MatGL’s MEGNet (the crystal models of the paper): 16-wide element embeddings, 100 Gaussians on [0, cutoff + 1] with exp(-0.5 (r - mu)^2), a 4 Angstrom cutoff, dense layers of 64 and 32 units, three blocks, two Set2Set steps and a two-dimensional zero state. The paper’s Gaussians, exp(-(r - mu)^2 / 0.5^2), are gamma=4.0.

The output is "properties", one value (or n_outputs values) per structure, standardized as property_scale * y + property_shift. Train it with optim.property_weight on properties labels. The model predicts no energy, so it gives no forces or stress.

Classes

MEGNet([n_features, n_interactions, n_rbf, ...])

MEGNet property model with a global state; multi-fidelity with n_state_types.

Set2Set(n_features, steps[, layers])

Set2Set readout of a set of vectors per structure (Vinyals, Bengio and Kudlur, 2015).