CEO_OPT TDDFT

455 views
Skip to first unread message

yan huang

unread,
Aug 25, 2022, 5:46:32 AM8/25/22
to cp2k
Dear all,

Now I want to get the first excited state structure,  should I add the following lines in cp2k 9.1?

   &EXCITED_STATES
     STATE 1
     XC_KERNEL_METHOD BEST_AVAILABLE
   &END EXCITED_STATES

Thanks & regards
Best,
Yan

Anna Hehn

unread,
Aug 25, 2022, 7:05:15 AM8/25/22
to cp...@googlegroups.com
Dear Yan,

you should add the EXCITED_STATES section in the DFT section, specifying the state to be optimized, and in the PROPERTIES section you can define the kernel to be used. I would recommend to use an ADMM-approximated hybrid functional kernel for high accuracy. 
For more details have a look at the tutorial on the CP2K website, https://www.cp2k.org/howto:tddft. Also you can find further exemplary input files of corresponding publications on the Materials Cloud platform, https://archive.materialscloud.org/record/2022.81.

Let me know in case of further questions,

best regards,

Anna

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/04c2649f-9a63-4d7a-ba69-295901a7482en%40googlegroups.com.

yan huang

unread,
Aug 27, 2022, 12:14:13 AM8/27/22
to cp2k
Dear Anna,

  Thank you very much for you reply! I run the example for the CP2K and get the opt-pos-1.xyz file.  I want to know if the  opt-pos-1.xyz  is the excited-state structure?
the inp file、out file and xyz file have been attatced.

best regards,

Yan
tddft.inp
opt-pos-1.xyz
opt.out

Anna Hehn

unread,
Aug 28, 2022, 5:44:39 PM8/28/22
to cp...@googlegroups.com
Dear Yan,

please excuse the late reply. Yes, the structure of the state that is optimized is printed in the xyz file. 

Best regards

Anna
  

yan huang

unread,
Sep 3, 2022, 5:52:09 AM9/3/22
to cp2k

Dear Anna,

Thank you very much for your reply! Recently, I calculated the structure of excited states for my system. Because of the large system, I used the PBE functional instead of the hybrid functional. But I found excited stated forces reach the maximun number of iterations, did't converge. I want to konw how to increase the  the maximun number of iterations (default : 100)? 

the inp file、out file and xyz file have been attatced.


      92        PCG       F         0.13E-01      0.0000000422     1245.73
       93        PCG       F         0.39E-01      0.0000000362     1259.35
       94        PCG       F         0.37E-01      0.0000000446     1272.88
       95        PCG       F         0.24E-01      0.0000000310     1286.32
       96        PCG       F         0.47E-01      0.0000000218     1299.98
       97        PCG       F         0.44E-01      0.0000000422     1313.46
       98        PCG       F         0.11E-01      0.0000000248     1327.00
       99        PCG       F         0.40E-01      0.0000000205     1340.44
      100        PCG       F         0.23E-01      0.0000000206     1353.98
  The linear solver didn't converge! Maximum number of iterations reached.
  DEBUG:: Pz*dT                       0.02698408      0.01755403      0.08408835
  DEBUG:: Pz*dHppl                   -0.00172389     -0.00192144     -0.00758440
  DEBUG:: Pz*dHppnl                   0.00203508      0.00898434      0.03836144
  DEBUG:: Force Pz*dHcore          0.02729528      0.02461693      0.11486539
  DEBUG:: Pz*dVhxc                   -0.05201569     -0.05475358     -0.22575630
  DEBUG:: Vh(rhoz)*dncore            -0.08077092     -0.03255382     -0.27401921
  DEBUG:: Pin*dK*rhoz                 0.09644318      0.04774496      0.32286211
  DEBUG:: Force Pin*V(rhoz)       -0.03634344     -0.03956245     -0.17691341
  DEBUG:: Wz*dS                      -0.00842473      0.00079797     -0.00826806
  DEBUG:: Response Force          -0.01747288     -0.01414755     -0.07031609
  DEBUG:: Total Force             -0.01747288     -0.01414755     -0.07031609

 

Best regards

 

Yan Huang

Co.xyz
opt.out
opt.inp

Anna Hehn

unread,
Sep 3, 2022, 8:01:07 PM9/3/22
to cp...@googlegroups.com
Dear Yan,

there is a MAX_ITER keyword in the LINRES section of the PROPERTIES section (and also in the TDDFPT section). 
The number of max SCF cycles in OUTER_SCF should be chosen as large as needed and in the inner SCF the number should be smaller, so the other way around.
Maybe one could also try different optimizers like DIIS.

Best regards,

Anna 

yan huang

unread,
Sep 4, 2022, 4:37:58 AM9/4/22
to cp2k

Dear Anna,

