Skip to main content

LammpsInputBuilder

LIB CI/CD Coverage badge PyLint pypi version

TLDR

LammpsInputBuilder (or LIB) is a Python library designed to generate Lammps inputs from a molecular model, a forcefield, and a high level definition of a simulation workflow.

The goal is to provide an API able to create a Lammps input and data scripts to load a molecular model, assign a forcefield to it, and execute a sequence of operations. The current implementation supports ReaxFF and Rebo potentials for the model defintion, with the possibility to extend to other types of forcefields later on.

Operations are organized in Sections, where each section is organized around typically but not necessary a time integration operations (minimize, nve, run 0, etc). Each Section can be extended to added addition computations (fix, compute, etc) running at the same time of the main time integration operation.

With this organization, the main objectives of LammpsInputBuilder are:

  • Provide an easy way to generate base Lammps input scripts via a simple Python API
  • Create a reusable library of common Sections types to easily chain common operations without having to copy Lammps code
  • Make is possible for external tools to generate Lammps inputs via a JSON representation of a workflow (under construction)

Here is a simple example (examples/tldr.py) on how to load a molecular model, assign a reax potential to it, and minimize the model:

    from lammpsinputbuilder.types import BoundingBoxStyle, ElectrostaticMethod
    from lammpsinputbuilder.typedmolecule import ReaxTypedMolecularSystem
    from lammpsinputbuilder.workflow_builder import WorkflowBuilder
    from lammpsinputbuilder.section import IntegratorSection
    from lammpsinputbuilder.integrator import MinimizeIntegrator, MinimizeStyle

    modelData = Path('benzene.xyz')
    forcefield = Path('ffield.reax.Fe_O_C_H.reax') 

    typedMolecule = ReaxTypedMolecularSystem(
        bbox_style=BoundingBoxStyle.PERIODIC,
        electrostatic_method=ElectrostaticMethod.QEQ
    )
    typedMolecule.load_from_file(modelData, forcefield)

    # Create the workflow. In this case, it's only the molecule
    workflow = WorkflowBuilder()
    workflow.set_typed_molecular_system(typedMolecule)

    # Create a minimization Section 
    sectionMin = IntegratorSection(
        integrator=MinimizeIntegrator(
            integrator_name="Minimize",
            style=MinimizeStyle.CG, 
            etol=0.01,
            ftol=0.01, 
            maxiter=100, 
            maxeval=10000))
    workflow.add_section(sectionMin)

    # Generate the inputs
    job_folder = workflow.generate_inputs()

Installation

The easiest way to get the latest release is via Pypi. You can install LammpsInputBuilder as follows:

# Create a virtual environment
python3 -m venv lammpsinputbuilder
source lammpsinputbuilder/bin/activate

# Install LammpsInputBuilder
pip3 install lammpsinputbuilder

Alternatively, if you would like the latest dev build (unstable), you may install LammpsInputBuilder from source as well:

# Create a virtual environment
python3 -m venv lammpsinputbuilder
source lammpsinputbuilder/bin/activate

git clone git@github.com:madreher/LammpsInputBuilder.git 
cd LammpsInputBuilder
pip3 install -e .

Documentation

The user documentation can be found here. This page will provide detailed explanations on the different concepts introduced by LammpsInputBuilder and how to build reusable simulation workflows.

A few notes for maintainers are also available here.

Metadata

Release files for lammpsinputbuilder 0.0.8

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

Source distribution (sdist)

Source distribution for lammpsinputbuilder 0.0.8
File Size Uploaded
lammpsinputbuilder-0.0.8.tar.gz 69.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lammpsinputbuilder 0.0.8
File Interpreter ABI Platform
lammpsinputbuilder-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 132.1 kB

Release files / lammpsinputbuilder-0.0.8.tar.gz

Download URL lammpsinputbuilder-0.0.8.tar.gz
Size 69.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c45d4e48e19cc8b8244bf0ba82cfa934deba94c7d02fe47601c6d47638bcf23d
BLAKE2b-256 checksum
How to use checksums
bf5ee36c7526915cb8fdecfe8bcf9ea69e1a4e4e6c0b52a52b47fa1fc79edae7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2024.

Transparency log

Release files / lammpsinputbuilder-0.0.8-py3-none-any.whl

Download URL lammpsinputbuilder-0.0.8-py3-none-any.whl
Size 63.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0431d0637fd69bbe1df160e7e010d66e83b407b50c4a0243a08b16b37f5e7319
BLAKE2b-256 checksum
How to use checksums
b991b54f024e936404416cfa648495471012bdbdf0db320fba5b3f5152970717
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

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