Problem with adapt charge in combination with kspace

Hello Lammps-Community!

I have have a problem with the fix adapt command in combination with the kspace command and want to ask if anybody can confirm my results or explain it.

My setup is as follows:
I have two fixed plates consisting of N particles and two point charges (each assigned with a small charge q=0.001) between the plates.

Now I try to run the following scheme:

1.)
The atoms of the electrodes are initially uncharged.
I adapt the charge of the first electrode and the charge of the second electrode with a fixed value, lets say 1.0 per atom on the first and -1.0 per atom on the second.
If I run this simulation with the kspace pppm solver it says in the logfile that the cell is not neutral and has a net charge: -32 which is exactly the number of atoms of one electrode times the charge I adapted.

To debug this I printed the forces and charge of the atoms: in the dump file the total sum of all charges is zero as expected. But why kspace is throwing an error and does this error mean that the forces are not calculated correctly? I tried the msm solver but found the same error.

2.)
To understand this problem I gave the atoms its charge manually (in the input file) so that I start in a configuration where the particles of one plate have charge 1.0 and the other -1.0. If I start the run no error is thrown by kspace.

Two understand if the calculation of forces is similar I looked at the forces dump where I found a deviation of deltaF_z=0.002 for my setup. In my understanding this means in my first setup something goes wrong but not terribly wrong so that the forces differ much from the manual setup. Or do I misinterpret something?

To make my problem more understandable I post my control script and potential script below. If necessary I could also send the sample input file. I tried to reduce the problem on the core commands. To produce my results I used the conda in-built version of
lammps in serial mode. I think this should be v2019.08.07.

Two investigate the problem:
The second case of constant charge is already activated. To run with adapt one has to comment it in in control.inp and set the charge of Ne atoms to zero initially in potential.inp.

I hope someone can help me with this problem because I am confused about this bug and wanted to use this scheme in a more complicated context.

Best regards and thanks in advance,
Florian

#control.inp

this happens because each instance of fix adapt will call force->kspace->init() and thus after the first instance is called your system is not charge neutral, but after the second instance is called it is again. thus there is one warning from the first, but none from the second.
you can confirm this by reversing the order of the fix adapt command, that should reverse the sign of the net charge printed in the warning.

axel.