Skip to main content

A fast and memory-efficient LAMMPS dump file reader with great developer experience

Project description

unDumper

unDumper is a fast and memory-efficient LAMMPS dump file reader with great developer experience. Completely unbiased and applicable to all projects

Features

  • Generator objects to load one frame of a dump file at a time
  • Capable of loading entire dumps into memory
  • Supports classic, YAML and grid type dumps
  • Utilizes a dictionary data structure for seamless integration with other plotting software in Python
  • Completely general, with data structure generated based on your dump file

Installation

unDumper is available on PyPI. Install it via pip

pip install undumper

Usage

There are many ways to use unDumper, and here we'll cover a few examples to illustrate its versatility in your project

In all cases you start by importing the package which can be done using the following

from undumper import undumper

From here, several functions are available. For most cases, you'll use either 'read_dump()' or 'read_whole_dump()'

undumper.read_dump('dump.lammpstrj', 'classic')
undumper.read_dump('dump.grid')
undumper.read_dump('dump.yaml')

When using read_dump, you may or may not specify the file type. In general, leaving the second argument blank is preferred

read_dump generates a generator object which can be used in a loop as follows

data = undumper.read_dump(file) #where file can be a classic, grid or yaml lammps dump file 

for snapshot in data:
    timesteps.append(snapshot["TIMESTEP"])
    positions.append([])

    for atom in snapshot["ATOMS"]:
        if atom["element"] == "Li":
            positions[-1].append([atom["xu"], atom["yu"], atom["zu"]])

At this point it is important to understand the structure of the dictionary that unDumper outputs, this applies to both the generator which returns the dictionary on each yield, and the 'read_whole_dump()' which returns a list of the following dictionaries

unDumped = {'TIMESTEP':0, 'NUMBER OF ATOMS':1600, 'BOX BOUNDS':{x: [0,0], y: [0,0]. z: [0,0]}, 'ATOMS':{id: 1, 'Element': "Li", "xu": 1, "yu": 2, "zu": 3}}

If your dump file has more parameters for specifying an atom they will be added in a similar manor, a good idea is to print and look at what your dictionary looks like before you start working with it

All the remaining functions are generally not recomended to be used and are listed here

  • 'read_classic()'
  • 'read_yaml()'
  • 'read_grid()'

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This work was conducted by the Intellimatter Group under Dr. Conrard Giresse Tetsassi Feugmo at the University of Waterloo.

Special thanks to Xander Gouws for supervising this project and originating the idea behind it.

Contact

For any questions or feedback, feel free to contact me at mu2farooqi@uwaterloo.ca

Let us know is there are any features you would like to see or if you find this project useful

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

undumper-1.0.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

undumper-1.0.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file undumper-1.0.0.tar.gz.

File metadata

  • Download URL: undumper-1.0.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for undumper-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7e12af015be6d11bd8594c79ca2bb36b03c221f0fd2c244e4255753e64b7a4c0
MD5 ee744805ddfd861b36350a20148287da
BLAKE2b-256 cc898d3fdc9aaee7477fe674260b02f569825886d2fd784cf570ca7536729fff

See more details on using hashes here.

File details

Details for the file undumper-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: undumper-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for undumper-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05b4514ec4e0f77bc6a2fa581061a2a6c50d8969df19064c79b26e1512ca2ce8
MD5 5ad3484f03d59b44e6b8fc42d34a245c
BLAKE2b-256 88d7af2c0aa63c4303289638435557e9d087b8aa6a0cb44c32a39d4d11aebcd4

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