# A question about the f-sum and DDK calculation

**URL:** <https://discourse.abinit.org/t/a-question-about-the-f-sum-and-ddk-calculation/3055>\
**Category:** Response calculations\
**Created:** [December 18, 2021, 11:52pm UTC](https://discourse.abinit.org/t/a-question-about-the-f-sum-and-ddk-calculation/3055 "2021-12-18T23:52:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yunfan](https://discourse.abinit.org/letter_avatar_proxy/v4/letter/y/c37758/32.png) [@Yunfan](https://discourse.abinit.org/u/Yunfan)\
**Post date:** [December 18, 2021, 11:52pm UTC](https://discourse.abinit.org/t/a-question-about-the-f-sum-and-ddk-calculation/3055/1 "2021-12-18T23:52:19Z")

</div>

Dear all

I am checking my result of the DDK perturbation preparing for nonlinear optical calculation. It is a single-step calculation that only includes the DDK for the ground state.

According to the tutorial, the parameter ‘f-sum rule ratio’ should be close to 1. However, it is only 0.6 for my single-step calculation. I am wondering what is the physics meaning of this f-sum. Is it something related to the Thomas–Reiche–Kuhn sum rule?

Another question is how the DDK is calculated in ABINIT. In optical calculation, the matrix element of d(H)/d(k) is applied, so I would like to know what method is applied to calculate this matrix in ABINIT.

Best regards,

---

<div class="post-metadata">

**Author:** ![mverstra](https://discourse.abinit.org/user_avatar/discourse.abinit.org/mverstra/32/92_2.png) [@mverstra](https://discourse.abinit.org/u/mverstra)\
**Post date:** [December 19, 2021, 7:54pm UTC](https://discourse.abinit.org/t/a-question-about-the-f-sum-and-ddk-calculation/3055/2 "2021-12-19T19:54:46Z")

</div>

Hi Yunnan,

yes, the f sum rule is TRK. 0.6 means you probably need more bands to get the full oscillator strength.

The DDK is calculated from the [H,r] commutator, which picks up the kinetic energy and the non local pseudopotential terms. If you just want the matrix elements (not the DDK 1WF) there is also a run mode for abinit which gets those : see wfk\_task [Ground-State - abinit](https://docs.abinit.org/variables/gstate/#wfk_task)

---

<div class="post-metadata">

**Author:** ![Yunfan](https://discourse.abinit.org/letter_avatar_proxy/v4/letter/y/c37758/32.png) [@Yunfan](https://discourse.abinit.org/u/Yunfan)\
**Post date:** [December 20, 2021, 3:44am UTC](https://discourse.abinit.org/t/a-question-about-the-f-sum-and-ddk-calculation/3055/3 "2021-12-20T03:44:00Z")

</div>

Thank you very much for your reply!

I have tried the calculation with a larger number of bands. The value is still not close to 1, but it gets close to 1 when I remove the nline=0 from the input file. I am wondering whether the value is correctly calculated when nline=0 and whether we need to check this value in a calculation without any optimization.

The Thomas–Reiche–Kuhn sum rule has this expression, but all terms are related with n and position in reciprocal space, so I am wondering how this thing is calculated in ABINIT to get the f sum rule ratio.  
 ![image](https://discourse.abinit.org/uploads/default/original/1X/37899cbd31fdbbd76574dfd8f43619914de27283.png)

Best regards,

---

<div class="post-metadata">

**Author:** ![mverstra](https://discourse.abinit.org/user_avatar/discourse.abinit.org/mverstra/32/92_2.png) [@mverstra](https://discourse.abinit.org/u/mverstra)\
**Post date:** [December 26, 2021, 9:23pm UTC](https://discourse.abinit.org/t/a-question-about-the-f-sum-and-ddk-calculation/3055/4 "2021-12-26T21:23:54Z")

</div>

Interesting, you may be right that the quantities in the f-sum rule may not be well calculated with nline 0. Where are you getting the f-sum rule value from?

In the DFPT part of the code this is evaluated from the 1st order kinetic energy ek1 in  
95\_drive/m\_dfpt\_looppert.F90  
At this point there is a Sternheimer equivalence between the full sum over absent bands and the corresponding 1st order wave function d/dk, for which you certainly need nline \>\> 0 to get good results.

You can only use nline 0 to get the DDK matrix elements, which can be fed to optic, but then you are doing sums over states, which have to go much higher up in nband than for DFPT. If there is really a difference in the matrix elements for nline =0 and \> 0 (this had been checked very thoroughly before) we need to find out why.

---

<div class="post-metadata">

**Author:** ![Yunfan](https://discourse.abinit.org/letter_avatar_proxy/v4/letter/y/c37758/32.png) [@Yunfan](https://discourse.abinit.org/u/Yunfan)\
**Post date:** [December 27, 2021, 9:07pm UTC](https://discourse.abinit.org/t/a-question-about-the-f-sum-and-ddk-calculation/3055/5 "2021-12-27T21:07:28Z")

</div>

I get the f-sum rule from the ‘.out’ file as shown below:  
 ![image](https://discourse.abinit.org/uploads/default/original/1X/d392c9c65aac24b4b6959a09cc187890ce53e76f.png)  
I’ll check the matrix element for nline=0 and \>0. Is there a script that can directly read the 1WF file? I have tried the cut3d, but it doesn’t work.

---

<div class="post-metadata">

**Author:** ![mverstra](https://discourse.abinit.org/user_avatar/discourse.abinit.org/mverstra/32/92_2.png) [@mverstra](https://discourse.abinit.org/u/mverstra)\
**Post date:** [December 30, 2021, 9:11am UTC](https://discourse.abinit.org/t/a-question-about-the-f-sum-and-ddk-calculation/3055/6 "2021-12-30T09:11:58Z")

</div>

Hi Yufan,

So this confirms what I wrote in the other post: you are using the sternheimer expression to get the f sum rule, which goes through the perturbed wave functions, and needs full convergence with nline\>0. Perhaps we should add a warning to the output, but breaking the sum rule is indeed a demonstration that you are not at convergence

In the optics code I think there is another evaluation of the f sum using sums over states and just the non scf matrix elements.

---

<div class="post-metadata">

**Author:** ![Yunfan](https://discourse.abinit.org/letter_avatar_proxy/v4/letter/y/c37758/32.png) [@Yunfan](https://discourse.abinit.org/u/Yunfan)\
**Post date:** [December 30, 2021, 5:59pm UTC](https://discourse.abinit.org/t/a-question-about-the-f-sum-and-ddk-calculation/3055/7 "2021-12-30T17:59:17Z")

</div>

Yes, adding a warning will be really helpful. For optical utility, I still have a question. You said that the matrix is the same for nline\>0 and nline=0. Is it means that the optimization in this calculation doesn’t change the matrix elements? If it is true, the non-converged result should be OK for optical calculation.

Best regards,

---

<div class="post-metadata">

**Author:** ![mverstra](https://discourse.abinit.org/user_avatar/discourse.abinit.org/mverstra/32/92_2.png) [@mverstra](https://discourse.abinit.org/u/mverstra)\
**Post date:** [May 16, 2022, 3:25pm UTC](https://discourse.abinit.org/t/a-question-about-the-f-sum-and-ddk-calculation/3055/8 "2022-05-16T15:25:41Z")

</div>

The optic calculation should be correct indeed.
