xnn.gnn.models.aimnet2.ShellConvolution#
- class xnn.gnn.models.aimnet2.ShellConvolution(n_channels, n_shells, n_combinations)[source]#
Bases:
FastPathModule,ModuleThe AIMNet2 convolution of per-atom features over the radial shells (paper eqs 4-5).
For center
iwith neighborsjcarrying featuresa_jcs(one value per channelcand radial shells) and the radial basisg_ijsof the pair, the scalar features are the shell-wise sumsv_ics = sum_j g_ijs a_jcsand the vector features the squared norms of
n_combinationslearned combinations of the shells along the unit bond vectorsu_ij,v_ich = | sum_s w_csh sum_j g_ijs u_ij a_jcs |^2.Both are flattened and concatenated (channel-major) into a vector of
n_channels * (n_shells + n_combinations)entries per atom. The atomic embeddings (one value per shell) and the partial charges (the same value in every shell) go through the same block.- Parameters:
- Variables:
weight (torch.nn.Parameter) – The combination weights
w_csh, shape(n_channels, n_shells, n_combinations). Initialized to standardized random vectors over the shells (the reference code picks a maximally spread set of sinusoids; any spread set serves, and trained weights transplant).output_dim (int) –
n_channels * (n_shells + n_combinations).
- forward(nodes, g, gu, edge_index)[source]#
Convolve neighbor features into per-center environment features.
- Parameters:
nodes (Tensor) – The convolved per-atom quantity, shape
(N, n_channels, n_shells).g (Tensor) – Radial basis of every edge, shape
(E, n_shells).gu (Tensor) – Radial basis times the unit bond vector, shape
(E, n_shells, 3).edge_index (Tensor) – Source (row 0, the neighbor
j) and destination (row 1, the centeri) of every edge.
- Returns:
Environment features, shape
(N, output_dim).- Return type:
Tensor