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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lmp2gro-1.0.5.tar.gz
  • Upload date:
  • Size: 19.3 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.5.tar.gz
Algorithm Hash digest
SHA256 b1a69cfbdc99060cc732a617dcf43d4cdf3c111275b23608e7af4df7a5bd7290
MD5 0391c2aa197881777478c5fe1f1a01df
BLAKE2b-256 383a2dde995d1f30eb51f2472676127953def70074d4727daae068f5ca9cf40c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lmp2gro-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 18.6 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2879979bcdd872b8af7cdae7c3f1184805a6482a0d16342ef21dc20181106b84
MD5 b5a81f7c9716de52173956e0ccf3e2a8
BLAKE2b-256 19699bacd155f096b49db38522fdb807febc11f247815984b4e9c12e30cb6f89

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