# LAMMPS

**LAMMPS**（Large-scale Atomic/Molecular Massively Parallel Simulator，大规模原子/分子大规模并行模拟器）是一款开源经典分子动力学代码，可对处于液态、固态或气态的相互作用粒子系综进行建模，规模从几个粒子到数十亿粒子的系统<sup>[1](https://docs.lammps.org/stable/Intro_overview.html)</sup>。单个粒子可以是原子、分子、粗粒化的原子团簇，也可以是介观或宏观的材料团块，该代码对粒子集合求解牛顿运动方程<sup>[1](https://docs.lammps.org/stable/Intro_overview.html)</sup>。它主要由桑迪亚国家实验室开发，以 GPLv2 许可证分发，用 C++ 编写<sup>[2](https://docs.lammps.org/stable/Intro_features.html)</sup><sup> • </sup><sup>[3](https://www.sandia.gov/ccr/software/lammps/)</sup>。

| 关键事实 | 详情 |
|---|---|
| 全名 | Large-scale Atomic/Molecular Massively Parallel Simulator（大规模原子/分子大规模并行模拟器）<sup>[3](https://www.sandia.gov/ccr/software/lammps/)</sup> |
| 起源 | 20 世纪 90 年代中期，由桑迪亚、劳伦斯利弗莫尔国家实验室、克雷、百时美施贵宝和杜邦参与的 CRADA 项目，由桑迪亚的史蒂夫·普林普顿领导<sup>[4](https://www.lammps.org/about/history/)</sup> |
| 开源发布 | C++ 重写版于 2004 年 9 月首次作为开源软件发布；更早的版本使用 Fortran 77（LAMMPS 99）和 Fortran 90（LAMMPS 2001）<sup>[4](https://www.lammps.org/about/history/)</sup> |
| 许可证与语言 | GPLv2 开源分发；可移植的 C++-17 核心，部分可选包可能需要 C++20<sup>[2](https://docs.lammps.org/stable/Intro_features.html)</sup> |
| 并行方式 | MPI 空间分解，外加每个子域内的 OpenMP 线程和 GPU 加速（CUDA、OpenCL、HIP、SYCL）<sup>[2](https://docs.lammps.org/stable/Intro_features.html)</sup><sup> • </sup><sup>[5](https://docs.lammps.org/latest/Developer_parallel.html)</sup> |
| 代码规模 | 从 2004 年的约 5 万行增长到约 100 万行，贡献者数百人<sup>[6](https://chris256.com/papers/molecular_dynamics/2021-thompson-LAMMPS_particle_based_materials_modeling.pdf)</sup> |
| 经典参考文献 | Plimpton, *J. Comp. Phys.* 117, 1–19 (1995); Thompson et al., *Comp. Phys. Comm.* 271, 108171 (2022)<sup>[7](https://doc.lammps.org/Intro_citing.html)</sup> |

## 历史

LAMMPS 始于 20 世纪 90 年代中期，基于美国能源部下属两个实验室——桑迪亚和劳伦斯利弗莫尔——与三家公司——克雷、百时美施贵宝和杜邦——之间的合作研究与开发协议（CRADA）。目标是开发一款大规模并行经典分子动力学代码，工作由桑迪亚国家实验室的计算科学家史蒂夫·普林普顿（Steve Plimpton）领导<sup>[4](https://www.lammps.org/about/history/)</sup>。

CRADA 结束后，最后一个 Fortran 77 版本 LAMMPS 99 问世，随后被用 Fortran 90 重写的 LAMMPS 2001 取代。当前代码是 C++ 重写版，于 2004 年 9 月首次作为开源软件发布。它吸收了桑迪亚早期并行 MD 代码 ParaDyn、Warp 和 GranFlow 的特性，并从 2006 年底起，从艾丹·汤普森（Aidan Thompson）的 GRASP 代码中引入了 Stillinger-Weber、Tersoff 和 ReaxFF 等多体势，以及电荷平衡方法<sup>[4](https://www.lammps.org/about/history/)</sup>。桑迪亚的艾丹·P·汤普森（Aidan P. Thompson）及其同事在 2022 年的综述论文中记录了该代码从 2004 年的五万行增长到一百万行的历程，这一增长由数百名外部贡献者推动<sup>[6](https://chris256.com/papers/molecular_dynamics/2021-thompson-LAMMPS_particle_based_materials_modeling.pdf)</sup>。

## 建模对象

LAMMPS 面向从原子到介观再到连续介质尺度的材料粒子建模。支持的系统类型包括原子、聚合物、生物、固态（金属、陶瓷、氧化物）、颗粒、粗粒化和宏观系统，维度为二维或三维<sup>[1](https://docs.lammps.org/stable/Intro_overview.html)</sup>。粒子类型包括点原子、联合原子或全原子分子、有限尺寸球体、椭球体、多边形和多面体、点偶极子、带磁自旋的粒子，以及刚性粒子集合<sup>[2](https://docs.lammps.org/stable/Intro_features.html)</sup>。

相互作用模型大多为短程，也包含一些长程模型。截至 2022 年的综述论文，代码包含约 230 种具有不同解析形式的对势风格模型，其中约 45 种是多体势，其能量项涉及三个或更多近邻原子的团簇；著名例子包括键序势 Tersoff、REBO 和 AIREBO，以及反应性可变电荷势 COMB 和 ReaxFF<sup>[6](https://chris256.com/papers/molecular_dynamics/2021-thompson-LAMMPS_particle_based_materials_modeling.pdf)</sup>。长程库仑相互作用通过粒子-粒子粒子-网格（PPPM）方法、多层求和法（MSM）或通过 ScaFaCoS 包的快速多极法处理<sup>[6](https://chris256.com/papers/molecular_dynamics/2021-thompson-LAMMPS_particle_based_materials_modeling.pdf)</sup>。

**机器学习势。** 势函数库中基于机器学习的部分日益增多。谱邻域分析势（SNAP）用双谱分量表征每个原子的邻域，并对从头算能量、力和应力数据拟合线性模型<sup>[8](https://doc.lammps.org/stable/pair_snap.html)</sup>。可选包增加了高维神经网络势（ML-HDNNP，需要 n2p2 库）、原子团簇展开（ML-PACE）、本征正交描述符（ML-POD），以及包括 PyTorch 模型在内的机器学习原子间势通用接口（ML-IAP）<sup>[9](https://doc.lammps.org/Packages_details.html)</sup>。

## 模拟的运行方式

LAMMPS 通过从文本输入脚本中逐行读取命令来执行，每条命令立即生效<sup>[10](https://doc.lammps.org/Manual.pdf)</sup>。典型脚本包含四个部分：初始化（单位、维度、边界、原子风格）、系统定义、模拟设置（力场系数、时间步长、近邻参数），以及用 `run` 或 `minimize` 命令运行模拟；后两部分可在同一脚本中重复<sup>[11](https://docs.lammps.org/Commands_structure.html)</sup>。`units` 命令可在 lj、real、metal、si、cgs、electron、micro 和 nano 等风格中选择，并设定输入和输出中每个量的单位；在无量纲的 lj 风格中，质量、\( \sigma \)、\( \epsilon \) 和玻尔兹曼常数均设为 1<sup>[12](https://docs.lammps.org/stable/units.html)</sup>。

时间积分基于 Størmer-Verlet 辛积分器，开发者称其稳定性优于高阶非辛方法<sup>[6](https://chris256.com/papers/molecular_dynamics/2021-thompson-LAMMPS_particle_based_materials_modeling.pdf)</sup>。为高效计算力，每个处理器构建 Verlet 风格的近邻列表，包含截断距离内的原子对，该截断距离等于力的截断距离加上缓冲距离；缓冲距离越大，列表重建越不频繁，但每步检查的原子对越多<sup>[13](https://docs.lammps.org/latest/neighbor.html)</sup>。

## 并行设计

对于分布式内存并行，LAMMPS 使用空间分解将模拟盒子划分为互不重叠的子域，每个 MPI 进程一个。每个处理器存储其拥有的原子以及截断距离内附近幽灵原子的副本，在每个维度上均分两阶段通信，以便在本地计算短程相互作用<sup>[6](https://chris256.com/papers/molecular_dynamics/2021-thompson-LAMMPS_particle_based_materials_modeling.pdf)</sup>。基本算法的复杂度随原子数 \( N \) 和处理器数 \( P \) 按 \( O(N/P) \) 缩放；用于长程相互作用的 FFT 按 \( O(N \log(N)/P) \) 缩放，其通信在处理器数极大时可能成为性能瓶颈<sup>[6](https://chris256.com/papers/molecular_dynamics/2021-thompson-LAMMPS_particle_based_materials_modeling.pdf)</sup>。

在每个 MPI 子域内，还可通过 OpenMP 线程和 GPU 加速获得额外并行性<sup>[5](https://docs.lammps.org/latest/Developer_parallel.html)</sup>。许多风格的加速版本由 GPU、KOKKOS、OPENMP、INTEL 和 OPT 包提供，通过风格后缀或命令行开关选择<sup>[14](https://docs.lammps.org/latest/atom_style.html)</sup>。KOKKOS 包将 Kokkos 性能可移植性库集成到 C++ 代码中，支持 CUDA、HIP、SYCL 和 OpenMP 后端；2025 年的一篇论文报告了在美国百亿亿次机器 Frontier、Aurora 和 El Capitan 上启用 Kokkos 的 LAMMPS 势的强扩展演示<sup>[15](https://arxiv.org/abs/2508.13523)</sup>。对于 GPU 包，文档建议尝试每个 GPU 配 2 到 10 个 MPI 任务，因为任务过多会因开销增长而降低性能<sup>[16](https://docs.lammps.org/stable/Speed_gpu.html)</sup>。

已演示的运行展示了规模。在 Summit 超级计算机的 4,650 个节点（27,900 块 NVIDIA V100 GPU）上使用 KOKKOS 包及其 CUDA 后端，LAMMPS 以每节点每秒 592 万原子步的速率模拟了 200 亿个碳原子，使用 SNAP 势<sup>[6](https://chris256.com/papers/molecular_dynamics/2021-thompson-LAMMPS_particle_based_materials_modeling.pdf)</sup>。在桑迪亚超级计算机的 500 个节点上，对含空洞的 HNS 分子晶体中的冲击进行 2000 万原子的 ReaxFF 模拟，运行速度约为每秒 1.4 个时间步，五种微结构总共需要 3000 万核心小时<sup>[6](https://chris256.com/papers/molecular_dynamics/2021-thompson-LAMMPS_particle_based_materials_modeling.pdf)</sup>。

## 接口与生态系统

LAMMPS 可构建为库并由其他语言驱动。Python 模块 `lammps` 使用 ctypes 封装 C 库接口，允许脚本创建 LAMMPS 实例、调用命令、增量运行模拟、提取结果并修改内部数据结构，可串行或并行运行；支持 Python 3.6 或更高版本<sup>[17](https://docs.lammps.org/Python_overview.html)</sup>。LAMMPS 还可从其输入脚本调用 Python 代码，通过 MDI 接口与其他代码耦合，并通过插件接口在运行时加载外部特性<sup>[2](https://docs.lammps.org/stable/Intro_features.html)</sup>。

大部分功能位于构建时包含或排除的可选包中，因此核心仅依赖 MPI 库<sup>[2](https://docs.lammps.org/stable/Intro_features.html)</sup>。发布遵循基于日期的版本方案；最新稳定版本日期为 2026 年 9 月 30 日，2025 年 7 月 22 日的版本是最后一个兼容 C++11 的版本<sup>[18](https://www.lammps.org/download/)</sup>。下载量相当可观：从 2004 年 9 月到 2021 年中期约有 405,000 个源码压缩包，从 2021 年 6 月到 2025 年 8 月在当前服务器上又有约 130,000 个，此外还有通过 GitHub 仓库的下载<sup>[18](https://www.lammps.org/download/)</sup>。

## References

1. [Overview of LAMMPS, LAMMPS documentation](https://docs.lammps.org/stable/Intro_overview.html)
2. [LAMMPS features, LAMMPS documentation](https://docs.lammps.org/stable/Intro_features.html)
3. [LAMMPS, Center for Computing Research, Sandia National Laboratories](https://www.sandia.gov/ccr/software/lammps/)
4. [History, LAMMPS website](https://www.lammps.org/about/history/)
5. [Parallel algorithms, LAMMPS documentation](https://docs.lammps.org/latest/Developer_parallel.html)
6. [A. P. Thompson et al., "LAMMPS – a flexible simulation tool for particle-based materials modeling at the atomic, meso, and continuum scales," Computer Physics Communications 271, 108171 (2022)](https://chris256.com/papers/molecular_dynamics/2021-thompson-LAMMPS_particle_based_materials_modeling.pdf)
7. [Citing LAMMPS, LAMMPS documentation](https://doc.lammps.org/Intro_citing.html)
8. [pair_style snap command, LAMMPS documentation](https://doc.lammps.org/stable/pair_snap.html)
9. [Package details, LAMMPS documentation](https://doc.lammps.org/Packages_details.html)
10. [LAMMPS Documentation (Manual PDF)](https://doc.lammps.org/Manual.pdf)
11. [Input script structure, LAMMPS documentation](https://docs.lammps.org/Commands_structure.html)
12. [units command, LAMMPS documentation](https://docs.lammps.org/stable/units.html)
13. [neighbor command, LAMMPS documentation](https://docs.lammps.org/latest/neighbor.html)
14. [atom_style command, LAMMPS documentation](https://docs.lammps.org/latest/atom_style.html)
15. [LAMMPS-KOKKOS: Performance Portable Molecular Dynamics Across Exascale Architectures, arXiv:2508.13523](https://arxiv.org/abs/2508.13523)
16. [GPU package, LAMMPS documentation](https://docs.lammps.org/stable/Speed_gpu.html)
17. [Use Python with LAMMPS: Overview, LAMMPS documentation](https://docs.lammps.org/Python_overview.html)
18. [Download LAMMPS, LAMMPS website](https://www.lammps.org/download/)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 11, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 物理学 › 物理学方法、实践与学术共同体 › Applied and interdisciplinary physics › Computational and simulation physics › Physics simulation software and engines › Scientific simulation packages › Molecular and particle simulation codes

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/lammps

English original: https://www.edgepedia.org/lammps
