# Sample LAMMPS input script for thermal conductivity units real variable T equal 300 variable V equal vol variable dt equal 1.0 variable p equal 5000 # correlation length (5ps) variable s equal 1 # sample interval (1fs) variable d equal $p*$s # dump interval log thermal_conductivity_s${s}cl${p}.log # convert from LAMMPS real units to SI variable kB equal 1.3806504e-23 # [J/K] Boltzmann variable kCal2J equal 4186.0/6.02214e23 variable A2m equal 1.0e-10 variable fs2s equal 1.0e-15 variable convert equal ${kCal2J}*${kCal2J}/${fs2s}/${A2m} read_restart postxlink_equilibrated.restart kspace_style pppm/cg 1.0e-4 neighbor 2.0 bin neigh_modify delay 0 every 1 check yes timestep 1.0 thermo $d # equilibration and thermalization velocity all create $T ${seed} mom yes rot yes dist gaussian fix NVT all nvt temp $T $T 10 drag 0.2 run 50000 #50ps # thermal conductivity calculation, switch to NVE if desired unfix NVT fix NVE all nve 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 variable temperature equal temp variable volume equal vol fix extra all print 1 "${temperature} ${volume} ${Jx} ${Jy} ${Jz}" file heatflux.txt title "Temp Vol J[1] J[2] J[3]" screen 0 fix JJ all ave/correlate $s $p $d & c_flux[1] c_flux[2] c_flux[3] type auto file J0Jt_s${s}cl${p}.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_style custom step temp v_Jx v_Jy v_Jz v_k11 v_k22 v_k33 run 1000000 #(1ns) variable k equal (v_k11+v_k22+v_k33)/3.0 variable ndens equal count(all)/vol print "average conductivity: $k[W/mK] @ $T K, ${ndens} /A\^3" unfix NVE