Skip to main content

A tool to convert LAMMPS data files to GROMACS topologies

Project description

lmp2gro

Author

  • Alexandre Moni Pereira

Motivation

lmp2gro is a Python-based utility designed to facilitate the topological conversion of Large-scale Atomic/Molecular Massively Parallel Simulator (LAMMPS) data files into GROMACS-compatible formats.

While LAMMPS provides several internal tools for topology generation (such as msi2lmp, amber2lmp, and ch2lmp) and supports external utilities like cif2lammps, transitioning these models to GROMACS remains a challenge. Given that these tools are highly effective for generating complex topologies—particularly for systems where GROMACS-native builders may struggle—a robust conversion bridge is essential for inter-software interoperability.

Current Status

Initially developed for the characterization of crystals, surfaces, and Metal-Organic Frameworks (MOFs), lmp2gro processes a single-molecule LAMMPS data file to generate the necessary GROMACS input files. The current implementation outputs a single residue name (resname), allowing for the subsequent integration of additional molecular species within the GROMACS environment.

The script has been validated using topologies generated via msi2lmp for the INTERFACE FF and CLAY-FF frameworks. Furthermore, it has been benchmarked against UFF4MOF parameters generated by cif2lammps and cross-referenced with OBGMX, a recognized tool for direct GROMACS parameterization.

Requirements

lmp2gro utilizes standard Python 3 libraries for data manipulation and regular expression parsing:

  • pandas
  • numpy
  • scipy

lmp2gro installation using pip

Alternatively to download the repository, one can install lmp2gro directly using pip. The primary advantage is that you no longer need to call the Python interpreter explicitly, as the tool can be executed from any directory.

Commands that previously began with python3 lmp2gro.py will now be replaced simply by lmp2gro.

To install, we recommend creating a dedicated environment:

# Create the environment
conda create -n lmp2gro_env python>=3.7

# Activate the environment
conda activate lmp2gro_env

# Install the package
pip install lmp2gro

To verify the installation and view available options:

lmp2gro -h

Usage

The primary execution syntax is:

python3 lmp2gro.py data.lammps_data_file

The input file (data.lammps_data_file) must contain a single molecular entity, which may include periodic boundary conditions.

Optional Arguments

  • Residue Naming: By default, the residue name is set to UNL. You can specify a custom name using the --resname or -r flag:
    python3 lmp2gro.py data.lammps_data_file -r RES
    
  • Output Directory: The output is saved to a folder named after the input file (stripping .data or data.). To define a custom directory, use the --folder flag:
    python3 lmp2gro.py data.lammps_data_file -r RES --folder folder_name
    
    The resulting directory will contain a structural file (conf.gro), global force field parameters (topol.top, ffbonded.itp, atomtypes.itp), and a molecule-specific inclusion file (conf.itp).

Parameter Refinement

In specific force fields like CLAY-FF, where interactions are predominantly non-bonded, automatically generated bonded terms may be physically redundant. The --clean function identifies and removes bonded parameters for which all values are zero.

python3 lmp2gro.py data.lammps_data_file -r RES --folder folder_name --clean

To manually exclude specific bonded interactions that possess non-zero parameters, provide the target indices as follows:

python3 lmp2gro.py data.lammps_data_file -r RES --folder folder_name --clean -b "1 2" -a "1 2 3" -d "1" -i "1 2"
  • -b: Indices for bonds to be deleted.
  • -a: Indices for angles to be deleted.
  • -d: Indices for dihedrals to be deleted.
  • -i: Indices for impropers to be deleted.
  • The numbers represent the indexes to be removed from the LAMMPS data file.

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

lmp2gro-1.0.1.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

lmp2gro-1.0.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file lmp2gro-1.0.1.tar.gz.

File metadata

  • Download URL: lmp2gro-1.0.1.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for lmp2gro-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1b15a5b396e367eced27f3f204c58d509fd1b84d62f5baa0aa7cdc7aa1afdc71
MD5 e09f6599175a7e33554ced87f8aa1f67
BLAKE2b-256 538ebfcc9cd0a6c5c6afe79a64851d6ae0cf9e655c7c418b2e0a9d6d17e2a692

See more details on using hashes here.

File details

Details for the file lmp2gro-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: lmp2gro-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for lmp2gro-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b95f7cef9055fbd13ccdb5337ef8c23c69bc1665c39aebbdf4b9b03fcdb82bd3
MD5 34bbe050d8685002af0affbde5b5e72e
BLAKE2b-256 988201ed0b25f58d72f297a84adfd4e85775b3334d28520c3ee9a6cf45fd7a98

See more details on using hashes here.

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