Pizza3
π Toolkit for multiscale modeling with LAMMPS in Python 3.x. It integrates with LAMMPS-GUI and leverages Large Language Models for rapid prototyping.
Install / Use
/learn @ovitrac/Pizza3README
π PizzaΒ³
<div align="center">|
| This project is part of the <br />Generative Simulation demonstrators | Say it.<br />Simulate it with AI. |
| ----------------------------------------- | ------------------------------------------------------------ | --------------------------------- |
<a href="https://deepwiki.com/ovitrac/Pizza3" title="Detailed manual of Pizza3" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/DeepWiki-Pizza3-1f6feb?style=flat&logo=bookstack&logoColor=white&labelColor=0d1117"> <source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/badge/DeepWiki-Pizza3-0969da?style=flat&logo=bookstack&logoColor=white&labelColor=f6f8fa"> <img alt="DeepWiki: Pizza3" src="https://img.shields.io/badge/DeepWiki-Pizza3-0969da?style=flat&logo=bookstack&logoColor=white"> </picture> </a>
Toolkit for multiscale modeling with LAMMPS in Python 3.x. It integrates with LAMMPS-GUI and leverages Large Language Models for rapid prototyping.
π Resources
- π Read this file in
HTML(includes π¬ videos and enhanced visuals). - π Online Documentation - πPython (including how to π οΈ install, βΆοΈ run and βοΈ modify <kbd>PizzaΒ³</kbd>)
- π Online Documentation - πMatlab/Octave (advanced ππ post-treatment)
- πPOST Examples and Analysis Workflow (examples of π fluid-structure interactions)
- π Releases (β¨ new capabilities are detailed there, β¬οΈ download page)
- π§΅Wiki Pages (π€Ί technical discussions) including on π’ codelet data containers)
- ποΈ DeepWiki Pages (the full manual of Pizza^3^ prepared by π§ AI)
- π°Publication
π Table of Contents
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->- π§ Part I | Overview
- ποΈ Part II | Illustrations (Workshops and Examples)
- πPart III | Overview of Classes used in Workshops
π§ Part I | Overview
<kbd>Pizza3</kbd> began as a fork and extension of the Pizza.py toolkit for LAMMPS, rewritten in Python 3.x to modernize the original Python 2.x framework. Over time, it has evolved into a flexible and loosely integrated toolkit designed for LAMMPS users, regardless of the simulation style. <kbd>Pizza3</kbd> empowers users to facilitate multiscale modeling and seamlessly connect results across different scales and levels of coarse-graining.
All objects in <kbd>Pizza3</kbd> have scripting and static compiling capabilities, and can be converted into LAMMPS instructions through mathematical operators (e.g., +, |, *) or by calling methods like <kbd>script()</kbd> or <kbd>do()</kbd>. This design philosophy ensures that complex workflows remain accessible, flexible, and modular.
Work in Progress: The toolkit evolves regularly. Come back often for improved capabilities. Newer versions add more classes, dynamic scripting (
pizza.dscript(),pizza.dforcefield()), and better integration with large language models via intermediateDSCRIPT SAVE FILEformats.
π Key Features:
- π οΈ Fully object-oriented architecture
- π Compatibility with modern Python standards
- π¦ Extensible classes for custom workflows
- π― Focus on multiscale and multiphysics modeling
- π Advanced 2D/3D design capabilities
π Key Components:
- π Design reusable templates with scripting classes like
pizza.script(),pizza.dscript(),pizza.forcefield(),pizza.dforcefield(),pizza.group(). - π Dynamic design of complex 2D and 3D shapes with
pizza.raster(),pizza.region(). - π§© Combine simulation components via mathematical operators (
+,|,*,&). - π Generate input/output scripts and dumps using classes like
pizza.data()andpizza.dump(). - π¬ Perform advanced spatial/temporal analysis using the MATLAB/Octave-based library in the
post/folder.
<details> <summary>Workshops and Examples (click to expand)</summary>
ποΈ Part II | Illustrations (Workshops and Examples)
πScope
Our main goal is to achieve a set of tools that facilitate multiscale modeling in LAMMPS: connecting results across scales with different levels of detail. Below we highlight the current achievements and show how <kbd>Pizza3</kbd> integrates with LAMMPS.
In the latest versions of <kbd>Pizza3</kbd>:
- π Almost all 3D design capabilities of LAMMPS have been implemented, particularly via new classes like
pizza.region()andpizza.group(). - π§ͺ 2D algorithms can be tested via
pizza.raster()at lower computational cost without losing generality.
The class <kbd>pizza.script()</kbd> is central for coding LAMMPS instructions from Python "codelets" and handling
TEMPLATES. Dynamic scripting concepts viapizza.dscript()andpizza.dforcefield()make it easy to transform existing LAMMPS code into reusable templates.
I/O Management:
pizza.data() and pizza.dump() objects streamline frame manipulation, output-to-input conversions (like restart files), and advanced spatial/temporal analysis.
Forcefields:
Forcefields can be managed through inheritance, and a user library can be built by overriding existing definitions. It's recommended to implement user rules with <kbd>pizza.generic()</kbd> or <kbd>pizza.dforcefield()</kbd>.
Visualization and Post-Processing:
Some examples of visualization are proposed in 2D and 3D in Python. The post/ folder includes advanced analysis tools integrated with MATLAB/Octave. Users are encouraged to combine LAMMPS-GUI with OVITO for rapid prototyping.
Integration with Large Language Models:
The DSCRIPT SAVE FILE format has been designed for AI text generators and facilitating the maintenance of a large library of codelets. The use of this new text format or language is not mandatory, but it enables code generation with almost zero Python.
πTable 1: Overview of Legacy Classes
| Workshops<br>(workable demos) | Main classes<br/>and subclasses | Low-level<br/> classes |
| :---------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: |
| class: ==workshop1== | 2D drawing class: pizza.raster | generic struct class Γ la Matlab: pizza.private.mstruct() |
| class: ==workshop2== | as above (with advanced features: time-steps, region of interest, salting) | as above |
| script: geometry | class to read/write input files: pizza.data3.data | self-evaluable struct with scripting/alias: pizza.private.param() |
| script: assembly | manage dump files: pizza.dump3.dump | |
| | advanced scripting: pizza.script.script, pizza.script.datascript, pizza.script.scriptobject, pizza.script.scriptobjectgroup, pizza.script.pipescript | |
| | forcefields: pizza.forcefield.forcefield, pizza.forcefield.smd, pizza.forcefield.tlsph, pizza.forcefield.ulsph, pizza.forcefield.none, pizza.forcefield.water, pizza.forcefield.solidfood, pizza.forcefield.rigidwall | |
πKey Steps
Workshop1 illustrates the main steps to design, run, and analyze a LAMMPS project from Python 3.x.
graph TD;
G[geometry] --> R
R[raster] --> F[data.write]
W[workshop1] --> A
F --> A
A[assembly] --> D[dump]
πOverview of workshop1 Classes
Workshop1 involves 7 main steps and codes, as shown below:
# initizalization of the scheme
bead_kernel_radius = 0.0015
init = initialization(neighbor =[bead_kernel_radius,"bin"])
# scriptobject handles bead interactions
FLUID = scriptdata(
rho = 1000,
c0 = 100.0,
q1 = 1.0,
contact_stiffness = 10000000
)
SOLID = scriptdata(
rho = 2000,
c0 = 200.0,
sigma_yield = '0.1*${E}',
contact_stiffness = 10000000
)
WALL = scriptdata(
rho = 3000,
c0 = 200.0,
contact_stiffness = 10000000,
contact_scale = 1.5
)
b1 = scriptobject(name="bead 1",
group = ["rigid", "solid"],
filename='./raster_2_types.lmp',
forcefield=rigidwall(USER=WALL))
b2 = scriptobject(name="bead 2",
