Why write_data (used to print data to file at the end of the simulation) file and the last frame of lammpstrj is different

I simulated a spherical droplet of water. the screenshot of the output structure and the screenshot of the final frame from lammps traj files is attached below. the input script is also attached. why this two structures are different, I thought that the final frame is saved when write_data command is used in the end of the input script. In the trajectory file dumped the water is spherical that all the atom are inside. In the final structure file got using write_data command shows water molecules all over the box spreading. VMD is used visualization. LAMMPS (23 Jun 2022 - Update 4) version is used to run the simulation.

input_nvt.lammps (681 Bytes)

You see a difference because the atom style dump file by default does not consider image flags, but the data file always includes them and reading the data file applies them. Even though, you seem to have a droplet with vacuum around it, you have non-zero image flags. This is a problem inherited from whatever you did to generate the original data file. You should have reset all image flags to zero.

Thank you