How to batch output the number of particles in each cell?

Hello developers! I want to calculate the lacey index of the particle. I can currently only get grain or cell data via mfix, respectively. But I want to output the number of particles in each cell in batches. How do I do that? Hope to get everyone’s opinion, thank you!

Here’s a thread from a while back where the Lacey index is mentioned - there are a few literature citations there, this may help you.