NequIP

0.17.1 · active · verified Fri Apr 17

NequIP is an open-source Python library for building E(3)-equivariant interatomic potentials, primarily used in molecular dynamics and materials science simulations. It leverages PyTorch and e3nn for deep learning models that respect physical symmetries, enabling accurate and robust simulations. The current stable version is 0.17.1, with releases typically tied to significant feature additions or dependency updates.

Common errors

Warnings

Install

Imports

Quickstart

Initializes a basic NequIP model from a configuration dictionary. In practice, configurations are often loaded from YAML files and models are either trained or loaded from pre-existing checkpoints. This example demonstrates the fundamental model instantiation.

import torch
from nequip.utils import Config
from nequip.model import NequIP

# Example minimal configuration for a NequIP model
# In real applications, this would typically be loaded from a YAML file.
config_dict = {
    'r_max': 5.0,
    'max_ell': 1,
    'num_layers': 3,
    'chemical_species_set': ['H', 'O'], # Example species
    'num_species': 2,
    'l_max_hidden': 1,
    'nonlinearity_type': 'silu',
    'resnet': True,
    'env_embed_multi_head': True,
    'mlp_output_irreps': '64x0e+64x1o+64x1e',
    'weight_init': 'xavier_uniform',
    'irreps_out_per_structure': '1x0e',
    'cutoff_type': 'polynomial', 
    'activation': 'silu'
}

# Create a Config object
config = Config(config_dict)

# Initialize the NequIP model
# This model is a placeholder; it would need to be trained or loaded from a checkpoint.
model = NequIP(config)

print(f"NequIP model initialized with {sum(p.numel() for p in model.parameters())} parameters.")
# Example of model structure for a single atom
# x = torch.zeros(1, 3)
# z = torch.tensor([1]) # Atomic number for H
# model(x, z) # Requires a full batch of positions and atomic numbers

view raw JSON →