[CP2K-user] [CP2K:19949] Understanding GAPW gradient implementation: why many terms are not calculated?

zc62 chenzh1993 at gmail.com
Wed Feb 21 23:51:45 UTC 2024


Dear Professor Hutter,

Thank you again for the helpful reply!

Yes now I found the place that evaluates 1-c term forces regarding C' 
gradients. They are in *qs_ks_atom.F::update_ks_atom* and *add_vhxca_forces*, 
and dimension 2 to 4 of C' contain the x, y, z gradient information. 
Somehow I was incorrectly expecting them in qs_rho_atom_methods.F such that 
I missed them.

For the 1-c integral concerns, now I totally agree with you.

It is fascinating to see that even for general Exc the same elegant result 
can be achieved, just like the Hartree energy. In my previous reply I 
thought it was only possible for simple functionals such as the Hartree 
energy that is quadratic in terms of the density. I even tried to 
numerically calculate the LDA exchange energy gradient contribution coming 
from the basis gradients:[image: 截屏2024-02-21 下午3.36.49.png]
and I thought the sum then cubic root term will mess things up and give 
non-zero results, but to my surprise, Mathematica gave me a numerically 
close to zero number in my s,px,py,pz basis demo. (See attached for the 
Mathematica nb file for whoever interested.)

The key information is, each *individual term* *\int V d/dR [ga gb]* before 
the summation is actually indeed *non-zero* in general, but just like in 
the Hartree energy case, when evaluating the sum with a fixed *CPC*, 
finally *the single number representing basis gradient contributions will 
be zero*. The rationale is exactly what Prof. Hutter has been explaining, 
that the partial derivatives involving only basis functions but not P or C' 
is essentially calculating the derivative of an integral with functions at 
the same center. In the end the integral will get rid of the center 
position information (because Hartree and Exc are translational invariant) 
and thus no derivative with respect to nuclear coordinates can be taken. 
This is similar to the fact that the overlap integral between two basis 
functions at the same center will never change.
[image: 截屏2024-02-21 下午5.45.49.png]

Because previously I mistakenly clicked "reply to author", which made some 
previous discussions private, here I paste the previous round so that in 
case anyone who has similar confusions as me can have a look.

Best,
ZC

On Wed, Feb 21, 2024 at 3:28 AM Jürg Hutter wrote:

Hi

1) yes, the derivatives of the projector coefficients are calculated and 
used for the gradient.

2-3) The one-center XC terms have only derivatives through the 
coefficients. The
integral over the potential and the local basis functions is zero by 
definition.
The integrand is a function of (r-A), so any derivative wrt to A is zero.

Hartree 1-center terms are calculated by half-numeric integration.

regards
JH

________________________________________
From: zc62
Sent: Tuesday, February 20, 2024 11:21 PM
To: Jürg Hutter
Subject: “[CP2K:19924] Understanding GAPW gradient implementation: why many 
terms are not calculated?”

Dear Professor Hutter,

Thanks for sending me the thesis! In equation 4.84 of the thesis, I do find 
there are C' derivatives in the gradient expression. Does current CP2K 
implementation have C' derivatives? In 
qs_rho_atom_methods.F::calculate_rho_atom_coeff, it looks like only C' but 
no derivatives got calculated? (My original question 1.)

For my original questions 2 and 3, I find the trick is to expand the 1-c 
Hartree integrals as Gaussian-basis two-electron integrals (though CP2K 
never calculates in that way), it is then easy to see 1-c Hartree terms 
have zero derivatives associated with basis function derivatives because 
they are same-center Gaussian integrals. In my original post I forgot the 
core density contribution (rho_A^Z). I will post my updated derivations 
later in this reply in case anyone else is interested. However, now the 
confusion becomes, why can we do the same thing for the 
exchange-correlation energy? I feel that Exc cannot be written as 
two-electron integrals and even in molecular software packages, they are 
evaluated using numerical integrations.

1c hard Hartree term with basis derivatives (with the forgotten rho_A^Z 
contribution added):

[image: 截屏2024-02-20 下午4.10.31.png]
Because the integrals are only for Gaussian basis function at the same 
center R_A, their nuclear coordinate derivatives are zero.

