[lammps-users] long range electrostatics

Dear LAMMPS users,
I am building a model which will requires a long range electrostatics solver, but is not periodic in all directions. I don’t mind making it fully periodic if I can provide a large enough buffer space in the anisotropic direction. But I want to bound the system in that direction cheaply with something like a Lennard-Jones 9-3 wall or a reflecting wall. Unfortunately those walls don’t work in periodic directions. (Can somebody tell me why that is?)
Anyway, if anybody has a good solution for this, please let me know. Thanks!

Jonathan

Dear LAMMPS users,
I am building a model which will requires a long range electrostatics
solver, but is not periodic in all directions. I don't mind making it fully
periodic if I can provide a large enough buffer space in the anisotropic
direction. But I want to bound the system in that direction cheaply with
something like a Lennard-Jones 9-3 wall or a reflecting wall. Unfortunately
those walls don't work in periodic directions. (Can somebody tell me why
that is?)

i am not sure about the check.

Anyway, if anybody has a good solution for this, please let me know.
Thanks!

have you tried just to comment out the tests for periodicity
in fix_wall.cpp or fix_wall_reflect.cpp and recompile?

you have to make _very_ certain that there is no particle
in the free space beyond the walls.

cheers,
   axel.

Hi Axel,
Thanks. I’ll try that. I hope this works!

Jonathan

Hmm, the check doesn’t seem to be there in fix_wall_lj93.cpp. I guess the website documentation should be updated accordingly.

Jonathan

Hmm, the check doesn't seem to be there in fix_wall_lj93.cpp. I guess the
website documentation should be updated accordingly.

as i a wrote, you have to change fix_wall.cpp which contains
the definition of the class from which fix_wall_lj93.cpp is derived.

cheers,
     axel.

The kspace_modify slab command is provided to handle exactly this problem. You can turn off pbc in the z direction (sorry, x and y are not supported), but still do the 3D periodic kspace sum, with a vacuum buffer that is different from the actual box dimension.

Thanks for the suggestions, Aidan and Matt. I am aware of the slab command, but if I understand correctly, it will not handle the electrostatics in the non-periodic direction. Aidan, I didn’t quite understand your second sentence; is that what you were saying?

Axel, sorry I misunderstood. I will try that. Thanks.

Jonathan

You should read the documentation on kspace_modify slab. I am pretty sure it will do what you need.

Hi Aidan,
I read the documentation and scanned through the Yeh & Berkowitz paper. If I understand it correctly, then yes I think that will do what I need. But if I don’t expect any significant total dipole, would it be more efficient to use slab mode without the correction? Is it possible to do this?
Also (this is for a separate project of mine), is it possible to remove the long range wall-normal component altogether? So just a 2D pppm? Thanks!

Jonathan

If the total dipole is zero, then so is the correction. It won’t do you any harm to leave it in, as it is quite fast to compute. As a check, you could just comment out those lines of code. If you mean PPPM based on a square lattice sum, then the answer is no. I believe that is substantially more complicated and expensive than the cubic lattice sum, which is why Berkowitz invited the slab correction.

I see, thanks. What about doing the cubic lattice sum and then zeroing out the force in the z-direction? I want to try a different long range solver for the z-direction. Thanks.

Jonathan

Aidan (or anybody else),
If I am going to use a different long range solver for my z-direction (but use pppm for the x- and y-directions), would it be correct to zero out line 1705 in pppm.cpp? This is the loop the which assigns values to the electric field. So if I zero out the z-component of the electric field, then it will not assign a force in that direction. Are there any other considerations? Thanks.

Jonathan

Aidan (or anybody else),
If I am going to use a different long range solver for my z-direction
(but use pppm for the x- and y-directions), would it be correct to zero out
line 1705 in pppm.cpp? This is the loop the which assigns values to the

i don't think that you can just do that.

electric field. So if I zero out the z-component of the electric field,
then it will not assign a force in that direction. Are there any other
considerations? Thanks.

