Library for inserting molecules into LAMMPS simulation boxes
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lammps_mol_inserter-0.1.tar.gz.
File metadata
- Download URL: lammps_mol_inserter-0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d01eb64ed04c06ce6d4ff0261ef0aa15228c4598ff05bfc54019c827436ab10
|
|
| MD5 |
ebeb4b8f8801462e4045a975f334fab2
|
|
| BLAKE2b-256 |
8ffe7c81ab1882a79a8f8b55b5f9e80c661497e88b32f81ea6b8ce19971f0c02
|
File details
Details for the file lammps_mol_inserter-0.1-py3-none-any.whl.
File metadata
- Download URL: lammps_mol_inserter-0.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e93b46c5b23108bc61b03722cc3ab08756ada2f633dd23f5d0e8d945b706d02
|
|
| MD5 |
8b4cad1bb4b42247bdaca24809db9b71
|
|
| BLAKE2b-256 |
1a2f081f4c9972029023a36a9327d92b32109b43f2b0534e09402750bce68dba
|