[CP2K-user] [CP2K:17630] CEO_OPT TDDFT

Anna Hehn hehnanna at gmail.com
Thu Sep 8 10:05:57 UTC 2022


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


Am Do., 8. Sept. 2022 um 11:40 Uhr schrieb yan huang <
huangtingyanyi at gmail.com>:

> 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
>
> 在2022年9月6日星期二 UTC+8 17:25:06<hehn... at gmail.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,"P
>> ROPERTIES%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
>>
>> Am So., 4. Sept. 2022 um 10:38 Uhr schrieb yan huang <
>> huangti... at gmail.com>:
>>
>>> 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
>>> 在2022年9月4日星期日 UTC+8 08:01:07<hehn... at gmail.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
>>>>
>>>> Am Sa., 3. Sept. 2022 um 11:52 Uhr schrieb yan huang <
>>>> huangti... at gmail.com>:
>>>>
>>>>> 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
>>>>>
>>>>> 在2022年8月29日星期一 UTC+8 05:44:39<hehn... at gmail.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
>>>>>>
>>>>>>
>>>>>> Am Sa., 27. Aug. 2022 um 06:14 Uhr schrieb yan huang <
>>>>>> huangti... at gmail.com>:
>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>> 在2022年8月25日星期四 UTC+8 19:05:15<hehn... at gmail.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
>>>>>>>>
>>>>>>>> Am Do., 25. Aug. 2022 um 11:46 Uhr schrieb yan huang <
>>>>>>>> huangti... at gmail.com>:
>>>>>>>>
>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> 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/04c2649f-9a63-4d7a-ba69-295901a7482en%40googlegroups.com
>>>>>>>>> <https://groups.google.com/d/msgid/cp2k/04c2649f-9a63-4d7a-ba69-295901a7482en%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/674eb227-d64e-4b6e-bd40-c83fe4d8e11an%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/cp2k/674eb227-d64e-4b6e-bd40-c83fe4d8e11an%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/ad1dd997-c301-4866-979e-93a41e699d98n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/cp2k/ad1dd997-c301-4866-979e-93a41e699d98n%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/be5b6b75-f714-46db-b23d-74e1337e7c9dn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/cp2k/be5b6b75-f714-46db-b23d-74e1337e7c9dn%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/89aa80af-d8ac-48f1-9bdc-dfd1c57c89a6n%40googlegroups.com
> <https://groups.google.com/d/msgid/cp2k/89aa80af-d8ac-48f1-9bdc-dfd1c57c89a6n%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/CACM8JBmp%3DJ60iDaPJ%3D8TvujuOMmrMCpsH2d4wmKXynzd%3DdHidg%40mail.gmail.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20220908/07c44c38/attachment-0001.htm>


More information about the CP2K-user mailing list