DimeNetPlusPlus
¶
DimeNetPlusPlus(
hidden_channels: int,
out_channels: int,
num_blocks: int,
int_emb_size: int,
basis_emb_size: int,
out_emb_channels: int,
num_spherical: int,
num_radial: int,
cutoff: float = 5.0,
max_num_neighbors: int = 32,
envelope_exponent: int = 5,
num_before_skip: int = 1,
num_after_skip: int = 2,
num_output_layers: int = 3,
act: Union[str, Callable] = "swish",
output_initializer: OutputInitializer = "zeros",
)
Bases: DimeNet
DimeNet++ from the "Fast and Uncertainty-Aware Directional Message Passing for Non-Equilibrium Molecules" paper.
DimeNet++ replaces the bilinear layer of DimeNet by down- and
up-projections, which makes it several times faster and more accurate.
The model follows PyG's DimeNetPlusPlus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hidden_channels
|
int
|
Hidden embedding size. |
required |
out_channels
|
int
|
Size of each output sample. |
required |
num_blocks
|
int
|
Number of building blocks. |
required |
int_emb_size
|
int
|
Size of embedding in the interaction block. |
required |
basis_emb_size
|
int
|
Size of basis embedding in the interaction block. |
required |
out_emb_channels
|
int
|
Size of embedding in the output block. |
required |
num_spherical
|
int
|
Number of spherical harmonics. |
required |
num_radial
|
int
|
Number of radial basis functions. |
required |
cutoff
|
float
|
Cutoff distance for interatomic interactions. Default: |
5.0
|
max_num_neighbors
|
int
|
The maximum number of neighbors of each atom
within |
32
|
envelope_exponent
|
int
|
Shape of the smooth cutoff. Default: |
5
|
num_before_skip
|
int
|
Number of residual layers in the interaction blocks
before the skip connection. Default: |
1
|
num_after_skip
|
int
|
Number of residual layers in the interaction blocks
after the skip connection. Default: |
2
|
num_output_layers
|
int
|
Number of linear layers for the output blocks.
Default: |
3
|
act
|
Union[str, Callable]
|
The activation function. Default: |
'swish'
|
output_initializer
|
OutputInitializer
|
The initialization of the output layer,
|
'zeros'
|
Example:
import mlx.core as mx
from mlx_graphs.nn import DimeNetPlusPlus
model = DimeNetPlusPlus(
hidden_channels=32, out_channels=1, num_blocks=2, int_emb_size=16,
basis_emb_size=4, out_emb_channels=32, num_spherical=3,
num_radial=4,
)
z = mx.array([6, 1, 1, 1, 1, 8, 1, 1])
pos = mx.random.normal((8, 3))
batch_indices = mx.array([0, 0, 0, 0, 0, 1, 1, 1])
model(z, pos, batch_indices).shape
>>> (2, 1)
Source code in mlx_graphs/nn/models/dimenet.py
from mlx_graphs.nn import DimeNetPlusPlus · mlx_graphs/nn/models/dimenet.py