MatRIS model
Project description
MatRIS
This repository contains the official PyTorch implementation of MatRIS (a foundation model for Materials Representation and Interaction Simulation). Please note that the current version is V0.9
Requirements
ase >= 3.23.0
numpy >= 2.0.0
pymatgen > 2024.9.10
torch > 2.6.0
Pretrained Models
We offer three pretrained models:
- MatRIS-10M-Omat: A model trained on the OMat24 dataset.
- Model key: matris_10m_omat
- MatRIS-10M-OAM: A model trained on the OMat24 dataset, and finetuned on sAlex+Mptrj dataset.
- Model key: matris_10m_oam
- MatRIS-10M-MP: A model trained on the MPTrj dataset.
- Model key: matris_10m_mp
Usage
There are some examples how to use MatRIS, including calculator, geometry optimization and molecular dynamics.
ASE Calculator
import ase
from ase.build import bulk
import torch
from matris.applications.base import MatRISCalculator
device = "cuda" if torch.cuda.is_available() else "cpu"
calc = MatRISCalculator(
model='matris_10m_oam', # matris_10m_oam, matris_10m_mp
task='efsm', # Can be e/ef/efs/efsm
device=device # cpu or cuda
)
cu = bulk('Cu', a=5.43, cubic=True)
cu.calc = calc
energy = cu.get_potential_energy() # total energy(eV)
forces = cu.get_forces() # forces (eV/A)
stress = cu.get_stress() # stress (eV/A^3)
magmoms = cu.get_magnetic_moments() # magmom (muB)
Structure Optimization
import ase
from ase.build import bulk
import torch
from matris.applications.relax import StructOptimizer
model_name = "matris_10m_oam"
device = "cuda" if torch.cuda.is_available() else "cpu"
matris_opt = StructOptimizer(
model = model_name,
task = "efsm",
optimizer = "FIRE", # FIRE, BFGS ...
device=device
)
atom = bulk('Cu', a=5.43, cubic=True)
max_steps = 500
fmax = 0.05
opt_result = matris_opt.relax(
atoms=atom, # pymatgen.Structure or ase.Atoms
verbose=True,
steps=max_steps,
fmax=fmax,
relax_cell=max_steps > 0,
ase_filter="FrechetCellFilter",
)
trajectory = opt_result['trajectory']
energy = trajectory.energies[-1] # final energy
force = trajectory.forces[-1]
stress = trajectory.stresses[-1]
magmom = trajectory.magmoms[-1]
final_structure = opt_result['final_structure'] # pymatgen.core.structure.Structure
Molecular Dynamics
import ase
from ase.build import bulk
import torch
from matris.applications import MolecularDynamics
# Molecular D
#atoms = Structure.from_file(f"xxx.cif")
atom = bulk('Cu', a=5.43, cubic=True)
md = MolecularDynamics(
atoms=atom, # pymatgen.Structure or ase.Atoms
model="matris_10m_oam",
ensemble="nvt", # nvt, nve ...
temperature=300, # in K
timestep=1, # in femto-seconds
trajectory="md_out.traj",
logfile="md_out.log",
loginterval=100,
task="efsm",
device="cuda",
)
md.run(1000)
LICENSE
MatRIS is licensed under the BSD-3-Clause License. Please see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file matris-0.0.1.tar.gz.
File metadata
- Download URL: matris-0.0.1.tar.gz
- Upload date:
- Size: 43.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4251d17243df6cf45f1de815d49b9bec909400656a8e877dae1c08173625b74
|
|
| MD5 |
f079b4a77ef24c4c8bb97e3ea1cc75cf
|
|
| BLAKE2b-256 |
d152acce818ad7eedaaab26e14dde1183c558cc2b0d28b6c8b6938041605112d
|
File details
Details for the file matris-0.0.1-py3-none-any.whl.
File metadata
- Download URL: matris-0.0.1-py3-none-any.whl
- Upload date:
- Size: 49.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c65972dc6fec1d7749201b0bacc0614dd64c7b19fbf35d2cef0bf7ce9b98afee
|
|
| MD5 |
1cf50562f76c7ef29327f5cd0a87a5e6
|
|
| BLAKE2b-256 |
bcdf667016c05cf2ac36a9f3918d1772fa9104c86b98e0dc55184a17a1d95133
|