|
|
我要模拟BN纳米管中CH4和N2的吸附,CH4是单点LJ模型,N2是TraPPE力场,即2LJ+3charge模型。CH4是单点LJ模型(1种原子类型),N2是2LJ+3电荷模型(2种原子类型)
我有个swnt.data文件,就是BN纳米管的结构,里面只有BN两种原子类型,部分内容如下:
# LAMMPS data file converted from XYZ
936 atoms
5 atom types
0.0 20.73053 xlo xhi
0.0 20.73053 ylo yhi
0.0 50.00000 zlo zhi
Masses
1 10.81
2 14.01
3 16.04 # CH4(单点LJ模型)
4 14.01 # N2中的N原子
5 1.0e-10 # N2中的虚拟点(质量为0)
Atoms
1 1 1 0.4000 16.58441 8.29221 1.20490
2 2 1 -0.4000 16.45831 9.73271 1.20490
3 1 1 0.4000 16.30191 10.43841 2.45730
4 2 1 -0.4000 15.80731 11.79721 2.45730
5 1 1 0.4000 15.47351 12.43831 1.20490
6 2 1 -0.4000 14.64401 13.62281 1.20490
7 1 1 0.4000 14.15571 14.15571 2.45730
lammps的输入文件如下:
# --------------------- 初始化 ---------------------
units real
atom_style full # 使用 full,支持电荷和分子ID
dimension 3
boundary s s p # x, y 方向非周期,z 方向周期
# --------------------- 读取BN纳米管 ---------------------
read_data swnt.data # 直接读取BN纳米管数据
# --------------------- 定义区域 ---------------------
region nanotube cylinder z 10.365 10.365 8.29221 0 50 units box # 以盒子中心为基准
region CH4_ads_region cylinder z 10.365 10.365 8.29221 0 50 units box
region N2_ads_region cylinder z 10.365 10.365 8.29221 0 50 units box
# --------------------- 力场参数 ---------------------
pair_style lj/cut/coul/cut 12.0 # 12 Å 截断半径
pair_modify mix arithmetic
# BN 之间不设置相互作用
# 吸附质与BN相互作用
pair_coeff 1 3 83.96 3.591 # B-CH4
pair_coeff 2 3 104.18 3.548 # N-CH4
pair_coeff 1 4 41.48 3.382 # B-N2
pair_coeff 2 4 51.21 3.338 # N-N2
pair_coeff 1 5 0.0 0.0 # B-虚拟点
pair_coeff 2 5 0.0 0.0 # N-虚拟点
# 吸附质之间相互作用
pair_coeff 3 3 148.0 3.73 # CH4-CH4
pair_coeff 4 4 36.0 3.31 # N-N (TraPPE)
pair_coeff 5 5 0.0 0.0 # 虚拟点无相互作用
# --------------------- BN 纳米管带电荷 ---------------------
set type 1 charge 0.4 # B 原子
set type 2 charge -0.4 # N 原子
# --------------------- 定义分子模板 ---------------------
molecule CH4_mol CH4_molecule.txt
molecule N2_mol N2_molecule.txt
# --------------------- GCMC 吸附模拟 ---------------------
fix gcmc_CH4 all gcmc 1000 10000 10000 3 29494 298.0 0.1 region CH4_ads_region fugacity 10.0 mol CH4_mol
fix gcmc_N2 all gcmc 1000 10000 10000 4 54321 298.0 0.1 region N2_ads_region fugacity 10.0 mol N2_mol
# --------------------- 运行控制 ---------------------
thermo 1000
thermo_style custom step temp press pe ke etotal density vol
dump mydump all atom 1000 dump.lammpstrj
run 500000
CH4_molecule.txt文件内容如下:
# CH4 molecule (single-point LJ model)
1 atoms
Atoms
1 3 0.0 0.0 0.0 0.0
N2_molecule.txt文件内容如下:
# TraPPE N2 molecule definition (修正版本)
3 atoms # 现在包括 2 个 N 原子 + 1 个虚拟点
1 bond
3 charges
Atoms
1 4 -0.482 0.0 0.0 -0.55 # 第一个 N 原子,带部分电荷
2 4 -0.482 0.0 0.0 0.55 # 第二个 N 原子,带部分电荷
3 5 0.964 0.0 0.0 0.0 # 新增:虚拟点,带 +0.964 e 电荷
Bonds
1 1 2 # N-N 键连接
运行lammps,出错如下,怎么解决?
LAMMPS (29 Aug 2024 - Update 1)
Reading data file ...
orthogonal box = (0 0 0) to (20.73053 20.73053 50)
1 by 1 by 1 MPI processor grid
reading atoms ...
936 atoms
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
0 = max # of 1-2 neighbors
0 = max # of 1-3 neighbors
0 = max # of 1-4 neighbors
1 = max # of special neighbors
special bonds CPU = 0.000 seconds
read_data CPU = 0.004 seconds
Setting atom values ...
936 settings made for charge
Setting atom values ...
0 settings made for charge
ERROR on proc 0: Unknown section 'Atoms' in molecule file
(src/molecule.cpp:664)
Last command: molecule CH4_mol CH4_molecule.txt
|
|