I don’t see anything that is obviously wrong, but this is really a math question more than a LAMMPS question. I haven’t checked your math for you. If LAMMPS parses your fix gravity command, and you’ve followed the documented format, the command should work. I haven’t checked that for you either.
Note that gravitational forces are miniscule in comparison with inter-atomic forces, so I doubt you’ll see much effect unless you use an artificially large value for gravity.
Paul