LAMMPS反应模板与电荷更新
用两二聚体连接成四珠链演示前后模板、原子映射、分子编号与部分电荷守恒。
阅读本篇目录
fix bond/react根据局部拓扑匹配反应前模板,随后应用反应后模板。与单条距离成键相比,它适合一次更新多条相互作用、原子类型和部分电荷;输入中的原子映射必须写清楚。
下载三篇共用的完整输入、反应模板、原生科学输出和绘图包。先按成键断键篇运行共用资料包。本例使用通用四珠子,不是特定反应的量子化学势能面。
1. 先查看前后模板与映射#
cat inputs/react/pre.molecule
cat inputs/react/post.molecule
cat inputs/react/reaction.map
前态是1–2和3–4两个二聚体;反应后增加2–3连接,成为1–2–3–4链。反应触发位点是模板编号2与3;模板类型顺序1、2、2、1,使两端和中心位点可以区分。完整文件如下:
pre.molecule#
Owned prereaction template
4 atoms
2 bonds
Coords
1 0 0 0
2 1 0 0
3 2 0 0
4 3 0 0
Types
1 1
2 2
3 2
4 1
Charges
1 0
2 0
3 0
4 0
Bonds
1 1 1 2
2 1 3 4
post.molecule#
Owned postreaction template
4 atoms
3 bonds
Coords
1 0 0 0
2 1 0 0
3 2 0 0
4 3 0 0
Types
1 1
2 2
3 2
4 1
Charges
1 -0.1
2 0.1
3 0.1
4 -0.1
Bonds
1 1 1 2
2 1 2 3
3 1 3 4
reaction.map#
Owned chain joining map
0 edgeIDs
4 equivalences
InitiatorIDs
2
3
Equivalences
1 1
2 2
3 3
4 4
Equivalences的每一行是“反应前模板编号→反应后模板编号”,不是初始体系中任意一对全局原子ID。本例四个位点均完整纳入模板,没有省略的外围环境,因此 edgeIDs 为0;大分子的局部模板需根据边界环境认真设置,不能照搬这个零边界配置。
2. 完整运行输入#
cat inputs/react/input.lammps
cat inputs/react/final.data
units lj
atom_style full
boundary f f f
read_data start.data extra/bond/per/atom 4 extra/special/per/atom 8
pair_style zero 6.0
pair_coeff * *
bond_style harmonic
bond_coeff 1 10.0 1.0
special_bonds lj 0 0 0 coul 0 0 0
neighbor 1.0 bin
neigh_modify every 1 delay 0 check yes
molecule pre pre.molecule
molecule post post.molecule
compute fragments all fragment/atom single yes
compute qa all property/atom q
compute totalq all reduce sum c_qa
fix freeze all setforce 0 0 0
fix integrate all nve
thermo 1
thermo_style custom step atoms bonds pe c_totalq
thermo_modify norm no format float %.17g
dump atoms all custom 1 atoms.dump id mol type q x y z c_fragments
dump_modify atoms sort id format float %.17g
timestep 0.001
fix event all bond/react reset_mol_ids yes react join all 1 0.5 1.2 pre post reaction.map prob 1 46623 rescale_charges yes molecule inter
run 2
write_data final.data nocoeff
molecule pre/post加载模板。react join all 1 0.5 1.2给这条反应命名为join,每步检查,触发两原子间距必须在0.5–1.2之间;本例中心间距1.0。molecule inter仅允许原来不同分子的连接。prob 1是规则接受概率,不是温度下的真实反应速率。
rescale_charges yes用于保持匹配区域的反应前净电荷;reset_mol_ids yes在拓扑更新后重算分子编号。两者的作用不同,不能把“分子重新编号”理解为“电荷自动守恒”。
本版本22Jul2025 Update6中,部分关键词所属层级与在线新版文档可能不同。修改其他选项时以匹配版本文档为准,本例没有借用新版才提供的公共反应限速语法。
3. 实际结果与距离反例#
第0步有2条键、2个连通分量;第1步形成2–3键后,有3条键、1个连通分量。四个位点原子ID和类型均保持,部分电荷从全0变为 −0.1,+0.1,+0.1,−0.1,净电荷仍0;分子ID重算后也只剩1种。
负对照 react-distance-control保持前态不变,只把最大触发距离改为0.9:中心间距1.0不合条件,所以末态仍2条键、2个分量、电荷全0。
cat inputs/react/atoms.dump
cat inputs/react-distance-control/final.data
这些部分电荷是为说明模板更新而设置的模型值,不是DFT拟合电荷;示例关闭非键相互作用并固定几何,没有由±0.1电荷得到实际静电反应能。新建键刚好位于谐键平衡长度,前后势能均0。生产聚合/交联还需要真实力场参数、接近构型、局部稳定化、温控及反应概率依据,不能由本例两步推断交联率或固化时间。
参考:匹配版本反应模板说明。