Dear LAMMPS users and Developers,

I am going to calculate heat flux vector (something like compute heat/flux) for a system that uses different potentials ( Tersoff + LJ + Coulomb + Buck + …). I write my code after calculations of forces in each potential and then save the calculated heat flux. For example, for two body term in Tersoff

f[i][0] += delx*fpair;
f[i][1] += dely*fpair;

f[i][2] += delz

*fpair;*

f[j][0] -= delxfpair;

f[j][0] -= delx

f[j][1] -= dely

*fpair;*

f[j][2] -= delzfpair;

f[j][2] -= delz

if (evflag) ev_tally(i,j,nlocal,newton_pair,

evdwl,0.0,fpair,delx,dely,delz);

energyBit = evdwl;

atomE[i] += 0.5*energyBit;
qdpi = 0.5*fpair*(delx

*v[i][0]+dely*v[i][1]+delz

*v[i][2]);*

q[i][0] += qdpidelx;

q[i][0] += qdpi

q[i][1] += qdpi

*dely;*

q[i][2] += qdpidelz;

q[i][2] += qdpi

atomE[j] += 0.5

*energyBit;*

qdpj = -0.5fpair*(delx

qdpj = -0.5

*v[j][0]+dely*v[j][1]+delz

*v[j][2]);*

q[j][0] -= qdpjdelx;

q[j][0] -= qdpj

q[j][1] -= qdpj

*dely;*

q[j][2] -= qdpjdelz;

q[j][2] -= qdpj

for (i=0;i<nall;i++){

qflux[0] += q[i][0]

qflux[1] += q[i][1]

qflux[2] += q[i][2]

}

MPI_Reduce(&qflux[0], &answer[0], 3, MPI_DOUBLE, MPI_SUM, 0, world);

if (me==0) {

fprintf(FfileQ,"%E %E %E\n",answer[0],answer[1],answer[2]);

}

I use the same method for LJ, Coulomb and other potentials. This method generates several heat flux files depending on the number of potentials I use in the simulation. I was wondering if I can add up the heat fluxes generated by each potential at each time step and save the sum in a single file.

The second question that I have is that if this is an efficient method to do this calculation or It would be better to combine all potential in single file and then calculate the heat flux.

Thanks

Hossein