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.3.tar.gz (19.2 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.3-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lmp2gro-1.0.3.tar.gz
  • Upload date:
  • Size: 19.2 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.3.tar.gz
Algorithm Hash digest
SHA256 caae90829635f80d19479d75235fc8c41e100c29c071ab2bf4bde915e5645533
MD5 9234b5a9bb84a58a87001481e3c52914
BLAKE2b-256 2a5159d15ec3356a2c24e22f30a27ff52523723aa0f1c3c35db9aa4a71b303d2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lmp2gro-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 18.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e7821a7077c25f787d186a8decb1c16e23b4a5c7f63ddbbb5bc96468415ecf58
MD5 d9d5b773a576af9e2bf8efb8a6e230a8
BLAKE2b-256 01d6589940b787da4e42314f2312e74204f4271b1b869cc97b14f2ab83bcb6ad

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