Restraining force in z direction

I want to apply a restraining force in z direction (i.e. atoms would be allowed to move in z-direction, but pull back by the force) but as I do or intending to do that I get zero in the force in z, and in the dump file or in thermo style I am still getting the same so I guess I don’t get how to do it properly :frowning:
this has been some of my attempts…

Apply forces

fix 1 all nvt temp 0.1 0.1 0.01
fix c group-c addforce 0 0 v_forcez #every 1
#fix 3 group-c smd/setvel NULL NULL 0.0
#set group group-c z 2.4216759
#set atom 2080 x 0.0 y 0.0 z 2.4216759
#velocity group-c set NULL NULL 0.0
#fix zzero group-c setforce NULL NULL 0.0
#fix c group-c setforce NULL NULL v_forcez

Unless you improve your way of asking for help and provide more context and make it easy to understand what exactly you are trying to do and how and what you expect as result, it is not likely that you will be getting anything beyond what you already got. Please see: Please Read This First: Guidelines and Suggestions for posting LAMMPS questions