# per atom heat flux

Dear LAMMPS users,

I’m interested in plotting the map of the thermal flux of a crystal, subjected to a difference of temperature. I saw that LAMMPS can compute the global heat flux which refers to the whole simulation region rather than to each atom. A possible way to compute the heat flux on atom “i” could do to drop the sums (running on atom “i” e keeping those running of atom “j”) in the equation appearing in the “compute heat/flux” doc. Besides thinking about whether it has physical sense or not, my concerning is about the volume normalization. I was wondering whether anyone has already tried to do this. Thanks a lot.

Giuseppe

Hello Guiseppe,
I have done this for a CNT-nanofluid system with a temperature drop across the domain. I used the AtC package to accumulate the data at finite element nodes, normalized by the element volumes. The main difficulty was coding the summations because one of my interaction potentials was many-bodied.

Jonathan

Hi Giuseppe,

Below I placed part of the input file script to calculate heat flux
without calling heat flux.
It was written for old version and if I'm not mistaken in new lammps
versions you do not need first square brackets for vectors.
If you do not execute "compute all reduce" you have flux for each atom.
And stress is divided by 1.6021765e6 to convert to unist metal.
I hope it helps

Best,

German

compute PE all pe/atom
compute KE all ke/atom

variable CX atom (vx[]*(c_KE[]+c_PE[]))
compute Jcx all reduce sum v_CX

variable CY atom (vy[]*(c_KE[]+c_PE[]))
compute Jcy all reduce sum v_CY

variable CZ atom (vz[]*(c_KE[]+c_PE[]))
compute Jcz all reduce sum v_CZ

compute SA all stress/atom virial

# J_x = S_xx*V_x + S_xy*V_y + S_xz*V_z
variable VX atom
-(c_SA[][1]*vx[]+c_SA[][4]*vy[]+c_SA[][5]*vz[])/1.6021765e6
compute Jvx all reduce sum v_VX
# J_y = S_yx*V_x + S_yy*V_y + S_yz*V_z, yx=xy
variable VY atom
-(c_SA[][4]*vx[]+c_SA[][2]*vy[]+c_SA[][6]*vz[])/1.6021765e6
compute Jvy all reduce sum v_VY
# J_z = S_zx*V_x + S_zy*V_y + S_zz*V_z, yx=xy
variable VZ atom
-(c_SA[][5]*vx[]+c_SA[][6]*vy[]+c_SA[][3]*vz[])/1.6021765e6
compute Jvz all reduce sum v_VZ

variable Jx equal (c_Jcx+c_Jvx)
variable Jy equal (c_Jcy+c_Jvy)
variable Jz equal (c_Jcz+c_Jvz)