LAMMPS 珠簧聚合物与回转半径
珠簧聚合物与回转半径,包含可提交输入、实际终端命令、数据和配图。
阅读本篇目录
本文使用鸢算科技集群 LAMMPS 30 Sep 2026 的真实计算。下载输入、参考轨迹、分析脚本与数据图(约 72.5 MB),解压后进入 lammps-examples。cases 保存参考结果,inputs 保存干净输入,使用 new-case.py 创建自己的计算副本。
要完成什么#
本例建立 16 条、每条 12 个珠子的链,使用 FENE 键和截断平移 WCA 排斥势。它是约化单位下的稀疏珠簧体系,用来演示拓扑、分子分组和链构象分析,不是真实化学结构或已平衡熔体。
special_bonds fene 保留该模型需要的邻接处理;不要照搬水体系的 1–2/1–3 排除。FENE 键有最大伸长,初态错误、时间步太大都会导致断言或能量发散。
compute chunk/atom molecule 按分子 ID 分组,compute gyration/chunk 给出各链回转半径。其默认结果是全局向量,传给 fix ave/time ... mode vector 时用 c_gyr,不是数组列通配形式。
1 准备并提交#
python new-case.py polymer
cd work/polymer
sbatch run.sh
run.sh 是本算例匹配的核时 P100 或 V10016G 模板。套餐用户按自己的权限使用 yskit 生成提交脚本,保留下面的计算命令。完整模拟在计算节点执行。其他例子回到资料包根目录,替换目录名后分别提交。
| 目录 | 内容 |
|---|---|
polymer |
独立输入、参考输出和可重跑命令 |
2 实际计算命令与输入#
polymer#
mpirun -np 1 lmp -sf gpu -pk gpu 1 -in in.lammps > stdout.log 2>&1
下面是 polymer/in.lammps 的完整输入;其他目录的完整输入也在资料包中。
units lj
atom_style molecular
read_data polymer.data
pair_style lj/cut 1.122462048309373
pair_coeff * * 1 1
pair_modify shift yes
bond_style fene
bond_coeff 1 30 1.5 1 1
special_bonds fene
neighbor .3 bin
comm_modify cutoff 2.0
neigh_modify every 1 delay 0 check yes
velocity all create 1 35187 mom yes dist gaussian
timestep .002
fix int all nve
fix bath all langevin 1 1 1 91823
compute chains all chunk/atom molecule
compute gyr all gyration/chunk chains
fix gout all ave/time 100 1 100 c_gyr file gyration.dat mode vector
thermo 100
thermo_style custom step time atoms temp pe ke etotal press vol density
thermo_modify norm no format float %.12g
dump tr all custom 200 trajectory.lammpstrj id type x y z vx vy vz
dump_modify tr sort id
run 20000
write_data final.data
数据文件头和原子部分节选如下,完整拓扑使用附件,不要把节选当成完整文件运行。
Bead spring topology
192 atoms
176 bonds
1 atom types
1 bond types
0 13.2 xlo xhi
0 8.8 ylo yhi
0 8.8 zlo zhi
Masses
1 1
Atoms # molecular
1 1 1 0.5 1.1 1.1
2 1 1 1.47 1.1 1.1
3 1 1 2.44 1.1 1.1
4 1 1 3.41 1.1 1.1
5 1 1 4.38 1.1 1.1
6 1 1 5.35 1.1 1.1
7 1 1 6.32 1.1 1.1
8 1 1 7.29 1.1 1.1
9 1 1 8.26 1.1 1.1
10 1 1 9.23 1.1 1.1
11 1 1 10.2 1.1 1.1
12 1 1 11.17 1.1 1.1
13 2 1 0.5 1.1 3.3000000000000003
14 2 1 1.47 1.1 3.3000000000000003
15 2 1 2.44 1.1 3.3000000000000003
16 2 1 3.41 1.1 3.3000000000000003
17 2 1 4.38 1.1 3.3000000000000003
3 查看输出与实际数据#
tail -n 30 stdout.log
ls -lh
stdout.log 是计算输出;轨迹保存在 trajectory.lammpstrj(适用的算例),结构保存在 final.data。静态扫描和 run 0 对照不一定生成动力学轨迹。以下动态均值取最后一个热力学输出块的后半段;静态结果取对应输出,单位随输入确定。
| 算例 | 原子数 | 平均温度 | 平均密度 | 最后势能 |
|---|---|---|---|---|
polymer |
192 | 1.01561 | 0.187829 | 3646.339 |
LJ/珠簧例子使用约化单位;metal 为 K、g/cm³、eV;水的 real 单位为 K、g/cm³、kcal/mol。势能列是整个体系的总量,跨不同原子数不可直接相比。


4 提取数据与重画#
回到附件根目录,使用已经安装的 ASE Python 环境执行真实数据分析脚本:
module load ase/3.29.0
python analyze.py --root .
ls analysis
ls figures
脚本使用 NumPy/Matplotlib,读取参考日志、轨迹和相关函数,生成 CSV 与 PNG。查看 analyze.py 中本篇对应目录的处理段,可以把路径换成你的新结果。完整脚本按本专题的全部参考目录组织,单个新算例不需要假造其他目录来运行;提取对应段即可。