[lammps-users] compute group/group slab calculation energy problem


I am trying to calculate the energy of a redox particle using compute group/group (ver 29Oct20). My system is a capacitor containing electrolyte. It’s periodic in X-Y and I use slab corrections in the Z direction with PPPM. When I compute group/group the redox particle energy with respect to the rest of the system, the tabulated energy increases monotonically with increasing slab correction thickness. Based on how the slab correction method works, I would expect the energy to converge to some value as slab thickness is increased.

group A is the ion (+1 charge), group B is the whole system (neutral). It seems that background charge corrections are being included in the energy even though the system is neutral. I think this is related to subtracting A-A and B-B interactions in compute group/group. Setting ‘boundary yes’ in compute group/group does not fix the problem. The forces from compute group/group are correct, however. Is this a problem with LAMMPS or am I misunderstanding how background charge corrections are supposed to work?

Working example is attached showing how my compute result ‘c_real’ changes with slab thickness. atom data file available on request.


Pt100_proton_NaCl.lmp (2.43 KB)

Perhaps Stan can give you some specific insight with respect to the kspace aspects.

However, from my personal experience, I would consider a different approach: run and record your trajectories the normal way and then do the analysis via the rerun command using compute group/group with a (longer) cutoff coulomb instead of long-range electrostatic with kspace.

There will be no errors on the forces or total energies for the trajectories since you did them with regular kspace handling, and the errors on the analysis are negligible since they are small compared to the errors from finite size effects and fluctuations that will be present in any case. Any you don’t have to worry about the fourier transforms discarding divergent terms.


Thank you Axel.

The reason why I am using compute group/group is that I have add-on code which computes the energy for both the reduced and oxidized states of my particle at each timestep, so I need to calculate the energy twice. Compute group/group seemed to be the cheapest way to do this without recalculating the energy of the whole system. The reduced-oxidized energy difference gives me the collective coordinate for the redox process a la Marcus theory, and I do harmonic restraints in that collective coordinate. I am unable to do all of this with rerun since I apply additional forces which depend on this ion-system energy calculation. But yes- maybe Stan can also provide some insight :slight_smile:

Best regards,

Please note that the real space part of compute group/group is much slower than the regular force/energy computation.

What you describe sounds much like it would be a candidate for a multi-partition run, where you compute both variants concurrently and then figure out how the final forces should be and communicate them.

Also, unless you keep both systems neutral, I don’t think you can compare the energies since a periodic system with a net charge essentially has an infinite energy and that term is ignored.