LAMMPS Data Analysis library
Reason this release was yanked:
Broken import
Project description
LaDa
LaDa (LAMMPS Data Access) is a lightweight Python package for parsing common LAMMPS output formats. It provides simple, streaming-friendly access to dump files, log files, and LAMMPS data files, with minimal dependencies.
🚀 Installation
Install using pip from PyPI:
pip install lada
Note: The package is designed to be used with Python 3.8+.
📦 Package structure
The core parser modules are located in src/LaDa/parsers/:
dump_parser.py- streaming parser for LAMMPS dump files (i.e., output fromdumpcommand) usingiter_dump_frames()log_parser.py- parser for LAMMPS log files usingread_lammps_log()data_parser.py- parser for LAMMPS data files (i.e., output formwrite_datacommand) usingread_data_file()
To keep imports simple, the package exports the most common entry point:
from LaDa import iter_dump_frames, read_lammps_log, read_data_file
🧩 1) Parsing LAMMPS dump files (dump_parser.py)
Main API
from LaDa import iter_dump_frames
for frame in iter_dump_frames("path/to/dump_file.dump"):
# metadata is a dict of "ITEM:" blocks
timestep = frame.metadata["TIMESTEP"] # int
box_bounds = frame.metadata["BOX BOUNDS pp pp pp"]
# get numeric columns by name
ids = frame.get_column("id")
xs = frame.get_column("x")
# convert the atom block into a pandas DataFrame
df = frame.to_dataframe()
Notes on metadata conversion
TIMESTEPis returned as anint.NUMBER OF ...entries (e.g.,NUMBER OF ATOMS) are converted toint.BOX BOUNDS ...entries are parsed into numeric values:- For orthogonal boxes, you get a 2D NumPy array shape
(3, 2). - For triclinic boxes, you get a 2D NumPy array shape
(3, 3)where the 3rd column contains tilt factors (xy, xz, yz).
- For orthogonal boxes, you get a 2D NumPy array shape
Column helpers
These helpers avoid manual index lookups:
ids = frame.get_column("id")
atom_ids = frame.get_column_or("id", default=None)
col_idx = frame.column_index("type")
📝 2) Parsing LAMMPS log files (log_parser.py)
Main API
from LaDa import read_lammps_log
thermo = read_lammps_log("log.lammps")
print(thermo.columns) # column names (Step, Temp, E_pair, ...)
print(thermo.get("E_pair")) # numpy array of E_pair values
# Convert to pandas DataFrame
df = thermo.to_pandas()
What it parses
- It extracts the table between the
Per MPI rank memory allocationmarker and theLoop timemarker. - The first non-empty line in that section is treated as the header.
🧬 3) Parsing LAMMPS data files (data_parser.py)
Main API
from LaDa import read_data_file
lammps_data = read_data_file("data.lmp")
# Get a parsed section as a NumPy array
atoms = lammps_data.get("Atoms")
# Convert a section to pandas (smart infer columns for Atoms/Bonds/Velocities)
df_atoms = lammps_data.to_pandas(section="Atoms")
Notes on atom style detection
- The parser attempts to detect the atom style from the comment in the
Atomssection header, e.g.Atoms # atomic. - If detected, it uses the correct column layout for that style (e.g.,
x y zvsqx qy qz).
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lada-1.0.0.tar.gz.
File metadata
- Download URL: lada-1.0.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
491ed5595f7cbacacf6e4c3baf761831bd06d2227b05fd1d5c39475a576f0e11
|
|
| MD5 |
7f9bc29bb78dd85b7a04e0ed93ecb191
|
|
| BLAKE2b-256 |
0a36ae8688bfd17b12f08e9b438825f33946a3bb6b3e258f6106f3a97ab6cc8d
|
File details
Details for the file lada-1.0.0-py3-none-any.whl.
File metadata
- Download URL: lada-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbc9a2c52003428b5ead9003bc7f7b3807c5fb0bee08fea2d1cb7e12e21ac117
|
|
| MD5 |
6cbf6e4dcf1249da513cf63cf2ac20be
|
|
| BLAKE2b-256 |
dbb9f44fa1aaed5f743129f3526f24ae5a6af7b3615822ee8bf44ddf3f62e4cb
|