[lammps-users] green-kubo method

I want to study the role of phonons in thermal conductivity.

Where should I define the phrase “fix NVE all nve” in the Green-Kubo method of heat conduction calculation? Comes with a run command before the Green-Kubo section, such as mode 1
Or with the part related to Green-Kubo? Like case 2
Is there a difference between the two?

1:
#!~~~ Fixes~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
fix NPT all npt temp $T $T 0.1 iso 0 0 1
run 2000000
unfix NPT
fix NVE all nve
run 4000000

#!~~~~~~~~~~~~~~~~~~~~~~~~~~ Thermal Conductivity~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

reset_timestep 0
compute myKE all ke/atom
compute myPE all pe/atom
compute myStress all stress/atom NULL virial
compute flux all heat/flux myKE myPE myStress
variable Jx equal c_flux[1]/vol
variable Jy equal c_flux[2]/vol
variable Jz equal c_flux[3]/vol
fix JJ all ave/correlate $s $p $d &
c_flux[1] c_flux[2] c_flux[3] type auto &
file J0Jt.dat ave running

variable scale equal {convert}/{kB}/$T/$T/$V*s*{dt}
variable k11 equal trap(f_JJ[3]){scale} variable k22 equal trap(f_JJ[4])*{scale}
variable k33 equal trap(f_JJ[5])
${scale}
thermo $d
thermo_style custom step temp v_Jx v_Jy v_Jz v_k11 v_k22 v_k33 cpu
run 100000000
variable kappa equal (v_k11+v_k22+v_k33)/3.0

2:

#!~~~ Fixes~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

fix NPT all npt temp $T $T 0.1 iso 0 0 1
run 2000000
unfix NPT

#!~~~~~~~~~~~~~~~~~~~~~~~~~~ Thermal Conductivity~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

reset_timestep 0
compute myKE all ke/atom
compute myPE all pe/atom
compute myStress all stress/atom NULL virial
compute flux all heat/flux myKE myPE myStress
variable Jx equal c_flux[1]/vol
variable Jy equal c_flux[2]/vol
variable Jz equal c_flux[3]/vol
fix NVE all nve
fix JJ all ave/correlate $s $p $d &
c_flux[1] c_flux[2] c_flux[3] type auto &
file J0Jt.dat ave running

variable scale equal {convert}/{kB}/$T/$T/$V*s*{dt}
variable k11 equal trap(f_JJ[3]){scale} variable k22 equal trap(f_JJ[4])*{scale}
variable k33 equal trap(f_JJ[5])
${scale}
thermo $d
thermo_style custom step temp v_Jx v_Jy v_Jz v_k11 v_k22 v_k33 cpu
run 100000000
variable kappa equal (v_k11+v_k22+v_k33)/3.0

Thank you very much

Please see the discussion about how LAMMPS processes input here: https://docs.lammps.org/Commands_input.html

Thanks!