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.5.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.5-cp313-cp313-musllinux_1_2_x86_64.whl (767.2 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

mattersim-1.2.5-cp313-cp313-musllinux_1_2_i686.whl (746.7 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ i686

mattersim-1.2.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (747.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

mattersim-1.2.5-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (735.3 kB view details)

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

mattersim-1.2.5-cp313-cp313-macosx_11_0_arm64.whl (349.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

mattersim-1.2.5-cp312-cp312-musllinux_1_2_x86_64.whl (773.0 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

mattersim-1.2.5-cp312-cp312-musllinux_1_2_i686.whl (747.7 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ i686

mattersim-1.2.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (755.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

mattersim-1.2.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (734.4 kB view details)

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

mattersim-1.2.5-cp312-cp312-macosx_11_0_arm64.whl (350.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: mattersim-1.2.5.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.5.tar.gz
Algorithm Hash digest
SHA256 2691b8376690b80947f93dc3f683985b2ec44aa9a0b16fda376678ef15aed8b9
MD5 c23edda066da8ae9298e50676773dcf8
BLAKE2b-256 6b8ff69685c2f7574e7942bc02cb592be0fc46d03d55339467aff2214af19365

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mattersim-1.2.5-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 27ac6987585f316418287f865291c44f723a461ef841f13dea1c101f8422279b
MD5 6a18ebe44595f20e35222a6e6b6c5286
BLAKE2b-256 f4db4758ba1196aaa1311b6b629681bcd8e9593d77ee34812c30ced4c35ebf41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mattersim-1.2.5-cp313-cp313-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 ffd54ebd11fffe749e32beb6d2c6adcf7a766e1d2220d9142aa337cb50650ba1
MD5 02692a97488d4ec323ccde6cd70d53d9
BLAKE2b-256 2df60c207e3e2bf969cdc9db6a18fb0793aafe43e341679ab7a6d8e2bac46df4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mattersim-1.2.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e0502e733a827d9489ddbffa3c06cf94442d987dffb7bfbe843c0dd27e94dc92
MD5 a64ad17042cff0455f119d470b0ff605
BLAKE2b-256 cca513da5b681c2a4becf43780486b58d8f8bea7a7e41f1310cb9047eda8389e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mattersim-1.2.5-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 123feb7705758cd2fd23057d543ec93c478fec802a6c52892c74dbd829c0c89e
MD5 19e4f102a9e45c9a27c75b068706b000
BLAKE2b-256 fee9c2b8b6ee850ac11b716d47dd47bc972ee7f68c76d21bc8604f5fcda0771b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mattersim-1.2.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7019503a4ca5640382aaff9b626ec6c321c6bc875cbee1036e5cd61a358fab91
MD5 c4c8befafb694ffaa20aacfca0198886
BLAKE2b-256 6a6837e4b1c260a3580c8a8ddb2ba4cf348a3048d394cce21473fdda9ace63dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mattersim-1.2.5-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f472e340c07ee4e1ee76687653622b854c542b4fe41fc253adf619936c7ea279
MD5 d29e8dc3067e828af46dc8bea3560c33
BLAKE2b-256 3a28c464d60a641c8a93cbc96dc2b9b83f59a33eeac589c929b7ec5e9b2fabf5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mattersim-1.2.5-cp312-cp312-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 d4cddb8d9221e9070bd11105b2a2a0ace9e21c3b0c1bc6df6bca7601c0966b51
MD5 8d6202b514e55e11f0b2915d11068aee
BLAKE2b-256 417de6e1612c8027e0d5899e753549e4bbe4bddd265584020a79914767539061

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mattersim-1.2.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b5e46ba56efa5c1e93372ad32321300fa5e1f07dd9188a11b727bd578cf8d7f
MD5 55025a96009353ca69e7c6dacd6c40e4
BLAKE2b-256 63005ebc37661b3333793b2861827439cc8e2a3129dd0c9694d54028328650ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mattersim-1.2.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 f2d7b115033cf34ed371c5a41c1904f3f1e3c8b21bc99d409bd10b64f451888e
MD5 414810048ad2f0a70d54c9ef5b9c034a
BLAKE2b-256 f09eda46e4269ae267993f411ddc4a0efe8e042a479b675059d144337af2943b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mattersim-1.2.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eda9a6c594111541298872f25fd577c3bb4de764290b479af13921039cc4b64e
MD5 6e36e61b43d15ee62ed14069800f7f36
BLAKE2b-256 7d0ac7754e4bd86b7778533f2375ff58ac4187b75fc5e137bbd535815b17e429

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