Energy from restart file not equal to energy at the end of geo opt

66 views
Skip to first unread message

Bram Van der Linden

unread,
Dec 4, 2024, 6:43:48 PM12/4/24
to cp2k
Dear all,

I was following this tutorial: Geometry Optimisation — CP2K documentation
If I perform the geo opt, I get the snippet below at the end of the output file.
If I do an energy calculation from the restart file, I obtain that
ENERGY| Total FORCE_EVAL ( QS ) energy [a.u.]:              -17.164620477328342a
So, the energy of the energy calculation is equal to the energy at the last step (11), it is not equal to the energy that is recomputed after the last geometry optimization step.
Could someone explain why this is the case?
Many thanks in advance!
Bram

--------  Informations at step =    11 ------------
  Optimization Method        =                   SD
  Total Energy               =       -17.1646204773
  Real energy change         =        -0.0000000529
  Decrease in energy         =                  YES
  Used time                  =                2.886

  Convergence check :
  Max. step size             =         0.0003393777
  Conv. limit for step size  =         0.0010000000
  Convergence in step size   =                  YES
  RMS step size              =         0.0001493511
  Conv. limit for RMS step   =         0.0010000000
  Convergence in RMS step    =                  YES
  Max. gradient              =         0.0001787811
  Conv. limit for gradients  =         0.0010000000
  Conv. in gradients         =                  YES
  RMS gradient               =         0.0000786768
  Conv. limit for RMS grad.  =         0.0010000000
  Conv. in RMS gradients     =                  YES
 ---------------------------------------------------

 *******************************************************************************
 ***                    GEOMETRY OPTIMIZATION COMPLETED                      ***
 *******************************************************************************

                    Reevaluating energy at the minimum

 Number of electrons:                                                          8
 Number of occupied orbitals:                                                  4
 Number of molecular orbitals:                                                 4

 Number of orbital functions:                                                 23
 Number of independent orbital functions:                                     23

 Extrapolation method: ASPC


 SCF WAVEFUNCTION OPTIMIZATION

  Step     Update method      Time    Convergence         Total energy    Change
  ------------------------------------------------------------------------------
     1 Pulay/Diag. 0.50E+00    0.0     0.00005610       -17.1646204769 -1.72E+01
     2 Pulay/Diag. 0.50E+00    0.1     0.00000563       -17.1646347273 -1.43E-05

  *** SCF run converged in     2 steps ***


  Electronic density on regular grids:         -8.0000016293       -0.0000016293
  Core density on regular grids:                7.9999992519       -0.0000007481
  Total charge density on r-space grids:       -0.0000023775
  Total charge density g-space grids:          -0.0000023775

  Overlap energy of the core charge distribution:               0.00000004555422
  Self energy of the core charge distribution:                -43.83289054591484
  Core Hamiltonian energy:                                     12.82175609863938
  Hartree energy:                                              17.97395116248504
  Exchange-correlation energy:                                 -4.12745148803461

  Total energy:                                               -17.16463472727081

 ENERGY| Total FORCE_EVAL ( QS ) energy [a.u.]:              -17.164634727270808

Jürg Hutter

unread,
Dec 5, 2024, 8:11:19 AM12/5/24
to cp...@googlegroups.com
Hi

this is due to the very loose accuracy/convergence settings in this example.
In the final calculation an additional SCF step is perfomed (the first energy
is the same as at the end of the geometry optimization).
This single SCF step decreases the energy by another 10^-5 au.
Tighter settings (e.g. EPS_SCF 10^-7) will decrease this difference.

regards
JH

________________________________________
From: cp...@googlegroups.com <cp...@googlegroups.com> on behalf of Bram Van der Linden <bramvdl...@gmail.com>
Sent: Thursday, December 5, 2024 12:43 AM
To: cp2k
Subject: [CP2K:20945] Energy from restart file not equal to energy at the end of geo opt

Dear all,

I was following this tutorial: Geometry Optimisation — CP2K documentation<https://manual.cp2k.org/trunk/methods/optimization/geometry.html>
--
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 visit https://groups.google.com/d/msgid/cp2k/7bd75aef-e648-41ca-b4c0-cab444f39165n%40googlegroups.com<https://groups.google.com/d/msgid/cp2k/7bd75aef-e648-41ca-b4c0-cab444f39165n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Bram Van der Linden

unread,
Dec 5, 2024, 8:18:46 AM12/5/24
to cp2k
Dear Jurg,

Thank you for your answer. Does this mean that the final energy calculation in a geo opt uses slightly different coordinates than the ones reported in the restart file?
Otherwise I do not understand why an energy calculation from the restart file yields the same energy as the energy at step 11, and not the final energy from the geo opt.

With kind regards,

Bram

Op donderdag 5 december 2024 om 14:11:19 UTC+1 schreef Jürg Hutter:

Bram Van der Linden

