Skip to main content

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.

Metadata

Release files for matris 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matris 0.1.0
File Size Uploaded
matris-0.1.0.tar.gz 42.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for matris 0.1.0
File Interpreter ABI Platform
matris-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 92.6 kB

Release files / matris-0.1.0.tar.gz

Download URL matris-0.1.0.tar.gz
Size 42.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8d92ca2fa0af26b4b65f0345257da5157dd11ecbf59ee26c569091e8a09dfc2f
BLAKE2b-256 checksum
How to use checksums
89d0643b71fb24e1f11f1be366ba253e2254cec225281607c45402cf62ed95b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / matris-0.1.0-py3-none-any.whl

Download URL matris-0.1.0-py3-none-any.whl
Size 49.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7623f25e66c35ad440f6fe4ee3e9ee233d3da96974e1f28c8a16a77e1eb7824f
BLAKE2b-256 checksum
How to use checksums
85bd3975829c439ee2e764e37c4a92e20ea3d9caf4fc79a81fa77a49371fcdc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

1.0.0

2 release files

This release

0.1.0 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page