<div dir="ltr">I am always happy when it is possible to remove some code! Paolo<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 10, 2018 at 6:09 PM, Andreussi, Oliviero <span dir="ltr"><<a href="mailto:Oliviero.Andreussi@unt.edu" target="_blank">Oliviero.Andreussi@unt.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space">
Dear Developers,
<div><span><br>
</span></div>
<div><span>I am working on the code to make the calculation of the Hartree potential a bit more clean and code independent (PW vs CP). It may not be very useful per se, but it may help to reduce the
cyclic dependencies of Environ. </span></div>
<div><span><br>
</span></div>
<div><span>Having said this, while looking at the current version of the code I realized that there is a new feature related to the electrostatic interactions and the pbc corrections, the Coulomb
Cutoff 2D. I double checked the formulas, and it seems to me that they are the same of the Martyna-Tuckermann approach in 2D (</span><span>Mináry, P.; Tuckerman, M. E.; Pihakari, K. a.; Martyna, G. J. A New Reciprocal
Space Based Treatment of Long Range Interactions on Surfaces. </span><i>J. Chem. Phys.</i><span>
</span><b>2002</b><span>,
</span><i>116</i><span> (13), 5351.), when an appropriate smoothing is added to avoid the cusp at the boundary, similar to what is done in the 0D Martyna-Tuckermann implementation in
PW (the additional </span>factor exp(-tpiba2*gg(:)*beta/4._dp)*<wbr>*2 in wg_corr )</div>
<div><span><br>
</span></div>
<div><span>Apart from the stress subroutines, which are totally new and very useful, the other subroutines in the </span>Coul_cut_2D.f90 module can be merged inside the martyna-tuckermann.f90 module with very little
changes. As a matter of fact, I did it already a few years ago, but did not submit it because I struggled -and failed- to make the 1D case work. My impression is that one just needs to change the way the wg_corr(ig) coefficients are computed, which for the
2D case would be something like</div>
<div><br>
</div>
<div>
<div> axis = at(3,3) * alat</div>
<div> DO ig =1, ngm</div>
<div> q2 = gg(ig)*tpiba2 </div>
<div> IF (q2>1.e-6_dp) THEN</div>
<div> gxy = SQRT(g(1,ig)**2 + g(2,ig)**2) </div>
<div> wg_corr(ig) = - COS( 0.5D0 * g(3,ig) * tpiba * axis ) * &</div>
<div> & EXP( -0.5D0 * gxy * tpiba * axis ) * &</div>
<div> & fpi / q2</div>
<div> ELSE</div>
<div> wg_corr(ig) = 0.D0</div>
<div> END IF</div>
<div> END DO</div>
<div> wg_corr(:) = wg_corr(:) * exp(-tpiba2*gg(:)*beta/4._dp)*<wbr>*2</div>
<div> if (gamma_only) wg_corr(gstart:ngm) = 2.d0 * wg_corr(gstart:ngm)</div>
</div>
<div><br>
</div>
<div>I think having the two correction schemes with a more uniform implementation would be desirable. In particular, I find the implementation of the MT approach to be very clean and compact, I would actually suggest to move it to Modules, the only
dependencies that forbid this are in a subroutines to print out debug stuff, which could be easily commented out. </div>
<div><br>
</div>
<div>If the developers of this new feature want to fix this by themselves, I would not mind at all. Otherwise, if there are strong opinions on why the Coulomb Cutoff 2D should be implemented in a totally different way from the MT approach, despite
being both G-space-based corrections, please let me know. At least we should change the capitalization of the module’s name, it is really hArd tO looK At. </div>
<div><br>
</div>
<div>Best, </div><span class="HOEnZb"><font color="#888888">
<div><br>
<div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
Oliviero Andreussi<br>
--<br>
Assistant Professor<br>
Department of Physics<br>
University of North Texas<br>
<a href="mailto:oliviero.andreussi@unt.edu" target="_blank">Email: oliviero.andreussi@unt.<wbr>edu</a> <br>
Skype: olivieroandreussi<br>
Web: <a href="https://sites.google.com/site/olivieroandreussi" target="_blank">https://sites.google.com/<wbr>site/olivieroandreussi</a></div>
</div>
<br>
</div>
</font></span></div>
<br>______________________________<wbr>_________________<br>
developers mailing list<br>
<a href="mailto:developers@lists.quantum-espresso.org">developers@lists.quantum-<wbr>espresso.org</a><br>
<a href="https://lists.quantum-espresso.org/mailman/listinfo/developers" rel="noreferrer" target="_blank">https://lists.quantum-<wbr>espresso.org/mailman/listinfo/<wbr>developers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Paolo Giannozzi, Dip. Scienze Matematiche Informatiche e Fisiche,<br>Univ. Udine, via delle Scienze 208, 33100 Udine, Italy<br>Phone +39-0432-558216, fax +39-0432-558222<br><br></div></div></div></div></div>
</div>