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

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.0.tar.gz (18.1 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.0-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lmp2gro-1.0.0.tar.gz
  • Upload date:
  • Size: 18.1 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.0.tar.gz
Algorithm Hash digest
SHA256 c4d23ace62df0c1dadc01f08ba85c1733e52d747a45a3674f4505ac69ab7c93e
MD5 95e4c81a10661c91416792fd9e9f00bb
BLAKE2b-256 e9a8c9a95990a83c095adea7bb899499217737ed052ca9dc857a16b1fee2cc19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lmp2gro-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 255415863e3bcb3fd36a9d39fcc87150215fd4ad8a1793c1acead931337e583a
MD5 7b01a9d82b399b4a27bf7c5f326f7e79
BLAKE2b-256 97514b4f156880dec81d39e1d00f945d14026009049863b004f522ae61b49bb6

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