# How to access force exerted on wall/ljXX?

Dear LAMMPS users & developers

I set up a Lennard-Jones simulation with periodic boundaries in all three dimensions, which is confined between two repulsive WCA walls (see wall2.pdf).
In the documentation it is written that one can use “fix_modify XX energy yes” to calculate the forces exerted on the walls. However, I don’t see how I can actually access these quantities. Which variable stores the two respective forces?

Thanks
Peter

demo script:

wall2.pdf (5.54 KB)

Dear LAMMPS users & developers

I set up a Lennard-Jones simulation with periodic boundaries in all three
dimensions, which is confined between two repulsive WCA walls (see
wall2.pdf).
In the documentation it is written that one can use "fix_modify XX energy
yes" to calculate the forces

No, it does not. All it does is to "add the energy of interaction between
atoms and each wall to the system's potential energy as part of thermodynamic
output <http://lammps.sandia.gov/doc/thermo_style.html>.".

Take a look at the next paragraph on how to output forces, "This fix
computes a global scalar energy and a global vector of forces, which can be
accessed by various output commands
<http://lammps.sandia.gov/doc/Section_howto.html#howto_15>. Note that the
scalar energy is the sum of interactions with all defined walls. If you
want the energy on a per-wall basis, you need to use multiple fix wall
commands. The length of the vector is equal to the number of walls defined
by the fix. Each vector value is the normal force on a specific wall. Note
that an outward force on a wall will be a negative value for *lo* walls and
a positive value for *hi*walls. The scalar and vector values calculated by
this fix are "extensive".".

Ray

Hi Ray

Thanks for your reply. Well, I have read this paragraph and the respective bits of source code several times before, but I still don’t know how to extract this information.
I guess the variable “ewall” in the source code is what I want.

Would you mind providing some additional input or possibly a minimum example please?

Thanks
Peter

Information on how to output a vector is provided on this doc page, http://lammps.sandia.gov/doc/Section_howto.html#howto_15.

Ray

Ray,

again thanks for your reply, but unless I missed something, this is only of limited use:

##### Fixes that generate values to output

Some fixes in LAMMPS produces either global or per-atom or local values which can be accessed by other commands. The values can be scalars or vectors or arrays of data. These values can be output using the other commands descri**bed in this section. The doc page for each fix command tells whether it produces any output quantities and describes them.

I know that this fix generates a vector output. However, I still don’t know how to access it and - unless I missed it - this is not explained in the section you were referring to. Probably there is a generic syntax for accessing output variables of fixes!? That would be useful.

Peter

Please look more closely at the “Scalar/vector/array data” section.

Ray

Thanks Ray, I missed that. It’s hard to find because the table below that line only shows how to deal with computes.

Now it works!

Best regards

Peter