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.6.tar.gz (64.9 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.6-py3-none-any.whl (63.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lammpsinputbuilder-0.0.6.tar.gz
  • Upload date:
  • Size: 64.9 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.6.tar.gz
Algorithm Hash digest
SHA256 9b1ebe9524d7fe6e2bd9994a9354f21474f8c00f49f452524735b532c293bf85
MD5 f6eedc3f1efb0c3daf3b53488c804237
BLAKE2b-256 8b7fba1f73b431243c53de846be2a0c89e2f0edc84c4f4424e6bffa9efafadcf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lammpsinputbuilder-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 653eabe6f96abd82345488d339ad9de01368dba84b3e441b93df755e3d1882d7
MD5 a16772c9448d60f818f67652a74c9036
BLAKE2b-256 148e5cbdca68ece01164589c7f919122c545e9579525cb1cc1281f109fdcf8b6

See more details on using hashes here.

Provenance

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