# Calculate total force applied to a group in peridynamics

Dear LAMMPS users,

I am trying to calculate the total interaction force between two groups in peridynamics. The model is consisted of three groups named “upper”, “middle”, and “lower”. The “upper” group contacts with “middle” only, while the “middle” interacts with “upper” and “lower” simultaneously.

The “upper” group moves at a constant velocity and interacts with “middle”. I used the following command to do so:

velocity upper set 0.0 -0.08 0.0 units box
fix 2 upper setforce 0.0 0.0 0.0

In order to calculate the total interaction force between “middle” and “upper", I tried two ways:

First, I tried to use “compute sum_fy upper reduce sum fy” to calculate the total force applied to “upper”. But the result is 0. I guess that is because I am using "setforce 0”.

Second, I tried to use “compute 2 middle group/group upper”. Then I got a error message saying “Pair style does not support compute group/group”.

So I wonder how am I supposed to get the total force between “upper” and “middle”?

Thanks,
Yifei

Dear LAMMPS users,

I am trying to calculate the total interaction force between two groups in peridynamics. The model is consisted of three groups named “upper”, “middle”, and “lower”. The “upper” group contacts with “middle” only, while the “middle” interacts with “upper” and “lower” simultaneously.

The “upper” group moves at a constant velocity and interacts with “middle”. I used the following command to do so:

velocity upper set 0.0 -0.08 0.0 units box
fix 2 upper setforce 0.0 0.0 0.0

In order to calculate the total interaction force between “middle” and “upper", I tried two ways:

First, I tried to use “compute sum_fy upper reduce sum fy” to calculate the total force applied to “upper”. But the result is 0. I guess that is because I am using "setforce 0”.

Please check the documentation of fix setforce. It stores the forces that it overwrites. So that should provide you with the info you are looking for.

Could you be more specific about how to access the stored total force? I read through the fix setforce command, but still have no clue.

On the other hand, I tried to use “fix nve/noforce” command instead of "fix setforce”. First, I give the “upper” group an initial velocity. Then I use “fix nve/noforce” to maintain the velocity while ignoring the force update. The script is as follow:

velocity upper set 0.0 -0.08 0.0 units box
fix 2 upper nve/noforce
compute 2 upper reduce sum fy

After post-processing the result, the model does not seem correct. The “upper” group is not moving at a constant velocity as I set. Could you please let me know what I did is wrong? Is this the right way to calculate total force in peridynamic models?

Thanks,
Yifei

Could you be more specific about how to access the stored total force? I read through the fix setforce command, but still have no clue.

Look for this paragraph :

This fix computes a global 3-vector of forces, which can be accessed by variousoutput commands. This is the total force on the group of atoms before the forces on individual atoms are changed by the fix. The vector values calculated by this fix are “extensive”.

Axel

Thank you so much for the help. It works now.

I have a follow-up question about fix nve/noforce.

It seems to me “fix nve/noforce” should do the same work as “setforce 0”. But the result does not seem so. In the manual, it says “fix nve/noforce” will update the position based on velocity, and velocity will not be updated. In my script, I assigned an initial velocity to the “upper” group, then used the command “fix nve/nofoce”, but the velocity does not remain constant. Is there anything wrong with my understanding about “fix nve/noforce”?

Best regards,
Yifei

Thank you so much for the help. It works now.

I have a follow-up question about fix nve/noforce.

It seems to me “fix nve/noforce” should do the same work as “setforce 0”.
But the result does not seem so. In the manual, it says “fix nve/noforce”
will update the position based on velocity, and velocity will not be
updated. In my script, I assigned an initial velocity to the “upper” group,
then used the command “fix nve/nofoce”, but the velocity does not remain
constant. Is there anything wrong with my understanding about “fix
nve/noforce”?

more likely there is an error somewhere else in your input. for
example, you may be time integrating atoms multiple times, or you may
be applying a thermostat to those atoms that changes the velocity.
impossible to say. can you reproduce this behavior with one of the
examples provided by LAMMPS?

axel.