ES+EAM potential

Hi, I want to achieve ES+EAM potential in lammps.

In related formulas, there is a '1/r'. It is a long-range item.

I do not know how to achieve that, even though the article refers the method of Ewald summation.

Since the formula of Ewald summation is complex, I try to copy code from lammps.

In pair_born_coul_long.cpp, long-range coulomb energy is taken into consideration.

The form should be qq/r.

But what I need is 1/r. Substitute q with 1 is my way.

The codes below is mine.
          grij = g_ewald * r;
          expm2 = exp(-grij*grij);
          t = 1.0 / (1.0 + EWALD_P*grij);
          erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
          prefactor = qqrd2e * qtmp*q[j]/r;
          ecoul = prefactor*erfc;

I substitute q by 1 in ewald.cpp as well.

My question is whether ecoul has same magnitude with long-range plus 1/r, then ecoul+1/r is my goal?

Hi, I want to achieve ES+EAM potential in lammps.

what does "ES+EAM" stand for. ewald summation plus embedded atom??

nobody can help you if you don't clearly explain what you are talking about.

In related formulas, there is a '1/r'. It is a long-range item.

ewald summation does *not* use 1/r.
please have a look into *any* text book on classical MD.

I do not know how to achieve that, even though the article refers the
method of Ewald summation.

it is a very bad idea to try and implement something
that you don't understand. how are you ever going to
prove (to yourself and others) that your code is correct??

Since the formula of Ewald summation is complex, I try to copy code from
lammps.

In pair_born_coul_long.cpp, long-range coulomb energy is taken into
consideration.

The form should be qq/r.

no! that is the expression for plain coulomb interactions
*WITHOUT* ewald summation (or its siblings PPPM, PME, SPME...).
the whole point of doing ewald summation is to *avoid*
having to sum over the (badly converging) (q_i*q_j)/(r_ij)
sum over all atoms and its periodic images.

But what I need is 1/r. Substitute q with 1 is my way.

NOOOOO!! that would not give you ewald summation
and also force all charges to be the unit charge.

The codes below is mine.

          grij = g_ewald * r;
          expm2 = exp(-grij*grij);
          t = 1.0 / (1.0 + EWALD_P*grij);
          erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
          prefactor = qqrd2e * qtmp*q[j]/r;
          ecoul = prefactor*erfc;

this doesn't compute any force at all. how should this work?
in any case, this branch of the code wouldn't be executed
anyway, since usually tabulated coulomb is used by preference.

I substitute q by 1 in ewald.cpp as well.

AIIIIHHHH! this hurts just to read.

My question is whether ecoul has same magnitude with long-range plus 1/r,

then ecoul+1/r is my goal?

what you were writing here makes no sense at all.

that being said, the gods of MD seem to be looking
upon you with mercy. if it all you need is to add
long-range electrostatics to an EAM potential,
you can realize this with LAMMPS without *ANY*
programming. all you need to do is to assign the
proper charges to the atoms and then use
pair style hybrid/overlay with your eam pair style
*and* coul/long (plus ewald or pppm as kspace style).

that is assuming, you don't need to make additional
changes to the EAM implementation to account for
the added charges when computing the embedding
energy outside of a custom eam potential file.

axel.