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] += delxfpair;
f[i][1] += delyfpair;
f[i][2] += delzfpair;
f[j][0] -= delxfpair;
f[j][1] -= delyfpair;
f[j][2] -= delzfpair;
if (evflag) ev_tally(i,j,nlocal,newton_pair,
evdwl,0.0,fpair,delx,dely,delz);
energyBit = evdwl;
atomE[i] += 0.5energyBit;
qdpi = 0.5fpair*(delxv[i][0]+delyv[i][1]+delzv[i][2]);
q[i][0] += qdpidelx;
q[i][1] += qdpidely;
q[i][2] += qdpidelz;
atomE[j] += 0.5energyBit;
qdpj = -0.5fpair*(delxv[j][0]+delyv[j][1]+delzv[j][2]);
q[j][0] -= qdpjdelx;
q[j][1] -= qdpjdely;
q[j][2] -= qdpjdelz;
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