https://github.com/simantalahkar/lammpskit

lammpskit is a Python toolkit for post-processing and analyzing molecular dynamics (MD) simulations with LAMMPS. Its modular data processing and analysis functions are broadly applicable to scientific computing, data engineering, and machine learning workflows involving time series or semi-structured data.

https://github.com/simantalahkar/lammpskit

Science Score: 39.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.4%) to scientific vocabulary

Keywords

data-analysis data-engineering data-science data-visualization lammps molecular-dynamics python-package
Last synced: 5 months ago · JSON representation

Repository

lammpskit is a Python toolkit for post-processing and analyzing molecular dynamics (MD) simulations with LAMMPS. Its modular data processing and analysis functions are broadly applicable to scientific computing, data engineering, and machine learning workflows involving time series or semi-structured data.

Basic Info
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Topics
data-analysis data-engineering data-science data-visualization lammps molecular-dynamics python-package
Created 8 months ago · Last pushed 7 months ago
Metadata Files
Readme Changelog License

README.md

LAMMPSKit

Tests Documentation Coverage PyPI version Python 3.12+ License: GPL v3

LAMMPSKit is a comprehensive Python toolkit for molecular dynamics (MD) simulation analysis with LAMMPS, specialized for electrochemical memory device characterization and filament analysis. It provides advanced post-processing capabilities for HfTaO-based resistive random access memory (ReRAM) devices, including filament formation tracking, charge redistribution analysis, and temporal evolution characterization.

🚀 Features

  • 🔬 Specialized Analysis: Advanced filament evolution tracking for electrochemical memory devices
  • 📊 Comprehensive Visualization: Publication-ready scientific plotting with customizable styling
  • ⚡ High Performance: Optimized for large trajectory analysis (>1M atoms, >10K frames)
  • 🧪 OVITO Integration: Advanced cluster analysis and structural characterization
  • 📐 Robust Data Processing: Memory-efficient streaming for multi-gigabyte datasets
  • 🎯 Modular Design: Separate I/O, plotting, and analysis components for flexibility
  • 🔧 Configuration Management: Centralized validation and parameter management
  • ✅ Complete Testing: 96% code coverage with visual regression testing

📦 Installation

From PyPI (Recommended)

bash pip install lammpskit

For Development

```bash git clone https://github.com/simantalahkar/lammpskit.git cd lammpskit

Primary method (modern pip with optional dependencies)

pip install -e .[dev]

Alternative method (if above fails)

pip install -e . && pip install -r requirements-dev.txt ```

📋 Requirements

Runtime Dependencies: - Python 3.12+ - numpy ≥2.3.1 - matplotlib ≥3.10.3 - ovito ≥3.12.4

Development Dependencies: - All runtime requirements - Testing: pytest, pytest-cov, pytest-mpl - Documentation: sphinx, sphinx-rtd-theme - Code Quality: black, flake8, isort, mypy - Build Tools: build, twine, setuptools

Function Summary Table

Core I/O Functions (lammpskit.io.lammps_readers)

| Function | Purpose | |--------------------------------|----------------------------------------------------------------| | readstructureinfo | Parse trajectory metadata (timestep, atom count, box dims) | | readcoordinates | Load coordinates and cell info from trajectory files | | readdisplacement_data | Parse processed displacement data with robust error handling |

Analysis Functions (lammpskit.ecellmodel.filament_layer_analysis)

| Function | Purpose | |--------------------------------|----------------------------------------------------------------| | analyzeclusters | OVITO-based cluster analysis and filament property extraction | | trackfilamentevolution | Track filament connectivity, gap, and size over time | | plotatomicdistribution | Analyze and plot atomic distributions by element type | | plotatomicchargedistribution| Analyze and plot atomic charge distributions | | plotdisplacementcomparison | Compare displacement data across multiple cases | | plotdisplacementtimeseries | Plot time series of displacement data with customization |

Plotting Utilities (lammpskit.plotting)

| Function | Purpose | |--------------------------------|----------------------------------------------------------------| | plotmultiplecases | General scientific plotting utility with flexible styling | | timeseries_plots.* | Centralized timeseries plotting with font and style control |

Data Processing (lammpskit.ecellmodel.data_processing)

| Function | Purpose | |--------------------------------|----------------------------------------------------------------| | Various validation functions | Centralized input validation and error handling |

Example Workflows (usage/ecellmodel/)

| Script | Purpose | |--------------------------------|----------------------------------------------------------------| | run_analysis.py | Complete workflow demonstrating 4 main analysis types |

Quick Start

Using the Example Workflow

LAMMPSKit v1.2.1 includes a comprehensive example workflow that demonstrates all major package capabilities:

