Skip to main content

Generator for LAMMPS two-body and three-body tabulated potentials.

Project description

Tablegen

LAMMPS potential table generator for LAMMPS, developed by Vasilii Maksimov at the Functional Glasses and Materials Modeling Laboratory (FGM²L) at the University of North Texas, under the supervision of Dr. Jincheng Du.

Tablegen is a command-line utility for generating two-body and three-body potential tables for use with LAMMPS simulations. It supports several interaction models commonly used in materials science and glass chemistry, including:

  • SHIK potential (Buckingham + Wolf summation)
  • Classical Buckingham potential
  • Extended Buckingham potential with softening
  • Truncated harmonic three-body interactions

🔧 Features

  • Command-line interface with argparse-based subcommands
  • Supports plotting potential curves with matplotlib
  • Generates .table and .3b files directly usable in LAMMPS
  • Fully modular: new potentials can be added as new handler classes
  • Handles numeric precision using mpmath
  • Actively developed for materials modeling workflows

📦 Installation

Install from PyPI (preferred)

The package is now published on PyPI you can install the latest stable release with:

pip install lammps-tablegen

Install directly from GitHub (bleeding‑edge)

If you need the most recent commit:

pip install git+https://github.com/superde1fin/tablegen.git

Clone & install locally

For local experimentation or contributing:

git clone https://github.com/superde1fin/tablegen.git
cd tablegen

# Standard install (no dev extras)
pip install .

# OR editable install (auto‑reload while editing)
pip install -e .

Tip : add the [dev] extra to pull in testing, type‑checking, and release tools:

pip install .[dev]

This installs pytest, ruff, mypy, twine, and other developer utilities declared in pyproject.toml.

Requires Python ≥ 3.9 and a working C/Fortran toolchain if installing numpy from source.

🥪 Usage

After installation, invoke the CLI with:

tablegen [style] [options]

Available styles:

  • shik: Generate two-body tables using the SHIK potential

$$ \begin{gather*} V^{SHIK} = V^{Buck} \left( r_{\alpha\beta} \right) + V^{Wolf}\left( r_{\alpha\beta} \right)\ V^{Buck} \left( r_{\alpha\beta} \right) = A_{\alpha\beta} \exp\left( -B_{\alpha\beta} r_{\alpha\beta} \right) - \frac{C_{\alpha\beta}}{r_{\alpha\beta}^6} + \frac{D_{\alpha\beta}}{r_{\alpha\beta}^{24}}\ V^W \left( r_{\alpha\beta} \right) = q_{\alpha} q_{\beta} \left( \frac{1}{r_{\alpha\beta}} - \frac{1}{r_{cut}^W} + \frac{r_{\alpha\beta} - r_{cut}^W}{\left( r_{cut}^W \right)^2} \right) \end{gather*} $$

Note: Currently the pairs with published coefficients will have the wolf part added while no potential entry will be generated for a pair without coefficients (i.e. Na-Al)

  • buck: Generate tables using the standard Buckingham potential

$$ \begin{gather*} V\left( r_{ij} \right) = A_{ij} \exp\left( -\frac{r}{\rho_{ij}} \right) - \frac{C_{ij}}{r^6} \end{gather*} $$

  • buck_ext: Use the extended Buckingham potential with softened short-range repulsion

$$ \begin{gather*} V\left( r_{ij} \right) = A_{ij} \exp\left( -\frac{r}{\rho_{ij}} \right) - \frac{C_{ij}}{r^6} \left( 1 - \exp\left( - \left( \frac{r_{ij}}{43\rho_{ij}} \right)^6 \right) \right) + \frac{D_{ij}}{r_{ij}^{12}} \end{gather*} $$

  • 3b_trunc: Generate three-body truncated harmonic tables

$$ \begin{gather*} V\left(r_{ij}, r_{ik}, \theta_{jik}\right) = \frac{k}{2} (\theta_{jik} - \theta_0)^2 \exp\left(-\frac{r_{ij}^8 + r_{ik}^8}{\rho^8}\right) \end{gather*} $$

  • sw: Generate three-body Stillinger-Weber potential energy tables

