measuring electrical potential using probe atom

Dear Lammps community,

I hope you are doing well.

I need to measure the electrical potential of my system (which is a polyelectrolyte network aka hydrogel)

I have bumped into Andrew Jewett’s post on the easiest way of doing that: using a dummy probe atom and subtracting the potential energy before vs after the inserted.

I have a couple of questions though:

  1. How would you verify the obtained potential. (what kind of model system will you use to compare calculated data with the theoretical predictions)

  2. How do you make sure that there is no overlap in the system when you insert the ghost atom.

  3. The way I setup my simulation is to create an atom inside lammps and use run 0 to calculate the energy. Andrew Jewett mentions one could use rerun command. will it make any difference?

create_atoms 4 single $x $y $z units box
pair_coeff 4 * 0. 0.
group probes type 4
set type 4 charge 1.
run 0
variable tmppe equal ecoul
variable mype equal v_tmppe
print “$x $y z {mype}” append info_${infile}.dat

delete_atoms group probes

Thank you,


This has been discussed before. See: or search for “Compute electric potential when using pppm style” in the mail list archives.​


Thank you so much Stan,

I haven’t seen this thread. It has almost exactly what I want.

Three more questions though.

  1. How do you make sure your ghost atom doesn’t overlap with a real atom.

  2. Which ensemble would you recommend to use for the calculations of the electrical potential?

  3. How do you reduce the result fluctuations?

I am trying to get the electrical potential, but my fluctuations are way bigger than my result itself.

I have tried adjusting the system size, the tdamp parameter in the fix nvt (i am using 100 time steps now which is 0.5 in lj units), equilibrating for longer time.

Does anyone have any other tips to reduce the result fluctuations?

Thanks a lot in advance,