Thank you very much for your reply! I have been added the MAX_ITER keyword  (default : 50) in the LINRES section and set the value 300. But it didn't change the maximun number of excited stated forces iterations. 

  &PROPERTIES
    &TDDFPT
      KERNEL FULL
      NSTATES   5
      MAX_ITER 300
      CONVERGENCE [eV] 1E-6
      RKS_TRIPLETS .F.
      &DIPOLE_MOMENTS
        DIPOLE_FORM BERRY
      &END DIPOLE_MOMENTS
      &XC                          
        &XC_FUNCTIONAL PBE        
        &END XC_FUNCTIONAL            
      &END XC      
    &END TDDFPT
   
    &LINRES
      MAX_ITER 300
    &END LINRES
  &END PROPERTIES
&END FORCE_EVAL


      87        PCG       F         0.40E-01      0.0000000203     1189.10
       88        PCG       F         0.15E-01      0.0000000073     1202.69
       89        PCG       F         0.32E-01      0.0000000106     1216.32
       90        PCG       F         0.30E-01      0.0000000073     1230.02
       91        PCG       F         0.24E-01      0.0000000145     1243.78
       92        PCG       F         0.26E-01      0.0000000052     1257.48
       93        PCG       F         0.81E-01      0.0000000051     1271.12
       94        PCG       F         0.71E-01      0.0000000069     1284.73
       95        PCG       F         0.30E-01      0.0000000066     1298.31
       96        PCG       F         0.38E-01      0.0000000046     1311.90
       97        PCG       F         0.82E-01      0.0000000042     1325.66
       98        PCG       F         0.44E-01      0.0000000064     1339.29
       99        PCG       F         0.25E-01      0.0000000046     1352.89
      100        PCG       F         0.23E-01      0.0000000068     1366.48

  The linear solver didn't converge! Maximum number of iterations reached.
  DEBUG:: Pz*dT                       0.00157382      0.00048231      0.00736383
  DEBUG:: Pz*dHppl                   -0.00008937     -0.00004994     -0.00067884
  DEBUG:: Pz*dHppnl                  -0.00001782      0.00017519      0.00369994
  DEBUG:: Force Pz*dHcore          0.00146663      0.00060756      0.01038493
  DEBUG:: Pz*dVhxc                   -0.00331493     -0.00167409     -0.01979951
  DEBUG:: Vh(rhoz)*dncore            -0.00513353     -0.00008315     -0.02284556
  DEBUG:: Pin*dK*rhoz                 0.00716620      0.00070356      0.02667802
  DEBUG:: Force Pin*V(rhoz)       -0.00128226     -0.00105368     -0.01596705
  DEBUG:: Wz*dS                      -0.00140176      0.00003803     -0.00036498
  DEBUG:: Response Force          -0.00121739     -0.00040810     -0.00594710
  DEBUG:: Total Force             -0.00121739     -0.00040810     -0.00594710

Best regards

 

Yan Huang

opt.inp
opt.out

Anna Hehn

unread,
Sep 6, 2022, 5:25:06 AM9/6/22
to cp...@googlegroups.com
Dear Yan,

yes please excuse, you're right that this is not a default option in the trunk.
Please just add the following 3 lines in src/excited_states.F instead of the already existing line 115:

  NULLIFY (linres_section)

            linres_section => section_vals_get_subs_vals(qs_env%input,"PROPERTIES%LINRES")

            CALL response_equation(qs_env, p_env,ex_env%cpmos,unit_nr,lr_section=linres_section)


also initializing the variable at the beginning of excited_state_energy subroutine: 

TYPE(section_vals_type), POINTER                   :: linres_section


You can also use my branch maxiter which I just generated and download it from GitHub. 


However, I would also consider modifying your settings. As far as I know, CENTER_COORDINATES should be used in combination with molecules and not periodic systems. Also you could maybe check convergence of grids for your system etc.


I hope this helps, again please excuse the inconvenience and let me know if I can help with any further questions.


Best reagrds


Anna


yan huang

unread,
Sep 8, 2022, 5:40:45 AM9/8/22
to cp2k

Dear Anna,

Thank you very much for your reply! I have been added the following 3 lines in src/excited_states.F instead of the already existing line 115:

            IF (dft_control%qs_control%semi_empirical) THEN


            NULLIFY (linres_section)
                      linres_section => section_vals_get_subs_vals(qs_env%input,"PROPERTIES%LINRES")
                      CALL response_equation(qs_env, p_env,ex_env%cpmos,unit_nr,lr_section=linres_section)

            ELSEIF (dft_control%qs_control%dftb) THEN

also initializing the variable at the beginning of excited_state_energy subroutine: 

      TYPE(qs_p_env_type), POINTER                       :: p_env
      TYPE(section_vals_type), POINTER                   :: linres_section

After recompiling and reinstalling, I still can't fix the problem  changing the maximun number of excited stated forces iterations . Can you give me the link to  your   GitHub?
And is the position of LINRES section right?

    &END TDDFPT
    &LINRES
      MAX_ITER 300
    &END LINRES
  &END PROPERTIES


Best regards

 

Yan Huang


Co.xyz
opt.inp

