error of "Dump dcd of non-matching # of atoms"

I've got the error message of "Dump dcd of non-matching # of atoms".
It happens when one parameter in force field is changed.

In what case, the number of total atoms changes during the simulation?

Either when you add or lose atoms.

It is the ensemble of constant N and hence, N should be the same during the whole simulation.
I think it may be concerned to the neighbor list radius and how often it is updated. It is right?

Yes, but also when you create unphysical large forces.

Generally, what factors cause this error and what I should do for it?

There is a discussion on losing atom in the documentation and many
discussions in the mailing list archives.

Axel

Turn on thermodynamic output every timestep near
when this occurs and you will probably find you
have lost atoms before the dump timestep occurs.

Steve