unread,
Dec 5, 2024, 8:34:04 AM12/5/24
to cp2k
I set EPS_DEFAULT to 1e-14 and EPS_SCF to 1e-7.
I included the geo opt result below.
If I do an energy calculation from the restart, I obtain
ENERGY| Total FORCE_EVAL ( QS ) energy [a.u.]:              -17.164621690030497
So, again this energy is equal to the energy at the last step, it is not equal to the energy computed in the final scf of the geo opt.



 SCF WAVEFUNCTION OPTIMIZATION

  Step     Update method      Time    Convergence         Total energy    Change
  ------------------------------------------------------------------------------
     1 Pulay/Diag. 0.50E+00    0.0     0.00028837       -17.1646216823 -1.72E+01
     2 Pulay/Diag. 0.50E+00    0.1     0.00002417       -17.1647099510 -8.83E-05
     3 Pulay/Diag. 0.50E+00    0.1     0.00001927       -17.1646218371  8.81E-05
     4 Pulay/Diag. 0.50E+00    0.1     0.00000930       -17.1646577256 -3.59E-05
     5 Pulay/Diag. 0.50E+00    0.2     0.00000078       -17.1646200227  3.77E-05
     6 Pulay/Diag. 0.50E+00    0.2     0.00000021       -17.1646214825 -1.46E-06
     7 Pulay/Diag. 0.50E+00    0.1     0.00000007       -17.1646216684 -1.86E-07

  *** SCF run converged in     7 steps ***


  Electronic density on regular grids:         -8.0000018479       -0.0000018479
  Core density on regular grids:                7.9999994863       -0.0000005137
  Total charge density on r-space grids:       -0.0000023616
  Total charge density g-space grids:          -0.0000023616

  Overlap energy of the core charge distribution:               0.00000004553664

  Self energy of the core charge distribution:                -43.83289054591484
  Core Hamiltonian energy:                                     12.82173498735973
  Hartree energy:                                              17.97397572044687
  Exchange-correlation energy:                                 -4.12744187580467

  Total energy:                                               -17.16462166837628

 ENERGY| Total FORCE_EVAL ( QS ) energy [a.u.]:              -17.164621690030479

 *******************************************************************************
 ***                 BRENT   - NUMBER OF ENERGY EVALUATIONS :       4        ***
 *******************************************************************************

 --------  Informations at step =    10 ------------
  Optimization Method        =                   CG
  Total Energy               =       -17.1646216900
  Real energy change         =        -0.0000000430

  Decrease in energy         =                  YES
  Used time                  =               14.528

  Convergence check :
  Max. step size             =         0.0005485208

  Conv. limit for step size  =         0.0010000000
  Convergence in step size   =                  YES
  RMS step size              =         0.0002589937

  Conv. limit for RMS step   =         0.0010000000
  Convergence in RMS step    =                  YES
  Max. gradient              =         0.0002215760

  Conv. limit for gradients  =         0.0010000000
  Conv. in gradients         =                  YES
  RMS gradient               =         0.0001046210

  Conv. limit for RMS grad.  =         0.0010000000
  Conv. in RMS gradients     =                  YES
 ---------------------------------------------------

 *******************************************************************************
 ***                    GEOMETRY OPTIMIZATION COMPLETED                      ***
 *******************************************************************************

                    Reevaluating energy at the minimum

 Number of electrons:                                                          8
 Number of occupied orbitals:                                                  4
 Number of molecular orbitals:                                                 4

 Number of orbital functions:                                                 23
 Number of independent orbital functions:                                     23

 Extrapolation method: ASPC


 SCF WAVEFUNCTION OPTIMIZATION

  Step     Update method      Time    Convergence         Total energy    Change
  ------------------------------------------------------------------------------
     1 Pulay/Diag. 0.50E+00    0.1     0.00010461       -17.1646216890 -1.72E+01
     2 Pulay/Diag. 0.50E+00    0.1     0.00000907       -17.1646546064 -3.29E-05
     3 Pulay/Diag. 0.50E+00    0.1     0.00000721       -17.1646212859  3.33E-05
     4 Pulay/Diag. 0.50E+00    0.1     0.00000339       -17.1646345270 -1.32E-05
     5 Pulay/Diag. 0.50E+00    0.1     0.00000029       -17.1646210776  1.34E-05
     6 Pulay/Diag. 0.50E+00    0.1     0.00000007       -17.1646216153 -5.38E-07

  *** SCF run converged in     6 steps ***


  Electronic density on regular grids:         -8.0000018479       -0.0000018479
  Core density on regular grids:                7.9999994863       -0.0000005137
  Total charge density on r-space grids:       -0.0000023616
  Total charge density g-space grids:          -0.0000023616

  Overlap energy of the core charge distribution:               0.00000004553565

  Self energy of the core charge distribution:                -43.83289054591484
  Core Hamiltonian energy:                                     12.82173337728078
  Hartree energy:                                              17.97397690071527
  Exchange-correlation energy:                                 -4.12744139290861

  Total energy:                                               -17.16462161529174

 ENERGY| Total FORCE_EVAL ( QS ) energy [a.u.]:              -17.164621615291743

Op donderdag 5 december 2024 om 14:18:46 UTC+1 schreef Bram Van der Linden:
Reply all
Reply to author
Forward
0 new messages