Spaces:
Running
Running
update before hf
Browse files- README.md +5 -0
- mlip_arena/models/__init__.py +1 -1
- mlip_arena/models/utils.py +3 -7
- pyproject.toml +38 -14
README.md
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# mlip-arena
|
2 |
|
3 |
MLIP Arena is an open-source platform for benchmarking machine learning interatomic potentials (MLIPs). The platform provides a unified interface for users to evaluate the performance of their models on a variety of tasks, including single-point density functional theory calculations and molecular dynamics simulations. The platform is designed to be extensible, allowing users to contribute new models, benchmarks, and training data to the platform.
|
|
|
1 |
+
---
|
2 |
+
sdk: streamlit
|
3 |
+
sdk_version: 1.25.0 # The latest supported version
|
4 |
+
---
|
5 |
+
|
6 |
# mlip-arena
|
7 |
|
8 |
MLIP Arena is an open-source platform for benchmarking machine learning interatomic potentials (MLIPs). The platform provides a unified interface for users to evaluate the performance of their models on a variety of tasks, including single-point density functional theory calculations and molecular dynamics simulations. The platform is designed to be extensible, allowing users to contribute new models, benchmarks, and training data to the platform.
|
mlip_arena/models/__init__.py
CHANGED
@@ -57,7 +57,7 @@ class MLIPCalculator(Calculator):
|
|
57 |
# self.implemented_properties = ["energy", "forces", "stress"]
|
58 |
|
59 |
def calculate(
|
60 |
-
self, atoms: Atoms, properties: list[str], system_changes: list = all_changes
|
61 |
):
|
62 |
"""Calculate energies and forces for the given Atoms object"""
|
63 |
super().calculate(atoms, properties, system_changes)
|
|
|
57 |
# self.implemented_properties = ["energy", "forces", "stress"]
|
58 |
|
59 |
def calculate(
|
60 |
+
self, atoms: Atoms, properties: list[str], system_changes: list = all_changes,
|
61 |
):
|
62 |
"""Calculate energies and forces for the given Atoms object"""
|
63 |
super().calculate(atoms, properties, system_changes)
|
mlip_arena/models/utils.py
CHANGED
@@ -6,22 +6,19 @@ from typing import Any
|
|
6 |
|
7 |
import torch
|
8 |
from ase.calculators.calculator import Calculator
|
9 |
-
from ase.calculators.mixing import SumCalculator
|
10 |
-
from torch_dftd.torch_dftd3_calculator import TorchDFTD3Calculator
|
11 |
|
12 |
from mlip_arena.models import REGISTRY
|
13 |
|
14 |
MLIPMap = {
|
15 |
model: getattr(
|
16 |
-
importlib.import_module(f"{__package__}.{metadata['module']}"), model
|
17 |
)
|
18 |
for model, metadata in REGISTRY.items()
|
19 |
}
|
20 |
|
21 |
|
22 |
class EXTMLIPEnum(Enum):
|
23 |
-
"""
|
24 |
-
Enumeration class for EXTMLIP models.
|
25 |
|
26 |
Attributes:
|
27 |
M3GNet (str): M3GNet model.
|
@@ -57,7 +54,7 @@ def get_freer_device() -> torch.device:
|
|
57 |
free_gpu_index = mem_free.index(max(mem_free))
|
58 |
|
59 |
print(
|
60 |
-
f"Selected GPU {free_gpu_index} with {mem_free[free_gpu_index] / 1024**2:.2f} MB free memory from {device_count} GPUs"
|
61 |
)
|
62 |
|
63 |
return torch.device(f"cuda:{free_gpu_index}")
|
@@ -65,7 +62,6 @@ def get_freer_device() -> torch.device:
|
|
65 |
|
66 |
def external_ase_calculator(name: EXTMLIPEnum, **kwargs: Any) -> Calculator:
|
67 |
"""Construct an ASE calculator from an external third-party MLIP packages"""
|
68 |
-
|
69 |
calculator = None
|
70 |
device = get_freer_device()
|
71 |
|
|
|
6 |
|
7 |
import torch
|
8 |
from ase.calculators.calculator import Calculator
|
|
|
|
|
9 |
|
10 |
from mlip_arena.models import REGISTRY
|
11 |
|
12 |
MLIPMap = {
|
13 |
model: getattr(
|
14 |
+
importlib.import_module(f"{__package__}.{metadata['module']}"), model,
|
15 |
)
|
16 |
for model, metadata in REGISTRY.items()
|
17 |
}
|
18 |
|
19 |
|
20 |
class EXTMLIPEnum(Enum):
|
21 |
+
"""Enumeration class for EXTMLIP models.
|
|
|
22 |
|
23 |
Attributes:
|
24 |
M3GNet (str): M3GNet model.
|
|
|
54 |
free_gpu_index = mem_free.index(max(mem_free))
|
55 |
|
56 |
print(
|
57 |
+
f"Selected GPU {free_gpu_index} with {mem_free[free_gpu_index] / 1024**2:.2f} MB free memory from {device_count} GPUs",
|
58 |
)
|
59 |
|
60 |
return torch.device(f"cuda:{free_gpu_index}")
|
|
|
62 |
|
63 |
def external_ase_calculator(name: EXTMLIPEnum, **kwargs: Any) -> Calculator:
|
64 |
"""Construct an ASE calculator from an external third-party MLIP packages"""
|
|
|
65 |
calculator = None
|
66 |
device = get_freer_device()
|
67 |
|
pyproject.toml
CHANGED
@@ -39,18 +39,42 @@ Homepage = "https://github.com/atomind-ai/mlip-arena"
|
|
39 |
Issues = "https://github.com/atomind-ai/mlip-arena/issues"
|
40 |
|
41 |
[tool.ruff]
|
42 |
-
#
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
"
|
47 |
-
"
|
48 |
-
"
|
49 |
-
"
|
50 |
-
"
|
51 |
-
"
|
52 |
-
"
|
53 |
-
"
|
54 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
]
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
Issues = "https://github.com/atomind-ai/mlip-arena/issues"
|
40 |
|
41 |
[tool.ruff]
|
42 |
+
# Exclude a variety of commonly ignored directories.
|
43 |
+
exclude = [
|
44 |
+
".bzr",
|
45 |
+
".direnv",
|
46 |
+
".eggs",
|
47 |
+
".git",
|
48 |
+
".git-rewrite",
|
49 |
+
".hg",
|
50 |
+
".ipynb_checkpoints",
|
51 |
+
".mypy_cache",
|
52 |
+
".nox",
|
53 |
+
".pants.d",
|
54 |
+
".pyenv",
|
55 |
+
".pytest_cache",
|
56 |
+
".pytype",
|
57 |
+
".ruff_cache",
|
58 |
+
".svn",
|
59 |
+
".tox",
|
60 |
+
".venv",
|
61 |
+
".vscode",
|
62 |
+
"__pypackages__",
|
63 |
+
"_build",
|
64 |
+
"buck-out",
|
65 |
+
"build",
|
66 |
+
"dist",
|
67 |
+
"node_modules",
|
68 |
+
"site-packages",
|
69 |
+
"venv",
|
70 |
]
|
71 |
+
|
72 |
+
# Same as Black.
|
73 |
+
line-length = 88
|
74 |
+
indent-width = 4
|
75 |
+
|
76 |
+
[tool.ruff.lint]
|
77 |
+
select = ["ALL"]
|
78 |
+
ignore = []
|
79 |
+
fixable = ["ALL"]
|
80 |
+
pydocstyle.convention = "google"
|