If and atom vector

Hi all,
How can we use ‘if’ along with a per atom vector in input script.
For example if I need to add an extra force to a group of particle according to the z-position of the individual atoms in the group. Force is added if it is within a cut off range.
Some thing like this
if z(of each atom)<r_c add force.
Thanks for your time

Not like that, but an atom-style
variable can use a relational math operator,
like x<10.0 which returns 0 or 1 if it is
true/false. If you multiply that quantity
in the formula by the force
you want then you get the same effect.


I have printed out the return value of the math operator x<10.0 in the dump file. And it returns 1 or 0 if it is True/False.


That's what the doc page for the variable command
says it should do ...