lammps-prep
Prepare LAMMPS simulation input files from RASPA3-style JSON force fields.
Given a force_field.json (pseudo-atom masses, charges, and LJ parameters)
plus per-species <name>.json molecule files, lammps_prep packs molecules at
a target mass density and writes two files:
data.lmp— LAMMPS data file (box dimensions, atom positions, bonds, angles, dihedrals)forcefield.lmp— LAMMPS settings file (masses, pair/bond/angle/dihedral coefficients, charge assignments)
Installation
pip install lammps-prep # pre-built wheel (Python + CLI binary bundled)
Or build from source:
pip install maturin
git clone https://github.com/JelleLagerweij/ff_creation.git
cd ff_creation
maturin develop
Packmol must be installed separately and available on PATH for the pack packmol backend.
The RASPA3 Python interface (raspalib) must be installed for the pack raspa backend:
pip install raspalib
CLI reference
lammps_prep pack packmol — random geometric packing
lammps_prep pack packmol [OPTIONS]
Options:
--force-field <FORCE_FIELD_JSON>
Path to force_field.json [default: force_field.json]
--species <MOLECULE_JSON>...
Molecule definition file paths, one per species
(order sets LAMMPS type numbering)
--counts <COUNT>...
Number of molecules per species (same order as --species;
0 skips a species but keeps its atom/bond types in output)
--density <DENSITY>
Target mixture mass density, kg/m³
--out-dir <DIR>
Directory to write data.lmp and forcefield.lmp into [default: .]
--pair-style <PAIR_STYLE>
Pair style preset: tip4p | lj_cut | lj_cut_coul_long [default: lj_cut]
--explicit-lb
Write every Lorentz-Berthelot cross-pair explicitly instead of
relying on `pair_modify mix arithmetic`
--tolerance <TOLERANCE>
Packmol packing tolerance in Å (min distance between atoms from
different molecules) [default: 2.0]
-h, --help
Print help
Example:
lammps_prep pack packmol \
--species CO2.json heptane.json \
--counts 200 50 \
--density 700 \
--out-dir build/
lammps_prep pack raspa — NVT MC equilibration via RASPA3
lammps_prep pack raspa [OPTIONS]
Options:
--force-field <FORCE_FIELD_JSON>
Path to force_field.json [default: force_field.json]
--species <MOLECULE_JSON>...
Molecule definition file paths, one per species
--counts <COUNT>...
Number of molecules per species
--density <DENSITY>
Target mixture mass density, kg/m³
--out-dir <DIR>
Directory to write data.lmp and forcefield.lmp into [default: .]
--pair-style <PAIR_STYLE>
Pair style preset: tip4p | lj_cut | lj_cut_coul_long [default: lj_cut]
--explicit-lb
Write every Lorentz-Berthelot cross-pair explicitly
--temperature <TEMPERATURE>
NVT simulation temperature in K [default: 300.0]
--init-cycles <INIT_CYCLES>
Initialization cycles (random placement + overlap removal) [default: 2000]
--equil-cycles <EQUIL_CYCLES>
Equilibration cycles (discarded) [default: 2000]
--prod-cycles <PROD_CYCLES>
Production cycles; the final frame becomes the LAMMPS starting
config [default: 1000]
--cutoff <CUTOFF>
LJ and Coulomb cutoff radius in Å [default: 12.0]
-h, --help
Print help
Example:
lammps_prep pack raspa \
--species CO2.json heptane.json \
--counts 200 50 \
--density 700 \
--temperature 300 \
--out-dir build/
Requires raspalib and python/python3 on PATH.
lammps_prep density — mixture density estimation (stubs)
These subcommands are reserved for future releases. Each currently exits with "not yet implemented".
lammps_prep density pr # Peng-Robinson EOS
lammps_prep density pc-saft # PC-SAFT EOS
lammps_prep density epc-saft # ePC-SAFT EOS (electrolyte)
lammps_prep density laliberte # Laliberte volumetric correlation
Python API
from lammps_prep.pack import packmol, raspa
from lammps_prep import PairSetup
# --- Packmol packing ---
summary = packmol(
species=["CO2.json", "heptane.json"],
counts=[200, 50],
density=700.0,
out_dir="build",
pair_style=PairSetup.LjCut,
)
print(summary)
# --- RASPA3 NVT equilibration ---
summary = raspa(
species=["CO2.json", "heptane.json"],
counts=[200, 50],
density=700.0,
out_dir="build",
temperature=300.0,
init_cycles=2000,
equil_cycles=2000,
prod_cycles=1000,
)
print(summary)
Density stubs raise NotImplementedError:
from lammps_prep.density import pr
pr(...) # NotImplementedError: Peng-Robinson EOS is not yet implemented.
Force-field file format
lammps_prep reads RASPA3-style JSON files.
force_field.json
{
"MixingRule": "Lorentz-Berthelot",
"PseudoAtoms": [
{ "name": "O_h2o", "mass": 15.9994, "charge": -1.1128 },
{ "name": "H_h2o", "mass": 1.00794, "charge": 0.5564 }
],
"SelfInteractions": [
{ "name": "O_h2o", "type": "lennard-jones", "parameters": [78.0, 3.1589] },
{ "name": "H_h2o", "type": "lennard-jones", "parameters": [ 0.0, 0.0 ] }
],
"BinaryInteractions": [
{ "names": ["O_h2o", "Na"], "type": "lennard-jones",
"parameters": [140.043, 2.8904], "source": "MadridT2023" }
]
}
parameters for LJ are [ε/k_B (K), σ (Å)].
BinaryInteractions override the Lorentz-Berthelot mixing rule for a specific pair.
<species>.json
{
"pseudoAtoms": [
["O_h2o", [0.000, 0.000, 0.0]],
["H_h2o", [0.757, 0.586, 0.0]],
["H_h2o", [-0.757, 0.586, 0.0]]
],
"Connectivity": [[0,1],[0,2]],
"Type": "rigid",
"Bonds": [ [["O_h2o","H_h2o"], "HARMONIC", [450000.0, 0.9572]] ],
"Bends": [ [["H_h2o","O_h2o","H_h2o"], "HARMONIC", [55000.0, 104.52]] ],
"CriticalTemperature": 647.1,
"CriticalPressure": 22064000.0,
"AcentricFactor": 0.345
}
Bonds/Bendsare optional for"Type": "rigid"molecules (LAMMPS SHAKE/RIGID placeholders are written with a warning).Torsionsfollow the TRAPPE potential form:[c0, c1, c2, c3]in K.
Project structure
lammps_prep/
├── Cargo.toml # Workspace root
├── pyproject.toml # Python package configuration (maturin)
├── README.md
├── rust/
│ ├── Cargo.toml # Rust crate (name = "lammps_prep")
│ └── src/
│ ├── lib.rs # Library exports
│ ├── main.rs # CLI entry point (bin = "lammps_prep")
│ ├── cli.rs # Subcommand parsing and dispatch
│ ├── ff.rs # Force-field data structures
│ ├── lammps.rs # LAMMPS file writers
│ ├── packmol.rs # Packmol interface
│ └── python.rs # PyO3 bindings (module = "lammps_prep._native")
└── python/
└── lammps_prep/
├── __init__.py # Package init (exports PairSetup)
├── pack.py # packmol() and raspa() functions
├── density.py # Density stubs (all raise NotImplementedError)
├── raspa_init.py # raspalib NVT MC helper
└── _cli.py # Console script entry point
Development
# Build Rust library, CLI binary, and Python extension in one step
maturin develop
# Run Rust tests
cd rust && cargo test
# Run Rust linter
cd rust && cargo clippy
Metadata
Release files for lammps-prep 0.2.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 4.2 MB
Release files / lammps_prep-0.2.9-cp312-cp312-win_amd64.whl
| Download URL | lammps_prep-0.2.9-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 388.3 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d7398a58a90fa368de5468143b390b049076e75e2bbd8f5f1b919c676f53c1bc
|
|
BLAKE2b-256 checksum How to use checksums |
d382775add7369bc1228a0f6a52e04cef98ce5ffca4d7138731a8fab9e01ad27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency logRelease files / lammps_prep-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | lammps_prep-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 524.6 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
840d70477bd6568e509ef4b5a7f2e7977ff0486f69ed91129ccf8f254c84d521
|
|
BLAKE2b-256 checksum How to use checksums |
15f6800d10e9452f3684de505574bbe97e0209523e03f79768d16b559693c6a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency logRelease files / lammps_prep-0.2.9-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | lammps_prep-0.2.9-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 457.5 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5e469d5f2244cc18c5e13758be350fd9f98eb13fd820e2ec0d1cef71fca135cd
|
|
BLAKE2b-256 checksum How to use checksums |
084f84c96be69e8cb4ced93a7d80c2580ac587957b77193d741c367ffa5e9694
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency logRelease files / lammps_prep-0.2.9-cp311-cp311-win_amd64.whl
| Download URL | lammps_prep-0.2.9-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 390.9 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3a4adce5a81263a64355bd4dcdfa75c5367a97240e161c27f647e3ca4a0def09
|
|
BLAKE2b-256 checksum How to use checksums |
4ab475fda83592542e630fc13f970d1f95c84483e003db02fd133f3a2ad149eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency logRelease files / lammps_prep-0.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | lammps_prep-0.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 538.8 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
a0f446fad98ce2edaf44a1fc3396e6e6315123f636f2d38f603aa0c99fceaade
|
|
BLAKE2b-256 checksum How to use checksums |
8a48cc9fa46024fb9afd9f9bc58e8c02f74255b5348efefa4166c24a2d399921
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency logRelease files / lammps_prep-0.2.9-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | lammps_prep-0.2.9-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 463.7 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
13211634749561a6ebf9c1eff1016536c8f8cbbd439753ae0619ba147aee8493
|
|
BLAKE2b-256 checksum How to use checksums |
bda351e8fe18062ae7f538a36d59f3ab2e7ff71e25d6568678a22f9ccd6a81f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency logRelease files / lammps_prep-0.2.9-cp310-cp310-win_amd64.whl
| Download URL | lammps_prep-0.2.9-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 390.9 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8678511ab252b2a722ed74af77f89d639af331912daf474bbab13abc104cfce7
|
|
BLAKE2b-256 checksum How to use checksums |
282b2004fe1f768354d32278fbfd4584029e6c576eba9edd9eca8b0fc1d9f034
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency logRelease files / lammps_prep-0.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | lammps_prep-0.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 538.6 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
032d03fe2fa40d1b00309743d82e9c85a645bee9b94fa07a660796cf01a5cebf
|
|
BLAKE2b-256 checksum How to use checksums |
e280a767dce711e918dcab4e738d1a85afdaad8f91619fb3f03fb6b4f9a19b64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency logRelease files / lammps_prep-0.2.9-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | lammps_prep-0.2.9-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 463.6 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a8e8ae94c5d0dcc5c23abbc03c17fa6ac9a81985fb1ad7800387cedde35ce568
|
|
BLAKE2b-256 checksum How to use checksums |
c5c587eaabae96369f8fd735f5d591758bac2213a0e3f89be9bc8b42f70cef06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.
Transparency log