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.
- 🔬 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
pip install lammpskitgit 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.txtRuntime 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 | Purpose |
|---|---|
| read_structure_info | Parse trajectory metadata (timestep, atom count, box dims) |
| read_coordinates | Load coordinates and cell info from trajectory files |
| read_displacement_data | Parse processed displacement data with robust error handling |
| Function | Purpose |
|---|---|
| analyze_clusters | OVITO-based cluster analysis and filament property extraction |
| track_filament_evolution | Track filament connectivity, gap, and size over time |
| plot_atomic_distribution | Analyze and plot atomic distributions by element type |
| plot_atomic_charge_distribution | Analyze and plot atomic charge distributions |
| plot_displacement_comparison | Compare displacement data across multiple cases |
| plot_displacement_timeseries | Plot time series of displacement data with customization |
| Function | Purpose |
|---|---|
| plot_multiple_cases | General scientific plotting utility with flexible styling |
| timeseries_plots.* | Centralized timeseries plotting with font and style control |
| Function | Purpose |
|---|---|
| Various validation functions | Centralized input validation and error handling |
| Script | Purpose |
|---|---|
| run_analysis.py | Complete workflow demonstrating 4 main analysis types |
LAMMPSKit v1.2.1 includes a comprehensive example workflow that demonstrates all major package capabilities:
# 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.pyThis workflow demonstrates four main analysis types:
- Filament Evolution Tracking - Monitor filament connectivity and structural changes over time
- Displacement Analysis - Compare atomic displacements across different species (Hf, O, Ta)
- Charge Distribution Analysis - Analyze local charge distributions in electrochemical systems
- Atomic Distribution Analysis - Study atomic distributions under different applied voltages
Generated plots and analysis results are saved to usage/ecellmodel/output/.
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
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.
-
Install Docker on your system.
See Get Docker for instructions. -
Pull the latest image:
docker pull simantalahkar/lammpskit:latest
Or pull a specific version:
docker pull simantalahkar/lammpskit:1.2.1
-
Run the container with your local data mounted as a volume:
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. -
Use the installed Python package:
python >>> import lammpskit # ...your analysis code... -
Copy custom scripts or files into the container (from another terminal):
docker cp /path/to/local/script.py <container_id>:/home/lammpsuser/
You can also install additional Python packages inside the container:
pip install <package-name>
-
Exit the container after analysis:
exitThe container will remain on your system for future use.
To re-enter the container:docker start <container_id> docker exec -it <container_id> bash
To delete the container completely:
docker rm <container_id>
For end users (runtime):
pip install lammpskitFor development and testing:
# Method 1: Using optional dependencies (recommended)
pip install -e .[dev]
# Method 2: Manual installation (fallback)
pip install -e .
pip install -r requirements-dev.txtAll runtime dependencies are listed in requirements.txt. Development and test dependencies are available in multiple formats:
[project.optional-dependencies]inpyproject.toml(modern standard)requirements-dev.txt(traditional method)extras_requireinsetup.py(legacy compatibility)
To set up a development environment and run tests locally:
# Recommended approach with fallback
pip install -e .[dev] || (pip install -e . && pip install -r requirements-dev.txt)
pytestTests are not shipped with the PyPI package, but are available in the source repository for development and validation.
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.
tests/test_io.py- I/O function validationtests/test_plotting.py- General plotting utilitiestests/test_timeseries_plots.py- Timeseries plotting functionstests/test_centralized_font_control.py- Font and styling consistencytests/test_ecellmodel/- Analysis function validation (subdirectory)tests/test_config.py- Configuration managementtests/baseline/- Centralized baseline images for all visual tests
# 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=htmlCentralized 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:
# For tests in tests/ directory (root level)
BASELINE_DIR_RELATIVE = "baseline"
# For tests in tests/test_ecellmodel/ directory (subdirectory)
BASELINE_DIR_RELATIVE = "../baseline"
@pytest.mark.mpl_image_compare(baseline_dir=BASELINE_DIR_RELATIVE, remove_text=True)
def test_plotting_function():
# Test implementation returns matplotlib figure
return figureTests 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.
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)
# header1
# header2
# header3
0 2
1.0 3.0
2.0 4.0
# end loop
See the CHANGELOG.md for a detailed list of changes and updates.
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
GPL-3.0-or-later
Simanta Lahkar