# [lammps-users] fix aveforce problem

Hello everyone,

I am using the fix aveforce command to construct a piston in my simulation. Although I have read the LAMMPS manual I didn’t get how this fix works.

consider : fix pressdown topwall aveforce 0.0 0.0 -\${fz}

In the document was mentioned that " the existing force is averaged for the group of atoms, component by component ". Suppose that my piston has 100 atoms. So, does every atom experience \${fz}/100 force in z-direction?

and also it was mentioned that “the actual force on each atom is then set to the average value plus the component specified in this command”. This sentence really confuses me of how this fix works.

I would appreciate it if anyone could explicate this fix command.

Best,

Alireza

Hello everyone,

I am using the fix aveforce command to construct a piston in my simulation. Although I have read the LAMMPS manual I didn’t get how this fix works.

consider : fix pressdown topwall aveforce 0.0 0.0 -\${fz}

In the document was mentioned that " the existing force is averaged for the group of atoms, component by component ". Suppose that my piston has 100 atoms. So, does every atom experience \${fz}/100 force in z-direction?

no. “existing force” is not what you add but what the individual atoms have as force currently.

and also it was mentioned that “the actual force on each atom is then set to the average value plus the component specified in this command”. This sentence really confuses me of how this fix works.

just break it down into the two parts. step 1, no additional force. Assume you use fix aveforce 0.0 0.0 0.0. that means, the force on each atom in the group is averaged for x, y, and z, so all atoms experience the same force in x, y, z (and thus move as a block), if you want that only in z direction (and free motion in x, and y) you need to use fix aveforce NULL NULL 0.0. step 2, if the value for the z-direction is not 0.0, then this value is added to all atoms in the group after computing the average force. so essentially this combines fix aveforce (with either NULL or 0.0) and fix addforce.

…and that is exactly what the manual says. read it again and you shall see.

axel.

1 Like

I got it.
Thanks a lot.

Hello everyone,

I am using the fix aveforce command to construct a piston in my simulation. Although I have read the LAMMPS manual I didn’t get how this fix works.

consider : fix pressdown topwall aveforce 0.0 0.0 -\${fz}

In the document was mentioned that " the existing force is averaged for the group of atoms, component by component ". Suppose that my piston has 100 atoms. So, does every atom experience \${fz}/100 force in z-direction?

no. “existing force” is not what you add but what the individual atoms have as force currently.

and also it was mentioned that “the actual force on each atom is then set to the average value plus the component specified in this command”. This sentence really confuses me of how this fix works.

just break it down into the two parts. step 1, no additional force. Assume you use fix aveforce 0.0 0.0 0.0. that means, the force on each atom in the group is averaged for x, y, and z, so all atoms experience the same force in x, y, z (and thus move as a block), if you want that only in z direction (and free motion in x, and y) you need to use fix aveforce NULL NULL 0.0. step 2, if the value for the z-direction is not 0.0, then this value is added to all atoms in the group after computing the average force. so essentially this combines fix aveforce (with either NULL or 0.0) and fix addforce.

…and that is exactly what the manual says. read it again and you shall see.

axel.