Skip to main content

Vector-oriented LAMMPS interface to rapidly iterate over series of atomistic structures or interatomic potentials.

Project description

lammpsparser

Pipeline codecov Binder

The lammpsparser packages provides primarily two functions. A write_lammps_structure() function to write an ase.atoms.Atoms structure to an LAMMPS data file and a parse_lammps_output_files() function to parse the log.lammps, dump.out and dump.h5 files from the LAMMPS thermo and dump commands.

Installation

The lammpsparser package is distributed via both pypi:

pip install lammpsparser

and conda-forge:

conda install -c conda-forge lammpsparser

Write LAMMPS structure

The write_lammps_structure() function is designed to write an ase.atoms.Atoms structure to an LAMMPS data file:

from lammpsparser import write_lammps_structure

write_lammps_structure(
    structure,
    potential_elements,
    units="metal",
    file_name="lammps.data",
    working_directory=None,
)

The structure parameter refers to the ase.atoms.Atoms structure and the potential_elements refers to the list of elements implemented in the specific interatomic potential. For example the NiAlH_jea.eam.alloy potential implements the elements Ni, Al and H, so when writing a structure for a simulation with this potential the potential_elements=["Ni", "Al", "H"]. It is important to maintain the order of the elements as LAMMPS internally references the elements based on their index, starting from one. The units parameter refers to the LAMMPS internal units to convert the ase.atoms.Atoms object which is defined in Angstrom to the length scale of the LAMMPS simulation. Finally, file_name parameter and the current working directory working_directory parameter are designed to select the location where the LAMMPS structure should be written. With the default parameters the LAMMPS structure is written in the lammps.data file in the current directory.

Parse LAMMPS output

In addition to writing the LAMMPS input structure lammpsparser also provide the parse_lammps_output_files() function to parse the LAMMPS output files, namely the log.lammps, dump.out and dump.h5 files:

from lammpsparser import parse_lammps_output_files

parse_lammps_output_files(
    working_directory,
    structure,
    potential_elements,
    units="metal",
    dump_h5_file_name="dump.h5",
    dump_out_file_name="dump.out",
    log_lammps_file_name="log.lammps",
)

In analogy to the write_lammps_structure() function the working_directory parameter refers to the directory which contains the output files. The structure parameter reefers to the ase.atoms.Atoms object which should be used as template to parse the structure from the dump files. This structure is again required as LAMMPS internally references elements only by an index, so the template structure is required to map the elements from the interatomic potential back to the elements of the ase.atoms.Atoms object. In the same way the potential_elements refers to the list of elements implemented in the specific interatomic potential. The units parameter refers to the LAMMPS internal units to convert the ase.atoms.Atoms object which is defined in Angstrom to the length scale of the LAMMPS simulation. Finally, the parameters dump_h5_file_name, dump_out_file_name and log_lammps_file_name refer to the output file names.

For the dump.out file the following LAMMPS dump command should be added to the LAMMPS input file:

dump 1 all custom 100 dump.out id type xsu ysu zsu fx fy fz vx vy vz
dump_modify 1 sort id format line "%d %d %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g %20.15g"

For the log.lammps file the following LAMMPS thermo command should be added to the LAMMPS input file:

thermo_style custom step temp pe etotal pxx pxy pxz pyy pyz pzz vol
thermo_modify format float %20.15g
thermo 100

Usage

Currently, the lammpsparser parser is primarily used in the pyiron_atomistics package and its successor the atomistics package to provide a simple LAMMPS parser. It only depends on ase, numpy, pandas and scipy and has an optional dependency on h5py to parse the LAMMPS h5md format.

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

lammpsparser-0.0.6.tar.gz (42.4 kB view details)

Uploaded Source

Built Distribution

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

lammpsparser-0.0.6-py3-none-any.whl (48.4 kB view details)

Uploaded Python 3

File details

Details for the file lammpsparser-0.0.6.tar.gz.

File metadata

  • Download URL: lammpsparser-0.0.6.tar.gz
  • Upload date:
  • Size: 42.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lammpsparser-0.0.6.tar.gz
Algorithm Hash digest
SHA256 08bcf4e394184b1253cabeb8db74d1287ba54aeaf2382201660a79a89b2c4b42
MD5 0c155df0145f77cc6ad91441db95a969
BLAKE2b-256 bbc06fca8e909f94f16b895b53ffe6c2b329a9cf086fc9b3781cacc2a2cef502

See more details on using hashes here.

Provenance

The following attestation bundles were made for lammpsparser-0.0.6.tar.gz:

Publisher: deploy.yml on pyiron/lammpsparser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lammpsparser-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: lammpsparser-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 48.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lammpsparser-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2e7626f5c6a5e0524d68c3f7bd4b957442329ba6ccddab039c7169b7eb68fcb4
MD5 b30f362d23595a2b20142b4d433a5ca0
BLAKE2b-256 ea92a13ef03e0cc694385ae51d152a43495da729e4758ae9ce6445baa7197c0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for lammpsparser-0.0.6-py3-none-any.whl:

Publisher: deploy.yml on pyiron/lammpsparser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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