I want to calculate the sum of the x component of velocity, the y component of velocity, and then the magnitude of velocity ... which commands can I use...
You can calculate velocity in the x and y direction separately using LAMMPS. After getting your desired value, you can do a summation using an excel file.