```python

Clone the repository and navigate to the usage example

git clone https://github.com/simantalahkar/lammpskit.git cd lammpskit/usage/ecellmodel

Run the complete analysis workflow

python run_analysis.py ```

This workflow demonstrates four main analysis types: 1. Filament Evolution Tracking - Monitor filament connectivity and structural changes over time 2. Displacement Analysis - Compare atomic displacements across different species (Hf, O, Ta) 3. Charge Distribution Analysis - Analyze local charge distributions in electrochemical systems 4. Atomic Distribution Analysis - Study atomic distributions under different applied voltages

Generated plots and analysis results are saved to usage/ecellmodel/output/.

Package Structure

LAMMPSKit v1.2.1 features a modular architecture:

lammpskit/ ├── io/ # Data reading and I/O operations ├── plotting/ # Visualization utilities and timeseries plots ├── ecellmodel/ # Electrochemical analysis functions └── config.py # Centralized configuration management

Docker Image

An official Docker image for lammpskit is available on Docker Hub. Using the Docker container provides a portable, reproducible environment with all dependencies pre-installed for running and testing lammpskit anywhere Docker is supported.

How to Use

  1. Install Docker on your system.
    See Get Docker for instructions.

  2. Pull the latest image: sh docker pull simantalahkar/lammpskit:latest Or pull a specific version: sh docker pull simantalahkar/lammpskit:1.2.1

  3. Run the container with your local data mounted as a volume: sh docker run -it -v /path/to/your/data:/data simantalahkar/lammpskit:latest This starts a bash shell in the container. Your local data is accessible at /data.

  4. Use the installed Python package: ```sh python

    import lammpskit

    ...your analysis code...

    ```

  5. Copy custom scripts or files into the container (from another terminal): sh docker cp /path/to/local/script.py <container_id>:/home/lammpsuser/ You can also install additional Python packages inside the container: sh pip install <package-name>

  6. Exit the container after analysis: sh exit The container will remain on your system for future use.
    To re-enter the container: sh docker start <container_id> docker exec -it <container_id> bash To delete the container completely: sh docker rm <container_id>

Installation (PyPI)

For end users (runtime): sh pip install lammpskit

For development and testing: ```sh

Method 1: Using optional dependencies (recommended)

pip install -e .[dev]

Method 2: Manual installation (fallback)

pip install -e . pip install -r requirements-dev.txt ```

Development and Testing Environment

All runtime dependencies are listed in requirements.txt. Development and test dependencies are available in multiple formats: - [project.optional-dependencies] in pyproject.toml (modern standard) - requirements-dev.txt (traditional method)
- extras_require in setup.py (legacy compatibility)

To set up a development environment and run tests locally: ```sh

Recommended approach with fallback

pip install -e .[dev] || (pip install -e . && pip install -r requirements-dev.txt) pytest ``` Tests are not shipped with the PyPI package, but are available in the source repository for development and validation.

Test Coverage & Visual Regression Testing

LAMMPSKit v1.2.1 includes extensive test coverage with over 270 test functions and 90+ baseline images for visual regression testing. The test suite uses a centralized baseline approach for consistent and maintainable visual regression testing.

Test Organization

  • tests/test_io.py - I/O function validation
  • tests/test_plotting.py - General plotting utilities
  • tests/test_timeseries_plots.py - Timeseries plotting functions
  • tests/test_centralized_font_control.py - Font and styling consistency
  • tests/test_ecellmodel/ - Analysis function validation (subdirectory)
  • tests/test_config.py - Configuration management
  • tests/baseline/ - Centralized baseline images for all visual tests

Running Tests Locally

```sh

Install with development dependencies

pip install .[dev]

Run all tests

pytest

Run with visual regression testing

pytest --mpl

Generate new baseline images (when plots change intentionally)

pytest --mpl-generate-path=tests/baseline tests/

Run tests with coverage

pytest --cov=lammpskit --cov-report=html ```

Visual Regression Testing Architecture

Centralized Baseline Directory Structure: tests/ ├── baseline/ # All baseline images (centralized) ├── test_*.py # Root level tests → "baseline" ├── test_ecellmodel/ # Subdirectory tests → "../baseline" │ └── test_*.py # Use relative paths to centralized location └── conftest.py # Shared pytest configuration

Key Benefits: - Cross-platform compatibility: Relative paths work on Windows, Linux, macOS - Container compatibility: Works identically in Docker and local environments
- Maintainability: Single location for all baseline images - CI/CD integration: Simplified path handling in GitHub Actions and Docker

