# Derivation of electrostatic potential in LAMMPS

Dear list,

I am implementing the electrostatic potential calculation in LAMMPS. I have got the equation from ewald summation and I would like to do the dU(electro)/dqi so I could get the electrostatic potential form. When doing it for the reciprocal term, I found that alpha is also related to charges, but from all the paper I collected nobody did the differential for it; I also checked the codes and online but how g_ewald is derived is puzzling to me. Any guidance or related paper for g_ewald is welcome.

Looking forward to hearing from you.

Best,

Andrew

The g_ewald (alpha, kappa, Gaussian width or other names) is determined according to the precision and cutoff you choose, as well as the charges. The purpose is to get rapid convergence but the coulomb energy is independent of g_ewald (in some degree). As so you do not need to calculate the derivative but just use it as a constant parameter.

Andrew was asking two questions, 1: how to take derivative of the reciprocal term wrt q, and 2: how is g_ewald calculated.

For Q1, I believe we can use Equation (C4) of the 2004 Zhou, Wadley, Filhol, and Neurock paper (PRB 69 035402). Just take the derivative wrt q_i. But how to actually implement it in LAMMPS and make use of existing code (e.g. ewald.cpp) require more thought.

For Q2, please take a look at ewald.cpp for how g_ewald is calculated (g_ewald = accuracysqrt(natomscutoffxprdyprdzprd) / (2.0q2)

Ray

Dear Ray,

Thank you for your answer. To follow up, I have got the derivation equation of electrostatic potential from ewald summation equation. The key question now is, whether I need to use the derivative of g_ewald wrt qi from the form below, since it includes q2. I searched other papers where they didn’t give specific details on how they choose certain g_ewald/alpha/damping factor/smearing factor but simply giving the number.

Looking forward to hearing from you,

Heng

Dear Ray,