[CP2K-user] [CP2K:17627] Re: Large discrepancy in xTB results from CP2K vs DFTB+

Magnus Rahm magnus at compulartech.com
Wed Sep 7 14:42:30 UTC 2022


If you downloaded or cloned the repo at d56aa67 the bug fix is included. 
Safest approach to compare the versions is probably not a cell optimization 
but a single-point calculation (RUN_TYPE ENERGY_FORCE). The EV-curves in my 
post indicate that cell relaxation with the new version would (probably 
erroneously) have led to a very small cell as well, even though the 
underlying energies have changed significantly.

Kind regards,
Magnus Rahm
On Wednesday, September 7, 2022 at 3:11:08 PM UTC+2 jazz... at gmail.com wrote:

> >> Could you remind me how to update CP2K 2022.1 to include this bug fix?
>
> > I think the easiest approach is to use Docker (following these 
> instructions: https://github.com/cp2k/cp2k/tree/master/tools/docker), 
> unless you want to clone the CP2K repo from github and compile from scratch.
>
> I tried yesterday with git clone and started from scratch. The downloaded 
> version (git:d56aa67) should have the xTB bug fix mentioned above (?), but 
> when I run variable-cell optimizations of beta-HMX with various EPS_DEFAULT 
> I find the exact same results as with CP2K 7.1. What's the right git 
> version for this bug fix? Should I copy the git folder instead of using git 
> clone? I mean, how to get the Trunk version you're talking about?
>
> On Wed, Sep 7, 2022 at 7:20 AM Magnus Rahm <mag... at compulartech.com> 
> wrote:
>
>> Btw, I can confirm that the energy now converges with EPS_DEFAULT also 
>> for the LiO2 system, although the convergence is perhaps a bit slower 
>> (=very small EPS_DEFAULT values needed) than what one might have expected 
>> (see LiO2-EPS_DEFAULT.pdf). The figure I attached in my previous post was 
>> made with EPS_DEFAULT at the default value, if I use 1e-24 I get a bit 
>> closer to DFTB+ but still there is a weird slope in the E-V curve 
>> (EV-LiO2.pdf).
>>
>> Furthermore, I had a look at the energy broken down into its different 
>> contributions as a function of volume (LiO2-energies-split.pdf), and FWIW 
>> it indicates that the electronic energy is responsible for the unexpected 
>> slope in the E-V curve  (perhaps that was already obvious?).
>>
>> > Could you remind me how to update CP2K 2022.1 to include this bug fix?
>>
>> I think the easiest approach is to use Docker (following these 
>> instructions: https://github.com/cp2k/cp2k/tree/master/tools/docker), 
>> unless you want to clone the CP2K repo from github and compile from scratch.
>>
>> Kind regards,
>> Magnus Rahm
>>
>>
>> On Wednesday, September 7, 2022 at 2:16:23 AM UTC+2 jazz... at gmail.com 
>> wrote:
>>
>>> Thank you. Could you remind me how to update CP2K 2022.1 to include this 
>>> bug fix?
>>>
>>> On Tue, Sep 6, 2022 at 10:36 AM Jürg Hutter <hut... at chem.uzh.ch> wrote:
>>>
>>>> Hi
>>>>
>>>> the updates are now on Github (Trunk version).
>>>> This should at least fix the strange behavior for changes of 
>>>> EPS_DEFAULT.
>>>>
>>>> regards
>>>>
>>>> JH
>>>>
>>>> ________________________________________
>>>> From: cp... at googlegroups.com <cp... at googlegroups.com> on behalf of 
>>>> Jürg Hutter <hut... at chem.uzh.ch>
>>>> Sent: Tuesday, September 6, 2022 11:37 AM
>>>> To: cp... at googlegroups.com
>>>> Subject: Re: [CP2K:17614] Re: Large discrepancy in xTB results from 
>>>> CP2K vs DFTB+
>>>>
>>>> Hi
>>>>
>>>> I think I found the problem. This is in fact a bug in CP2K and is 
>>>> related to the damping of
>>>> the "short range" part of the Coulomb term. As mentioned before this 
>>>> short range part
>>>> is not short range at all, even diverging in periodic systems. We use a 
>>>> damping function
>>>> for this term and the radius is taken from the range of the basis 
>>>> function on each atom.
>>>> The bug is now, that this range is not a constant but depends on 
>>>> EPS_DEFAULT.
>>>> I will work on a solution, but at least the default settings will cause 
>>>> considerable changes
>>>> in the energies of periodic systems.
>>>>
>>>> regards
>>>>
>>>> JH
>>>>
>>>> ________________________________________
>>>> From: cp... at googlegroups.com <cp... at googlegroups.com> on behalf of 
>>>> Magnus Rahm <mag... at compulartech.com>
>>>> Sent: Monday, September 5, 2022 3:19 PM
>>>> To: cp2k
>>>> Subject: Re: [CP2K:17609] Re: Large discrepancy in xTB results from 
>>>> CP2K vs DFTB+
>>>>
>>>> Hi,
>>>>
>>>> Thank you for valuable input! Here's a breakdown of energies for a 
>>>> periodic LiO2 system (where CP2K and DFTB+ disagree).
>>>> CP2K:
>>>>
>>>>   Core Hamiltonian energy:                                  
>>>>  -609.45757320827579
>>>>   Repulsive potential energy:                                  
>>>>  2.86335541921533
>>>>   Electronic energy:                                          
>>>> -65.73940900376786
>>>>   DFTB3 3rd order energy:                                      
>>>>  9.00274299587460
>>>>   Dispersion energy:                                          
>>>>  -2.00065978643714
>>>>   Correction for halogen bonding:                              
>>>>  0.00000000000000
>>>>
>>>>   Total energy:                                              
>>>> -665.33154358339084
>>>>
>>>>   outer SCF iter =    1 RMS gradient =   0.49E-06 energy =       -665.
>>>> 3315435834 <(331)%20543-5834>
>>>>   outer SCF loop converged in   1 iterations or   10 steps
>>>>
>>>> And the same system with DFTB+ (I don't know this is the best breakdown 
>>>> I can get from DFTB+? This info is from detailed.out.):
>>>>
>>>> Fermi level:                        -0.1574062769 H           -4.2832 eV
>>>> Band energy:                      -254.9890864567 H        -6938.6061 eV
>>>> TS:                                  0.0000000000 H            0.0000 eV
>>>> Band free energy (E-TS):          -254.9890864567 H        -6938.6061 eV
>>>> Extrapolated E(0K):               -254.9890864567 H        -6938.6061 eV
>>>> Input / Output electrons (q):    864.0000000000    864.0000000000
>>>>
>>>> Energy H0:                        -610.3586854777 H       -16608.7049 eV
>>>> Energy SCC:                         13.1915555608 H          358.9605 eV
>>>> Total Electronic energy:          -597.1671299169 H       -16249.7444 eV
>>>> Repulsive energy:                    0.0000000000 H            0.0000 eV
>>>> Total energy:                     -597.1671299169 H       -16249.7444 eV
>>>> Extrapolated to 0:                -597.1671299169 H       -16249.7444 eV
>>>> Total Mermin free energy:         -597.1671299169 H       -16249.7444 eV
>>>> Force related energy:             -597.1671299169 H       -16249.7444 eV
>>>>
>>>>
>>>> ----------------------------------------------------------------------------------------------------------------
>>>> For reference, here are the equivalent breakdowns for the LiF molecule, 
>>>> where the total energies do match quite well.
>>>> CP2K:
>>>>
>>>>   Core Hamiltonian energy:                                    
>>>>  -5.57594122418510
>>>>   Repulsive potential energy:                                  
>>>>  0.00036401843654
>>>>   Electronic energy:                                            
>>>> 0.08477836575096
>>>>   DFTB3 3rd order energy:                                      
>>>> -0.00385103760005
>>>>   Dispersion energy:                                          
>>>>  -0.00008325087778
>>>>   Correction for halogen bonding:                              
>>>>  0.00000000000000
>>>>
>>>>   Total energy:                                                
>>>> -5.49473312847544
>>>>
>>>>   outer SCF iter =    1 RMS gradient =   0.12E-06 energy =        
>>>>  -5.4947331285
>>>>   outer SCF loop converged in   1 iterations or   25 steps
>>>>
>>>> DFTB+
>>>> Fermi level:                        -0.3434874008 <(343)%20487-4008> 
>>>> H           -9.3468 eV
>>>> Band energy:                        -3.7493389034 H         -102.0247 eV
>>>> TS:                                  0.0000000000 H            0.0000 eV
>>>> Band free energy (E-TS):            -3.7493389034 H         -102.0247 eV
>>>> Extrapolated E(0K):                 -3.7493389034 H         -102.0247 eV
>>>> Input / Output electrons (q):      8.0000000444      8.0000000000
>>>>
>>>> Energy H0:                          -5.5743451431 <(574)%20345-1431> 
>>>> H         -151.6856 eV
>>>> Energy SCC:                          0.0807122067 H            2.1963 eV
>>>> Total Electronic energy:            -5.4936329365 H         -149.4894 eV
>>>> Repulsive energy:                    0.0000000000 H            0.0000 eV
>>>> Total energy:                       -5.4936329365 H         -149.4894 eV
>>>> Extrapolated to 0:                  -5.4936329365 H         -149.4894 eV
>>>> Total Mermin free energy:           -5.4936329365 H         -149.4894 eV
>>>> Force related energy:               -5.4936329365 H         -149.4894 eV
>>>>
>>>>
>>>> ----------------------------------------------------------------------------------------------------------------
>>>>
>>>> > I recently run variable-cell optimization of various molecular 
>>>> crystals and I found xTB at CP2K ultra sensitive to EPS_DEFAULT. Tested from 
>>>> 1e-5 to 1e-24 (with EPS_SCF 1e-8), and no convergence happened.
>>>>
>>>> Thank you for sharing this info! I tried a series of calculations with 
>>>> LiO2 using varying values of EPS_DEFAULT (using default EPS_SCF) and found 
>>>> the same effect; no convergence with EPS_DEFAULT (or perhaps unreasonably 
>>>> slow convergence). I attach a figure showing these results, including the 
>>>> energy broken down into the different parts as specified in the CP2K 
>>>> output. Note the energy scale, the changes with EPS_DEFAULT are really 
>>>> quite substantial. In the LiF (non-PBC) case, the corresponding curves look 
>>>> completely flat on the same scale. I don't know what to make of this 
>>>> result, but perhaps someone else does?
>>>>
>>>> Magnus
>>>>
>>>> [X]
>>>> On Monday, September 5, 2022 at 12:18:26 PM UTC+2 jazz... at gmail.com 
>>>> wrote:
>>>> I recently run variable-cell optimization of various molecular crystals 
>>>> and I found xTB at CP2K ultra sensitive to EPS_DEFAULT. Tested from 1e-5 to 
>>>> 1e-24 (with EPS_SCF 1e-8), and no convergence happened. I just ended up 
>>>> with EPS_DEFAULT 1e-10 as a "gut" choice. Also, the behavior of xTB at CP2K is 
>>>> doutfull with MD even at ambiant conditions, where the converged volume is 
>>>> barely larget than at 0K. Depending on EPS_DEFAULT, it can even be smaller 
>>>> at ambient T. Weird. The behavior of DFTB2 at CP2K is far better.
>>>>
>>>> I found that DFTB+ has other issues. xTB at DFTB+ has no convergence 
>>>> issue, but the recommended variable-cell optimization algorithm has flaws. 
>>>> The unit cell and a supercell does NOT always end up with related lattice 
>>>> parameters. The main issue is that some 90° angles are not preserved with 
>>>> DFTB+ whereas CP2K does (with no symmetry enforced, obviously). Some 
>>>> inconsistencies appears in DFTB+ with a lattice dimensions < 10 angstroms 
>>>> in the unit cell versus > 10 angstroms in the supercell. A proper tight 
>>>> mesh of k-points does not improve. So I'm afraid that xTB at DFTB+ (or DFTB+,  
>>>> actually) cannot be a relevant choice for crystal structure predictions, 
>>>> for instance.
>>>>
>>>> xTB may be unreliable with CP2K and DFTB+, but for the different 
>>>> reasons above. You can check these weird behaviors with your own crystals 
>>>> of interest.
>>>>
>>>> Xavier
>>>>
>>>>
>>>>
>>>> Le lun. 5 sept. 2022, 3:59 AM, Jürg Hutter <hut... at chem.uzh.ch> a 
>>>> écrit :
>>>> Hi
>>>>
>>>> thank you for testing. Could you send a break down of the energies for 
>>>> the LiF molecule for
>>>> the two codes? That might help to recognize the source of the 
>>>> difference.
>>>>
>>>> regards
>>>>
>>>> JH
>>>>
>>>> ________________________________________
>>>> From: cp... at googlegroups.com <cp... at googlegroups.com> on behalf of 
>>>> Magnus Rahm <mag... at compulartech.com>
>>>> Sent: Monday, September 5, 2022 8:40 AM
>>>> To: cp2k
>>>> Subject: [CP2K:17599] Re: Large discrepancy in xTB results from CP2K vs 
>>>> DFTB+
>>>>
>>>> For the record, the problem is the same in CP2K version 2022.1.
>>>>
>>>> On Thursday, September 1, 2022 at 12:48:35 PM UTC+2 Magnus Rahm wrote:
>>>> Dear all,
>>>>
>>>> I want to use CP2K (version 8.2, trying to get a more recent version 
>>>> compiled) together with xTB for a crystal containing Li and O. I get 
>>>> strange results already for a simple LiO2 crystal:
>>>>
>>>> * There is a very large discrepancy compared to DFTB+ (version 22.1).
>>>> * Mulliken charges tend to be large, meaning that CHECK_ATOMIC_CHARGES 
>>>> stops the SCF. If I turn it off, the system tends to converge 
>>>> systematically to values just outside the "chemical range". Mulliken 
>>>> charges obtained by DFTB+ are significantly smaller (and within "chemical 
>>>> range").
>>>> * The energy-volume curve looks strange and very different from DFTB+.
>>>>
>>>> I have tried converging with respect to system size and the EWALD / 
>>>> ALPHA and GMAX parameters, but they have only a marginal impact. I have 
>>>> tried similar calculations for a number of periodic systems. Sometimes I 
>>>> get agreement, sometimes not. I also tried calculations for CO and NO 
>>>> molecules which agree perfectly between CP2K and DFTB+, whereas an 
>>>> artificial LiF molecule does not.
>>>>
>>>> A perhaps related issue was reported in 
>>>> https://groups.google.com/g/cp2k/c/oFwgGcQuySs but the solutions 
>>>> suggested there did not solve my problem.
>>>>
>>>> I attach input scripts for CP2K and DFTB+, as well as a figure showing 
>>>> the E-V curve for LiO2 obtained with CP2K and DFTB+. I'm new to CP2K, DFTB+ 
>>>> and xTB so I suspect I have made some simple mistake, and any advice is 
>>>> appreciated.
>>>>
>>>> Kind regards,
>>>> Magnus Rahm
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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/c51e70a2-7f7a-4887-8ada-971d840a1b13n%40googlegroups.com
>>>> <
>>>> https://groups.google.com/d/msgid/cp2k/c51e70a2-7f7a-4887-8ada-971d840a1b13n%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+uns... at googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/cp2k/ZR0P278MB075983A13AA78F53FFB422559F7F9%40ZR0P278MB0759.CHEP278.PROD.OUTLOOK.COM
>>>> .
>>>>
>>>> --
>>>> 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/7d455fce-a22e-44f1-ac48-18495f9553a5n%40googlegroups.com
>>>> <
>>>> https://groups.google.com/d/msgid/cp2k/7d455fce-a22e-44f1-ac48-18495f9553a5n%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+uns... at googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/cp2k/ZR0P278MB0759EEC38142F9D207742F549F7E9%40ZR0P278MB0759.CHEP278.PROD.OUTLOOK.COM
>>>> .
>>>>
>>>> -- 
>>>> 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.
>>>>
>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/cp2k/ZR0P278MB0759A3BAE12A4F8C0298072A9F7E9%40ZR0P278MB0759.CHEP278.PROD.OUTLOOK.COM
>>>> .
>>>>
>>> -- 
>> 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.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/cp2k/1234148a-7a9a-4c6b-a0c9-13caabfe8811n%40googlegroups.com 
>> <https://groups.google.com/d/msgid/cp2k/1234148a-7a9a-4c6b-a0c9-13caabfe8811n%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/e80f7efb-e11f-4e6c-bc4a-a20e0e234b57n%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20220907/5fb8aafc/attachment-0001.htm>


More information about the CP2K-user mailing list