Implementation Pattern: ```python

For tests in tests/ directory (root level)

BASELINEDIRRELATIVE = "baseline"

For tests in tests/test_ecellmodel/ directory (subdirectory)

BASELINEDIRRELATIVE = "../baseline"

@pytest.mark.mplimagecompare(baselinedir=BASELINEDIRRELATIVE, removetext=True) def testplottingfunction(): # Test implementation returns matplotlib figure return figure ```

Tests use pytest, pytest-mpl, and pytest-cov for automated validation, image comparison, and coverage analysis. The centralized baseline approach ensures consistent visual regression testing across all development and CI/CD environments.

Data Format Examples

LAMMPS Trajectory File (.lammpstrj)

ITEM: TIMESTEP 1200000 ITEM: NUMBER OF ATOMS 5 ITEM: BOX BOUNDS pp pp pp 0.0 50.0 0.0 50.0 0.0 50.0 ITEM: ATOMS id type q x y z ix iy iz vx vy vz c_eng 1 2 0.1 1.0 2.0 3.0 0 0 0 0 0 0 0 2 1 -0.2 2.0 3.0 4.0 0 0 0 0 0 0 0 ... (one line per atom)

Processed Displacement Data File

```

header1

header2

header3

0 2 1.0 3.0 2.0 4.0

end loop

```

Changelog

See the CHANGELOG.md for a detailed list of changes and updates.

Citation

If you use this package in your research, please cite:

S. Lahkar et al., Decoupling Local Electrostatic Potential and Temperature-Driven Atomistic Forming Mechanisms in TaOx/HfO2-Based ReRAMs using Reactive Molecular Dynamics Simulations, arXiv:2505.24468, https://doi.org/10.48550/arXiv.2505.24468

License

GPL-3.0-or-later

Author

Simanta Lahkar

Links

Owner

  • Name: Simanta Lahkar
  • Login: simantalahkar
  • Kind: user

GitHub Events

Total
  • Watch event: 1
  • Delete event: 2
  • Issue comment event: 1
  • Push event: 21
  • Pull request event: 2
  • Create event: 3
Last Year
  • Watch event: 1
  • Delete event: 2
  • Issue comment event: 1
  • Push event: 21
  • Pull request event: 2
  • Create event: 3

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 242 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 1
pypi.org: lammpskit

A Python toolkit for advanced LAMMPS data processing and scientific simulation analysis.

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 242 Last month
Rankings
Dependent packages count: 8.9%
Average: 29.7%
Dependent repos count: 50.4%
Maintainers (1)
Last synced: 7 months ago

Dependencies

Dockerfile docker
  • python 3.12-slim build
pyproject.toml pypi
  • matplotlib >=3.10.3
  • numpy >=2.3.1
  • ovito >=3.12.4
requirements-dev.txt pypi
  • Jinja2 >=3.1.6 development
  • MarkupSafe >=3.0.2 development
  • build >=1.2.2.post1 development
  • coverage >=7.9.1 development
  • cycler >=0.12.1 development
  • fonttools >=4.58.4 development
  • packaging >=25.0 development
  • pillow >=11.2.1 development
  • pluggy >=1.6.0 development
  • pyparsing >=3.2.3 development
  • pytest >=8.4.1 development
  • pytest-cov >=6.2.1 development
  • pytest-mpl >=0.17.0 development
  • python-dateutil >=2.9.0.post0 development
  • readme_renderer >=44.0 development
  • requests >=2.32.4 development
  • requests-toolbelt >=1.0.0 development
  • rich >=14.0.0 development
  • setuptools >=80.9.0 development
  • twine >=6.1.0 development
requirements.txt pypi
  • matplotlib >=3.10.3
  • numpy >=2.3.1
  • ovito >=3.12.4
setup.py pypi
  • matplotlib >=3.10.3
  • numpy >=2.3.1
  • ovito >=3.12.4
uv.lock pypi
  • colorama 0.4.6
  • contourpy 1.3.2
  • coverage 7.9.1
  • cycler 0.12.1
  • fonttools 4.58.4
  • iniconfig 2.1.0
  • jinja2 3.1.6
  • kiwisolver 1.4.8
  • lammpskit 0.1.0
  • markupsafe 3.0.2
  • matplotlib 3.10.3
  • numpy 2.3.1
  • ovito 3.12.4
  • packaging 25.0
  • pillow 11.2.1
  • pluggy 1.6.0
  • pygments 2.19.2
  • pyparsing 3.2.3
  • pyside6-essentials 6.9.1
  • pytest 8.4.1
  • pytest-cov 6.2.1
  • pytest-mpl 0.17.0
  • python-dateutil 2.9.0.post0
  • shiboken6 6.9.1
  • six 1.17.0
  • traits 7.0.2