Skip to main content

LAMMPS Molecule Inserter

A Python library for inserting molecules into LAMMPS simulation boxes with various orientations and positions, then evaluating their potential energy.

Algorithm Overview

The LAMMPS Molecule Inserter works by splitting the simulation box into small 3D boxes (bins). It first checks which of these small boxes are empty (no atoms from the host material). Then it tries inserting the molecule at the center of each empty box while rotating it in different directions. For each position and rotation, it calculates the system's energy. Finally, it keeps the best positions where the molecule fits comfortably with lowest energy. This helps quickly find good starting positions for molecules in materials.

Requirements

  • Python 3.6+
  • numpy
  • ASE (Atomic Simulation Environment)
  • LAMMPS (with Python interface)

Installation

pip install lammps_mol_inserter

Usage

from lammps_mol_inserter.io import Matrix, Particle
from lammps_mol_inserter.methods import bin_inserter


matrix = Matrix('matrix.data')
particle = Particle('particle.data')


results = bin_inserter(
    matrix, 
    particle,
    nbins_x=5,      # Number of bins along x-axis
    nbins_y=5,      # along y-axis
    nbins_z=5,      # along z-axis
    num_rot=10,     # Number of rotation steps per axis (0-360°)
    out_pref='out'  # Output file prefix
)

# Sort results by potential energy
sorted_results = sorted(results, key=lambda x: x['potential_energy'])
print("Top 5 lowest energy configurations:")
print(sorted_results[:5])

To use different force field styles (pair, bond, angle, etc.), you need to modify the _initialize_system() method in the LAMMPSInserter class. This method contains the LAMMPS commands that initialize the simulation environment.

Metadata

Release files for lammps-mol-inserter 0.1

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

Source distribution (sdist)

Source distribution for lammps-mol-inserter 0.1
File Size Uploaded
lammps_mol_inserter-0.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lammps-mol-inserter 0.1
File Interpreter ABI Platform
lammps_mol_inserter-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / lammps_mol_inserter-0.1.tar.gz

Download URL lammps_mol_inserter-0.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5d01eb64ed04c06ce6d4ff0261ef0aa15228c4598ff05bfc54019c827436ab10
BLAKE2b-256 checksum
How to use checksums
8ffe7c81ab1882a79a8f8b55b5f9e80c661497e88b32f81ea6b8ce19971f0c02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / lammps_mol_inserter-0.1-py3-none-any.whl

Download URL lammps_mol_inserter-0.1-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e93b46c5b23108bc61b03722cc3ab08756ada2f633dd23f5d0e8d945b706d02
BLAKE2b-256 checksum
How to use checksums
1a2f081f4c9972029023a36a9327d92b32109b43f2b0534e09402750bce68dba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1 This release

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