Variable force along any Geometrical axis

Dear Lammps Users,
Suppose I have a geometrical region say a cone along z-axis, I want to apply a variable force whose magnitude is inversely or say in any way proportional to the co-ordinate points along z-axis.Does anyone have any idea how to take into account the z-coordinates defined above in geometrical region defination to define the variable force(z dependent).

You can define an atom-style variable and use the atom coordinates as an input to the variable, see

Thankyou for the reference, it worked.