Skip to main content

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.

Metadata

Release files for lmp2gro 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lmp2gro 1.0.7
File Size Uploaded
lmp2gro-1.0.7.tar.gz 19.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lmp2gro 1.0.7
File Interpreter ABI Platform
lmp2gro-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 38.1 kB

Release files / lmp2gro-1.0.7.tar.gz

Download URL lmp2gro-1.0.7.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
162a675e8f763d2d4da14e1749b5d4ac01d8dbc7d8ef01410ce00b61122308b3
BLAKE2b-256 checksum
How to use checksums
55363343eb0d6e6d4a1741d537294598ca8e07e5cc21c1d3318eac75cd28afcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / lmp2gro-1.0.7-py3-none-any.whl

Download URL lmp2gro-1.0.7-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56560ed2431218c46343d1870e1ef1ea0ada816ee619da48f038cca1440e44ec
BLAKE2b-256 checksum
How to use checksums
f020ebcff36c0cfd2aafa38f228ce00839a7e401fc800c144dbbf48edaadecc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release history Release notifications | RSS feed

1.0.8

2 release files

This release

1.0.7 This release

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page