$$ \begin{gather*} V\left(r_{ij}, r_{ik}, \theta_{jik}\right) = \lambda_{ijk}\epsilon_{ijk}\left( \cos\theta_{ijk} - \cos\theta_{0ijk} \right)^2 \exp\left( \frac{\gamma_{ij}\sigma_{ij}}{r_{ij} - a_{ij}\sigma_{ij}} \right)\exp\left( \frac{\gamma_{ik}\sigma_{ik}}{r_{ik} - a_{ik}\sigma_{ik}} \right) \end{gather*} $$

Example usage:

PLEASE MAKE SURE TO READ THE HELP INFORMATION THOROUGHLY BEFORE USING EACH STYLE

Minimal SHIK potential generation for SiO2:

tablegen shik initial.structure Si O

Standard options invoked:

tablegen shik initial.structure Si O --cutoff 8 --data_points 10000 --table_name SHIK.table --plot -10 10

or equivalently

tablegen shik initial.structure Si O -c 8 -d 10000 -t SHIK.table -p -10 10

Minimal Buckingham potential table generation (user will be prompted for coefficients):

tablegen buck Na-O Si-O

Standard options invoked

tablegen buck Na-O Si-O -c 10 -d 5000 -t buck.table -p -20 10

Minimal truncated three-body potential table generation (user will be prompted for coefficients):

tablegen 3b_trunc Si-O-Si

Standard options invoked:

tablegen 3b_trunc Si-O-Si -t silica -d 30 -c 5

Minimal Stillinger-Weber potential table generation (user will be prompted for coefficients):

tablegen sw Si-O-Si

Standard options invoked:

tablegen sw Si-O-Si -t silica -d 30 -c 5

📚 Documentation

All styles support -h or --help flags for detailed usage:

tablegen shik --help

🧠 Design Overview

The project is modular:

  • cli.py: Main entry point, defines CLI and parses arguments
  • handlers/: Contains one handler class per potential type (SHIK, BUCK, etc.)
  • constants.py: Shared constants (e.g., cutoffs, physical constants, default coefficients)
  • __init__.py: Exposes handler classes and version metadata
  • pyproject.toml: Build and dependency metadata

Each handler:

  • Parses user-provided arguments
  • Validates species/pair/triplet input
  • Prompts for coefficients
  • Provides eval_force and eval_pot methods used by two_body() or three_body()

📈 Plotting

If the --plot option is passed, matplotlib will be used to visualize the potential curves for the specified pairs or triplets.

🥪 Development

Install dev dependencies:

pip install .[dev]

Run tests:

pytest

🔖 License

GNU General Public License v3.0 (GPLv3). See LICENSE for details.

👤 Author

Vasilii Maksimov
University of North Texas
✉️ VasiliiMaksimov@my.unt.edu

🌐 Links

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

lammps_tablegen-0.1.5.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

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

lammps_tablegen-0.1.5-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file lammps_tablegen-0.1.5.tar.gz.

File metadata

  • Download URL: lammps_tablegen-0.1.5.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for lammps_tablegen-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6cbe4b87e0d16ef83200c90636c822fa3702276f59886aa9f39ad0b820939cbf
MD5 94a2e75cf4af69e7426797511f16f03c
BLAKE2b-256 2634c679f578005253bb73ea3f9cf7a8cd960e4cb944404676bb109b32f25b0e

See more details on using hashes here.

File details

Details for the file lammps_tablegen-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for lammps_tablegen-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1a0caa50927a48e6f836d1b9bad030b4a6415ffc62aa7d13d42d97526c9f08fa
MD5 c1f60c4b50af734684f5c0f525197404
BLAKE2b-256 0874ff3bcf8c651ee3f64393f1a5b44a9a4fea2b568dd152e29a73d07750fbd4

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