diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ddb09ae --- /dev/null +++ b/.gitignore @@ -0,0 +1,163 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so +**/*.c + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..eef096d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,27 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 + hooks: + - id: end-of-file-fixer + - id: fix-encoding-pragma + - id: mixed-line-ending + - id: trailing-whitespace + - id: check-json + + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + args: ["--profile", "black"] + + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black + args: ["--line-length", "88"] + + - repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + args: ["--max-line-length=88", "--ignore=E203,W503"] \ No newline at end of file diff --git a/environment.yaml b/environment.yaml new file mode 100644 index 0000000..1dc0aac --- /dev/null +++ b/environment.yaml @@ -0,0 +1,23 @@ +name: mattersim +channels: + - pyg + - pytorch + - conda-forge +dependencies: + - python=3.9 + - pytorch==1.11.0 + - pytorch-sparse=0.6.15 + - pytorch-scatter=2.0.9 + - ca-certificates + - openssl + - numpy<2 + - phonopy==2.14.0 + - phono3py==2.3.0 + - cython + - loguru + - pip: + - seekpath + - torch==1.11.0+cu113 + - torchvision==0.12.0+cu113 + - torchaudio==0.11.0 + - --extra-index-url https://download.pytorch.org/whl/cu113 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..581bc2f --- /dev/null +++ b/setup.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +import numpy as np +from setuptools import Extension, find_packages, setup +from setuptools.command.build_ext import build_ext as _build_ext + + +class build_ext(_build_ext): + def finalize_options(self): + _build_ext.finalize_options(self) + if self.distribution.ext_modules: + import pyximport + + pyximport.install() + + +setup( + name="mattersim", + version="1.0", + description=( + "MatterSim: MatterSim: A Deep Learning Atomistic Model Across " + "Elements, Temperatures and Pressures." + ), + author=( + "Han Yang, Chenxi Hu, Yichi Zhou, Xixian Liu, Yu Shi, Jielan Li, " + "Guanzhi Li, Zekun Chen, Shuizhou Chen, Claudio Zeni, Matthew Horton, " + "Robert Pinsler, Andrew Fowler, Daniel Zügner, Tian Xie, Jake Smith, " + "Lixin Sun, Qian Wang, Lingyu Kong, Chang Liu, Hongxia Hao, Ziheng Lu" + ), + author_email=( + "hanyang@microsoft.com; jielanli@microsoft.com; " + "hongxiahao@microsoft.com; zihenglu@microsoft.com;" + ), + python_requires=">=3.9", + packages=find_packages(where="src", include=["mattersim", "mattersim.*"]), + package_dir={"": "src"}, + url="https://github.com/msr-ai4science/mattersim", + requires=[ + "torch", + ], + install_requires=[ + "ase>=3.23.0", + "Cython>=0.29.32", + "e3nn==0.5.0", + "numpy<2", + "pymatgen", + "torch_geometric==2.0.4", + "torch_runstats==0.2.0", + "torchmetrics>=0.10.0", + "torch-ema==0.3", + "opt_einsum_fx", + "pre-commit", + "Pathlib", + "pytest", + "pytest-testmon", + "azure-storage-blob", + "azure-identity", + ], + setup_requires=[ + "Cython>=0.29.32", + ], + cmdclass={"build_ext": build_ext}, + ext_modules=[ + Extension( + "mattersim.datasets.utils.threebody_indices", + ["src/mattersim/datasets/utils/threebody_indices.pyx"], + include_dirs=[np.get_include()], + ) + ], +)