Anna Hehn

unread,
Sep 8, 2022, 6:06:11 AM9/8/22
to cp...@googlegroups.com
Dear Yan,

yes I am sorry, I checked again and I forgot to tell you to initialize the routines. Please excuse the inconvenience.
The link to the branch is: https://github.com/annahehn/cp2k/tree/maxiter. It is more or less the latest master.

diff --git a/src/excited_states.F b/src/excited_states.F

index f06157953..581a029d1 100644

--- a/src/excited_states.F

+++ b/src/excited_states.F

@@ -34,6 +34,8 @@ MODULE excited_states

    USE response_solver,                 ONLY: response_equation,&

                                               response_force,&

                                               response_force_xtb

+   USE input_section_types,             ONLY: section_vals_get_subs_vals,&

+                                              section_vals_type

 #include "./base/base_uses.f90"

 

    IMPLICIT NONE

@@ -75,6 +77,7 @@ CONTAINS

       TYPE(qs_energy_type), POINTER                      :: energy

       TYPE(qs_force_type), DIMENSION(:), POINTER         :: ks_force, lr_force

       TYPE(qs_p_env_type)                                :: p_env

+      TYPE(section_vals_type), POINTER                   :: linres_section

 

       CALL timeset(routineN, handle)

 

@@ -107,7 +110,9 @@ CONTAINS

             CALL zero_qs_force(lr_force)

             CALL set_qs_env(qs_env, force=lr_force)

             !

-            CALL response_equation(qs_env, p_env, ex_env%cpmos, unit_nr)

+            NULLIFY (linres_section)

+            linres_section => section_vals_get_subs_vals(qs_env%input,"PROPERTIES%LINRES")

+            CALL response_equation(qs_env, p_env,ex_env%cpmos,unit_nr,lr_section=linres_section)

             !

             CALL get_qs_env(qs_env, dft_control=dft_control)

             IF (dft_control%qs_control%semi_empirical) THEN


Let me please know if installation then works and if this helps with converging the computation for your system, if not, I can try to have another look.

Best regards,

Anna

yan huang

unread,
Sep 10, 2022, 4:21:15 AM9/10/22
to cp2k
Dear Anna,

Thank you very much for your reply! I have been  solved the problem  changing the maximun number of excited stated forces iterations . But I found it more difficult to converge, and the value of convergence increase with iterations.The two out files have been attached.



Iteration    Method   Restart      Stepsize      Convergence         Time
  ------------------------------------------------------------------------------
        1        CG        F         0.00E+00      0.0010353714        0.36
        2        CG        F         0.52E+00      0.0007680304        6.90
        3        CG        F         0.37E+00      0.0012386086       13.18
        4        CG        F         0.33E+00      0.0015398605       19.51
        5        CG        F         0.20E+00      0.0014074471       25.64
        6        CG        F         0.16E+00      0.0015509455       32.12
        7        CG        F         0.15E+00      0.0022541178       38.48
        8        CG        F         0.11E+00      0.0030670538       45.10
        9        CG        F         0.83E-01      0.0037224131       51.86
       10        CG        F         0.65E-01      0.0044437804       58.47
       11        CG        F         0.53E-01      0.0053939725       64.81
       12        CG        F         0.44E-01      0.0066346043       71.04
       13        CG        F         0.36E-01      0.0082228215       77.33
       14        CG        F         0.30E-01      0.0102075903       83.70
       15        CG        F         0.26E-01      0.0125859742       90.71
       16        CG        F         0.22E-01      0.0152855073       97.42
       17        CG        F         0.18E-01      0.0181872107      103.65
       18        CG        F         0.16E-01      0.0211694290      110.23
       19        CG        F         0.14E-01      0.0241439294      116.45
       20        CG        F         0.12E-01      0.0270690365      122.81
       21        CG        F         0.10E-01      0.0299429363      129.07
       22        CG        F         0.92E-02      0.0327885753      135.68
       23        CG        F         0.83E-02      0.0356394345      142.06
       24        CG        F         0.74E-02      0.0385300372      148.71
       25        CG        F         0.67E-02      0.0414911888      155.12
       26        CG        F         0.61E-02      0.0445484675      161.36
       27        CG        F         0.56E-02      0.0477224413      167.55
       28        CG        F         0.52E-02      0.0510295412      174.13
       29        CG        F         0.48E-02      0.0544829974      180.44
       30        CG        F         0.44E-02      0.0580935825      186.76
       31        CG        F         0.41E-02      0.0618701028      193.16
       32        CG        F         0.38E-02      0.0658196763      199.75
       33        CG        F         0.36E-02      0.0699478695      206.10
       34        CG        F         0.34E-02      0.0742587654      212.47
       35        CG        F         0.32E-02      0.0787550188      218.85
       36        CG        F         0.30E-02      0.0834379381      225.58

Best regards

 

Yan Huang

opt-old.out
opt-new.out
Reply all
Reply to author
Forward
0 new messages