# Calculating the electric field from arbitrary charge configuration

Hello,

I would like to calculate the electric field in some region from the charges on my atoms. Is there a simple way to do so in lammps? Would it be possible to define some grid of virtual atoms which have some small negligible charge and calculate the electrostatic force on those atoms from interaction with all the charges in my system?

Best regards

Kristian Kuppart

Hello,

I would like to calculate the electric field in some region from the charges
on my atoms. Is there a simple way to do so in lammps?

simple? no.

Would it be possible to define some grid of virtual atoms which have some small negligible charge
and calculate the electrostatic force on those atoms from interaction with
all the charges in my system?

no. not in general and not without programming. those charges would
still affect the system unless there are some special considerations
taken into account. if you are only interested in cutoff coulomb, you
might set something up in this vain and then write a custom compute
style that uses the pair->single() method looping over all pairs
similar to what compute group/group does, while those special "grid"
particles have to be excluded from all other interactions that compute
forces during the normal MD process. to make this work, some hacking
for pair styles may be needed, too.

and it would particularly not work, if your system is periodic and you
need to include long-range electrostatic contributions.
here you effectively need to solve the poisson equation for your
system, which in 3-d can be done rather similar to what is done, e.g.
in PPPM:
compute the charge distribution on a grid, fourier transform to
reciprocal space, convolute, reverse fourier transform to real space,
and you have the potential on the grid. for non-periodic, you might be
better off using a multi-grid method (which in turn is similar to what
MSM does).

axel.

As Axel indicates, any of the Coulomb solvers like PPPM are

effectively solving for the electric field at an atom’s position.

So if you take a snapshot of charged atom positions (e.g. dump file)

and read it into LAMMPS and define only Coulombic interactions

(e.g. pair_style coul/long and PPPM), then do a “run 0” and

dump the forces on all atoms, you will have effectively

the E-field at each of those atoms, since F = Eq.

If you add a single test atom

to the N atoms, at some new coord (e.g. on a grid point)

and get the force (E-field) on that atom, it might also

be the E-field at that point, since periodic images of that atom

shouldn’t exert force on itself. But I’m not sure about the

Coulombic self-energy terms for that scenario. Stan would

know the details (CCd).

Steve

As Axel indicates, any of the Coulomb solvers like PPPM are
effectively solving for the electric field at an atom's position.

So if you take a snapshot of charged atom positions (e.g. dump file)
and read it into LAMMPS and define only Coulombic interactions
(e.g. pair_style coul/long and PPPM), then do a "run 0" and
dump the forces on all atoms, you will have effectively
the E-field at each of those atoms, since F = Eq.

in PPPM you already have the electrostatic potential on a grid. the
force is then computed for the interaction with that grid (see the
PPPM:fieldforce_XXX() functions). the only downside under normal
circumstances is that you are using smeared out charges and not the
"true" charge distributio and thus have only an approximation to the
potential. if you rig a piece of code that would run an instance of
PPPM
for a suitably short coulomb cutoff, you can improve on that at the
expense of computational cost. this kind of approach is used for
visualization purposes, for example:
http://www.ks.uiuc.edu/Research/vmd/plugins/pmepot/

axel.

This has been discussed before. See: http://sourceforge.net/p/lammps/mailman/message/31309080/ or search for "Compute electric potential when using pppm style" in the mail list archives.

Stan