计算化学公社

 找回密码 Forget password
 注册 Register
Views: 135|回复 Reply: 1
打印 Print 上一主题 Last thread 下一主题 Next thread

[GROMACS] 请问gromacs能计算材料的热导率吗?怎么计算呢?

[复制链接 Copy URL]

214

帖子

0

威望

854

eV
积分
1068

Level 4 (黑子)

跳转到指定楼层 Go to specific reply
楼主
请问gromacs能计算材料的热导率吗?怎么计算呢?

81

帖子

0

威望

445

eV
积分
526

Level 4 (黑子)

2#
发表于 Post on 2025-12-28 19:08:02 | 只看该作者 Only view this author
老老实实用LAMMPS吧,GROMACS做rNEMD麻烦死了。
脚本可以直接参考radonpy:
  1. #########################################################
  2. ## NEMD with kinetic energy exchange (RNEMD)
  3. ##########################################################
  4. fix             NVE all nve
  5. fix             mp  all thermal/conductivity ${exchg} ${axis} ${slab}

  6. # Generate temperature profile of layers
  7. compute         layers all chunk/atom bin/1d ${axis} lower ${invslab} units reduced
  8. fix             2 all ave/chunk ${Nevery} ${Nfreq} ${exchg} layers temp density/mass file ${Tprof} norm sample

  9. # Output
  10. dump            1 all custom 1000 ${dumpf} id type mol xs ys zs ix iy iz
  11. dump            2 all xtc 1000 ${xtcf}
  12. dump_modify     2 unwrap yes
  13. restart         100000 ${rstf1} ${rstf2}

  14. variable        heatflux   equal   (f_mp*${kcal2j}/${NA})/(2*${Jarea}*${ang2m}*${ang2m})   # J/m^2 = Ws/m^2
  15. thermo_style    custom step time temp press enthalpy etotal ke pe ebond eangle edihed eimp evdwl ecoul elong etail vol lx ly lz density pxx pyy pzz pxy pxz pyz f_mp v_heatflux
  16. thermo_modify   flush yes
  17. thermo          ${exchg}

  18. run             ${NStep}


  19. """

  20.         if decomp:
  21.             in_strings += """
  22. ##########################################################
  23. ## Component decomposition of heat flux
  24. ##########################################################
  25. # heat flux preparation
  26. compute         KE        all   ke/atom
  27. compute         PE        all   pe/atom

  28. compute         Spair     all   stress/atom NULL pair
  29. compute         Sbond     all   stress/atom NULL bond
  30. compute         Sangle    all   centroid/stress/atom NULL angle
  31. compute         Sdihed    all   centroid/stress/atom NULL dihedral
  32. compute         Simpro    all   centroid/stress/atom NULL improper
  33. compute         Skspac    all   stress/atom NULL kspace
  34. compute         Sfix      all   stress/atom NULL fix
  35. """

  36.             if decomp_intermol:
  37.                 in_strings += """
  38. compute         Spairer   all   stress/atom NULL interpair
  39. compute         Spairra   all   stress/atom NULL intrapair
  40. """

  41.             in_strings += """
  42. # Generate empty vector
  43. group           empty     type      99999
  44. compute         KENULL    empty ke/atom
  45. compute         PENULL    empty pe/atom improper
  46. compute         STNULL    empty stress/atom NULL improper

  47. ########################   Cell half-left   ########################
  48. ###  |//|  |  |  |  |**|  |  |  |  |  ###   |//| cold slab
  49. ###  |//|  |  |  |  |**|  |  |  |  |  ###   |**| hot slab
  50. ###  |//|  |  |  |  |**|  |  |  |  |  ###
  51. ###  |//|  |  |  |  |**|  |  |  |  |  ###
  52. ###  |//|  |  |  |  |**|  |  |  |  |  ###
  53. ###      <--------->                  ###
  54. ### heat flux decomposition of this reagion
  55. #####################################################################

  56. # left cell information
  57. group           halfL     dynamic  all         region     lhalf     every  ${Nevery}  # Nevery=ave/time Nevery

  58. #1st term   eivi
  59. compute         lF1ke     halfL    heat/flux   KE         PENULL    STNULL
  60. compute         lF1pe     halfL    heat/flux   KENULL     PE        STNULL

  61. #2nd term   Sivi
  62. compute         lFpair    halfL    heat/flux   KENULL     PENULL    Spair
  63. compute         lFbond    halfL    heat/flux   KENULL     PENULL    Sbond
  64. compute         lFangle   halfL    heat/flux   KENULL     PENULL    Sangle
  65. compute         lFdihed   halfL    heat/flux   KENULL     PENULL    Sdihed
  66. compute         lFimpro   halfL    heat/flux   KENULL     PENULL    Simpro
  67. compute         lFkspac   halfL    heat/flux   KENULL     PENULL    Skspac
  68. compute         lFfix     halfL    heat/flux   KENULL     PENULL    Sfix
  69. """

  70.             if decomp_intermol:
  71.                 in_strings += """
  72. compute         lFpairer  halfL    heat/flux   KENULL     PENULL    Spairer
  73. compute         lFpairra  halfL    heat/flux   KENULL     PENULL    Spairra
  74. fix             20 halfL ave/time ${Nevery} ${Nfreq} ${exchg}  c_lF1ke[${idx}] c_lF1pe[${idx}] c_lFpair[${idx}]  c_lFpairer[${idx}]  c_lFpairra[${idx}]  c_lFbond[${idx}]  c_lFangle[${idx}]  c_lFdihed[${idx}]  c_lFimpro[${idx}]  c_lFkspac[${idx}]  c_lFfix[${idx}]  file ${lJprof}
  75. """
  76.             else:
  77.                 in_strings += """
  78. fix             20 halfL ave/time ${Nevery} ${Nfreq} ${exchg}  c_lF1ke[${idx}] c_lF1pe[${idx}] c_lFpair[${idx}]  c_lFbond[${idx}]  c_lFangle[${idx}]  c_lFdihed[${idx}]  c_lFimpro[${idx}]  c_lFkspac[${idx}]  c_lFfix[${idx}]  file ${lJprof}
  79. """

  80.             in_strings += """

  81. ########################   Cell half-right   #######################
  82. ###  |//|  |  |  |  |**|  |  |  |  |  ###   |//| cold slab
  83. ###  |//|  |  |  |  |**|  |  |  |  |  ###   |**| hot slab
  84. ###  |//|  |  |  |  |**|  |  |  |  |  ###
  85. ###  |//|  |  |  |  |**|  |  |  |  |  ###
  86. ###  |//|  |  |  |  |**|  |  |  |  |  ###
  87. ###                     <--------->   ###
  88. ###        heat flux decomposition of this reagion
  89. #####################################################################

  90. # right cell information
  91. group           halfR     dynamic  all         region     rhalf     every  ${Nevery}

  92. #1st term   eivi
  93. compute         rF1ke     halfR    heat/flux   KE         PENULL    STNULL
  94. compute         rF1pe     halfR    heat/flux   KENULL     PE        STNULL

  95. #2nd term   Sivi
  96. compute         rFpair    halfR    heat/flux   KENULL     PENULL    Spair
  97. compute         rFbond    halfR    heat/flux   KENULL     PENULL    Sbond
  98. compute         rFangle   halfR    heat/flux   KENULL     PENULL    Sangle
  99. compute         rFdihed   halfR    heat/flux   KENULL     PENULL    Sdihed
  100. compute         rFimpro   halfR    heat/flux   KENULL     PENULL    Simpro
  101. compute         rFkspac   halfR    heat/flux   KENULL     PENULL    Skspac
  102. compute         rFfix     halfR    heat/flux   KENULL     PENULL    Sfix
  103. """

  104.             if decomp_intermol:
  105.                 in_strings += """
  106. compute         rFpairer  halfR    heat/flux   KENULL     PENULL    Spairer
  107. compute         rFpairra  halfR    heat/flux   KENULL     PENULL    Spairra
  108. fix             30 halfR ave/time ${Nevery} ${Nfreq} ${exchg}  c_rF1ke[${idx}] c_rF1pe[${idx}] c_rFpair[${idx}]  c_rFpairer[${idx}]  c_rFpairra[${idx}]  c_rFbond[${idx}]  c_rFangle[${idx}]  c_rFdihed[${idx}]  c_rFimpro[${idx}]  c_rFkspac[${idx}]  c_rFfix[${idx}]  file ${rJprof}
  109. """
  110.             else:
  111.                 in_strings += """
  112. fix             30 halfR ave/time ${Nevery} ${Nfreq} ${exchg}  c_rF1ke[${idx}] c_rF1pe[${idx}] c_rFpair[${idx}]  c_rFbond[${idx}]  c_rFangle[${idx}]  c_rFdihed[${idx}]  c_rFimpro[${idx}]  c_rFkspac[${idx}]  c_rFfix[${idx}]  file ${rJprof}
  113. """

  114.             in_strings += """

  115. ##########################################################
  116. ## RNEMD with kinetic energy exchange in decomposition
  117. ##########################################################
  118. thermo_style    custom step time temp press enthalpy etotal ke pe ebond eangle edihed eimp evdwl ecoul elong etail vol lx ly lz density pxx pyy pzz pxy pxz pyz f_mp v_heatflux
  119. thermo_modify   flush yes
  120. thermo          ${exchg}

  121. run             ${NStepd}


  122. """

  123.         in_strings += """
  124. write_dump      all custom ${ldumpf} id x y z xu yu zu vx vy vz fx fy fz modify sort id
  125. write_data      ${ldataf}
  126. quit
  127. """
复制代码


Green-Kubo法:优点,准;缺点,需要很长的平衡时间;
  1. ##########################################################

  2. log             ${logf} append

  3. units           real
  4. atom_style      full
  5. boundary        p p p

  6. bond_style      ${bondst}  
  7. angle_style     ${anglest}
  8. dihedral_style  ${dihedst}
  9. improper_style  ${improst}

  10. pair_style      ${pairst} ${cutoff1} ${cutoff2}
  11. pair_modify     mix arithmetic
  12. special_bonds   amber
  13. neighbor        2.0 bin
  14. neigh_modify    delay 0 every 1 check yes
  15. kspace_style    pppm 1e-6

  16. read_data       ${dataf}

  17. velocity        all create ${Ttemp} ${seed} mom yes rot yes dist gaussian

  18. ##########################################################
  19. ## Thermal conductivity calculation by Green-Kubo method
  20. ##########################################################
  21. timestep        ${TimeSt}

  22. compute         kpKE      all ke/atom    # KE_i
  23. compute         kpPE      all pe/atom    # PE_i
  24. compute         kpStress  all centroid/stress/atom NULL virial  # S_i
  25. compute         kpflux    all heat/flux kpKE kpPE kpStress

  26. # x, y, z components of JE
  27. variable        kpJx      equal c_kpflux[1]/vol
  28. variable        kpJy      equal c_kpflux[2]/vol
  29. variable        kpJz      equal c_kpflux[3]/vol

  30. # Compute the autocorrelation function
  31. fix             JJ all ave/correlate ${kpsample} ${kpcorrlen} ${kpdump} c_kpflux[1] c_kpflux[2] c_kpflux[3] type auto file ${autocorrf} overwrite ave running

  32. variable        kpscale   equal ${conv}*(${kpsample}*dt)/${Ttemp}/${Ttemp}/vol/${kB}
  33. variable        kappaxx   equal trap(f_JJ[3])*${kpscale}
  34. variable        kappayy   equal trap(f_JJ[4])*${kpscale}
  35. variable        kappazz   equal trap(f_JJ[5])*${kpscale}
  36. variable        kappa     equal (v_kappaxx+v_kappayy+v_kappazz)/3.0   # in isotropic system, getting the average
  37. fix             kappa     all ave/time ${kpdump} 1 ${kpdump} v_kappaxx v_kappayy v_kappazz v_kappa ave one file ${kappaf}

  38. fix             NVT1 all nvt temp ${Ttemp} ${Ttemp} 100

  39. # Output
  40. dump            1 all custom 1000 ${dumpf} id type mol x y z vx vy vz
  41. dump            2 all xtc 1000 ${xtcf}
  42. dump_modify     2 unwrap yes
  43. restart         100000 ${rstf1} ${rstf2}

  44. thermo_style    custom step time temp press enthalpy etotal ke pe ebond eangle edihed eimp evdwl ecoul elong etail vol lx ly lz density pxx pyy pzz pxy pxz pyz v_kpJx v_kpJy v_kpJz
  45. thermo          1000

  46. run             ${NStep}

  47. write_dump      all custom ${ldumpf} id x y z xu yu zu vx vy vz fx fy fz modify sort id
  48. write_data      ${ldataf}
  49. quit
  50. """
复制代码

评分 Rate

参与人数
Participants 1
eV +2 收起 理由
Reason
SharkYYX2025 + 2 牛!

查看全部评分 View all ratings

本版积分规则 Credits rule

手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图

GMT+8, 2026-1-24 01:00 , Processed in 0.156582 second(s), 21 queries , Gzip On.

快速回复 返回顶部 返回列表 Return to list