i don't know about pppm, but for the regular ewald sum,
there is a different derivation for 2d long-range electrostatic
than for 3d long-range electrostatics (and 1-d for that matter).
i would assume that a proper 2d pppm would have to be
derived in a similar way.

if it was so simple, why would there be the slab
correction in the first place? if your surface has
a dipole in z-direction then there are going to be
legitimate z-components in the forces on all atoms.
the slab correction should remove only the contributions
from inter-slab dipole interactions, but should keep
the intra-slab contributions.

...and while doing 3d with a long z-direction is generally
thought to be sufficient for a 2d system, there are some
subtle side effects. due to using a spherical cutoff, the
error from the ewald sum will be the smallest when the unit
cell is as similar as possible to a sphere, i.e. cubic.

in total, i would suspect that mix-and-matching poisson
solvers is not as straightforward as you are hoping for.
depending on the system you are trying. i think that it
is possible to partition the real-space force components
in the way you outline it, but i am not certain, if this can
be easily extended to reciprocal space.

cheers,
   axel.

What Axel said. True 2D PPPM is complicated. If you want to go that route, you should start by making it work for Ewald sum. There is a reach literature on this subject. I wouls not recommend it. The more rational approach is to do the following:

-Use kspace_modify slab value
-Make value larger and larger until your results are insensitive to value.

At this point, you can feel confident that you are modeling an infinite set of infinite parallel slabs that have no effect on each other.
This convergence will not occur for pressure or energy, I don’t think, but other properties will probably converge quite quickly.

Aidan

Sorry wait, I think either I’m not understanding something or we are not talking about the same problem.

My understanding is that PPPM in slab mode computes the full 3D PPPM as if it were an elongated periodic system (according to the slab value) and a correction term is included to negate any leftover dipole moments.

That said, I was wondering about two separate issues for two separate projects. (Both are 2D periodic, finite size in z.)

  1. If I don’t expect any significant total dipole moment, I was wondering if it would be more efficient to not include the correction term. Aidan, you had indicated it wouldn’t make a big difference. I’m ok with that.

  2. I wish to test out the long range electrostatics solver in the ATC package. It will only apply electrostatics in the z-direction, so I still require a kspace solver for the x- and y-directions. Can I use PPPM in slab mode, but subtract away the z-component of the electric field so that PPPM is effectively only applied in 2D? What I’m proposing should be independent of slab-slab interactions because the total z-component is zeroed away. I understand Axel’s point that, if it were so simple, then there would be no use for the more complicated 2D PPPM method. I guess I don’t understand why it can’t be so simple though.

Thanks.

Jonathan

2) I wish to test out the long range electrostatics solver in the ATC
package. It will only apply electrostatics in the z-direction, so I still
require a kspace solver for the x- and y-directions. Can I use PPPM in slab
mode, but subtract away the z-component of the electric field so that PPPM
is effectively only applied in 2D? What I'm proposing should be independent
of slab-slab interactions because the total z-component is zeroed away. I
understand Axel's point that, if it were so simple, then there would be no
use for the more complicated 2D PPPM method. I guess I don't understand why
it can't be so simple though.

please consider the interactions of two neighboring dipolar molecules.
there will be a z-direction force component if the two molecules are not
perfectly parallel and on the same height. a 2d solver doesn't mean that
interactions in the non-periodic dimension are neglected. you only apply
the ewald sum "trick" in two dimensions, i.e. you augement the interactions
that are damped in x- and y-direction by the opposite of the damping
computed in k-space. that would imply for example that you would not use
a spherical cutoff for real-space interactions, but a cylinder shape, i.e.
include all charges in the non-periodic dimension in real space.

now, on second thought, it might be possible to replace the
z-contribution from PPPM, if you zero out _all_ force components
in z-direction, not only PPPM and then compute them explicitly only
in z-direction in a second step. but that would require more than a
little bit of coding and a very, _very_ good reason to do this, not to
mention extremely paranoid testing.

cheers,
   axel.