Here is my script. Can anyone be kind enough to direct me where I made the mistake?
# heat layers
region hot_end block INF INF INF INF 0 6.805
region cold_end block INF INF INF INF 156.506 163.311
region hot block INF INF INF INF 0 20
region cold block INF INF INF INF 141 161.946
region fixed_heat_source_side block INF INF INF INF 0 12
region fixed_heat_sink_side block INF INF INF INF 151 161.946
group hot region hot
group cold region cold
group fixed_heat_source_side region fixed_heat_source_side
group fixed_heat_sink_side region fixed_heat_sink_side
group end union fixed_heat_source_side fixed_heat_sink_side
group moving subtract all end
velocity all create $t 87287 dist gaussian
compute Thot hot temp
compute Tcold cold temp
# 1st equilibration run
fix 1 all nvt temp $t $t 0.5
thermo 1000
thermo_modify lost ignore flush yes
run 100000
unfix 1
reset_timestep 0
# 2nd equilibration run
fix 2 all nve
fix hot_langevin hot langevin ${thi} ${thi} 0.5 59804 tally yes
fix cold_langevin cold langevin ${tlo} ${tlo} 0.5 287859 tally yes
#velocity end set 0.0 0.0 0.0
#fix set_end end setforce 0.0 0.0 0.0
fix_modify hot_langevin temp Thot
fix_modify cold_langevin temp Tcold
variable tdiff equal c_Thot-c_Tcold
thermo_style custom step temp c_Thot c_Tcold f_hot_langevin f_cold_langevin v_tdiff etotal
thermo 1000
thermo_modify lost ignore flush yes
run 1000000
# 3rd thermal conductivity calculation
# reset langevin thermostats to zero energy accumulation
unfix hot_langevin
unfix cold_langevin
fix hot_langevin hot langevin ${thi} ${thi} 0.5 59804 tally yes
fix cold_langevin cold langevin ${tlo} ${tlo} 0.5 287859 tally yes
velocity end set 0.0 0.0 0.0
fix set_end end setforce 0.0 0.0 0.0
fix_modify hot_langevin temp Thot
fix_modify cold_langevin temp Tcold
fix ave all ave/time 1 200000 200000 v_tdiff ave running
thermo 10000
thermo_style custom step temp c_Thot c_Tcold f_hot_langevin f_cold_langevin v_tdiff etotal
thermo_modify lost ignore flush yes
compute ke all ke/atom
variable KB equal 8.625e-5
variable temp atom c_ke/1.5/${KB}
# Define spatial bins along the z-axis for temperature profiling
compute myChunk all chunk/atom bin/1d z lower 0.01 units reduced
fix 4 all ave/chunk 1 200000 200000 myChunk v_temp file profile.langevin ave running
run 5000000