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.5.tar.gz (64.7 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.5-py3-none-any.whl (62.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lammpsinputbuilder-0.0.5.tar.gz
  • Upload date:
  • Size: 64.7 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.5.tar.gz
Algorithm Hash digest
SHA256 4d0ba4c12b8b81232c8b5474ef89adb4e9e80a19b588cf68f5aaeeb16f4a8d68
MD5 3247c5e4059de5d2cb23aaa5336d3e51
BLAKE2b-256 27166b478ca2247a9d0428669ece4de35d9db579956e54a6caacfee5130f607d

See more details on using hashes here.

Provenance

The following attestation bundles were made for lammpsinputbuilder-0.0.5.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.5-py3-none-any.whl.

File metadata

File hashes

Hashes for lammpsinputbuilder-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 efb9e6f63363cff4f95f4962ef199f06b6c6f835d72dadcf1cc9f63c85d7bf77
MD5 e39ae75067d85f9333089f10d0cf6006
BLAKE2b-256 ebbd0c4d4546dfab65f7f822e86965ddfcc8c68ff61bba0e2fd88c8fd6478159

See more details on using hashes here.

Provenance

The following attestation bundles were made for lammpsinputbuilder-0.0.5-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