Z-directional charge of the output system is not electrically neutral

Dear all,
I am using the method of dividing bins in lammps to output the Z-directional charge distribution of the system, but after I add up the charges of all the bins, the sum of the charges of the system is not 0. My system is electrically neutral and the calculation from the trajectory is also electrically neutral, do you know why this is?
This is the output command I used:
compute charge all property/atom q
compute cz all chunk/atom bin/1d z lower 0.1
fix 8 all ave/chunk 10 20 500 cz c_charge file out.charge_density-0v

Thanks!

1 Like

Hello,
Please ask this question in the LAMMPS forum, LAMMPS - Materials Science Community Discourse

Adding ave none to your fix ... ave/chunk command should give you the results you want. The documentation will tell you why. (: