forked from cp2k/cp2k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxc_ke_gga.F
1330 lines (1173 loc) · 52.8 KB
/
xc_ke_gga.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \brief Calculate the several different kinetic energy functionals
!> with a GGA form
!> \par History
!> JGH (26.02.2003) : OpenMP enabled
!> fawzi (04.2004) : adapted to the new xc interface
!> \author JGH (20.02.2002)
! **************************************************************************************************
MODULE xc_ke_gga
USE cp_array_utils, ONLY: cp_3d_r_cp_type
USE kinds, ONLY: dp
USE mathconstants, ONLY: pi
USE xc_derivative_desc, ONLY: deriv_norm_drho,&
deriv_norm_drhoa,&
deriv_norm_drhob,&
deriv_rho,&
deriv_rhoa,&
deriv_rhob
USE xc_derivative_set_types, ONLY: xc_derivative_set_type,&
xc_dset_get_derivative
USE xc_derivative_types, ONLY: xc_derivative_get,&
xc_derivative_type
USE xc_functionals_utilities, ONLY: calc_wave_vector,&
set_util
USE xc_input_constants, ONLY: ke_lc,&
ke_llp,&
ke_ol1,&
ke_ol2,&
ke_pbe,&
ke_pw86,&
ke_pw91,&
ke_t92
USE xc_rho_cflags_types, ONLY: xc_rho_cflags_type
USE xc_rho_set_types, ONLY: xc_rho_set_get,&
xc_rho_set_type
#include "../base/base_uses.f90"
IMPLICIT NONE
PRIVATE
REAL(KIND=dp), PARAMETER :: f13 = 1.0_dp/3.0_dp, &
f23 = 2.0_dp*f13, &
f43 = 4.0_dp*f13, &
f53 = 5.0_dp*f13
PUBLIC :: ke_gga_info, ke_gga_lda_eval, ke_gga_lsd_eval
REAL(KIND=dp) :: cf, b, b_lda, b_lsd, flda, flsd, sfac, t13
REAL(KIND=dp) :: fact, tact
REAL(KIND=dp) :: eps_rho
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'xc_ke_gga'
CONTAINS
! **************************************************************************************************
!> \brief ...
!> \param cutoff ...
! **************************************************************************************************
SUBROUTINE ke_gga_init(cutoff)
REAL(KIND=dp), INTENT(IN) :: cutoff
eps_rho = cutoff
CALL set_util(cutoff)
cf = 0.3_dp*(3.0_dp*pi*pi)**f23
flda = cf
flsd = flda*2.0_dp**f23
! the_factor 2^(1/3) for LDA is here
b_lda = 2.0_dp**f43*(3.0_dp*pi*pi)**(f13)
b_lsd = 2.0_dp*(3.0_dp*pi*pi)**(f13)
sfac = 1.0_dp/(2.0_dp*(3.0_dp*pi*pi)**f13)
t13 = 2.0_dp**f13
END SUBROUTINE ke_gga_init
! **************************************************************************************************
!> \brief ...
!> \param functional ...
!> \param lsd ...
!> \param reference ...
!> \param shortform ...
!> \param needs ...
!> \param max_deriv ...
! **************************************************************************************************
SUBROUTINE ke_gga_info(functional, lsd, reference, shortform, needs, max_deriv)
INTEGER, INTENT(in) :: functional
LOGICAL, INTENT(in) :: lsd
CHARACTER(LEN=*), INTENT(OUT), OPTIONAL :: reference, shortform
TYPE(xc_rho_cflags_type), INTENT(inout), OPTIONAL :: needs
INTEGER, INTENT(out), OPTIONAL :: max_deriv
IF (PRESENT(reference)) THEN
SELECT CASE (functional)
CASE (ke_ol1)
reference = "H. Ou-Yang and M. Levy, "// &
"Intl. J. Quant. Chem. 40, 379 (1991); Functional 1"
CASE (ke_ol2)
reference = "H. Ou-Yang and M. Levy, "// &
"Intl. J. Quant. Chem. 40, 379 (1991); Functional 2"
CASE (ke_llp)
reference = "H. Lee, C. Lee, R.G. Parr, Phys. Rev. A, 44, 768 (1991)"
CASE (ke_pw86)
reference = "J.P. Perdew and Y. Wang, Phys. Rev. B, 33, 8800 (1986)"
CASE (ke_pw91)
reference = "J.P. Perdew and Y. Wang, Electronic Structure of Solids 91"
CASE (ke_lc)
reference = "A. Lembarki and H. Chermette, Phys. Rev. A, 50, 5328 (1994)"
CASE (ke_t92)
reference = "A.J. Thakkar, Phys. Rev. A, 46, 6920 (1992)"
CASE (ke_pbe)
reference = "J.P.Perdew, K.Burke, M.Ernzerhof, Phys. Rev. Letter, 77, 3865 (1996)"
END SELECT
IF (.NOT. lsd) THEN
IF (LEN_TRIM(reference) + 6 < LEN(reference)) THEN
reference(LEN_TRIM(reference):LEN_TRIM(reference) + 6) = ' {spin unpolarized}'
END IF
END IF
END IF
IF (PRESENT(shortform)) THEN
SELECT CASE (functional)
CASE (ke_ol1)
shortform = "Ou-Yang-Levy Functional 1"
CASE (ke_ol2)
shortform = "Ou-Yang-Levy Functional 2"
CASE (ke_llp)
shortform = "Lee-Lee-Parr Functional"
CASE (ke_pw86)
shortform = "Perdew-Wang 1986 Functional (kinetic energy)"
CASE (ke_pw91)
shortform = "Perdew-Wang 1991 Functional (kinetic energy)"
CASE (ke_lc)
shortform = "Lembarki-Chermette kinetic energy functional"
CASE (ke_t92)
shortform = "Thakkar 1992 Functional"
CASE (ke_pbe)
shortform = "Perdew-Burke-Ernzerhof Functional (kinetic energy)"
END SELECT
IF (.NOT. lsd) THEN
IF (LEN_TRIM(shortform) + 6 < LEN(shortform)) THEN
shortform(LEN_TRIM(shortform):LEN_TRIM(shortform) + 6) = ' {spin unpolarized}'
END IF
END IF
END IF
IF (PRESENT(needs)) THEN
IF (lsd) THEN
needs%rho_spin = .TRUE.
needs%rho_spin_1_3 = .TRUE.
needs%norm_drho_spin = .TRUE.
ELSE
needs%rho = .TRUE.
needs%rho_1_3 = .TRUE.
needs%norm_drho = .TRUE.
END IF
END IF
IF (PRESENT(max_deriv)) max_deriv = 3
END SUBROUTINE ke_gga_info
! **************************************************************************************************
!> \brief ...
!> \param functional ...
!> \param rho_set ...
!> \param deriv_set ...
!> \param order ...
! **************************************************************************************************
SUBROUTINE ke_gga_lda_eval(functional, rho_set, deriv_set, order)
INTEGER, INTENT(IN) :: functional
TYPE(xc_rho_set_type), INTENT(IN) :: rho_set
TYPE(xc_derivative_set_type), INTENT(IN) :: deriv_set
INTEGER, INTENT(IN) :: order
CHARACTER(LEN=*), PARAMETER :: routineN = 'ke_gga_lda_eval'
INTEGER :: handle, m, npoints
INTEGER, DIMENSION(2, 3) :: bo
REAL(KIND=dp) :: drho_cutoff, rho_cutoff
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: s
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: fs
REAL(KIND=dp), CONTIGUOUS, DIMENSION(:, :, :), POINTER :: e_0, e_ndrho, e_ndrho_ndrho, &
e_ndrho_ndrho_ndrho, e_rho, e_rho_ndrho, e_rho_ndrho_ndrho, e_rho_rho, e_rho_rho_ndrho, &
e_rho_rho_rho, grho, rho, rho13
TYPE(xc_derivative_type), POINTER :: deriv
CALL timeset(routineN, handle)
NULLIFY (rho, rho13, e_0, e_rho, e_ndrho, &
e_rho_rho, e_rho_ndrho, e_ndrho_ndrho, &
e_rho_rho_rho, e_rho_rho_ndrho, e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho)
m = ABS(order)
CALL xc_rho_set_get(rho_set, rho_1_3=rho13, rho=rho, &
norm_drho=grho, local_bounds=bo, rho_cutoff=rho_cutoff, &
drho_cutoff=drho_cutoff)
npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
CALL ke_gga_init(rho_cutoff)
ALLOCATE (s(npoints))
ALLOCATE (fs(npoints, m + 1))
! s = norm_drho/(rho^(4/3)*2*(pi*pi*3)^(1/3))
CALL calc_wave_vector("p", rho, grho, s)
fact = flda
! Definition of s has changed
b = b_lda
! tact = t13
tact = 1.0_dp
SELECT CASE (functional)
CASE (ke_ol1)
CALL efactor_ol1(s, fs, m)
CPABORT("OL1 functional currently not working properly")
CASE (ke_ol2)
CALL efactor_ol2(s, fs, m)
CPABORT("OL2 functional currently not working properly")
CASE (ke_llp)
CALL efactor_llp(s, fs, m)
CASE (ke_pw86)
CALL efactor_pw86(s, fs, m)
CASE (ke_pw91)
CALL efactor_pw91(s, fs, m, 1)
CASE (ke_lc)
CALL efactor_pw91(s, fs, m, 2)
CASE (ke_t92)
CALL efactor_t92(s, fs, m)
CASE (ke_pbe)
CALL efactor_pbex(s, fs, m, 1)
CASE DEFAULT
CPABORT("Unsupported functional")
END SELECT
IF (order >= 0) THEN
deriv => xc_dset_get_derivative(deriv_set, [INTEGER::], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_0)
CALL kex_p_0(rho, rho13, fs, e_0, npoints)
END IF
IF (order >= 1 .OR. order == -1) THEN
deriv => xc_dset_get_derivative(deriv_set, [deriv_rho], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho)
deriv => xc_dset_get_derivative(deriv_set, [deriv_norm_drho], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_ndrho)
CALL kex_p_1(rho, rho13, s, fs, e_rho=e_rho, e_ndrho=e_ndrho, &
npoints=npoints)
END IF
IF (order >= 2 .OR. order == -2) THEN
deriv => xc_dset_get_derivative(deriv_set, [deriv_rho, deriv_rho], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho_rho)
deriv => xc_dset_get_derivative(deriv_set, [deriv_rho, deriv_norm_drho], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho_ndrho)
deriv => xc_dset_get_derivative(deriv_set, &
[deriv_norm_drho, deriv_norm_drho], allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho)
CALL kex_p_2(rho, rho13, s, fs, e_rho_rho=e_rho_rho, &
e_rho_ndrho=e_rho_ndrho, e_ndrho_ndrho=e_ndrho_ndrho, npoints=npoints)
END IF
IF (order >= 3 .OR. order == -3) THEN
deriv => xc_dset_get_derivative(deriv_set, [deriv_rho, deriv_rho, deriv_rho], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho_rho_rho)
deriv => xc_dset_get_derivative(deriv_set, &
[deriv_rho, deriv_rho, deriv_norm_drho], allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho_rho_ndrho)
deriv => xc_dset_get_derivative(deriv_set, &
[deriv_rho, deriv_norm_drho, deriv_norm_drho], allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho_ndrho_ndrho)
deriv => xc_dset_get_derivative(deriv_set, &
[deriv_norm_drho, deriv_norm_drho, deriv_norm_drho], allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho_ndrho)
CALL kex_p_3(rho, rho13, s, fs, e_rho_rho_rho=e_rho_rho_rho, &
e_rho_rho_ndrho=e_rho_rho_ndrho, e_rho_ndrho_ndrho=e_rho_ndrho_ndrho, &
e_ndrho_ndrho_ndrho=e_ndrho_ndrho_ndrho, npoints=npoints)
END IF
IF (order > 3 .OR. order < -3) THEN
CPABORT("derivatives bigger than 3 not implemented")
END IF
DEALLOCATE (s)
DEALLOCATE (fs)
CALL timestop(handle)
END SUBROUTINE ke_gga_lda_eval
! **************************************************************************************************
!> \brief ...
!> \param functional ...
!> \param rho_set ...
!> \param deriv_set ...
!> \param order ...
! **************************************************************************************************
SUBROUTINE ke_gga_lsd_eval(functional, rho_set, deriv_set, order)
INTEGER, INTENT(IN) :: functional
TYPE(xc_rho_set_type), INTENT(IN) :: rho_set
TYPE(xc_derivative_set_type), INTENT(IN) :: deriv_set
INTEGER, INTENT(IN), OPTIONAL :: order
CHARACTER(len=*), PARAMETER :: routineN = 'ke_gga_lsd_eval'
INTEGER, DIMENSION(2), PARAMETER :: &
norm_drho_spin_name = [deriv_norm_drhoa, deriv_norm_drhob], &
rho_spin_name = [deriv_rhoa, deriv_rhob]
INTEGER :: handle, ispin, m, npoints
INTEGER, DIMENSION(2, 3) :: bo
REAL(KIND=dp) :: rho_cutoff
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: s
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: fs
REAL(KIND=dp), CONTIGUOUS, DIMENSION(:, :, :), POINTER :: e_0, e_ndrho, e_ndrho_ndrho, &
e_ndrho_ndrho_ndrho, e_rho, e_rho_ndrho, e_rho_ndrho_ndrho, e_rho_rho, e_rho_rho_ndrho, &
e_rho_rho_rho
TYPE(cp_3d_r_cp_type), DIMENSION(2) :: norm_drho, rho, rho_1_3
TYPE(xc_derivative_type), POINTER :: deriv
CALL timeset(routineN, handle)
NULLIFY (e_0, e_ndrho, e_ndrho_ndrho, e_ndrho_ndrho_ndrho, e_rho_ndrho_ndrho, &
e_rho_ndrho, e_rho_rho_ndrho, e_rho, e_rho_rho, e_rho_rho_rho)
DO ispin = 1, 2
NULLIFY (norm_drho(ispin)%array, rho(ispin)%array, rho_1_3(ispin)%array)
END DO
CALL xc_rho_set_get(rho_set, rhoa_1_3=rho_1_3(1)%array, &
rhob_1_3=rho_1_3(2)%array, rhoa=rho(1)%array, &
rhob=rho(2)%array, norm_drhoa=norm_drho(1)%array, &
norm_drhob=norm_drho(2)%array, rho_cutoff=rho_cutoff, &
local_bounds=bo)
npoints = (bo(2, 1) - bo(1, 1) + 1)*(bo(2, 2) - bo(1, 2) + 1)*(bo(2, 3) - bo(1, 3) + 1)
m = ABS(order)
CALL ke_gga_init(rho_cutoff)
ALLOCATE (s(npoints))
ALLOCATE (fs(npoints, m + 1))
fact = flsd
b = b_lsd
tact = 1.0_dp
DO ispin = 1, 2
CALL calc_wave_vector("p", rho(ispin)%array, norm_drho(ispin)%array, s)
SELECT CASE (functional)
CASE (ke_ol1)
CALL efactor_ol1(s, fs, m)
CASE (ke_ol2)
CALL efactor_ol2(s, fs, m)
CASE (ke_llp)
CALL efactor_llp(s, fs, m)
CASE (ke_pw86)
tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
CALL efactor_pw86(s, fs, m, f2_lsd=tact)
tact = 1.0_dp
CASE (ke_pbe)
tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
CALL efactor_pbex(s, fs, m, 1, f2_lsd=tact)
tact = 1.0_dp
CASE (ke_pw91)
tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
CALL efactor_pw91(s, fs, m, 1, f2_lsd=tact)
tact = 1.0_dp
CASE (ke_lc)
tact = (1.0_dp/2.0_dp)**(1.0_dp/3.0_dp)
CALL efactor_pw91(s, fs, m, 2, f2_lsd=tact)
tact = 1.0_dp
CASE (ke_t92)
CALL efactor_t92(s, fs, m)
CASE DEFAULT
CPABORT("Unsupported functional")
END SELECT
IF (order >= 0) THEN
deriv => xc_dset_get_derivative(deriv_set, [INTEGER::], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_0)
CALL kex_p_0(rho(ispin)%array, rho_1_3(ispin)%array, fs, &
e_0=e_0, npoints=npoints)
END IF
IF (order >= 1 .OR. order == -1) THEN
deriv => xc_dset_get_derivative(deriv_set, [rho_spin_name(ispin)], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho)
deriv => xc_dset_get_derivative(deriv_set, [norm_drho_spin_name(ispin)], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_ndrho)
CALL kex_p_1(rho=rho(ispin)%array, &
r13=rho_1_3(ispin)%array, s=s, fs=fs, e_rho=e_rho, &
e_ndrho=e_ndrho, npoints=npoints)
END IF
IF (order >= 2 .OR. order == -2) THEN
deriv => xc_dset_get_derivative(deriv_set, [rho_spin_name(ispin), &
rho_spin_name(ispin)], allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho_rho)
deriv => xc_dset_get_derivative(deriv_set, [rho_spin_name(ispin), &
norm_drho_spin_name(ispin)], allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho_ndrho)
deriv => xc_dset_get_derivative(deriv_set, [norm_drho_spin_name(ispin), &
norm_drho_spin_name(ispin)], allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho)
CALL kex_p_2(rho(ispin)%array, rho_1_3(ispin)%array, &
s, fs, e_rho_rho, e_rho_ndrho, e_ndrho_ndrho, npoints)
END IF
IF (order >= 3 .OR. order == -3) THEN
deriv => xc_dset_get_derivative(deriv_set, [rho_spin_name(ispin), &
rho_spin_name(ispin), rho_spin_name(ispin)], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho_rho_rho)
deriv => xc_dset_get_derivative(deriv_set, [rho_spin_name(ispin), &
rho_spin_name(ispin), norm_drho_spin_name(ispin)], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho_rho_ndrho)
deriv => xc_dset_get_derivative(deriv_set, [rho_spin_name(ispin), &
norm_drho_spin_name(ispin), norm_drho_spin_name(ispin)], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_rho_ndrho_ndrho)
deriv => xc_dset_get_derivative(deriv_set, [norm_drho_spin_name(ispin), &
norm_drho_spin_name(ispin), norm_drho_spin_name(ispin)], &
allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho_ndrho)
CALL kex_p_3(rho(ispin)%array, &
rho_1_3(ispin)%array, s, fs, e_rho_rho_rho, e_rho_rho_ndrho, &
e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho, npoints)
END IF
IF (order > 3 .OR. order < -3) THEN
CPABORT("derivatives bigger than 3 not implemented")
END IF
END DO
DEALLOCATE (s)
DEALLOCATE (fs)
CALL timestop(handle)
END SUBROUTINE ke_gga_lsd_eval
! **************************************************************************************************
!> \brief ...
!> \param rho ...
!> \param r13 ...
!> \param fs ...
!> \param e_0 ...
!> \param npoints ...
! **************************************************************************************************
SUBROUTINE kex_p_0(rho, r13, fs, e_0, npoints)
REAL(KIND=dp), DIMENSION(*), INTENT(IN) :: rho, r13
REAL(KIND=dp), DIMENSION(:, :), INTENT(IN) :: fs
REAL(KIND=dp), DIMENSION(*), INTENT(INOUT) :: e_0
INTEGER, INTENT(in) :: npoints
INTEGER :: ip
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP SHARED(npoints, rho, e_0, fact, r13, fs, eps_rho) &
!$OMP PRIVATE(ip)
DO ip = 1, npoints
IF (rho(ip) > eps_rho) THEN
e_0(ip) = e_0(ip) + fact*r13(ip)*r13(ip)*rho(ip)*fs(ip, 1)
END IF
END DO
!$OMP END PARALLEL DO
END SUBROUTINE kex_p_0
! **************************************************************************************************
!> \brief ...
!> \param rho ...
!> \param r13 ...
!> \param s ...
!> \param fs ...
!> \param e_rho ...
!> \param e_ndrho ...
!> \param npoints ...
! **************************************************************************************************
SUBROUTINE kex_p_1(rho, r13, s, fs, e_rho, e_ndrho, npoints)
REAL(KIND=dp), DIMENSION(*), INTENT(IN) :: rho, r13, s
REAL(KIND=dp), DIMENSION(:, :), INTENT(IN) :: fs
REAL(KIND=dp), DIMENSION(*), INTENT(INOUT) :: e_rho, e_ndrho
INTEGER, INTENT(in) :: npoints
INTEGER :: ip
REAL(KIND=dp) :: a0, a1, sx, sy
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP SHARED(npoints, rho, eps_rho, fact, r13, sfac, tact) &
!$OMP SHARED(fs, e_rho, e_ndrho, s) &
!$OMP PRIVATE(ip,a0,a1,sx,sy)
DO ip = 1, npoints
IF (rho(ip) > eps_rho) THEN
a0 = fact*r13(ip)*r13(ip)*rho(ip)
a1 = f53*fact*r13(ip)*r13(ip)
sx = -f43*s(ip)/rho(ip)
sy = sfac*tact/(r13(ip)*rho(ip))
e_rho(ip) = e_rho(ip) + a1*fs(ip, 1) + a0*fs(ip, 2)*sx
e_ndrho(ip) = e_ndrho(ip) + a0*fs(ip, 2)*sy
END IF
END DO
!$OMP END PARALLEL DO
END SUBROUTINE kex_p_1
! **************************************************************************************************
!> \brief ...
!> \param rho ...
!> \param r13 ...
!> \param s ...
!> \param fs ...
!> \param e_rho_rho ...
!> \param e_rho_ndrho ...
!> \param e_ndrho_ndrho ...
!> \param npoints ...
! **************************************************************************************************
SUBROUTINE kex_p_2(rho, r13, s, fs, e_rho_rho, e_rho_ndrho, e_ndrho_ndrho, &
npoints)
REAL(KIND=dp), DIMENSION(*), INTENT(IN) :: rho, r13, s
REAL(KIND=dp), DIMENSION(:, :), INTENT(IN) :: fs
REAL(KIND=dp), DIMENSION(*), INTENT(INOUT) :: e_rho_rho, e_rho_ndrho, e_ndrho_ndrho
INTEGER, INTENT(in) :: npoints
INTEGER :: ip
REAL(KIND=dp) :: a0, a1, a2, sx, sxx, sxy, sy
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP SHARED (npoints, rho, eps_rho, fact, r13) &
!$OMP SHARED (e_rho_rho, e_rho_ndrho, e_ndrho_ndrho, fs) &
!$OMP SHARED(s, sfac, tact) &
!$OMP PRIVATE(ip,a0,a1,a2,sx,sy,sxx,sxy)
DO ip = 1, npoints
IF (rho(ip) > eps_rho) THEN
a0 = fact*r13(ip)*r13(ip)*rho(ip)
a1 = f53*fact*r13(ip)*r13(ip)
a2 = f23*f53*fact/r13(ip)
sx = -f43*s(ip)/rho(ip)
sy = sfac*tact/(r13(ip)*rho(ip))
sxx = 28.0_dp/9.0_dp*s(ip)/(rho(ip)*rho(ip))
sxy = -f43*sfac*tact/(r13(ip)*rho(ip)*rho(ip))
e_rho_rho(ip) = e_rho_rho(ip) + a2*fs(ip, 1) + 2.0_dp*a1*fs(ip, 2)*sx + &
a0*fs(ip, 3)*sx*sx + a0*fs(ip, 2)*sxx
e_rho_ndrho(ip) = e_rho_ndrho(ip) + a1*fs(ip, 2)*sy + a0*fs(ip, 3)*sx*sy + &
a0*fs(ip, 2)*sxy
e_ndrho_ndrho(ip) = e_ndrho_ndrho(ip) + a0*fs(ip, 3)*sy*sy
END IF
END DO
!$OMP END PARALLEL DO
END SUBROUTINE kex_p_2
! **************************************************************************************************
!> \brief ...
!> \param rho ...
!> \param r13 ...
!> \param s ...
!> \param fs ...
!> \param e_rho_rho_rho ...
!> \param e_rho_rho_ndrho ...
!> \param e_rho_ndrho_ndrho ...
!> \param e_ndrho_ndrho_ndrho ...
!> \param npoints ...
! **************************************************************************************************
SUBROUTINE kex_p_3(rho, r13, s, fs, e_rho_rho_rho, e_rho_rho_ndrho, &
e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho, npoints)
REAL(KIND=dp), DIMENSION(*), INTENT(IN) :: rho, r13, s
REAL(KIND=dp), DIMENSION(:, :), INTENT(IN) :: fs
REAL(KIND=dp), DIMENSION(*), INTENT(inout) :: e_rho_rho_rho, e_rho_rho_ndrho, &
e_rho_ndrho_ndrho, e_ndrho_ndrho_ndrho
INTEGER, INTENT(in) :: npoints
INTEGER :: ip
REAL(KIND=dp) :: a0, a1, a2, a3, sx, sxx, sxxx, sxxy, &
sxy, sy
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP SHARED(npoints, rho, eps_rho, fact, r13) &
!$OMP SHARED(s, sfac, tact, fs, e_rho_rho_rho) &
!$OMP SHARED(e_rho_rho_ndrho, e_rho_ndrho_ndrho) &
!$OMP SHARED(e_ndrho_ndrho_ndrho) &
!$OMP PRIVATE(ip,a0,a1,a2,a3,sx,sy,sxx,sxy,sxxx,sxxy)
DO ip = 1, npoints
IF (rho(ip) > eps_rho) THEN
a0 = fact*r13(ip)*r13(ip)*rho(ip)
a1 = f53*fact*r13(ip)*r13(ip)
a2 = f23*f53*fact/r13(ip)
a3 = -f13*f23*f53*fact/(r13(ip)*rho(ip))
sx = -f43*s(ip)/rho(ip)
sy = sfac*tact/(r13(ip)*rho(ip))
sxx = 28.0_dp/9.0_dp*s(ip)/(rho(ip)*rho(ip))
sxy = -f43*sfac*tact/(r13(ip)*rho(ip)*rho(ip))
sxxx = -280.0_dp/27.0_dp*s(ip)/(rho(ip)*rho(ip)*rho(ip))
sxxy = 28.0_dp/9.0_dp*sfac*tact/(r13(ip)*rho(ip)*rho(ip)*rho(ip))
e_rho_rho_rho(ip) = e_rho_rho_rho(ip) + a3*fs(ip, 1) + 3.0_dp*a2*fs(ip, 2)*sx + &
3.0_dp*a1*fs(ip, 3)*sx*sx + 3.0_dp*a1*fs(ip, 2)*sxx + &
a0*fs(ip, 4)*sx*sx*sx + 3.0_dp*a0*fs(ip, 3)*sx*sxx + &
a0*fs(ip, 2)*sxxx
e_rho_rho_ndrho(ip) = e_rho_rho_ndrho(ip) + a2*fs(ip, 2)*sy + 2.0_dp*a1*fs(ip, 3)*sx*sy + &
2.0_dp*a1*fs(ip, 2)*sxy + a0*fs(ip, 4)*sx*sx*sy + &
2.0_dp*a0*fs(ip, 3)*sx*sxy + a0*fs(ip, 3)*sxx*sy + &
a0*fs(ip, 2)*sxxy
e_rho_ndrho_ndrho(ip) = e_rho_ndrho_ndrho(ip) + a1*fs(ip, 3)*sy*sy + a0*fs(ip, 4)*sx*sy*sy + &
2.0_dp*a0*fs(ip, 3)*sxy*sy
e_ndrho_ndrho_ndrho(ip) = e_ndrho_ndrho_ndrho(ip) + a0*fs(ip, 4)*sy*sy*sy
END IF
END DO
!$OMP END PARALLEL DO
END SUBROUTINE kex_p_3
! Enhancement Factors
! **************************************************************************************************
!> \brief ...
!> \param s ...
!> \param fs ...
!> \param m ...
! **************************************************************************************************
SUBROUTINE efactor_ol1(s, fs, m)
REAL(KIND=dp), DIMENSION(:), INTENT(IN) :: s
REAL(KIND=dp), DIMENSION(:, :), INTENT(OUT) :: fs
INTEGER, INTENT(IN) :: m
INTEGER :: ip
REAL(KIND=dp) :: t1, t2
t1 = b*b/(72.0_dp*cf)
t2 = 0.001878_dp*b
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP SHARED(s, m, fs, t1, t2) &
!$OMP PRIVATE(ip)
DO ip = 1, SIZE(s)
SELECT CASE (m)
CASE (0)
fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)
CASE (1)
fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)
fs(ip, 2) = 2.0_dp*t1*s(ip) + t2
CASE (2:3)
fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)
fs(ip, 2) = 2.0_dp*t1*s(ip) + t2
fs(ip, 3) = 2.0_dp*t1
CASE DEFAULT
CPABORT("Illegal order.")
END SELECT
END DO
!$OMP END PARALLEL DO
IF (m == 3) fs(:, 4) = 0.0_dp
END SUBROUTINE efactor_ol1
! **************************************************************************************************
!> \brief ...
!> \param s ...
!> \param fs ...
!> \param m ...
! **************************************************************************************************
SUBROUTINE efactor_ol2(s, fs, m)
REAL(KIND=dp), DIMENSION(:), INTENT(IN) :: s
REAL(KIND=dp), DIMENSION(:, :), INTENT(OUT) :: fs
INTEGER, INTENT(IN) :: m
INTEGER :: ip
REAL(KIND=dp) :: t1, t2, t3, y
t1 = b*b/(72.0_dp*cf)
t2 = 0.0245_dp*b
t3 = 2.0_dp**f53*b
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP SHARED(s, m, t1, t2, t3, fs) &
!$OMP PRIVATE(ip,y)
DO ip = 1, SIZE(s)
y = 1.0_dp/(1.0_dp + t3*s(ip))
SELECT CASE (m)
CASE (0)
fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
CASE (1)
fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
fs(ip, 2) = 2.0_dp*t1*s(ip) + t2*y*y
CASE (2)
fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
fs(ip, 2) = 2.0_dp*t1*s(ip) + t2*y*y
fs(ip, 3) = 2.0_dp*(t1 - t2*t3*y*y*y)
CASE (3)
fs(ip, 1) = 1.0_dp + t1*s(ip)*s(ip) + t2*s(ip)*y
fs(ip, 2) = 2.0_dp*t1*s(ip) + t2*y*y
fs(ip, 3) = 2.0_dp*(t1 - t2*t3*y*y*y)
fs(ip, 4) = 6.0_dp*t2*t3*t3*y*y*y*y
CASE DEFAULT
CPABORT("Illegal order.")
END SELECT
END DO
!$OMP END PARALLEL DO
END SUBROUTINE efactor_ol2
! **************************************************************************************************
!> \brief ...
!> \param s ...
!> \param fs ...
!> \param m ...
! **************************************************************************************************
SUBROUTINE efactor_llp(s, fs, m)
REAL(KIND=dp), DIMENSION(:), INTENT(IN) :: s
REAL(KIND=dp), DIMENSION(:, :), INTENT(OUT) :: fs
INTEGER, INTENT(IN) :: m
INTEGER :: ip
REAL(KIND=dp) :: as, bs, p, q, sas, sbs, t1, t10, t11, t12, t133, t16, t17, t19, t2, t20, &
t22, t23, t26, t28, t29, t3, t30, t33, t36, t39, t4, t40, t42, t43, t45, t46, t47, t49, &
t5, t50, t54, t55, t7, t71, t8, t9, x, ys
p = 0.0044188_dp*b*b
q = 0.0253_dp*b
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP SHARED(s, m, fs, p, q, b) &
!$OMP PRIVATE(ip,x,bs,sbs,as,sas,ys,t2,t4,t5,t8,t9,t10,t12) &
!$OMP PRIVATE(t1,t3,t7,t11,t16,t17,t20,t22,t23,t26,t30,t33) &
!$OMP PRIVATE(t40,t42,t43,t45,t46,t47,t49,t50,t71,t133) &
!$OMP PRIVATE(t19,t28,t29,t36,t39,t54,t55)
DO ip = 1, SIZE(s)
x = s(ip)
bs = b*x
sbs = SQRT(bs*bs + 1.0_dp)
as = LOG(bs + sbs)
sas = x*as
ys = 1.0_dp/(1.0_dp + q*sas)
SELECT CASE (m)
CASE (0)
fs(ip, 1) = 1.0_dp + p*x*x*ys
CASE (1)
fs(ip, 1) = 1.0_dp + p*x*x*ys
t2 = q*x
t4 = b**2
t5 = x**2
t8 = SQRT(1.0_dp + t4*t5)
t9 = b*x + t8
t10 = LOG(t9)
t12 = 1.0_dp + t2*t10
t17 = t12**2
fs(ip, 2) = 2.0_dp*p*x/t12 - p*t5/t17*(q*t10 + t2*(b + 1.0_dp/t8*t4*x)/t9)
CASE (2)
fs(ip, 1) = 1.0_dp + p*x*x*ys
! first der
t2 = q*x
t4 = b**2
t5 = x**2
t8 = SQRT(1.0_dp + t4*t5)
t9 = b*x + t8
t10 = LOG(t9)
t12 = 1.0_dp + t2*t10
t17 = t12**2
fs(ip, 2) = 2.0_dp*p*x/t12 - p*t5/t17*(q*t10 + t2*(b + 1.0_dp/t8*t4*x)/t9)
! second der
t1 = q*x
t3 = b**2
t4 = x**2
t7 = SQRT(1.0_dp + t3*t4)
t8 = b*x + t7
t9 = LOG(t8)
t11 = 1.0_dp + t1*t9
t16 = t11**2
t17 = 1.0_dp/t16
t20 = 1.0_dp/t7*t3
t22 = b + t20*x
t23 = 1/t8
t26 = q*t9 + t1*t22*t23
t30 = p*t4
t33 = t26**2
t40 = t7**2
t43 = t3**2
t49 = t22**2
t50 = t8**2
fs(ip, 3) = 2.0_dp*p/t11 - 4.0_dp*p*x*t17*t26 + 2.0_dp*t30/t16/ &
t11*t33 - t30*t17*(2.0_dp*q*t22*t23 + t1* &
(-1.0_dp/t40/t7*t43*t4 + t20)*t23 - t1*t49/t50)
CASE (3)
fs(ip, 1) = 1.0_dp + p*x*x*ys
! first der
t2 = q*x
t4 = b**2
t5 = x**2
t8 = SQRT(1.0_dp + t4*t5)
t9 = b*x + t8
t10 = LOG(t9)
t12 = 1.0_dp + t2*t10
t17 = t12**2
fs(ip, 2) = 2.0_dp*p*x/t12 - p*t5/t17*(q*t10 + t2*(b + 1.0_dp/t8*t4*x)/t9)
! second der
t1 = q*x
t3 = b**2
t4 = x**2
t7 = SQRT(1.0_dp + t3*t4)
t8 = b*x + t7
t9 = LOG(t8)
t11 = 1.0_dp + t1*t9
t16 = t11**2
t17 = 1.0_dp/t16
t20 = 1.0_dp/t7*t3
t22 = b + t20*x
t23 = 1/t8
t26 = q*t9 + t1*t22*t23
t30 = p*t4
t33 = t26**2
t40 = t7**2
t43 = t3**2
t49 = t22**2
t50 = t8**2
fs(ip, 3) = 2.0_dp*p/t11 - 4.0_dp*p*x*t17*t26 + 2.0_dp*t30/t16/ &
t11*t33 - t30*t17*(2.0_dp*q*t22*t23 + t1* &
(-1.0_dp/t40/t7*t43*t4 + t20)*t23 - t1*t49/t50)
t1 = q*x
t3 = b**2
t4 = x**2
t7 = SQRT(1 + t3*t4)
t8 = b*x + t7
t9 = LOG(t8)
t11 = 1.0_dp + t1*t9
t12 = t11**2
t133 = 1.0_dp/t12
t17 = 1.0_dp/t7*t3
t19 = b + t17*x
t20 = 1.0_dp/t8
t23 = q*t9 + t1*t19*t20
t26 = p*x
t28 = 1.0_dp/t12/t11
t29 = t23**2
t36 = t7**2
t39 = t3**2
t40 = 1.0_dp/t36/t7*t39
t42 = -t40*t4 + t17
t45 = t19**2
t46 = t8**2
t47 = 1.0_dp/t46
t50 = 2.0_dp*q*t19*t20 + t1*t42*t20 - t1*t45*t47
t54 = p*t4
t55 = t12**2
t71 = t36**2
fs(ip, 4) = &
-6.0_dp*p*t133*t23 + 12.0_dp*t26*t28*t29 - &
6.0_dp*t26*t133*t50 - 6.0_dp*t54/t55*t29*t23 + &
6.0_dp*t54*t28*t23*t50 - t54*t133* &
(3.0_dp*q*t42*t20 - 3.0_dp*q*t45*t47 + 3.0_dp*t1* &
(1.0_dp/t71/t7*t39*t3*t4*x - t40*x)*t20 - &
3.0_dp*t1*t42*t47*t19 + 2.0_dp*t1*t45*t19/t46/t8)
CASE DEFAULT
CPABORT("Illegal order.")
END SELECT
END DO
!$OMP END PARALLEL DO
END SUBROUTINE efactor_llp
! **************************************************************************************************
!> \brief ...
!> \param s ...
!> \param fs ...
!> \param m ...
!> \param f2_lsd ...
! **************************************************************************************************
SUBROUTINE efactor_pw86(s, fs, m, f2_lsd)
REAL(KIND=dp), DIMENSION(:), INTENT(IN) :: s
REAL(KIND=dp), DIMENSION(:, :), INTENT(OUT) :: fs
INTEGER, INTENT(IN) :: m
REAL(dp), OPTIONAL :: f2_lsd
INTEGER :: ip
REAL(KIND=dp) :: f15, ff, p0, p1, p15, p2, p3, s1, s2, &
s4, s6, t1, t2, t3
t1 = 1.296_dp
t2 = 14.0_dp
t3 = 0.2_dp
f15 = 1.0_dp/15.0_dp
ff = 1.0_dp
IF (PRESENT(f2_lsd)) ff = f2_lsd
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP SHARED(s, fs, m, t1, t2, t3, f15, ff) &
!$OMP PRIVATE(ip, s1, s2, s4, s6, p0, p1, p2, p3, p15)
DO ip = 1, SIZE(s)
s1 = s(ip)*ff
s2 = s1*s1
s4 = s2*s2
s6 = s2*s4
SELECT CASE (m)
CASE (0)
p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
fs(ip, 1) = p0**f15
CASE (1)
p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
p1 = s1*ff*(2.0_dp*t1 + 4.0_dp*t2*s2 + 6.0_dp*t3*s4)
p15 = p0**f15
fs(ip, 1) = p15
fs(ip, 2) = f15*p1*p15/p0
CASE (2)
p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
p1 = s1*ff*(2.0_dp*t1 + 4.0_dp*t2*s2 + 6.0_dp*t3*s4)
p2 = ff*ff*(2.0_dp*t1 + 12.0_dp*t2*s2 + 30.0_dp*t3*s4)
p15 = p0**f15
fs(ip, 1) = p15
fs(ip, 2) = f15*p1*p15/p0
fs(ip, 3) = f15*p15/p0*(p2 - 14.0_dp/15.0_dp*p1*p1/p0)
CASE (3)
p0 = 1.0_dp + t1*s2 + t2*s4 + t3*s6
p1 = s1*ff*(2.0_dp*t1 + 4.0_dp*t2*s2 + 6.0_dp*t3*s4)
p2 = ff*ff*(2.0_dp*t1 + 12.0_dp*t2*s2 + 30.0_dp*t3*s4)
p3 = s1*ff*ff*ff*(24.0_dp*t2 + 120.0_dp*t3*s2)
p15 = p0**f15
fs(ip, 1) = p15
fs(ip, 2) = f15*p1*p15/p0
fs(ip, 3) = f15*p15/p0*(p2 - 14.0_dp/15.0_dp*p1*p1/p0)
fs(ip, 4) = f15*p15/p0*(-14.0_dp*f15*p1*p1/p0 + 14.0_dp*14.0_dp*f15*p1*p1*p1/p0/p0 + &
p3 - 14.0_dp*p2*p1/p0 + 14.0_dp*p1*p1/p0/p0)
CASE DEFAULT
CPABORT("Illegal order.")
END SELECT
END DO
!$OMP END PARALLEL DO
END SUBROUTINE efactor_pw86
! **************************************************************************************************
!> \brief ...
!> \param s ...
!> \param fs ...
!> \param m ...
! **************************************************************************************************
SUBROUTINE efactor_t92(s, fs, m)
REAL(KIND=dp), DIMENSION(:), INTENT(IN) :: s
REAL(KIND=dp), DIMENSION(:, :), INTENT(OUT) :: fs
INTEGER, INTENT(IN) :: m
INTEGER :: ip
REAL(KIND=dp) :: a1, a2, as, asp, asp2, asp3, bs, p, q, &
s1, s2, sas, sbs, sbs3, sbs5, t0, w1, &
x, ys
p = 0.0055_dp*b*b
q = 0.0253_dp*b
a1 = 0.072_dp*b
a2 = 2.0_dp**f53*b