[lammps-users] bringing molecules back into the box

Dear lammps users,
I am counting the number of molecules in my box. For a box of (45.97 Ang)^3 including 500 molecules, I used:

region my_region block 0 45.98 0 45.98 0 45.98 units box
variable c equal count(all,my_region)

and printed it out with themo_style command
the number of molecules supposed to be 500 but what is printed at every step is less than that

I think the molecules go out of periodic box.
Can I bring molecules back into the box in an easy way?

Thank you very much

Regions are not periodic. See the region doc page for details.
If you just want to count all the molecules in the simulation
box, why do you need a region? For that matter, why do
you need to count them?