Skip to main content

MatterSim: A Deep Learning Atomistic Model Across Elements, Temperatures and Pressures.

Project description

MatterSim logo

arXiv Requires Python 3.12+ PyPI Downloads

MatterSim is a deep learning atomistic model across elements, temperatures and pressures.

Documentation

This README provides a quick start guide. For more comprehensive information, please refer to the MatterSim documentation.

Installation

Prerequisite

  • Python >= 3.12

Install from PyPI

[!TIP] While not mandatory, we recommend creating a clean conda environment before installing MatterSim to avoid potential package conflicts. You can create and activate a conda environment with the following commands:

# create the environment
conda create -n mattersim python=3.12

# activate the environment
conda activate mattersim

To install MatterSim, use the following command. Please note that downloading the dependencies may take some time:

pip install mattersim

In case you want to install the package with the latest version, you can run the following command:

pip install git+https://github.com/microsoft/mattersim.git

Install from source code

  1. Download the source code of MatterSim and change to the directory
git clone git@github.com:microsoft/mattersim.git
cd mattersim
  1. Install MatterSim

[!WARNING] We strongly recommend that users install MatterSim using mamba or micromamba, because conda can be significantly slower when resolving the dependencies in environment.yaml.

To install the package, run the following command under the root of the folder:

mamba env create -f environment.yaml
mamba activate mattersim
uv pip install -e .

Pre-trained Models

We currently offer two pre-trained MatterSim-v1 models based on the M3GNet architecture in the pretrained_models folder:

  1. MatterSim-v1.0.0-1M: A mini version of the model that is faster to run.
  2. MatterSim-v1.0.0-5M: A larger version of the model that is more accurate.

These models have been trained using the data generated through the workflows introduced in the MatterSim manuscript, which provides an in-depth explanation of the methodologies underlying the MatterSim model.

More advanced and fully-supported pretrained versions of MatterSim, and additional materials capabilities are available in Azure Quantum Elements.

Usage

[!TIP] Note for macOS Users: If you are using macOS with Apple Silicon, please be aware of potential numerical instability with the MPS backend. We recommend using the CPU device for MatterSim on Mac to avoid these issues.

A minimal test

import torch
from loguru import logger
from ase.build import bulk
from ase.units import GPa
from mattersim.forcefield import MatterSimCalculator

device = "cuda" if torch.cuda.is_available() else "cpu"
logger.info(f"Running MatterSim on {device}")

si = bulk("Si", "diamond", a=5.43)
si.calc = MatterSimCalculator(device=device)
logger.info(f"Energy (eV)                 = {si.get_potential_energy()}")
logger.info(f"Energy per atom (eV/atom)   = {si.get_potential_energy()/len(si)}")
logger.info(f"Forces of first atom (eV/A) = {si.get_forces()[0]}")
logger.info(f"Stress[0][0] (eV/A^3)       = {si.get_stress(voigt=False)[0][0]}")
logger.info(f"Stress[0][0] (GPa)          = {si.get_stress(voigt=False)[0][0] / GPa}")

In this release, we provide two checkpoints: MatterSim-v1.0.0-1M.pth and MatterSim-v1.0.0-5M.pth. By default, the 1M version is loaded. To switch to the 5M version, manually set the load_path of MatterSimCalculator as shown below:

MatterSimCalculator(load_path="MatterSim-v1.0.0-5M.pth", device=device)

Finetune

[!TIP] MatterSim provides a finetune script to finetune the pre-trained MatterSim model on a custom dataset. Please refer to the MatterSim documentation for more details.

A minimal finetune example

torchrun --nproc_per_node=1 src/mattersim/training/finetune_mattersim.py --load_model_path mattersim-v1.0.0-1m --train_data_path tests/data/high_level_water.xyz

Reference

We kindly request that users of MatterSim version 1.0.0 cite our preprint available on arXiv:

