PyMatterSim
Summary
Physics-driven data analyis of computer simulations for materials science, chemistry, physics, and beyond.
Installation [in a virtual environment]
Preparation: You need a C++compiler and cmake, which can be obtained from the source code installation section.
python3.10 -m venv .venvsource .venv/bin/activatepip install PyMatterSim- version upgrade
pip install --upgrade pymattersim
Install from source
-
You need a C++compiler that supports at least the
C++11standard and cmake.Recommend using
condaormambafor installation.Linux:
conda install gxx cmakeormamba install gxx cmakeMac OS.
conda install clang cmakeormamba install clang cmakeWindows:
conda install gxx cmakeormamba install gxx cmakeor Download visual studio installer from here and install the C++ compiler.A package manager is also a good choice, for example:
ubuntu:
sudo apt-get install g++ cmakecentos:
sudo yum install gcc-c++ cmake3macos:
brew install gcc cmakeNow that you have all the build tools, pip will help you complete everything for compilation.
git clone https://gitee.com/yuanchaohu/pymattersim --recursive # get submodule
cd pymattersim
pip install .
Confirm installation
Acceleration is enabled by default. You can determine whether to enable acceleration by importing the _acc module and checking the variables.
from PyMatterSim import _acc
print(_acc.ENABLE_ACC) # should be True
We also provide an environment variable DISABLE_ACC to disable acceleration code. Note that setting it to any non-zero value will result in disabling acceleration code.
export DISABLE_ACC=1 # will disable acceleration
# If you want to reactivate acceleration, do this.
unset(DISABLE_ACC) # will reactivate acceleration
Documentation
The documentation is now available online.
Requirements
- python 3.8-3.11 (recommend 3.10)
- numpy==1.26.4
- pandas==2.1.4
- freud-analysis==3.0.0
- scipy==1.15.2
- sympy==1.12
- gsd (optional)
- mdtraj (optional)
- voro++ (optional, standalone binary)
Usage
Please refer to the /docs/ for documentation and examples.
Some examples are provided from the unittest modules (tests/)
Types of computer simulations
- LAMMPS
- atom type & molecular type such as patchy particle, rigid body, molecules et al.
- x, xs, xu type particle positions
- orthagonal / triclinic box
- Hoomd-blue
- GSD for structure analysis (need
gsd==3.2.0) - GSD + DCD for dynamics analysis (need
gsd==3.2.0andmdtraj==1.9.9)
- GSD for structure analysis (need
- VASP (to be added)
- Any type of simulators as long as the input were formatted well, modifying the
readermodule to use the computational modules.
Notes
Voro++ is recommended to install separately for specific Voronoi analysis. Some of the analysis from the original voro++ is maintained from the freud-analysis package developed by the Glozter group.
Citation
@article{hu2024pymattersimpythondataanalysis,
title={PyMatterSim: a Python Data Analysis Library for Computer Simulations of Materials Science, Physics, Chemistry, and Beyond},
author={Y. -C. Hu and J. Tian},
year={2024},
eprint={2411.17970},
archivePrefix={arXiv},
primaryClass={cond-mat.mtrl-sci},
url={https://arxiv.org/abs/2411.17970},
}
References
- Y.-C. Hu et al. Origin of the boson peak in amorphous solids. Nature Physics, 18(6), 669-677 (2022)
- Y.-C. Hu et al. Revealing the role of liquid preordering in crystallisation of supercooled liquids. Nature Communications, 13(1), 4519 (2022)
- Y.-C. Hu et al. Physical origin of glass formation from multicomponent systems. Science Advances 6 (50), eabd2928 (2020)
- Y.-C. Hu et al. Configuration correlation governs slow dynamics of supercooled metallic liquids. Proceedings of the National Academy of Sciences U.S.A., 115(25), 6375-6380 (2018)
- Y.-C. Hu et al. Five-fold symmetry as indicator of dynamic arrest in metallic glass-forming liquids. Nature Communications, 6(1), 8310 (2015)
UnitTest
Please run the bash scripts available from shell/ for unittests. As follows are test statistics:
| Test | # Tests and Runtime | Status |
|---|---|---|
| test_dynamics | Ran 15 tests in 10.303s | OK |
| test_neighbors | Ran 11 tests in 91.711s | OK |
| test_reader | Ran 11 tests in 0.270s | OK |
| test_static | Ran 28 tests in 298.248s | OK |
| test_utils | Ran 30 tests in 4.997s | OK |
| test_writer | Ran 3 tests in 0.005s | OK |
The activation of the acceleration code is slightly different for unit-test, and you need to manually compile the dynamic link library and place it in the _acc module.
# compile the dynamic link library
mkdir build
cd build
cmake ..
make
cp PyMatterSim/_acc/acc.cpython-313-x86_64-linux-gnu.so ../PyMatterSim/_acc/ # The dynamic library name varies depending on your platform.
Metadata
Release files for PyMatterSim 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| PyMatterSim-0.2.4.tar.gz | 1.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| PyMatterSim-0.2.4-cp311-cp311-macosx_14_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 14.0+ ARM64 | Details |
Total release size: 1.4 MB
Release files / PyMatterSim-0.2.4.tar.gz
| Download URL | PyMatterSim-0.2.4.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5eb1880e0b3766fe8c66103748ea259d7a9c7e802c7da41adee81826d7b4f90d
|
|
BLAKE2b-256 checksum How to use checksums |
e529078914cbd952454eeb2785570491fed23b7ce87f60e47bb23894508fe4b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / PyMatterSim-0.2.4-cp311-cp311-macosx_14_0_arm64.whl
| Download URL | PyMatterSim-0.2.4-cp311-cp311-macosx_14_0_arm64.whl |
|---|---|
| Size | 194.4 kB |
| Tags | CPython 3.11 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3b87934f75da241288b3380917ddbb68b5c0bc407fd4f4e83d31a9b7b128beb9
|
|
BLAKE2b-256 checksum How to use checksums |
0b6f5a6612c0508edef1bc721d53bdfa572a05e6c226cc3d387675758f36ec52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|