Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nequip support #304

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion janus_core/helpers/janus_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class CorrelationKwargs(TypedDict, total=True):

# Janus specific
Architectures = Literal[
"mace", "mace_mp", "mace_off", "m3gnet", "chgnet", "alignn", "sevennet"
"mace", "mace_mp", "mace_off", "m3gnet", "chgnet", "alignn", "sevennet", "nequip"
]
Devices = Literal["cpu", "cuda", "mps", "xpu"]
Ensembles = Literal["nph", "npt", "nve", "nvt", "nvt-nh"]
Expand Down
9 changes: 9 additions & 0 deletions janus_core/helpers/mlip_calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ def choose_calculator(
kwargs.setdefault("sevennet_config", None)
calculator = SevenNetCalculator(model=model, device=device, **kwargs)

elif arch == "nequip":
from nequip.ase import NequIPCalculator

model = model_path if model_path else ""

calculator = NequIPCalculator.from_deployed_model(
model_path=model, device=device, **kwargs
)

else:
raise ValueError(
f"Unrecognized {arch=}. Suported architectures "
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ sevenn = { version = "0.9.3", optional = true }
torchdata = {version = "0.7.1", optional = true} # Pin due to dgl issue
torch_geometric = { version = "^2.5.3", optional = true }
ruff = "^0.5.7"
nequip = {version = "^0.6.1", optional = true }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
nequip = {version = "^0.6.1", optional = true }
nequip = {version = "0.6.1", optional = true }

Probably best to pin like the other MLIPs to avoid API/dependency breaking changes?


[tool.poetry.extras]
all = ["alignn", "chgnet", "matgl", "dgl", "torchdata", "sevenn", "torch_geometric"]
alignn = ["alignn"]
chgnet = ["chgnet"]
m3gnet = ["matgl", "dgl", "torchdata"]
sevennet = ["sevenn", "torch_geometric"]
nequip = ["nequip"]

[tool.poetry.group.dev.dependencies]
coverage = {extras = ["toml"], version = "^7.4.1"}
Expand Down