@article{yang2024mattersim,
      title={MatterSim: A Deep Learning Atomistic Model Across Elements, Temperatures and Pressures},
      author={Han Yang and Chenxi Hu and Yichi Zhou and Xixian Liu and Yu Shi and Jielan Li and Guanzhi Li and Zekun Chen and Shuizhou Chen and Claudio Zeni and Matthew Horton and Robert Pinsler and Andrew Fowler and Daniel Zügner and Tian Xie and Jake Smith and Lixin Sun and Qian Wang and Lingyu Kong and Chang Liu and Hongxia Hao and Ziheng Lu},
      year={2024},
      eprint={2405.04967},
      archivePrefix={arXiv},
      primaryClass={cond-mat.mtrl-sci},
      url={https://arxiv.org/abs/2405.04967},
      journal={arXiv preprint arXiv:2405.04967}
}

[!IMPORTANT] We kindly ask users to explicitly specify the exact model version and checkpoint (e.g., MatterSim-v1.0.0-1M) when reporting results in academic papers or technical reports, rather than referring to the model generically as MatterSim. Precise versioning is crucial for ensuring reproducibility. For instance, the statement "This study was conducted using MatterSim-v1.0.0-1M" serves as a good example.

Limitations

MatterSim-v1 is designed specifically for atomistic simulations of bulk materials. Applications or interpretations beyond this scope should be approached with caution. For instance, when using the model for simulations involving surfaces, interfaces, or properties influenced by long-range interactions, the results may be qualitatively accurate but are not suitable for quantitative analysis. In such cases, we recommend fine-tuning the model to better align with the specific application.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Responsible AI Transparency Documentation

The responsible AI transparency documentation can be found here.

Researcher and Developers

MatterSim is actively under development, and we welcome community engagement. If you have research interests related to this model, ideas you’d like to contribute, or issues to report, we encourage you to reach out to us at ai4s-materials@microsoft.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mattersim-1.2.4.tar.gz (27.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mattersim-1.2.4-cp313-cp313-musllinux_1_2_x86_64.whl (772.4 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

mattersim-1.2.4-cp313-cp313-musllinux_1_2_i686.whl (749.9 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ i686

mattersim-1.2.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (749.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

mattersim-1.2.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (736.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

mattersim-1.2.4-cp313-cp313-macosx_11_0_arm64.whl (350.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

mattersim-1.2.4-cp312-cp312-musllinux_1_2_x86_64.whl (779.7 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

mattersim-1.2.4-cp312-cp312-musllinux_1_2_i686.whl (762.4 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ i686

mattersim-1.2.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (757.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

mattersim-1.2.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (736.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

mattersim-1.2.4-cp312-cp312-macosx_11_0_arm64.whl (351.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file mattersim-1.2.4.tar.gz.

File metadata

  • Download URL: mattersim-1.2.4.tar.gz
  • Upload date:
  • Size: 27.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mattersim-1.2.4.tar.gz
Algorithm Hash digest
SHA256 e076a3d43636ff3820d9bae74f61a2bff9f5bd51a922abe468b43fc65af7ffc9
MD5 c3ecfd8fd9d0a4f3e769599404cd9e63
BLAKE2b-256 8a34509427f134fd009cb95fc78927aebf5b0ab39e28abf68aa5658b81ddce6e

See more details on using hashes here.

File details

Details for the file mattersim-1.2.4-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mattersim-1.2.4-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 76ea455680cfa26597404ae2eea6b0c147db3739c48e6d98e374775478b0666a
MD5 9ad3e03d061cac4f75991bb9a73759dc
BLAKE2b-256 160d6b19637a646e40130f2dcb8c7a72047e40edcb2056096151f42845ced065

See more details on using hashes here.

File details

Details for the file mattersim-1.2.4-cp313-cp313-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for mattersim-1.2.4-cp313-cp313-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 015f0ef473ff33365f2f1a3527028796a9227f11d738bdb2d819a369b2f30621
MD5 14cc5ce5ba55333120a316ecb6c39153
BLAKE2b-256 9c5e0133aa56c3f6f64e1c3a091f3a3229f00ed74504a0ba277cbd74ca8a00ab

See more details on using hashes here.

File details

Details for the file mattersim-1.2.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mattersim-1.2.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 62e8a5b32588deb406d3bd7189f83a401454354ccfdca3462d679bfbc9a888e0
MD5 963ef4710d0caa104164db0523ba855e
BLAKE2b-256 ff1b6ad533d5f7d841da34643a8973bb88bd7373ae4c4fc7f9a40b7bf16fa796

See more details on using hashes here.

File details

Details for the file mattersim-1.2.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for mattersim-1.2.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 bdaae9ad98c4976996c27827c6b371245a66d837e3847a74e076dcb038a3181f
MD5 da990a88b71a28759d64b2e267db9931
BLAKE2b-256 45029413c4f0065a43a25dfbb3fca3e566af547d32fc1ac2dbe5e466a8e9a8bb

See more details on using hashes here.

File details

Details for the file mattersim-1.2.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mattersim-1.2.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 347f34be5a0a3b0295684ac1589feb6a0f5fe776c920c6e7d27de4611fa15cb7
MD5 732034bea8bf7fc1c74f0ebe39e31c2e
BLAKE2b-256 441895be1605de61119f12cd3573261c09d157361b34feafa9d6d10120332ce9

See more details on using hashes here.

File details

Details for the file mattersim-1.2.4-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mattersim-1.2.4-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2c1334f044bcb6d7223108e7c53ab5a9131a70670d8b6213633afd5c5b76afc5
MD5 826df23bae27335d38431806706b5824
BLAKE2b-256 35ea75d0f114c4ea50d35dcfc4add9d0b67351c1fcaf2594f886d0fb5b646f9b

See more details on using hashes here.

File details

Details for the file mattersim-1.2.4-cp312-cp312-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for mattersim-1.2.4-cp312-cp312-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 da69dd8e874347d636e6e6747c8243731664840cba3720a7565ee7d2f6e7f763
MD5 68042bcc1fa250ce35c2a52e0318352a
BLAKE2b-256 3cf0f1e8f2deedbd6551f9518301a7bc10112f68eb17db3c7ae9fb1c5e0d0bc7

See more details on using hashes here.

File details

Details for the file mattersim-1.2.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mattersim-1.2.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7ed0cefa7fa21b669903a93b7bfabeefc78196a8c0d841619e3cd7268231290
MD5 dd857b04d686621da426caeceb6931c0
BLAKE2b-256 a8eb8dbd48eb75d19a93c0a3f63c5fdee0aac5c073872e42ad18ddd159bb2d68

See more details on using hashes here.

File details

Details for the file mattersim-1.2.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for mattersim-1.2.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6ded11d664006d7d64b5c9842ff04b442b28a3572ada14251f0d3031d06e6337
MD5 fe2974ec2d19b4cf011105109d648473
BLAKE2b-256 4b9852bff8a00fffff26a7d1cf25d76b46e9e59d52b025c4dca993e5a47c2e92

See more details on using hashes here.

File details

Details for the file mattersim-1.2.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mattersim-1.2.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ad724c5ddae91e0860d5d9326a6ee161760a403ddcdc92656eef5a900f89751
MD5 4d84a8c6a777ed75c49485c9911f8bcd
BLAKE2b-256 1c6b1cad9acb3bc77b8607b0f22d999dfb1ae29a71c45b4d514e835a9a3f13af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page