GROMACS 最小化、NVT与NPT平衡
最小化、NVT与NPT平衡,包含终端操作、输入文件、实际数据和适用范围。
阅读本篇目录
本文以鸢算科技集群 GROMACS 2026.4 实际结果为例。下载输入、参考轨迹、分析与绘图资料包,资料包约 529 MB,包含参考轨迹。解压后进入 gromacs-examples。参考输出在 cases;新计算由 new-case.py 建立独立目录。
本篇任务与操作要点#
最小化先消除严重接触,NVT 在固定体积下调温,NPT 再让密度和体积松弛。它们解决的问题不同,不能用“程序跑完了”替代平衡判断。
本例最小化目标 emtol = 500,单位 kJ mol⁻¹ nm⁻¹;动力学时间步 dt = 0.002 ps。v-rescale 用于温控,C-rescale 用于压控。进入 NPT 时使用 NVT 的 .gro 和 .cpt,gen-vel = no、continuation = yes 保留已有速度与约束状态。后续阶段同理。
蛋白 NVT/NPT 开启重原子位置约束,grompp -r 指定该阶段的参考坐标,NPT 用 refcoord-scaling = com。本例 NPT 的参考是 NVT 末帧;生产 MDP 不含 POSRES。若希望所有平衡阶段约束到同一初始构象,应显式给出同一个参考文件。
小盒子瞬时压力可以波动很大,应看分块均值、密度与结构的稳定性;本页图展示生产段,不能单独证明前面的 70 ps 已满足任意研究目标。
1 准备与提交#
python new-case.py water-300
cd work/water-300
sbatch run.sh
run.sh 申请资源后执行 workflow.sh。不要在登录节点直接执行完整模拟。下列每个算例可单独新建副本并提交。
| 算例目录 | 本次内容 |
|---|---|
water-300 |
完整输入、前置文件与真实计算输出 |
ubiquitin |
完整输入、前置文件与真实计算输出 |
2 实际终端命令#
以下是在对应算例目录中实际执行并生成结果的命令。分析命令在该算例的 analysis 子目录执行;交互回答已用 printf 写入,组名需随自己的体系核对。
water-300
gmx grompp -f em.mdp -c solv.gro -r solv.gro -p topol.top -o em.tpr -po em-processed.mdp
gmx mdrun -deffnm em -ntmpi 1 -ntomp 4 -nb gpu -pme cpu -update cpu
gmx grompp -f nvt.mdp -c em.gro -r em.gro -p topol.top -o nvt.tpr -po nvt-processed.mdp
gmx mdrun -deffnm nvt -ntmpi 1 -ntomp 4 -nb gpu -pme gpu -update cpu
gmx grompp -f npt.mdp -c nvt.gro -r nvt.gro -p topol.top -o npt.tpr -po npt-processed.mdp -t nvt.cpt
gmx mdrun -deffnm npt -ntmpi 1 -ntomp 4 -nb gpu -pme gpu -update cpu
gmx grompp -f md.mdp -c npt.gro -r npt.gro -p topol.top -o md.tpr -po md-processed.mdp -t npt.cpt
gmx mdrun -deffnm md -ntmpi 1 -ntomp 4 -nb gpu -pme gpu -update cpu
printf %s 'Potential
Temperature
Pressure
Density
0
' | gmx energy -f md.edr -o thermo.xvg
water-300/analysis
printf %s 'Potential
Temperature
Pressure
Density
0
' | gmx energy -f ../md.edr -o thermo.xvg
ubiquitin
gmx grompp -f em.mdp -c solv.gro -r solv.gro -p topol.top -o ions.tpr
gmx grompp -f em.mdp -c ions.gro -r ions.gro -p topol.top -o em.tpr -po em-processed.mdp
3 输入文件与关键设置#
water-300/em.mdp 完整输入(点击展开)
cutoff-scheme = Verlet
nstlist = 20
coulombtype = PME
rcoulomb = 1.0
rvdw = 1.0
pbc = xyz
constraints = none
integrator = steep
nsteps = 10000
emtol = 500
emstep = 0.01
define = -DFLEXIBLE
water-300/nvt.mdp 完整输入(点击展开)
cutoff-scheme = Verlet
nstlist = 20
coulombtype = PME
rcoulomb = 1.0
rvdw = 1.0
pbc = xyz
constraints = h-bonds
integrator = md
dt = 0.002
nsteps = 10000
nstenergy = 50
nstcalcenergy = 50
nstlog = 1000
nstxout-compressed = 50
tcoupl = v-rescale
tc-grps = System
tau-t = 0.5
ref-t = 300
pcoupl = no
gen-vel = yes
gen-temp = 300
gen-seed = 76262
water-300/npt.mdp 完整输入(点击展开)
cutoff-scheme = Verlet
nstlist = 20
coulombtype = PME
rcoulomb = 1.0
rvdw = 1.0
pbc = xyz
constraints = h-bonds
integrator = md
dt = 0.002
nsteps = 25000
nstenergy = 50
nstcalcenergy = 50
nstlog = 1000
nstxout-compressed = 50
tcoupl = v-rescale
tc-grps = System
tau-t = 0.5
ref-t = 300
pcoupl = C-rescale
gen-vel = no
gen-temp = 300
gen-seed = 76262
continuation = yes
pcoupltype = isotropic
tau-p = 5
ref-p = 1
compressibility = 4.5e-05
ubiquitin/em.mdp 完整输入(点击展开)
cutoff-scheme = Verlet
nstlist = 20
coulombtype = PME
rcoulomb = 1.0
rvdw = 1.0
pbc = xyz
constraints = h-bonds
integrator = steep
nsteps = 10000
emtol = 500
emstep = 0.01
ubiquitin/nvt.mdp 完整输入(点击展开)
cutoff-scheme = Verlet
nstlist = 20
coulombtype = PME
rcoulomb = 1.0
rvdw = 1.0
pbc = xyz
constraints = h-bonds
integrator = md
dt = 0.002
nsteps = 10000
nstenergy = 50
nstcalcenergy = 50
nstlog = 1000
nstxout-compressed = 50
tcoupl = v-rescale
tc-grps = System
tau-t = 0.5
ref-t = 300
pcoupl = no
gen-vel = yes
gen-temp = 300
gen-seed = 76266
define = -DPOSRES
ubiquitin/npt.mdp 完整输入(点击展开)
cutoff-scheme = Verlet
nstlist = 20
coulombtype = PME
rcoulomb = 1.0
rvdw = 1.0
pbc = xyz
constraints = h-bonds
integrator = md
dt = 0.002
nsteps = 25000
nstenergy = 50
nstcalcenergy = 50
nstlog = 1000
nstxout-compressed = 50
tcoupl = v-rescale
tc-grps = System
tau-t = 0.5
ref-t = 300
pcoupl = C-rescale
gen-vel = no
gen-temp = 300
gen-seed = 76266
continuation = yes
pcoupltype = isotropic
tau-p = 5
ref-p = 1
compressibility = 4.5e-05
define = -DPOSRES
refcoord-scaling = com
4 实际结果与画图#


下表为本次 100 ps 生产轨迹后半段的简单均值,不是收敛物性或误差分析。
| 实例 | 原子数 | 温度 K | 密度 kg/m³ |
|---|---|---|---|
| water-300 | 2652 | 299.83 | 969.57 |
| ubiquitin | 26742 | 299.40 | 994.22 |
用附件中的 Python 脚本重画所有参考图:
# 回到 gromacs-examples 根目录
module load ase/3.29.0
python plot.py --root .
plot.py 使用 NumPy 和 Matplotlib,直接读取 XVG/COLVAR/坐标数值,图片保存在 figures。对单项新结果,可照着脚本对应段替换文件路径;不要把不同模型或单位的数据直接拼在一起。
参数查阅#
以本集群 gmx 命令名 -h 为准;GROMACS 2026.4 命令手册和MDP 参数手册可查完整选项。