[lammps-users] r_ij(f_ij*v_i)

Dear Steve & Lammps user

I want to calculate r_ij(f_ij*v_i) as a output qunatity. But it seems I am doing some thing wrong.
the code is as follows:

if (rsq < cutsq[itype][jtype]) {
fforce = one.fforce;
// multiplying f_ij*v_i

stress[i][0] -= v[i][0]*fforce;
stress[i][1] -= v[i][0]*fforce;
stress[i][2] -= v[i][0]*fforce;
stress[i][3] -= v[i][0]*fforce;
stress[i][4] -= v[i][0]*fforce;
stress[i][5] -= v[i][0]*fforce;

//calculating r_ij (f_ij*v_i)

for (i = 0; i < nlocal; i++) {
if (rsq < cutsq[itype][jtype]) {

stress[i][0] = delxdelx;
stress[i][1] = delydely;
stress[i][2] = delzdelz;
stress[i][3] = delxdely;
stress[i][4] = delxdelz;
stress[i][5] = delydelz;}

Is something wrong with the code? because I am not getting the result as I expected. any suggestions???

thanx and regards


Do you get the right answer for a 2-atom system?
Then try 3 pairs. You should be able to do this
by hand and see where your mistake is.