Skip to main content

A python data analysis library for computer simulations

Project description

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 .venv
  • source .venv/bin/activate
  • pip install PyMatterSim
  • version upgrade pip install --upgrade pymattersim

Install from source

  • You need a C++compiler that supports at least the C++11 standard and cmake.

    Recommend using conda or mamba for installation.

    Linux: conda install gxx cmake or mamba install gxx cmake

    Mac OS.conda install clang cmake or mamba install clang cmake

    Windows: conda install gxx cmake or mamba install gxx cmake or 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++ cmake

    centos: sudo yum install gcc-c++ cmake3

    macos: brew install gcc cmake

    Now 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

  1. LAMMPS
    1. atom type & molecular type such as patchy particle, rigid body, molecules et al.
    2. x, xs, xu type particle positions
    3. orthagonal / triclinic box
  2. Hoomd-blue
    1. GSD for structure analysis (need gsd==3.2.0)
    2. GSD + DCD for dynamics analysis (need gsd==3.2.0 and mdtraj==1.9.9)
  3. VASP (to be added)
  4. Any type of simulators as long as the input were formatted well, modifying the reader module 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

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.

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

PyMatterSim-0.2.3.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

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

PyMatterSim-0.2.3-cp311-cp311-macosx_14_0_arm64.whl (194.4 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

File details

Details for the file PyMatterSim-0.2.3.tar.gz.

File metadata

  • Download URL: PyMatterSim-0.2.3.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for PyMatterSim-0.2.3.tar.gz
Algorithm Hash digest
SHA256 fefdde5d8f0ae5ace8ea47781d1c382a5a1aefdcd9f9d12658caeaeb55f73bfb
MD5 6281cfd48ca5f0123887883b2783708d
BLAKE2b-256 5cac1f452653e9a9f6d8dda3917ea1ed616acc50b33705acf5d8e437044f1ae5

See more details on using hashes here.

File details

Details for the file PyMatterSim-0.2.3-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for PyMatterSim-0.2.3-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 870b21020a9c60098004ecddf54d627566a4f2f04f981c8214e3d66507a7a8b8
MD5 c3f51d14535a962e4a63fbd345e70c87
BLAKE2b-256 993c775c317b044af36c117df639817590e69c30c1165ca05f690b21fee252be

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