(no subject)

I would like to place thin pate of hydrogen atoms in contact with Fe bicrystal to see diffusion of H in lattice or along grain boundary. But everytime I run simulation, the hydrogen atoms move out of simulation box. Kindly, suggest some solution to this problem.

I assuming you are using periodic boundary conditions.

I suspect this is not a LAMMPS issue, but an issue with the way you are visualizing the trajectories (dump files) of your simulation. It seems like you forgot to ask your visualizer software to “wrap” the atoms into your simulation box.

Note: If you use OVITO, then atoms are wrapped by default.

If you use VMD, then they are not. Here are some instructions how to visualize a LAMMPS trajectory in VMD with wrapping.

Note: The instructions above assume you are simulating molecules. I also assumed that your dump file was generated using the dump command with the custom keyword". For example:

dump 1 all custom 1000 traj.lammpstrj id mol type x y z ix iy iz

If you don’t have any molecules in your simulation, then you can leave out “mol” from the dump command above, and you can probably use simpler “pbc” commands. In that case, see the documentation for the “pbc” plugin for VMD:

Hope this helps.