一键导入
lammps
Create and validate LAMMPS input scripts with physics-aware validation and educational feedback
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create and validate LAMMPS input scripts with physics-aware validation and educational feedback
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | lammps |
| description | Create and validate LAMMPS input scripts with physics-aware validation and educational feedback |
| version | 2.0.0 |
| author | Claude Code |
| tags | ["lammps","molecular-dynamics","simulation","physics","validation"] |
Generate and validate LAMMPS (Large-scale Atomic/Molecular Massively Parallel Simulator) input scripts with physics-aware validation.
# Check syntax, physics, and protocol
python scripts/validate_syntax.py path/to/input.in
python scripts/validate_physics.py path/to/input.in
python scripts/validate_protocol.py path/to/input.in --explain
from scripts.generate_input import LAMMPSInputGenerator
generator = LAMMPSInputGenerator()
script = generator.generate(
units="real",
atom_style="full",
system_type="liquid",
temperature=300,
pressure=1
)
from scripts.search_docs import DocumentationSearcher
searcher = DocumentationSearcher()
info = searcher.find_command("fix nvt")
DO NOT generate files in the examples/ directory. The examples/ folder contains curated reference examples that should remain unchanged. Always output generated scripts to:
-o or --output flagGenerated scripts can include inline syntax documentation for each LAMMPS command:
from scripts.generate_input import LAMMPSInputGenerator
# Create generator with syntax comments enabled
generator = LAMMPSInputGenerator(include_syntax=True)
generator.add_units("lj")
generator.add_fix("1", "all", "nvt", temp="300", "300", "100")
Output format:
# Set the simulation units
# Syntax: units style
# https://docs.lammps.org/units.html
units lj
# NVT integration with Nose/Hoover thermostat
# Syntax: fix ID group-ID nvt temp Tstart Tstop damp
# https://docs.lammps.org/fix_nvt.html
fix 1 all nvt temp 300 300 100
The syntax database (scripts/commands_syntax.json) contains 250+ commands with:
To update the database:
# Parse local LAMMPS HTML documentation
python scripts/lammps_docs_parser.py --local /path/to/lammps/doc/html
# Or use the built-in database (covers most common commands)
python scripts/lammps_docs_parser.py
Generate pre-built scripts from the command line:
# Basic LJ melt script
python scripts/generate_input.py --type basic -o output.in
# NVT equilibration script
python scripts/generate_input.py --type nvt -T 300 -o nvt_eq.in
# Deformation script
python scripts/generate_input.py --type deform --strain-rate 0.001 -o deform.in
# Without syntax comments
python scripts/generate_input.py --type basic --no-syntax -o output.in
A well-structured LAMMPS input script follows this 4-section pattern:
units real # Unit system (real, metal, lj, si, cgs, electron, micro, nano)
atom_style full # Atom attributes
boundary p p p # Periodic boundaries
read_data system.data # Read atom coordinates
pair_style lj/cut 10.0 # Force field
pair_coeff * * 0.155 3.166 # Parameters
neighbor 2.0 bin # Neighbor list
timestep 1.0 # Time step (fs for real units)
thermo_style custom step temp pe ke etotal press
minimize 1.0e-4 1.0e-6 100 1000 # Energy minimization
fix 1 all nvt temp 300 300 100 # NVT equilibration
run 10000 # Production run
| Style | Time | Distance | Energy | Max dt |
|---|---|---|---|---|
| real | fs | Angstrom | kcal/mol | 5.0 |
| metal | ps | Angstrom | eV | 0.010 |
| lj | τ | σ | ε | 0.02 |
| si | s | m | J | 1e-14 |
lj/cut - Lennard-Joneslj/cut/coul/long - LJ with PPPM electrostaticseam - Embedded Atom Method (metals)reax - ReaxFF reactive force fieldcharmm - CHARMM force fieldRequired before dynamics to relax high-energy overlaps.
minimize 1.0e-4 1.0e-6 100 1000
Bring system to target temperature/pressure.
fix 1 all nvt temp 300 300 100
run 50000 # 50 ps with dt=1.0 fs
Collect data for analysis.
unfix 1
fix 1 all nve
run 100000 # 100 ps production
The examples/ directory contains 354 input scripts across 20 categories:
examples/basic/ - Fundamental simulations (pour, flow, deposit, indent, LJ argon)
minimal_with_syntax.in - Example with inline syntax documentationexamples/minimization/ - Energy minimization (CG, steepest descent, NEB, structural optimization)examples/equilibration/ - System equilibration to target T/Pexamples/production/ - Production data collection runsexamples/shear/ - Shear flow, SLLOD equations, viscosity calculationsexamples/uef/ - Unsteady Extensional Flow (uniaxial/biaxial extension)examples/deformation/ - Mechanical tensile deformation (fix deform)examples/viscosity/ - Viscosity measurement (Green-Kubo, non-equilibrium methods)examples/thermal/ - Thermal conductivity and heat fluxexamples/diffusion/ - MSD and VACF diffusion analysisexamples/elasticity/ - Elastic constant calculations, stress-strain relationsexamples/aspherical/ - Non-spherical particles (ellipsoids, Gay-Berne potential)examples/magnetic/ - Magnetic spin systemsexamples/packages/ - 133 examples across 59 LAMMPS packages (EFF, MEAM, FEP, Drude, CGDNA)examples/uncategorized/ - 62 diverse examples (NEB, GCMC, AIMD, balance)examples/coupling/ - Multi-physics couplingexamples/python/ - Python integration examplesexamples/reaction/ - Chemical reaction modelingNeed to deform your system? Use this decision guide:
Need to deform your system?
│
├─ Studying flow/rheology (polymer melts, extensional flow)?
│ └─ Use UEF (examples/uef/)
│ - Volume-preserving (traceless strain rate)
│ - Requires triclinic box and periodic boundaries
│ - fix nvt/uef thermostat
│
├─ Mechanical deformation/tension?
│ ├─ Need volume control (Poisson effect)?
│ │ └─ Use fix deform + fix npt (examples/deformation/)
│ │ - Transverse directions free to contract
│ │ - Volume can change
│ │ - Tensile testing, fracture studies
│ │
│ └─ Fixed transverse dimensions?
│ └─ Use fix deform + fix nvt (examples/deformation/)
│
└─ Shear deformation?
└─ Use SLLOD (examples/shear/)
- fix deform with erate
- fix nvt/sllod thermostat
Key Distinction: UEF vs Mechanical Tension
| Property | UEF (Extensional Flow) | Fix Deform (Tension) |
|---|---|---|
| Purpose | Rheology (flow behavior) | Mechanical deformation |
| Volume | Preserved (traceless) | Can change (Poisson effect) |
| Strain Rate | ε_xx + ε_yy + ε_zz = 0 | No traceless requirement |
| Box Type | Must be triclinic | Can be orthogonal |
| Thermostat | fix nvt/uef | fix nvt/npt + fix deform |
| Boundary | Periodic required | Non-periodic OK |
| Primary Application | Polymer melts in flow | Tensile testing, fracture |
Ready-to-use templates in templates/:
minimal_template.inp - Basic script structureminimization_template.inp - Energy minimizationequilibration_template.inp - NVT equilibrationproduction_template.inp - NVE productionfull_simulation_template.inp - Complete workflowEnable detailed explanations with --explain flag:
python scripts/validate_protocol.py input.in --explain
This provides pedagogical context for each validation issue.
Search local LAMMPS documentation (Jun 2022) via indexed JSON:
v2.0.0 - Symbolic Tolerance, Units-Aware Physics, Educational Mode