count number of atom by variable region

Dear all users Lammps
I have two kind atoms. I want to calculate the numbers of atom type 1 that there are in MSD of atom type 2(for each step).
I try by this code to calculate it:

compute MeanSquaredDisplasment 1 msd

variable MsdCluster equal c_MeanSquaredDisplasment[4]

region atom1 sphere 0.0 0.0 0.0 v_MsdCluster units box

variable numberatom1 equal count(2,atom1)

The error you quote stems from computes needing a “consumer” to be updated and thus current.
I the given example, thermo output was the consumed, but it will only work if you actually do a run and thus “consume” the data from the compute. But even then, you are likely to run into problems, so the better approach would be to use one of the averaging fixes with 1 1 1 or suitable setting to serve as a cache. This has been discussed and explained in detail multiple times on this mailing list. the e-mail you have looked up is only one example. there are more and with more details.