how to do the structural optimization using LAMMPS?
What LAMMPS can do and how you can enable those features is described (in great detail) in the documentation. Head over to https://docs.lammps.org/ and enjoy the read.
Before creating more posts, please also read the Guidelines for posting questions to the LAMMPS forum
Structural Optimization/ energy minimization in LAMMPS can be done by minimize command.