Understanding GAPW gradient implementation: why many terms are not calculated?

120 views
Skip to first unread message

zc62

unread,
Feb 16, 2024, 4:51:13 PM2/16/24
to cp2k
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!

Jürg Hutter

unread,
Feb 19, 2024, 3:35:30 AM2/19/24
to cp...@googlegroups.com
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...@googlegroups.com <cp...@googlegroups.com> on behalf of zc62 <chenz...@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...@googlegroups.com<mailto:cp2k+uns...@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>.
截屏2024-02-16 下午3.35.17.png

zc62

unread,
Feb 21, 2024, 6:51:45 PM2/21/24
to cp2k
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:截屏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.
截屏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):

截屏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):
截屏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.)
截屏2024-02-20 下午4.16.52.png

1c_integrals.nb
Reply all
Reply to author
Forward
0 new messages