# force in compute vs single methods

Dear Lammps users,

Can you please explain why is there a difference in the normal force calculation between the “compute” method and the “single” method?

I have been using Lammps during the past few months, and have modified the Granular pair potential to my own needs. I have just noticed that the compute method and single method return different “Forces”.
The normal force in the compute method is a vector: ccel times the vector r.

fx = delxccel + fs1;
fy = dely
ccel + fs2;
fz = delz*ccel + fs3;
and the compute method returns a vector of the total force.

The “single” method returns the scalar fforce as the “normal force”. fforce is a scalar equal to ccel and is not multiplied by the vector r. The units of fforce are Newton/meter.

It seems that in order to use the single method force, one needs to multiply it first by the vector r.

Am I missing something? Why is there a difference?

Thanks,

Dear Lammps users,

Can you please explain why is there a difference in the normal force
calculation between the "compute" method and the "single" method?

I have been using Lammps during the past few months, and have modified the
Granular pair potential to my own needs. I have just noticed that the
compute method and single method return different "Forces".
The normal force in the compute method is a vector: ccel times the vector r.

fx = delx*ccel + fs1;
fy = dely*ccel + fs2;
fz = delz*ccel + fs3;
and the compute method returns a vector of the total force.

The "single" method returns the scalar fforce as the "normal force". fforce
is a scalar equal to ccel and is not multiplied by the vector r. The units
of fforce are Newton/meter.

It seems that in order to use the single method force, one needs to multiply
it first by the vector r.

Am I missing something? Why is there a difference?

the compute and the single method serve different purposes. however,
there is a particular problem when granular pair styles: the single
API implicitly assumes that your particles are point particles (as is
true for the vast majority of pair styles in LAMMPS) but does not
apply for granular particles.

please note that this behavior is documented:

The single() function of these pair styles returns 0.0 for the energy
of a pairwise interaction, since energy is not conserved in these
dissipative potentials. It also returns only the normal component of
the pairwise interaction force. However, the single() function also
calculates 4 extra pairwise quantities. The first 3 are the components
of the tangential force between particles I and J, acting on particle
I. P4 is the magnitude of this tangential force. These extra quantites
can be accessed by the compute pair/local command, as p1, p2, p3, p4.

axel.