-
Notifications
You must be signed in to change notification settings - Fork 1
/
Coupling_transform_cfg_LSjj3.f90
executable file
·1566 lines (1562 loc) · 79.7 KB
/
Coupling_transform_cfg_LSjj3.f90
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
!
!***********************************************************************
!
module Coupling_transform_cfg_LSjj3
! *
! Written by G. Gaigalas, *
! NIST last update: Oct 2015 *
! *
!***********************************************************************
!-----------------------------------------------
! M o d u l e s
!-----------------------------------------------
use Coupling_constants
use Coupling_structures
use Coupling_data
use Coupling_inside_shell
!-----------------------------------------------
! R o u t i n e s
!-----------------------------------------------
public :: main_cfg_lsjj3
public :: count_nr_of_csfs_jj3
public :: delete_cfg_expansions
private :: form_list_nomach_csfs
private :: form_csfs_jj3
private :: matrix_LS_jj3
private :: dotransform_LSjj3
private :: print_cfg_LSjj3
private :: equivalent_LSjj3
!-----------------------------------------------
! D e f i n i t i o n s
!-----------------------------------------------
type::Ji_lists
integer::nr_of_csf !serial number of csf_LS in csfs_LS
type(list),dimension(:),pointer::Ji !i=1..nr_of_subc
end type Ji_lists
!
type:: cfg_Ji_lists
integer::nr_of_subc
integer::nr_of_nomach_csfs
type(Ji_lists),dimension(:),pointer::csfs_Ji !i=1..nr_of_nomach_csfs
end type cfg_Ji_lists
!
type(expansion), public :: expansion_cfg_LS
type(expansion), public :: expansion_cfg_jj3
!
type(list), private ::nomach_csfs_ls
type(cfg_Ji_lists), private::cfg_Ji_structure
!-----------------------------------------------
!
contains
!
!***********************************************************************
! *
subroutine main_cfg_lsjj3(print_level)
! *
! This is managerial subroutine *
! *
! Written by G. Gaigalas, *
! NIST last update: Oct 2015 *
! *
!***********************************************************************
implicit none
integer, intent(in) :: print_level
integer::error
integer::itype
expansion_cfg_jj3%nr_of_state=expansion_cfg_LS%nr_of_state
call form_list_nomach_csfs
itype=0
call form_csfs_jj3(itype)
call dotransform_LSjj3
if(print_level.gt.1) call print_cfg_LSjj3(2)
deallocate(nomach_csfs_ls%items, STAT = error)
end subroutine main_cfg_lsjj3
!
!***********************************************************************
! *
subroutine count_nr_of_csfs_jj3(nr_of_csfs)
! *
! This subroutine counts the number of oneconfigurational *
! expansion in jj3 coupling *
! (corresponding to the one in the JJ coupling "expansion_cfg_LS") *
! *
! Written by G. Gaigalas, *
! NIST last update: Oct 2015 *
! *
!***********************************************************************
implicit none
integer, intent(out):: nr_of_csfs
integer::error
integer::itype
if(expansion_cfg_LS%csfs(1)%nosubc /= 3) then
write(*,*) &
'ERROR at subroutine count_nr_of_csfs_jj3: nosubc /= 3'
write(*,*) &
'(you can use jj3 coupling with subshells number = 3)'
write(*,*) 'At presint number of subshells is', &
expansion_cfg_LS%csfs(1)%nosubc
write(*,*)'program is terminated'
stop
end if
expansion_cfg_jj3%nr_of_state=expansion_cfg_LS%nr_of_state
call form_list_nomach_csfs
itype=1
call form_csfs_jj3(itype)
nr_of_csfs = expansion_cfg_jj3%size
if(associated(nomach_csfs_ls%items)) &
deallocate(nomach_csfs_ls%items,STAT=error)
end subroutine count_nr_of_csfs_jj3
!
!***********************************************************************
! *
subroutine delete_cfg_expansions
! *
! This subroutine deallocates the arrays of *
! oneconfigurational expansions "expansion_cfg_jj3" and *
! "expansion_cfg_LS" *
! *
! Written by G. Gaigalas, *
! NIST last update: Oct 2015 *
! *
!***********************************************************************
integer::icsf
!
!write(iwrite_log,'(6x,a21)') 'delete_cfg_expansions'
!
!delete expansion_cfg_jj3
if(associated(expansion_cfg_jj3%coeffs)) &
deallocate(expansion_cfg_jj3%csfs)
if(associated(expansion_cfg_jj3%csfs)) then
do icsf=1, expansion_cfg_jj3%size
if(associated(expansion_cfg_jj3%csfs(icsf)%subc_cfg)) &
deallocate(expansion_cfg_jj3%csfs(icsf)%subc_cfg)
if(associated(expansion_cfg_jj3%csfs(icsf)%subc)) &
deallocate(expansion_cfg_jj3%csfs(icsf)%subc)
if(associated(expansion_cfg_jj3%csfs(icsf)%iM1)) &
deallocate(expansion_cfg_jj3%csfs(icsf)%iM1)
if(associated(expansion_cfg_jj3%csfs(icsf)%iM2)) &
deallocate(expansion_cfg_jj3%csfs(icsf)%iM2)
if(associated(expansion_cfg_jj3%csfs(icsf)%iJ)) &
deallocate(expansion_cfg_jj3%csfs(icsf)%iJ)
end do
deallocate(expansion_cfg_jj3%csfs)
end if
expansion_cfg_jj3%size=0
expansion_cfg_jj3%nr_of_state=0
!
!delete expansion_cfg_LS
if(associated(expansion_cfg_LS%coeffs)) &
deallocate(expansion_cfg_LS%csfs)
if(associated(expansion_cfg_LS%csfs)) then
do icsf=1, expansion_cfg_LS%size
if(associated(expansion_cfg_LS%csfs(icsf)%subc_cfg)) &
deallocate(expansion_cfg_LS%csfs(icsf)%subc_cfg)
if(associated(expansion_cfg_LS%csfs(icsf)%subc)) &
deallocate(expansion_cfg_LS%csfs(icsf)%subc)
if(associated(expansion_cfg_LS%csfs(icsf)%iM1)) &
deallocate(expansion_cfg_LS%csfs(icsf)%iM1)
if(associated(expansion_cfg_LS%csfs(icsf)%iM2)) &
deallocate(expansion_cfg_LS%csfs(icsf)%iM2)
if(associated(expansion_cfg_LS%csfs(icsf)%iJ)) &
deallocate(expansion_cfg_LS%csfs(icsf)%iJ)
end do
deallocate(expansion_cfg_LS%csfs)
end if
expansion_cfg_LS%size=0
expansion_cfg_LS%nr_of_state=0
!
end subroutine delete_cfg_expansions
!
!***********************************************************************
! *
function equivalent_LSjj3(csf1, csf2) result(rez)
! *
! This function defines the "equivalency" of *
! two csfs in LS coupling for the formation of jj3 csfs *
! (for notion of the "equivalency" see the *
! description in the program) *
! *
! Written by G. Gaigalas, *
! NIST last update: Oct 2015 *
! *
!***********************************************************************
implicit none
type(csf_LS) :: csf1, csf2
logical :: rez
integer::isubc
rez = .true.
if(csf1%nosubc /= 3 .or. csf2%nosubc /= 3) then
write(*,*)'ERROR at subroutine equivalent_LSjj3: ', &
'csf1%nosubc /= 3 .or. csf2%nosubc /= 3'
write(*,*)'(you can use jj3 coupling with shell number 3)'
write(*,*)'program will be terminated'
write(*,*)'csf1%nosubc, csf2%nosubc',csf1%nosubc, csf2%nosubc
stop
end if
if(csf1%nosubc.eq.csf2%nosubc) then
do isubc=1,csf1%nosubc
if(.not.csf1%subc_cfg(isubc)==csf2%subc_cfg(isubc)) then
rez=.false.
exit
! else if(.not.csf1%subc(isubc)==csf2%subc(isubc)) then
! if(isubc /= 1) rez=.false.
! exit
end if
end do
else
rez=.false.
end if
end function equivalent_LSjj3
!
!***********************************************************************
! *
subroutine form_list_nomach_csfs
! *
! This subroutine form the list of serial numbers *
! in "expansion_cfg_LS" of "nonequivalent" LS coupling csfs *
! (for notion of the "equivalency" see the *
! description in the program) *
! *
! Written by G. Gaigalas, *
! NIST last update: Oct 2015 *
! *
!***********************************************************************
implicit none
integer:: inomach_counter
integer, dimension(:), pointer :: temp_list
integer::icsf_LS, inew
logical:: new_csf
!
inomach_counter=0
allocate(temp_list(expansion_cfg_LS%size))
!
do icsf_LS=1,expansion_cfg_LS%size,1
new_csf = .true.
do inew = 1, inomach_counter, 1
if(equivalent_LSjj3(expansion_cfg_LS%csfs(icsf_LS), &
expansion_cfg_LS%csfs(temp_list(inew)))) new_csf = .false.
end do
if(new_csf) then
inomach_counter = inomach_counter + 1
if(inomach_counter.gt.expansion_cfg_LS%size) then
write(*,*) 'stop at subroutine define_nomach: ', &
'inomach_counter.gt.expansion_cfg_LS%size'
stop
end if
temp_list(inomach_counter)= icsf_LS
end if
end do
!
nomach_csfs_LS%list_size = inomach_counter
!
allocate(nomach_csfs_LS%items(nomach_csfs_LS%list_size))
!
do icsf_LS=1, nomach_csfs_LS%list_size, 1
nomach_csfs_LS%items(icsf_LS) = temp_list(icsf_LS)
end do
!
deallocate(temp_list)
!----- print down data -----------
!write(iwrite_log, *)'Nonmaching csfs_LS:'
!write(iwrite_log, *)' Nr. icsf_nr '
!do icsf_LS=1, nomach_csfs_LS%list_size, 1
! write(iwrite_log, '(4x,i3,2x,i3)') icsf_LS, nomach_csfs_LS%items(icsf_LS)
!end do !icsf_LS
!write(iwrite_log, *)' '
!
end subroutine form_list_nomach_csfs
!
!***********************************************************************
! *
subroutine form_csfs_jj3(itype)
! *
! This subroutine forms the oneconfigurational *
! expansion in jj3 coupling "expansion_cfg_jj3", *
! correponding to the one in LS coupling "expansion_cfg_LS" *
! *
! Written by G. Gaigalas, *
! NIST last update: February 2020 *
! *
!***********************************************************************
implicit none
!type(cfg_Ji_lists),intent(in)::cfg_Ji_structure
integer:: itype !defines the type of execution
!itype=1 - to find the number
!of csfs_jj3 only,
!itype.ne.1 - perform full
!calculation
!GG! real(kind=dp) :: coef
integer :: inr_of_csfs_jj3
integer :: icsf_LS, icsf_jj3
integer :: J_1, J_1_min, J_1_max
integer :: J_12, J_12_min, J_12_max
integer :: J_12S, J_12S_min, J_12S_max
integer :: J_123S, J_123_min, J_123_max
integer :: IKK
integer :: JJTM1,JJTP1,JJTM1_min,JJTM1_max,JJTP1_min,JJTP1_max
integer :: JJTM2,JJTP2,JJTM2_min,JJTM2_max,JJTP2_min,JJTP2_max
integer :: inosubc, isubc, isubc_aviable
integer :: icsf, icsf_nr, ITTK, ITREXG
integer :: I, II, III, N1_MAX, N2_MAX, N3_MAX
integer :: N1_big, N2_big, N3_big, N4_big
integer :: N5_big, N6_big
integer :: number_1, number_2, number_3, number_4
integer :: number_5, number_6
integer :: I_Count1, I_Count2, I_Count3
integer :: iterm_1, iterm_2, iterm_3, iterm_4
integer :: iterm_5, iterm_6
integer :: N1_big_jj, N2_big_jj, N3_big_jj, N4_big_jj
integer :: N5_big_jj, N6_big_jj
integer :: iJ_total, Q_Term1, Nr_Term1, Q_Term2, Nr_Term2
integer :: Q_Term3, Nr_Term3
type(subshell_term), dimension(1:63) :: jj_1_term, jj_2_term
type(subshell_term), dimension(1:63) :: jj_3_term, jj_4_term
type(subshell_term), dimension(1:63) :: jj_5_term, jj_6_term
! write(*,*) ' subroutine form_csfs_jj3'
isubc_aviable = 3
if(expansion_cfg_LS%csfs(1)%nosubc /= isubc_aviable) then
write(*,*) "is available =",isubc_aviable," we have =", &
expansion_cfg_LS%csfs(1)%nosubc
write(*,*) 'STOP at subroutine define_number_of_csfs_jj3 ', &
'module transform_lsjj3: cfg_Ji_structure%nr_of_subc.gt.',&
'isubc_aviable'
stop
end if
iJ_total=states%states(expansion_cfg_LS%nr_of_state)%J
call define_number_of_csfs_jj3(inr_of_csfs_jj3)
expansion_cfg_jj3%size=inr_of_csfs_jj3
if(itype.ne.1) then
allocate(expansion_cfg_jj3%csfs(expansion_cfg_jj3%size))
allocate(expansion_cfg_jj3%coeffs(expansion_cfg_jj3%size))
icsf_jj3=0
do icsf_LS=1, nomach_csfs_ls%list_size,1
icsf_nr = nomach_csfs_ls%items(icsf_LS)
!
if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il == 3 .and. &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big>=3) then
Nr_Term1 = expansion_cfg_LS%csfs(icsf_nr)%subc(1)%inr
Q_Term1 = gettermLSQ( &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il, &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big,Nr_term1,&
expansion_cfg_LS%csfs(icsf_nr)%subc(1)%iL, &
expansion_cfg_LS%csfs(icsf_nr)%subc(1)%iS)
else
Q_Term1 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il+1- &
expansion_cfg_LS%csfs(icsf_nr)%subc(1)%inr
Nr_Term1 = 0
end if
inosubc = expansion_cfg_LS%csfs(icsf_nr)%nosubc
N1_MAX=2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il
if (N1_MAX == 0) then
N1_big = 0
N2_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big
I_Count1 = 1
else if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big &
<= N1_MAX) then
N1_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big
N2_big= 0
I_Count1 = N1_big + 1
else
N1_big=N1_MAX
N2_big= &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big-N1_big
I_Count1 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il+2 &
-N2_big+1
end if
!
if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il == 3 .and. &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big>=3) then
Nr_Term2 = expansion_cfg_LS%csfs(icsf_nr)%subc(2)%inr
Q_Term2 = gettermLSQ( &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il, &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big,Nr_term2,&
expansion_cfg_LS%csfs(icsf_nr)%subc(2)%iL, &
expansion_cfg_LS%csfs(icsf_nr)%subc(2)%iS)
else
Q_Term2 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il+1- &
expansion_cfg_LS%csfs(icsf_nr)%subc(2)%inr
Nr_Term2 = 0
end if
N2_MAX=2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il
if (N2_MAX == 0) then
N3_big = 0
N4_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big
I_Count2 = 1
else if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big &
<= N2_MAX) then
N3_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big
N4_big= 0
I_Count2 = N3_big + 1
else
N3_big=N2_MAX
N4_big= &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big-N3_big
I_Count2 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il+2 &
-N4_big+1
end if
!
if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il == 3 .and. &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big>=3) then
Nr_Term3 = expansion_cfg_LS%csfs(icsf_nr)%subc(3)%inr
Q_Term3 = gettermLSQ( &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il, &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big,Nr_term3,&
expansion_cfg_LS%csfs(icsf_nr)%subc(3)%iL, &
expansion_cfg_LS%csfs(icsf_nr)%subc(3)%iS)
else
Q_Term3 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il+1- &
expansion_cfg_LS%csfs(icsf_nr)%subc(3)%inr
Nr_Term3 = 0
end if
inosubc = expansion_cfg_LS%csfs(icsf_nr)%nosubc
N3_MAX=2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il
if (N3_MAX == 0) then
N5_big = 0
N6_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big
I_Count3 = 1
else if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big &
<= N3_MAX) then
N5_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big
N6_big= 0
I_Count3 = N5_big + 1
else
N5_big=N3_MAX
N6_big= &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big-N5_big
I_Count3 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il+2 &
-N6_big+1
end if
!
call getJMinMax( &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il, &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big, &
J_1_min,J_1_max)
do J_1 = J_1_min, J_1_max, 2
do I = 1,I_Count1,1
if (N1_big-I+1 .ge. 0) then
if(I == 1) then
if (N1_MAX /= 0) then
N1_big_jj = N1_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(1)%il-1,N1_big_jj,jj_1_term,&
number_1)
else
N1_big_jj = 0
number_1 = 1
jj_1_term(1)%j = 0
jj_1_term(1)%Q = 0
jj_1_term(1)%subshellJ = 0
end if
N2_big_jj = N2_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(1)%il+1,N2_big_jj,jj_2_term, &
number_2)
else
N1_big_jj = N1_big-I+1
N2_big_jj = N2_big+I-1
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(1)%il-1,N1_big_jj,jj_1_term, &
number_1)
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(1)%il+1,N2_big_jj,jj_2_term, &
number_2)
end if
do iterm_1 = 1,number_1
do iterm_2 = 1,number_2
if(ITTK( &
2*jj_1_term(iterm_1)%subshellJ, &
2*jj_2_term(iterm_2)%subshellJ, &
2*J_1) == 0) cycle
!GG! coef = coefLSjj( &
!GG! expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il, &
!GG! expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big,&
!GG! Nr_Term1, &
!GG! Q_Term1, &
!GG! expansion_cfg_LS%csfs(icsf_nr)%subc(1)%iL, &
!GG! expansion_cfg_LS%csfs(icsf_nr)%subc(1)%iS, &
!GG! J_1, &
!GG! jj_1_term(iterm_1)%j, &
!GG! N1_big_jj, &
!GG! jj_1_term(iterm_1)%Q, &
!GG! jj_1_term(iterm_1)%subshellJ, &
!GG! jj_2_term(iterm_2)%j, &
!GG! jj_2_term(iterm_2)%Q, &
!GG! jj_2_term(iterm_2)%subshellJ)
!GG! if (coef == ZERO_dp) cycle
do II = 1,I_Count2,1
if (N3_big-II+1 .ge. 0) then
if(II == 1) then
if (N2_MAX /= 0) then
N3_big_jj = N3_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(2)%il-1,N3_big_jj,jj_3_term,&
number_3)
else
N3_big_jj = 0
number_3 = 1
jj_3_term(1)%j = 0
jj_3_term(1)%Q = 0
jj_3_term(1)%subshellJ = 0
end if
N4_big_jj = N4_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(2)%il+1,N4_big_jj,jj_4_term, &
number_4)
else
N3_big_jj = N3_big-II+1
N4_big_jj = N4_big+II-1
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(2)%il-1,N3_big_jj,jj_3_term, &
number_3)
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(2)%il+1,N4_big_jj,jj_4_term, &
number_4)
end if
call getjjJMinMax( &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il-1,&
N3_big_jj,JJTM1_min,JJTM1_max)
call getjjJMinMax( &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il+1,&
N4_big_jj,JJTP1_min,JJTP1_max)
do JJTM1 = JJTM1_min, JJTM1_max, 2
do JJTP1 = JJTP1_min, JJTP1_max, 2
J_12S_min =iabs(J_1-JJTM1)
J_12S_max =J_1+JJTM1
do J_12S = J_12S_min, J_12S_max, 2
J_12_min = iabs(JJTP1-J_12S)
J_12_max = JJTP1+J_12S
do J_12 = J_12_min, J_12_max, 2
do iterm_3 = 1,number_3
if(jj_3_term(iterm_3)%subshellJ /= JJTM1) cycle
do iterm_4 = 1,number_4
if(jj_4_term(iterm_4)%subshellJ /= JJTP1) cycle
!
do III = 1,I_Count3,1
if (N5_big-III+1 .ge. 0) then
if(III == 1) then
if (N3_MAX /= 0) then
N5_big_jj = N5_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(3)%il-1,N5_big_jj,jj_5_term,&
number_5)
else
N5_big_jj = 0
number_5 = 1
jj_5_term(1)%j = 0
jj_5_term(1)%Q = 0
jj_5_term(1)%subshellJ = 0
end if
N6_big_jj = N6_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(3)%il+1,N6_big_jj,jj_6_term, &
number_6)
else
N5_big_jj = N5_big-III+1
N6_big_jj = N6_big+III-1
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(3)%il-1,N5_big_jj,jj_5_term, &
number_5)
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(3)%il+1,N6_big_jj,jj_6_term, &
number_6)
end if
call getjjJMinMax( &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il-1,&
N5_big_jj,JJTM2_min,JJTM2_max)
call getjjJMinMax( &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il+1,&
N6_big_jj,JJTP2_min,JJTP2_max)
do JJTM2 = JJTM2_min, JJTM2_max, 2
do JJTP2 = JJTP2_min, JJTP2_max, 2
J_123_min =ITREXG(J_12,JJTM2,JJTP2,iJ_total,IKK)
if(IKK.LE.0) cycle
J_123_max = J_123_min+IKK-1
do J_123S = J_123_min, J_123_max, 2
!
do iterm_5 = 1,number_5
if(jj_5_term(iterm_5)%subshellJ /= JJTM2) cycle
do iterm_6 = 1,number_6
if(jj_6_term(iterm_6)%subshellJ /= JJTP2) cycle
icsf_jj3 = icsf_jj3 + 1
expansion_cfg_jj3%csfs(icsf_jj3)%nosubc= &
inosubc
allocate(expansion_cfg_jj3%csfs(icsf_jj3)% &
subc_cfg(3))
allocate(expansion_cfg_jj3%csfs(icsf_jj3)% &
subc(3))
allocate(expansion_cfg_jj3%csfs(icsf_jj3)% &
iM1(3))
allocate(expansion_cfg_jj3%csfs(icsf_jj3)% &
iM2(3))
allocate(expansion_cfg_jj3%csfs(icsf_jj3)% &
iJ(3))
expansion_cfg_jj3%csfs(icsf_jj3)%iM1(1) &
= 1000*N1_big_jj + N3_big_jj
expansion_cfg_jj3%csfs(icsf_jj3)%iM1(2) &
= 1000*iterm_1 + iterm_3
expansion_cfg_jj3%csfs(icsf_jj3)%iM2(1) &
= 1000*N2_big_jj + N4_big_jj
expansion_cfg_jj3%csfs(icsf_jj3)%iM2(2) &
= 1000*iterm_2 + iterm_4
expansion_cfg_jj3%csfs(icsf_jj3)%iM1(3) &
= 1000*N5_big_jj + N6_big_jj
expansion_cfg_jj3%csfs(icsf_jj3)%iM2(3) &
= 1000*iterm_5 + iterm_6
!
expansion_cfg_jj3%csfs(icsf_jj3)%iJ(1)=J_1
expansion_cfg_jj3%csfs(icsf_jj3)%iJ(2) &
= 1000*J_12S + J_12
expansion_cfg_jj3%csfs(icsf_jj3)%iJ(3)=J_123S
!
expansion_cfg_jj3%csfs(icsf_jj3)%subc_cfg(1)=&
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)
expansion_cfg_jj3%csfs(icsf_jj3)%subc(1) = &
expansion_cfg_LS%csfs(icsf_nr)%subc(1)
!
expansion_cfg_jj3%csfs(icsf_jj3)%subc_cfg(2)=&
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)
expansion_cfg_jj3%csfs(icsf_jj3)%subc(2) = &
expansion_cfg_LS%csfs(icsf_nr)%subc(2)
!
expansion_cfg_jj3%csfs(icsf_jj3)%subc_cfg(3)=&
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)
expansion_cfg_jj3%csfs(icsf_jj3)%subc(3) = &
expansion_cfg_LS%csfs(icsf_nr)%subc(3)
end do
end do
end do
end do
end do
end if
end do
!
end do
end do
end do
end do
end do
end do
end if
end do
end do
end do
end if
end do
end do
end do
end if
!
! write(*,*) ' end subroutine form_csfs_jj3'
!write(iwrite_log,*) ' end subroutine form_csfs_jj3'
!
contains
!
!***********************************************************************
! *
subroutine define_number_of_csfs_jj3(irez)
! *
! This subroutine defines the number of csfs in jj3 coupling *
! *
! Written by G. Gaigalas, *
! NIST last update: February 2020 *
! *
!***********************************************************************
implicit none
integer, intent(out) :: irez
!GG! real(kind=dp) :: coef
! integer :: inr_of_csfs_jj3
integer :: J_1, J_1_min, J_1_max
integer :: J_12, J_12_min, J_12_max
integer :: J_12S, J_12S_min, J_12S_max
integer :: J_123S, J_123_min, J_123_max
integer :: IKK
integer :: JJTM1,JJTP1,JJTM1_min,JJTM1_max,JJTP1_min,JJTP1_max
integer :: JJTM2,JJTP2,JJTM2_min,JJTM2_max,JJTP2_min,JJTP2_max
integer :: inosubc, isubc, isubc_aviable
integer :: icsf, icsf_nr, ITTK, ITREXG
integer :: I, II, III, N1_MAX, N2_MAX, N3_MAX
integer :: N1_big, N2_big, N3_big, N4_big
integer :: N5_big, N6_big
integer :: number_1, number_2, number_3, number_4
integer :: number_5, number_6
integer :: I_Count1, I_Count2, I_Count3
integer :: iterm_1, iterm_2, iterm_3, iterm_4
integer :: iterm_5, iterm_6
integer :: N1_big_jj, N2_big_jj, N3_big_jj, N4_big_jj
integer :: N5_big_jj, N6_big_jj
integer :: Q_Term1, Nr_Term1, Q_Term2, Nr_Term2
integer :: Q_Term3, Nr_Term3
type(subshell_term), dimension(1:63) :: jj_1_term, jj_2_term
type(subshell_term), dimension(1:63) :: jj_3_term, jj_4_term
type(subshell_term), dimension(1:63) :: jj_5_term, jj_6_term
! write(*,*) ' subroutine define_number_of_csfs_jj3'
isubc_aviable = 3
if(expansion_cfg_LS%csfs(1)%nosubc /= isubc_aviable) then
write(*,*)'STOP at subroutine define_number_of_csfs_jj3 ',&
'module transform_lsclsJ3:cfg_Ji_structure%nr_of_subc.gt.',&
'isubc_aviable'
stop
end if
irez=0
do icsf=1, nomach_csfs_ls%list_size,1
icsf_nr = nomach_csfs_ls%items(icsf)
!
if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il == 3 .and. &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big>=3) then
Nr_Term1 = expansion_cfg_LS%csfs(icsf_nr)%subc(1)%inr
Q_Term1 = gettermLSQ( &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il, &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big,Nr_term1,&
expansion_cfg_LS%csfs(icsf_nr)%subc(1)%iL, &
expansion_cfg_LS%csfs(icsf_nr)%subc(1)%iS)
else
Q_Term1 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il+1- &
expansion_cfg_LS%csfs(icsf_nr)%subc(1)%inr
Nr_Term1 = 0
end if
inosubc = expansion_cfg_LS%csfs(icsf_nr)%nosubc
N1_MAX=2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il
if (N1_MAX == 0) then
N1_big = 0
N2_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big
I_Count1 = 1
else if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big &
<= N1_MAX) then
N1_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big
N2_big= 0
I_Count1 = N1_big + 1
else
N1_big=N1_MAX
N2_big= &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big-N1_big
I_Count1 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il+2 &
-N2_big+1
end if
!
if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il == 3 .and. &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big>=3) then
Nr_Term2 = expansion_cfg_LS%csfs(icsf_nr)%subc(2)%inr
Q_Term2 = gettermLSQ( &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il, &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big,Nr_term2,&
expansion_cfg_LS%csfs(icsf_nr)%subc(2)%iL, &
expansion_cfg_LS%csfs(icsf_nr)%subc(2)%iS)
else
Q_Term2 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il+1- &
expansion_cfg_LS%csfs(icsf_nr)%subc(2)%inr
Nr_Term2 = 0
end if
N2_MAX=2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il
if (N2_MAX == 0) then
N3_big = 0
N4_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big
I_Count2 = 1
else if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big &
<= N2_MAX) then
N3_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big
N4_big= 0
I_Count2 = N3_big + 1
else
N3_big=N2_MAX
N4_big= &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%iN_big-N3_big
I_Count2 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il+2 &
-N4_big+1
end if
!
if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il == 3 .and. &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big>=3) then
Nr_Term3 = expansion_cfg_LS%csfs(icsf_nr)%subc(3)%inr
Q_Term3 = gettermLSQ( &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il, &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big,Nr_term3,&
expansion_cfg_LS%csfs(icsf_nr)%subc(3)%iL, &
expansion_cfg_LS%csfs(icsf_nr)%subc(3)%iS)
else
Q_Term3 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il+1- &
expansion_cfg_LS%csfs(icsf_nr)%subc(3)%inr
Nr_Term3 = 0
end if
inosubc = expansion_cfg_LS%csfs(icsf_nr)%nosubc
N3_MAX=2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il
if (N3_MAX == 0) then
N5_big = 0
N6_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big
I_Count3 = 1
else if(expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big &
<= N3_MAX) then
N5_big = expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big
N6_big= 0
I_Count3 = N5_big + 1
else
N5_big=N3_MAX
N6_big= &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%iN_big-N5_big
I_Count3 = &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il+2 &
-N6_big+1
end if
!
call getJMinMax( &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il, &
expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big, &
J_1_min,J_1_max)
do J_1 = J_1_min, J_1_max, 2
do I = 1,I_Count1,1
if (N1_big-I+1 .ge. 0) then
if(I == 1) then
if (N1_MAX /= 0) then
N1_big_jj = N1_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(1)%il-1,N1_big_jj,jj_1_term,&
number_1)
else
N1_big_jj = 0
number_1 = 1
jj_1_term(1)%j = 0
jj_1_term(1)%Q = 0
jj_1_term(1)%subshellJ = 0
end if
N2_big_jj = N2_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(1)%il+1,N2_big_jj,jj_2_term, &
number_2)
else
N1_big_jj = N1_big-I+1
N2_big_jj = N2_big+I-1
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(1)%il-1,N1_big_jj,jj_1_term, &
number_1)
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(1)%il+1,N2_big_jj,jj_2_term, &
number_2)
end if
do iterm_1 = 1,number_1
do iterm_2 = 1,number_2
if(ITTK( &
2*jj_1_term(iterm_1)%subshellJ, &
2*jj_2_term(iterm_2)%subshellJ, &
2*J_1) == 0) cycle
!GG! coef = coefLSjj( &
!GG! expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%il, &
!GG! expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(1)%iN_big,&
!GG! Nr_Term1, &
!GG! Q_Term1, &
!GG! expansion_cfg_LS%csfs(icsf_nr)%subc(1)%iL, &
!GG! expansion_cfg_LS%csfs(icsf_nr)%subc(1)%iS, &
!GG! J_1, &
!GG! jj_1_term(iterm_1)%j, &
!GG! N1_big_jj, &
!GG! jj_1_term(iterm_1)%Q, &
!GG! jj_1_term(iterm_1)%subshellJ, &
!GG! jj_2_term(iterm_2)%j, &
!GG! jj_2_term(iterm_2)%Q, &
!GG! jj_2_term(iterm_2)%subshellJ)
!GG! if (coef == ZERO_dp) cycle
!
do II = 1,I_Count2,1
if (N3_big-II+1 .ge. 0) then
if(II == 1) then
if (N2_MAX /= 0) then
N3_big_jj = N3_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(2)%il-1,N3_big_jj,jj_3_term,&
number_3)
else
N3_big_jj = 0
number_3 = 1
jj_3_term(1)%j = 0
jj_3_term(1)%Q = 0
jj_3_term(1)%subshellJ = 0
end if
N4_big_jj = N4_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(2)%il+1,N4_big_jj,jj_4_term, &
number_4)
else
N3_big_jj = N3_big-II+1
N4_big_jj = N4_big+II-1
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(2)%il-1,N3_big_jj,jj_3_term, &
number_3)
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(2)%il+1,N4_big_jj,jj_4_term, &
number_4)
end if
call getjjJMinMax( &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il-1,&
N3_big_jj,JJTM1_min,JJTM1_max)
call getjjJMinMax( &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(2)%il+1,&
N4_big_jj,JJTP1_min,JJTP1_max)
do JJTM1 = JJTM1_min, JJTM1_max, 2
do JJTP1 = JJTP1_min, JJTP1_max, 2
J_12S_min =iabs(J_1-JJTM1)
J_12S_max =J_1+JJTM1
do J_12S = J_12S_min, J_12S_max, 2
J_12_min = iabs(JJTP1-J_12S)
J_12_max = JJTP1+J_12S
do J_12 = J_12_min, J_12_max, 2
do iterm_3 = 1,number_3
if(jj_3_term(iterm_3)%subshellJ /= JJTM1) cycle
do iterm_4 = 1,number_4
if(jj_4_term(iterm_4)%subshellJ /= JJTP1) cycle
!
do III = 1,I_Count3,1
if (N5_big-III+1 .ge. 0) then
if(III == 1) then
if (N3_MAX /= 0) then
N5_big_jj = N5_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(3)%il-1,N5_big_jj,jj_5_term,&
number_5)
else
N5_big_jj = 0
number_5 = 1
jj_5_term(1)%j = 0
jj_5_term(1)%Q = 0
jj_5_term(1)%subshellJ = 0
end if
N6_big_jj = N6_big
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(3)%il+1,N6_big_jj,jj_6_term, &
number_6)
else
N5_big_jj = N5_big-III+1
N6_big_jj = N6_big+III-1
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(3)%il-1,N5_big_jj,jj_5_term, &
number_5)
call gettermjj( &
2*expansion_cfg_LS%csfs(icsf_nr)% &
subc_cfg(3)%il+1,N6_big_jj,jj_6_term, &
number_6)
end if
call getjjJMinMax( &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il-1,&
N5_big_jj,JJTM2_min,JJTM2_max)
call getjjJMinMax( &
2*expansion_cfg_LS%csfs(icsf_nr)%subc_cfg(3)%il+1,&
N6_big_jj,JJTP2_min,JJTP2_max)
do JJTM2 = JJTM2_min, JJTM2_max, 2
do JJTP2 = JJTP2_min, JJTP2_max, 2
J_123_min =ITREXG(J_12,JJTM2,JJTP2,iJ_total,IKK)
if(IKK.LE.0) cycle
J_123_max = J_123_min+IKK-1
do J_123S = J_123_min, J_123_max, 2
!
do iterm_5 = 1,number_5
if(jj_5_term(iterm_5)%subshellJ /= JJTM2) cycle
do iterm_6 = 1,number_6
if(jj_6_term(iterm_6)%subshellJ /= JJTP2) cycle
irez = irez +1
end do
end do
end do
end do
end do
end if
end do
!
end do
end do
end do
end do