Skip to main content

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.

Project description

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.

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

lammpsinputbuilder-0.0.8.tar.gz (69.0 kB view details)

Uploaded Source

Built Distribution

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

lammpsinputbuilder-0.0.8-py3-none-any.whl (63.1 kB view details)

Uploaded Python 3

File details

Details for the file lammpsinputbuilder-0.0.8.tar.gz.

File metadata

  • Download URL: lammpsinputbuilder-0.0.8.tar.gz
  • Upload date:
  • Size: 69.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for lammpsinputbuilder-0.0.8.tar.gz
Algorithm Hash digest
SHA256 c45d4e48e19cc8b8244bf0ba82cfa934deba94c7d02fe47601c6d47638bcf23d
MD5 0191f43015069955fc481a36768b4af0
BLAKE2b-256 bf5ee36c7526915cb8fdecfe8bcf9ea69e1a4e4e6c0b52a52b47fa1fc79edae7

See more details on using hashes here.

Provenance

The following attestation bundles were made for lammpsinputbuilder-0.0.8.tar.gz:

Publisher: publish-to-pypi.yml on madreher/LammpsInputBuilder

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

File details

Details for the file lammpsinputbuilder-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for lammpsinputbuilder-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0431d0637fd69bbe1df160e7e010d66e83b407b50c4a0243a08b16b37f5e7319
MD5 3f68e70702b81f19a722ea5b0c35bedc
BLAKE2b-256 b991b54f024e936404416cfa648495471012bdbdf0db320fba5b3f5152970717

See more details on using hashes here.

Provenance

The following attestation bundles were made for lammpsinputbuilder-0.0.8-py3-none-any.whl:

Publisher: publish-to-pypi.yml on madreher/LammpsInputBuilder

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