Skip to main content

LAMMPS logfile reader

Tool to read a logfile produced by LAMMPS into a simple python data structure with a get()-function providing the log data.

Installation

From pypi (preferred/stable)

pip install lammps-logfile

Depending on your python installation, you may have to use pip3 instead of pip. This is usualy the case if you need to run python3 rather than python to run python version 3.

Install using pip directly from github to get the latest (possibly unstable) version:

pip install git+https://github.com/henriasv/lammps-logfile.git

Or by cloning the repository:

git clone https://github.com/henriasv/lammps-logfile.git
cd lammps-logfile
pip3 install .

Basic usage

import lammps_logfile

log = lammps_logfile.File("path/to/logfile")

x = log.get("Time")
y = log.get("Temp")

import matplotlib.pyplot as plt
plt.plot(x, y)
plt.show()

This will give the concatenated log entries of all the runs where the style of the thermo output didn't change with respect to the last run. I.e. if the entries in the thermo_style was not changed between runs it will contain the log data for all the timesteps. If the thermo_style was changed, x and y will contain the data from all the timesteps after the thermo_style was changed for the last time.

Multiple runs in the same log file

If multiple run statements have been made in a simulation, these can be retrieved bu supplying the run_num keyword to the get()-function

import lammps_logfile

log = lammps_logfile.File("path/to/logfile")

x = log.get("Time", run_num=N)
y = log.get("Temp", run_num=N)

import matplotlib.pyplot as plt
plt.plot(x, y)
plt.show()

In this case, x and y will contain the log data from the N'th run command in LAMMPS, counting from 0.

Any invalid call to the get()-function will result in the function returning None. This happes if the user asks for a thermo propery that does not exist in the log file, or if the user asks for a run_num larger than the number of runs in the logfile.

Metadata

Release files for atomify-lammps-logfile 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for atomify-lammps-logfile 1.0.2
File Interpreter ABI Platform Actions
atomify_lammps_logfile-1.0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details for atomify_lammps_logfile-1.0.2-py2.py3-none-any.whl

Release files / atomify_lammps_logfile-1.0.2-py2.py3-none-any.whl

Download URL atomify_lammps_logfile-1.0.2-py2.py3-none-any.whl
Size 19.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d26dbac1325f49d3792a1445a6823fc28283bee4e816251bb7c47a6e3f08cc24
BLAKE2b-256 checksum
How to use checksums
a61c1acb6b9ebf4266616f03c42999cf45fb243f6c55b5b142fffd523c0b1433
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for atomify-lammps-logfile 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page