Creating group of atoms in each region

Dear all,
I have a system with 3 atom types. I want to compute MSD for some slices of this system. To this end, I need to slice the system into several region blocks and create three groups of each atom type in each region. Next, I can compute MSD for each atom type in each sliced region block. I don’t know how can I group each atom type in each region. Any help in this regards is appreciated, Thanks.

Please have a look at compute msd/chunk and forget about groups except for grouping the different atom types.

Dear Axel,
Thanks a lot for your time and for suggesting me to use msd/chunk. I have a problem with the time history output of MSD for each region because in the output I have the results for all three atom types in a format that I cannot plot MSD versus time step. Is there any way to output MSD only for one atom type? My code is:

region n1 block INF INF INF INF 30 40 units box side in
compute cc1 all chunk/atom type region n1
compute myChunk1 all msd/chunk cc1
fix f1 all ave/time 100 1 100 c_myChunk1[4] file temp.out mode vector

The results are in the following format:

Time-averaged data for fix f1

TimeStep Number-of-rows

Row c_myChunk1[4]

0 3
1 0
2 0
3 0
100 3
1 0.076379
2 0
3 0
200 3
1 0.0655714
2 0
3 0
300 3
1 0.0661873
2 0
3 0

Sorry, but what you do in your input makes no sense.
You create a group for each atom type so that you do binning for each atom type separately.

If you want the data per atom type separately, you must do that, regardless of how you implement the grouping into sub-regions.
You use the chunk/atom compute to then create a 1d-binning and then compute ave/time to time average that per-chunk data. … and - of course - you do that separately for each group i.e. each atom type.

If you want a more customized and compact processing and output in a convenient format, then I suggest you just write out a trajectory and do the analysis with a custom program or script yourself or check if some external tools are more accessible. MSD is one of the easiest analysis procedures to program.