Do you remember the cosmology parameters for your run: particles, grid, box, refinement, AMR ON or OFF ?
I have run a 200 Mpc/h box, 512^3 particle, 512^3 grid, AMR-OFF simulation and I get about 30,000 halos using HOP. When I try to finding virial halos, I get only 500. I may have to increase the grid to 1024^3.
Let me know how you got 40,000 virial halos.