# How to dump J_x and j_y

Dear all

I want to have J_x an J_y (heat flux in x and y directions)
Individually for all atoms in system. But no fixes and dumps do this

Farrokh

Dear Farrokh,

If I've understood you correctly, you want to get the following vector for each atom in your system:

J_i = e_i * v_i - S_i * v_i where e_i is the energy of atom i, v_i is the velocity, and S_i is the per atom stress. This is just the first equation from http://lammps.sandia.gov/doc/compute_heat_flux.html, without the summation.

You can print out e_i, v_i, and S_i for every atom, and then do this as a post-processing step. compute stress/atom virial will give you S_i. To get the total energy, you can use an atom style variable to combine the output of compute ke/atom and compute pe/atom. You can then use dump custom to output, e.g.:

compute s_a all stress/atom virial
compute ke_a all ke/atom
compute pe_a all pe/atom
variable e_tot atom c_ke_a+c_pe_a
dump flux_out all custom 50 flux.* id vx vy vz v_e_tot c_s_a c_s_a c_s_a c_s_a c_s_a c_s_a

This will give you a dump file every 50 timesteps with the columns: i, vx_i, vy_i, vz_i, e_i, s_xx_i, s_yy_i, s_zz_i, s_xy_i, s_xz_i, s_yz_i

In fact, you can go a step further in LAMMPS and save yourself some disk space.
You can define two more atom style variables to calculate Jx and Jy for you, and just dump those.

As an example, for J_xi = e_i*v_xi + S_xxi*v_xi + S_xyi*v_yi + S_xzi*v_zi:

compute s_a all stress/atom virial
compute ke_a all ke/atom
compute pe_a all pe/atom
variable e_tot atom c_ke_a+c_pe_a
variable Jx atom (v_e_tot*vx)+(c_s_a*vx)+(c_s_a*vy)+(c_s_a*vz)
...
dump flux_out all custom 50 flux.* id v_Jx

Dear Niall

Thank you very much, You are correct.
In J_xi, is back of S mines? or plus?

Thanks

Sorry! Yes, you're quite right.

J_xi = e_i*v_xi - S_xxi*v_xi - S_xyi*v_yi - S_xzi*v_zi

Thank you Niall.