# [lammps-users] fix aveforce, calculating applied pressure and thermostatting

Hi,

In an effort to replicate some results from a previous study I am looking at applying a pressure to a block of atoms. The way the study does it it is they apply a force to the top 4 layers of the block which corresponds to a specific pressure. I want to be sure I am approaching this problem right:

1. To apply the pressure should I use fix aveforce? This makes sense as it seems to be the option used when looking for something like a wall. In this case I assume I should use:
fix 1 setforce 0 0 NULL
fix 2 aveforce NULL NULL -{force}

2. Assuming this is correct, when calculating the force needed for a specific pressure is it as simple as multiplying the desired pressure by the surface area (ie x and y dimensions of the box) and then doing some unit conversions? Because the force in aveforce is the average force of the group and it is only applied in the z I am thinking this, but seems too simple.

3. For thermostatting, the study says a thermostat/barostat was left on the weld area (no thermostat for the fixed layers) that kept pressure in the transverse direction to the atmosphere. This seems like the fix aveforce will then have to compete with this fix npt, is this true?

Thanks very much.

Liam

All of this sounds correct to me.

Steve

Hi Liam,

Regarding number 2, I think you should also devide the average force by the number of rigid wall atoms because the force in aveforce apply to every atoms of its group. Something like this:

Fix piston Aveforce NULL NULL fz

P=N*fz/A

Where N is number of atom, p is your desired and A is your surface area.

Best,

Alireza

All of this sounds correct to me.

Steve

Hi all,

Thanks for the responses, after doing some more digging I seem to think that for item 2) the total force calculated should be divided by the number of atoms as well. In other words, pressure*surface area/ number of atoms in the region. Adding in unit conversions as well of course.

Thanks

Liam