1c soft Hartree term with basis function derivatives (and rho0 gaussian 
function derivatives):
[image: 截屏2024-02-20 下午4.13.07.png]
Zero for the same reason.

The exchange-correlation term, how to make the basis function gradients 
zero? (Last term.)
[image: 截屏2024-02-20 下午4.16.52.png]


在2024年2月19日星期一 UTC-6 02:35:30<Jürg Hutter> 写道:

> Hi
>
> you are having most of term correct. The 1-center terms only depend on
> the atomic positions through the coefficients C'. The derivatives wrt the 
> local functions are in fact zero. You can best see that by inspecting their 
> dependencies
> on the molecular geometry.
>
> If you wish you can download the thesis of Gerald Lippert from this link 
> (expires in
> early March).
>
>
> https://filesender.switch.ch/filesender2/?s=download&token=7549a87c-9cad-44b0-9138-45a53c6f796a
>
> It is in German but has all the formulas in great detail. To compare to 
> the current
> implementation in CP2K you have to set the two compensation charges
> (hard and soft) equal. This simplifies the formulas slightly.
>
> regards
> JH
>
> ________________________________________
> From: cp... at googlegroups.com <cp... at googlegroups.com> on behalf of zc62 <
> chenz... at gmail.com>
> Sent: Friday, February 16, 2024 10:51 PM
> To: cp2k
> Subject: [CP2K:19924] Understanding GAPW gradient implementation: why many 
> terms are not calculated?
>
> Hi,
>
> Recently I have been trying to derive GAPW nuclear coordinate gradients 
> (somehow they are not presented in the 1999 and 2000 GAPW papers) and 
> compare with the actual implementation, but there are a few places I could 
> not understand.
>
> [截屏2024-02-16 下午3.35.17.png]
> Above shows what I have derived for Hartree and Exc (without density 
> matrix derivative terms). However, the actual implementation does not have 
> any 1c terms implemented. To be specific, they are:
>
> 1. C' derivatives. C' is calculated from the projection, and the overlap 
> between the projector at A and basis at B certainly will change.
> 2. For the compensation density (rho0), the integral of g_A^lm gradient 
> with V_H is calculated in qs_rho0_ggrid.F on the global grid, but the 
> corresponding local grid integral is not calculated (if I did not miss it).
> 3. All the local grid integrals involve the gradient of basis functions 
> are not calculated (at least not in hartree_local_methods.F).
>
> According to my numerical tests, the analytic gradients do agree with 
> numerical differentiations, but I do feel that I am unable to correctly 
> understand why these terms should be zero. Can you help me develop a proper 
> understanding for this?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups 
> "cp2k" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cp2k+uns... at googlegroups.com<mailto:cp2k+uns... at googlegroups.com
> >.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/cp2k/28b358d5-3ccb-4e54-8649-f5ce588c54a2n%40googlegroups.com
> <
> https://groups.google.com/d/msgid/cp2k/28b358d5-3ccb-4e54-8649-f5ce588c54a2n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>

-- 
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/591a2738-8b05-45fe-ac45-3a88ac2ea434n%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20240221/96d819c2/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ??2024-02-21 ??5.45.49.png
Type: image/png
Size: 31985 bytes
Desc: not available
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20240221/96d819c2/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ??2024-02-20 ??4.13.07.png
Type: image/png
Size: 97546 bytes
Desc: not available
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20240221/96d819c2/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ??2024-02-20 ??4.16.52.png
Type: image/png
Size: 55215 bytes
Desc: not available
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20240221/96d819c2/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ??2024-02-20 ??4.10.31.png
Type: image/png
Size: 122242 bytes
Desc: not available
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20240221/96d819c2/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1c_integrals.nb
Type: application/mathematica
Size: 24291 bytes
Desc: not available
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20240221/96d819c2/attachment-0001.nb>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ??2024-02-21 ??3.36.49.png
Type: image/png
Size: 36579 bytes
Desc: not available
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20240221/96d819c2/attachment-0009.png>


More information about the CP2K-user mailing list