[CP2K-user] [CP2K:13321] Re: geometry optimization takes very long time to calculate the Hessian
hut... at chem.uzh.ch
hut... at chem.uzh.ch
Sat May 16 11:31:12 UTC 2020
Hi
the long time you notice between SCF optimizations in a geometry optimization
are not from a Hessian calculation. This is just the time needed to calculate
the nuclear gradient within HFX. This is about 3x more expensive than the first
SCF step as all integrals and their derivatives have to be calculated.
You can get some speedup using the Keywords in the HFX section that affect
screening of derivative integrals. But I would expect a rather minor effect.
regards
Juerg Hutter
--------------------------------------------------------------
Juerg Hutter Phone : ++41 44 635 4491
Institut für Chemie C FAX : ++41 44 635 6838
Universität Zürich E-mail: hut... at chem.uzh.ch
Winterthurerstrasse 190
CH-8057 Zürich, Switzerland
---------------------------------------------------------------
-----cp... at googlegroups.com wrote: -----
To: "cp2k" <cp... at googlegroups.com>
From: "Nicholas Winner"
Sent by: cp... at googlegroups.com
Date: 05/16/2020 02:51AM
Subject: [CP2K:13321] Re: geometry optimization takes very long time to calculate the Hessian
The Hessian is very expensive to calculate. You can avoid calculating the Hessian by using CG method, which is based on the gradient without the hessian. However, this is not recommended. Quasi-Netwonian methods like BFGS that use the Hessian converge very fast once you are near the minimum. If you choose not to do the BFGS, your individual steps might be faster, but its possible that it will be slower overall convergence. Since HFX calculations should always be initialized from a pre-converged GGA calculation, it is most likely close to the minimum already and just needs refinement. So BFGS makes sense. Its just the cost of doing business with hybrid calculations.
One question I have for you, why did you not use ADMM? It trades a small loss of accuracy for an immense speedup. Personally, I have seen 1000 fold improvement in calculation speed when using ADMM for some systems.
On Tuesday, September 3, 2019 at 12:17:17 PM UTC-7, Xiaoming Wang wrote:
Hello,
I am trying to do geo_opt with hybrid functionals and MOLOPT basis. I didn't use ADMM.
I know the calculation without ADMM would be very expensive. But it turned out that only
the first OT step took a longer time, the following steps are relatively cheap. However,
between every two ionic steps, it seems to take very long time to calculate the Hessian.
Is this expected for the current condition? And is there any way to reduce the time?
Here is part of the output:
OPTIMIZATION STEP: 3
--------------------------
Spin 1
Number of electrons: 865
Number of occupied orbitals: 865
Number of molecular orbitals: 865
Spin 2
Number of electrons: 863
Number of occupied orbitals: 863
Number of molecular orbitals: 863
Number of orbital functions: 2916
Number of independent orbital functions: 2916
Parameters for the always stable predictor-corrector (ASPC) method:
ASPC order: 1
B(1) = 2.500000
B(2) = -2.000000
B(3) = 0.500000
Parameters for the always stable predictor-corrector (ASPC) method:
ASPC order: 1
B(1) = 2.500000
B(2) = -2.000000
B(3) = 0.500000
Extrapolation method: ASPC
SCF WAVEFUNCTION OPTIMIZATION
----------------------------------- OT ---------------------------------------
Allowing for rotations
Minimizer : CG : conjugate gradient
Preconditioner : FULL_KINETIC : inversion of T + eS
Precond_solver : DEFAULT
Line search : 2PNT : 2 energies, one gradient
stepsize : 0.15000000 energy_gap : 0.00100000
eps_taylor : 0.10000E-15 max_taylor : 4
----------------------------------- OT ---------------------------------------
Step Update method Time Convergence Total energy Change
------------------------------------------------------------------------------
HFX_MEM_INFO| Est. max. program size before HFX [MiB]: 18930
HFX_MEM_INFO| Number of cart. primitive ERI's calculated: 38624794188272
HFX_MEM_INFO| Number of sph. ERI's calculated: 5756863922070
HFX_MEM_INFO| Number of sph. ERI's stored in-core: 5727923021897
HFX_MEM_INFO| Number of sph. ERI's stored on disk: 0
HFX_MEM_INFO| Number of sph. ERI's calculated on the fly: 0
HFX_MEM_INFO| Total memory consumption ERI's RAM [MiB]: 5164770
HFX_MEM_INFO| Whereof max-vals [MiB]: 1233
HFX_MEM_INFO| Total compression factor ERI's RAM: 8.46
HFX_MEM_INFO| Total memory consumption ERI's disk [MiB]: 0
HFX_MEM_INFO| Total compression factor ERI's disk: 0.00
HFX_MEM_INFO| Size of density/Fock matrix [MiB]: 128
HFX_MEM_INFO| Size of buffers [MiB]: 2
HFX_MEM_INFO| Number of periodic image cells considered: 33
HFX_MEM_INFO| Est. max. program size after HFX [MiB]: 18871
1 OT CG 0.15E+00 337.0 0.00012275 -7323.9604751264 -7.32E+03
2 OT LS 0.77E-01 20.9 -7323.9605963412
3 OT CG 0.77E-01 21.3 0.00005254 -7323.9619119441 -1.44E-03
4 OT LS 0.69E-01 21.1 -7323.9621490010
5 OT CG 0.69E-01 21.3 0.00003333 -7323.9621521424 -2.40E-04
6 OT LS 0.65E-01 21.0 -7323.9622430025
7 OT CG 0.65E-01 21.3 0.00001976 -7323.9622432955 -9.12E-05
8 OT LS 0.58E-01 21.0 -7323.9622712907
9 OT CG 0.58E-01 21.2 0.00001132 -7323.9622717428 -2.84E-05
10 OT LS 0.68E-01 21.1 -7323.9622824556
11 OT CG 0.68E-01 21.2 0.00000720 -7323.9622826949 -1.10E-05
12 OT LS 0.73E-01 21.1 -7323.9622874241
13 OT CG 0.73E-01 21.2 0.00000482 -7323.9622874446 -4.75E-06
14 OT LS 0.82E-01 21.0 -7323.9622898107
15 OT CG 0.82E-01 21.2 0.00000382 -7323.9622898422 -2.40E-06
16 OT LS 0.73E-01 21.0 -7323.9622911751
17 OT CG 0.73E-01 21.3 0.00000296 -7323.9622911933 -1.35E-06
18 OT LS 0.81E-01 21.0 -7323.9622920761
19 OT CG 0.81E-01 21.2 0.00000231 -7323.9622920831 -8.90E-07
20 OT LS 0.93E-01 21.2 -7323.9622926954
Leaving inner SCF loop after reaching 20 steps.
Electronic density on regular grids: -1727.9999999402 0.0000000598
Core density on regular grids: 1727.9999999265 -0.0000000735
Total charge density on r-space grids: -0.0000000137
Total charge density g-space grids: -0.0000000137
Overlap energy of the core charge distribution: 0.00000000000265
Self energy of the core charge distribution: -14074.58786311355834
Core Hamiltonian energy: 4408.80717501710569
Hartree energy: 4095.52826292682403
Exchange-correlation energy: -671.83062536674151
Hartree-Fock Exchange energy: -1081.87924215901262
Total energy: -7323.96229269538162
outer SCF iter = 1 RMS gradient = 0.23E-05 energy = -7323.9622926954
----------------------------------- OT ---------------------------------------
Allowing for rotations
Minimizer : CG : conjugate gradient
Preconditioner : FULL_KINETIC : inversion of T + eS
Precond_solver : DEFAULT
Line search : 2PNT : 2 energies, one gradient
stepsize : 0.15000000 energy_gap : 0.00100000
eps_taylor : 0.10000E-15 max_taylor : 4
----------------------------------- OT ---------------------------------------
Step Update method Time Convergence Total energy Change
------------------------------------------------------------------------------
1 OT CG 0.15E+00 43.0 0.00000211 -7323.9622927063 -6.23E-07
2 OT LS 0.47E-01 20.9 -7323.9622916813
3 OT CG 0.47E-01 21.2 0.00000134 -7323.9622929669 -2.61E-07
4 OT LS 0.10E+00 21.0 -7323.9622931292
5 OT CG 0.10E+00 21.2 0.00000129 -7323.9622931964 -2.29E-07
6 OT LS 0.85E-01 21.0 -7323.9622933660
7 OT CG 0.85E-01 21.4 0.00000115 -7323.9622933731 -1.77E-07
8 OT LS 0.87E-01 21.0 -7323.9622935183
9 OT CG 0.87E-01 21.2 0.00000099 -7323.9622935185 -1.45E-07
*** SCF run converged in 9 steps ***
Electronic density on regular grids: -1727.9999999401 0.0000000599
Core density on regular grids: 1727.9999999265 -0.0000000735
Total charge density on r-space grids: -0.0000000136
Total charge density g-space grids: -0.0000000136
Overlap energy of the core charge distribution: 0.00000000000265
Self energy of the core charge distribution: -14074.58786311355834
Core Hamiltonian energy: 4408.80711518344106
Hartree energy: 4095.52826732740959
Exchange-correlation energy: -671.83060828648809
Hartree-Fock Exchange energy: -1081.87920462925604
Total energy: -7323.96229351845068
outer SCF iter = 2 RMS gradient = 0.99E-06 energy = -7323.9622935185
outer SCF loop converged in 2 iterations or 29 steps
Integrated absolute spin density : 2.0000037692
Ideal and single determinant S**2 : 2.000000 2.000000
HFX_MEM_INFO| Number of cart. primitive DERIV's calculated: 171964164039744
HFX_MEM_INFO| Number of sph. DERIV's calculated: 39581123230020
HFX_MEM_INFO| Number of sph. DERIV's stored in-core: 0
HFX_MEM_INFO| Number of sph. DERIV's calculated on the fly: 39581123230020
HFX_MEM_INFO| Total memory consumption DERIV's RAM [MiB]: 0
HFX_MEM_INFO| Whereof max-vals [MiB]: 16
HFX_MEM_INFO| Total compression factor DERIV's RAM: 0.00
ENERGY| Total FORCE_EVAL ( QS ) energy (a.u.): -7323.962293636419417
-------- Informations at step = 3 ------------
Optimization Method = BFGS
Total Energy = -7323.9622936364
Real energy change = -0.0007083471
Predicted change in energy = -0.0002188809
Scaling factor = 0.0000000000
Step size = 0.0453787275
Trust radius = 0.4724315332
Decrease in energy = YES
Used time = 2379.563
Convergence check :
Max. step size = 0.0453787275
Conv. limit for step size = 0.0030000000
Convergence in step size = NO
RMS step size = 0.0037943120
Conv. limit for RMS step = 0.0015000000
Convergence in RMS step = NO
Max. gradient = 0.0042154388
Conv. limit for gradients = 0.0004500000
Conv. for gradients = NO
RMS gradient = 0.0002954283
Conv. limit for RMS grad. = 0.0003000000
Conv. in RMS gradients = YES
---------------------------------------------------
As you see the 'Used time' of each ionic step is much larger than the sum of the OT steps.
Here is my input:
&GLOBAL
PROJECT_NAME NaCl
RUN_TYPE GEO_OPT
PRINT_LEVEL MEDIUM
&END GLOBAL
&FORCE_EVAL
METHOD QS
&DFT
BASIS_SET_FILE_NAME GTH_BASIS_SETS
POTENTIAL_FILE_NAME GTH_POTENTIALS
WFN_RESTART_FILE_NAME NaCl-RESTART.wfn
ROKS
MULTIP 3
&QS
EPS_PGF_ORB 1.0e-12
&END
&MGRID
CUTOFF 1400
REL_CUTOFF 40
&END MGRID
&XC
&XC_FUNCTIONAL PBE0
&END XC_FUNCTIONAL
&HF
&MEMORY
MAX_MEMORY 32000
&END
&SCREENING
EPS_SCHWARZ 1.0e-8
SCREEN_ON_INITIAL_P TRUE
&END
&INTERACTION_POTENTIAL
POTENTIAL_TYPE TRUNCATED
CUTOFF_RADIUS 6.0
T_C_G_DATA t_c_g.dat
&END
&END
&END XC
&SCF
MAX_SCF 20
EPS_SCF 1.0e-6
CHOLESKY INVERSE
SCF_GUESS RESTART
&OT
ROTATION
PRECONDITIONER FULL_KINETIC
ENERGY_GAP 0.001
&END OT
&OUTER_SCF
EPS_SCF 1.0e-6
MAX_SCF 30
&END OUTER_SCF
&END SCF
&END DFT
&SUBSYS
&CELL
ABC [angstrom] 16.92 16.92 16.92
ALPHA_BETA_GAMMA [deg] 90 90 90
PERIODIC XYZ
SYMMETRY CUBIC
&END CELL
&TOPOLOGY
COORD_FILE_FORMAT XYZ
COORD_FILE_NAME 11.xyz
&END TOPOLOGY
&KIND Na
ELEMENT Na
BASIS_SET DZVP-GTH
POTENTIAL GTH-PBE-q9
&END KIND
&KIND Cl
ELEMENT Cl
BASIS_SET DZVP-GTH
POTENTIAL GTH-PBE-q7
&END KIND
&END SUBSYS
&END FORCE_EVAL
Best,
Xiaoming
--
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 cp... at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/70b1f14e-3f84-4027-ac7c-c270588dc87e%40googlegroups.com.
More information about the CP2K-user
mailing list