-
Notifications
You must be signed in to change notification settings - Fork 1
/
Coupling_getdata_mchf.f90
executable file
·2146 lines (2144 loc) · 89.5 KB
/
Coupling_getdata_mchf.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_getdata_mchf
! *
! 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
!-----------------------------------------------
! R o u t i n e s
!-----------------------------------------------
public :: get_mchf_data
private :: analy1GG
private :: analy1
private :: cfgo2
private :: cfgo3
private :: analy_j
private :: readcoeffs
private :: print_csf
!-----------------------------------------------
! G l o b a l V a r i a b l e s
!-----------------------------------------------
type(set_of_csfs_LS) :: csfs_LS
integer, dimension(:),pointer:: Iselect
!-----------------------------------------------
!
contains
!
!***********************************************************************
! *
subroutine get_mchf_data(icase, icoupling_nr_in_expansions, &
print_level, nr_of_j)
! *
! This managerial subroutine *
! *
!***********************************************************************
implicit none
!-----------------------------------------------
! D u m m y A r g u m e n t s
!-----------------------------------------------
integer, intent(in) :: icase, icoupling_nr_in_expansions, print_level
integer, intent(inout) :: nr_of_j
!-----------------------------------------------
! L o c a l V a r i a b l e s
!-----------------------------------------------
integer :: I_CSF, J
character(len=72), save :: cfg_line
!-----------------------------------------------
! write(*,*)' subroutine get_mchf_data'
! write(*,*)'Specify csf.inp format:'
! write(*,*)' ATSP2K CPC or GRASP jj2lsj (0/1)'
! read(*,'(i1)') I_CSF
I_CSF = 1
! open(1000+iread_csf, file='Coup.tmp',status='unknown')
! open(1000+iread_coefs, file='Coup2.tmp',status='unknown')
open(1000+iread_csf, status='scratch')
open(1000+iread_coefs, status='scratch')
if(icase == 1) call analy1GG(nr_of_j,I_CSF)
call analy1(icase,I_CSF)
if(csfs_LS%nr_of_csfs.gt.0) then
allocate(csfs_LS%csfs(csfs_LS%nr_of_csfs))
if(icase == 1) then
write(*,*) 'Specify shells for recoupling (no more than 12)'
read(*,'(a56)') cfg_line
write(*,*) &
"List of the shells included in the recoupling:"
write(*,*) cfg_line
write(*,*) ""
write(iwrite_log,*) &
"List of the shells included in the recoupling:"
write(iwrite_log,*) cfg_line
end if
write(*,*) ""
write(*,*) ""
write(*,'(A15,I5)') "Symmetry block:",icase
write(iwrite_log,*)""
write(iwrite_log,*)""
write(iwrite_log,'(1x,a15,i5)')"Symmetry block:",icase
write(iwrite_log,'(1x,a39,i9,a30)') &
'Total number of CSF in the input file =', &
csfs_LS%nr_of_csfs, ' (number of csf in expansion)'
write(iwrite_log,*) &
"---------------------------------------------------------------"
write(iwrite_log,*)"List of configurations which", &
" are eliminated from the calculation"
write(iwrite_log,*)''
write(iwrite_log,*)" No. Configurations"
write(iwrite_log,*) &
"---------------------------------------------------------------"
if (I_Numb == 1) then
call cfgo1(I_CSF,cfg_line)
else if (I_Numb == 2) then
call cfgo2(I_CSF,cfg_line)
else if (I_Numb == 3) then
call cfgo3(I_CSF,cfg_line)
else
write(*,*) "To many shell for evaluation"
stop
end if
call analy_j(icase,I_CSF,icoupling_nr_in_expansions)
if(states%nr_of_states.gt.0 .and. &
all_expansions%coupling_expansions &
(icoupling_nr_in_expansions)%nr_of_expansions.gt.0) then
allocate(states%states(states%nr_of_states))
allocate(all_expansions% &
coupling_expansions(icoupling_nr_in_expansions)% &
expansions(all_expansions% &
coupling_expansions(icoupling_nr_in_expansions)% &
nr_of_expansions))
end if
call readcoeffs(icase,I_CSF,nr_of_j,icoupling_nr_in_expansions)
end if
if(print_level.gt.1) call print_csf
call mchf_iseiti
close(1000+iread_csf)
close(1000+iread_coefs)
! write(*,*)' end subroutine get_mchf_data'
contains
!
!***********************************************************************
! *
subroutine mchf_iseiti
! *
!***********************************************************************
implicit none
!-----------------------------------------------
! L o c a l V a r i a b l e s
!-----------------------------------------------
integer :: error
integer :: icsf
!-----------------------------------------------
if(associated(Iselect)) deallocate(Iselect, STAT = error)
if(associated(csfs_LS%csfs)) then
do icsf=1, csfs_LS%nr_of_csfs
if(associated(csfs_LS%csfs(icsf)%subc)) &
deallocate(csfs_LS%csfs(icsf)%subc, STAT = error)
if(associated(csfs_LS%csfs(icsf)%subc_cfg)) &
deallocate(csfs_LS%csfs(icsf)%subc_cfg, STAT = error)
if(associated(csfs_LS%csfs(icsf)%iM1)) &
deallocate(csfs_LS%csfs(icsf)%iM1, STAT = error)
if(associated(csfs_LS%csfs(icsf)%iM2)) &
deallocate(csfs_LS%csfs(icsf)%iM2, STAT = error)
if(associated(csfs_LS%csfs(icsf)%iJ)) &
deallocate(csfs_LS%csfs(icsf)%iJ, STAT = error)
end do
deallocate(csfs_LS%csfs, STAT = error)
end if
end subroutine mchf_iseiti
!
end subroutine get_mchf_data
!
!***********************************************************************
! *
subroutine analy1GG(nr_of_j,I_CSF)
! *
! This subroutine defines: *
! csfs_LS%nr_of_csfs : number of csf's in mchf expansion *
! (to be used in definition of array of csf's *
! in subroutine cfgo1) *
! *
!***********************************************************************
implicit none
!-----------------------------------------------
! D u m m y A r g u m e n t s
!-----------------------------------------------
integer, intent(in) :: I_CSF
integer, intent(out) :: nr_of_j
!-----------------------------------------------
! L o c a l V a r i a b l e s
!-----------------------------------------------
character(len=72) :: line
character(len=55) :: cfg_line
integer :: ilinecount, eof
!-----------------------------------------------
! write(*,*) ' subroutine analy1GG'
read(iread_csf,'(a72)') line
read(iread_csf,'(a72)') line
ilinecount=0
nr_of_j = 0
do
read (iread_csf,'(a55)',iostat=eof) cfg_line
if (eof /= 0) exit
!GG if(cfg_line(2:2).eq.'*')read (iread_csf,'(a55)',iostat=eof) cfg_line
if(cfg_line(1:1).eq.'*' .or. cfg_line(2:2).eq.'*') then
nr_of_j = nr_of_j +1
write (2000+iread_csf,'(I55)') ilinecount
if (eof /= 0) exit
ilinecount=0
cycle
end if
if(cfg_line(3:3).eq.' '.or.cfg_line(4:4).eq.' ') exit
! if(cfg_line(3:3).eq.' '.or.cfg_line(4:4).eq.' ') THEN
! print*, "STOP analy1GG: A"
! print*, cfg_line
! STOP
! END IF
! if(cfg_line(1:1).ne.' '.or.cfg_line(9:9).ne.' ') exit
if(cfg_line(1:1).ne.' '.or.cfg_line(9:9).ne.' ') THEN
print*, "STOP analy1GG: B"
STOP
END IF
read (iread_csf,'(a72)') line
write (1000+iread_csf,'(a55)') cfg_line
write (1000+iread_csf,'(a72)') line
if(I_CSF == 0) THEN
if(line(1:5).ne.' '.or.line(6:6).eq.' ') exit
if(line(7:7).eq.' '.or.line(8:8).eq.' ') exit
else if(I_CSF == 1) THEN
! if(line(1:1).ne.' '.or.line(2:2).eq.' ') exit
if(line(1:1).ne.' '.or.line(2:2).eq.' ') THEN
print*, "STOP analy1GG: E"
STOP
END IF
! if(line(3:3).eq.' '.or.line(4:4).eq.' ') exit
if(line(3:3).eq.' '.or.line(4:4).eq.' ') THEN
print*, "STOP analy1GG: F"
STOP
END IF
else
write(*,*) ' error in cfg.inp format I_CSF',I_CSF
stop
end if
ilinecount = ilinecount + 1
if (ilinecount == 0) then
write(*,*) ' error in cfg.inp format'
stop
end if
end do
rewind(iread_csf)
rewind(2000+iread_csf)
! csfs_LS%nr_of_csfs=ilinecount
! print*,"analy1 csfs_LS%nr_of_csfs=",csfs_LS%nr_of_csfs
! write(iwrite_log,'(1x,a39,i9,a30)') &
! 'Total number of CSF in the input file =', &
! csfs_LS%nr_of_csfs, ' (number of csf in expansion)'
! write(*,*) ' end subroutine analy1'
end subroutine analy1GG
!
!***********************************************************************
! *
subroutine analy1(icase,I_CSF)
! *
! This subroutine defines: *
! csfs_LS%nr_of_csfs : number of csf's in mchf expansion *
! (to be used in definition of array of csf's *
! in subroutine cfgo1) *
! *
!***********************************************************************
implicit none
!-----------------------------------------------
! D u m m y A r g u m e n t s
!-----------------------------------------------
integer, intent(in) :: icase, I_CSF
!-----------------------------------------------
! L o c a l V a r i a b l e s
!-----------------------------------------------
character(len=72) :: line
character(len=55) :: cfg_line
integer :: ilinecount, eof
!-----------------------------------------------
! write(*,*) ' subroutine analy1'
read (2000+iread_csf,'(I55)') csfs_LS%nr_of_csfs
if(icase == 1) read(iread_csf,'(a72)') line
if(icase == 1) read(iread_csf,'(a72)') line
ilinecount=0
do
read (iread_csf,'(a55)',iostat=eof) cfg_line
!GG if(cfg_line(2:2).eq.'*')read (iread_csf,'(a55)',iostat=eof) cfg_line
if(cfg_line(1:1).eq.'*' .or. cfg_line(2:2).eq.'*') exit
if (eof /= 0) exit
if(cfg_line(3:3).eq.' '.or.cfg_line(4:4).eq.' ') exit
! if(cfg_line(3:3).eq.' '.or.cfg_line(4:4).eq.' ') THEN
! print*, "STOP analy1: A"
! STOP
! END IF
! if(cfg_line(1:1).ne.' '.or.cfg_line(9:9).ne.' ') exit
if(cfg_line(1:1).ne.' '.or.cfg_line(9:9).ne.' ') THEN
print*, "STOP analy1: B"
STOP
END IF
read (iread_csf,'(a72)') line
write (1000+iread_csf,'(a55)') cfg_line
write (1000+iread_csf,'(a72)') line
if(I_CSF == 0) THEN
if(line(1:5).ne.' '.or.line(6:6).eq.' ') exit
if(line(7:7).eq.' '.or.line(8:8).eq.' ') exit
else if(I_CSF == 1) THEN
! if(line(1:1).ne.' '.or.line(2:2).eq.' ') exit
if(line(1:1).ne.' '.or.line(2:2).eq.' ') THEN
print*, "STOP analy1: E"
STOP
END IF
! if(line(3:3).eq.' '.or.line(4:4).eq.' ') exit
if(line(3:3).eq.' '.or.line(4:4).eq.' ') THEN
print*, "STOP analy1: F"
STOP
END IF
else
write(*,*) ' error in cfg.inp format I_CSF',I_CSF
stop
end if
ilinecount = ilinecount + 1
end do
rewind(1000+iread_csf)
if (ilinecount == 0) then
write(*,*) ' error in cfg.inp format'
stop
end if
csfs_LS%nr_of_csfs=ilinecount
! write(*,*) ' end subroutine analy1'
end subroutine analy1
!
!***********************************************************************
! *
subroutine cfgo1(I_CSF,cfg_line)
! *
! This subroutine up the arrays *
! csfs_LS%csfs, with data from iread_csf *
! *
!***********************************************************************
implicit none
!-----------------------------------------------
! D u m m y A r g u m e n t s
!-----------------------------------------------
integer, intent(in) :: I_CSF
character(len=72), intent(in) :: cfg_line
!-----------------------------------------------
! L o c a l V a r i a b l e s
!-----------------------------------------------
character(len=72) :: cfg_line2, csf_line
character(len=8) :: somech
character(len=1) :: somech1
character :: charl
integer :: lval
integer :: imultiplicity, itermnr
integer :: icsf, isuba, isubc, j, jj, i, ii
integer :: inosubc_count
integer :: shell_n_1, shell_l_1, shell_n_2, shell_l_2
integer :: shell_n_3, shell_l_3, shell_n_4, shell_l_4
integer :: shell_n_5, shell_l_5, shell_n_6, shell_l_6
integer :: shell_n_7, shell_l_7, shell_n_8, shell_l_8
integer :: shell_n_9, shell_l_9, shell_n_10, shell_l_10
integer :: shell_n_11, shell_l_11, shell_n_12, shell_l_12
integer :: iN_T, iL_T, iN_big_T, iJ1, iJ2
integer, dimension(2) :: iJJ
!-----------------------------------------------
shell_n_1 = -100
shell_n_2 = -100
shell_n_3 = -100
shell_n_4 = -100
shell_n_5 = -100
shell_n_6 = -100
shell_n_7 = -100
shell_n_8 = -100
shell_n_9 = -100
shell_n_10 = -100
shell_n_11 = -100
shell_n_12 = -100
allocate (Iselect(csfs_LS%nr_of_csfs))
! write(*,*) 'Specify shells for recoupling (no more than 12)'
! read(*,'(a56)') cfg_line
! write(*,*) &
! "List of the shells included in the recoupling:"
! write(*,*) cfg_line
! write(*,*) ""
! write(iwrite_log,*) &
! "List of the shells included in the recoupling:"
! write(iwrite_log,*) cfg_line
! write(iwrite_log,*)""
! write(iwrite_log,*) &
! "---------------------------------------------------------------"
! write(iwrite_log,*)"List of configurations which", &
! " are eliminated from the calculation"
! write(iwrite_log,*)''
! write(iwrite_log,*)" No. Configurations"
! write(iwrite_log,*) &
! "---------------------------------------------------------------"
read(cfg_line(1:1),'(a1)') somech1
if (somech1(1:1) == ' ') then
if(cfg_line(4:4) == ' ' .or. cfg_line(4:4) .eq. ',') then
read(cfg_line(2:2),'(i1)') shell_n_1
read(cfg_line(3:3),'(a1)') somech1
jj=4
else if(cfg_line(5:5) == ' ' .or. cfg_line(5:5) .eq. ',') then
read(cfg_line(2:3),'(i2)') shell_n_1
read(cfg_line(4:4),'(a1)') somech1
jj=5
end if
else
if(cfg_line(3:3) == ' ' .or. cfg_line(3:3) .eq. ',') then
read(cfg_line(1:1),'(i1)') shell_n_1
read(cfg_line(2:2),'(a1)') somech1
jj=3
else if(cfg_line(4:4) == ' ' .or. cfg_line(4:4) .eq. ',') then
read(cfg_line(1:2),'(i2)') shell_n_1
read(cfg_line(3:3),'(a1)') somech1
jj=4
end if
end if
shell_l_1 = lval(somech1)
1 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
! write(*,*) 'Must be two shells for recoupling: cfgo2'
! stop
! end if
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 1
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_2
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_2
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_2 = lval(somech1)
end if
2 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 2
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_3
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_3
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_3 = lval(somech1)
end if
3 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 3
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_4
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_4
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_4 = lval(somech1)
end if
4 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 4
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_5
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_5
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_5 = lval(somech1)
end if
5 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 5
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_6
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_6
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_6 = lval(somech1)
end if
6 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 6
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_7
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_7
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_7 = lval(somech1)
end if
7 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 7
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_8
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_8
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_8 = lval(somech1)
end if
8 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 8
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_9
read(cfg_line(jj+1:jj+1),'(a1)') somech1
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_9
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_9 = lval(somech1)
end if
9 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 9
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_10
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_10
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_10 = lval(somech1)
end if
10 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 10
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_11
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_11
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_11 = lval(somech1)
end if
11 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 11
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_12
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_12
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_12 = lval(somech1)
end if
!
! read(iread_csf,'(a1)')csf_line
! read(iread_csf,'(a1)')csf_line
!zr froese aprasyme ka reiskia tie numeriai prie termu...
do i=1,72
cfg_line2(i:i)=' '
csf_line(i:i)=' '
end do
!write(*,*)' ', cfgs_LS%nr_of_cfg
do icsf=1, csfs_LS%nr_of_csfs,1
inosubc_count=0
read(1000+iread_csf,'(a56)')cfg_line2
read(1000+iread_csf,'(a72)')csf_line
!define the number of coupled shells nosubc
do j=1, 7, 1
read(cfg_line2(8*j-7:8*j),'(a8)') somech
if(somech.ne.' ') then
!write(*,*) '*',somech,'*'
inosubc_count=inosubc_count+1
end if
!---- sitas apsisaugojimas tam atvejui,
!jei tai ne cfg.inp, o cfg.out failas ...
if(somech.eq.' ') exit
end do
!GG csfs_LS%csfs(icsf)%nosubc=inosubc_count
csfs_LS%csfs(icsf)%nosubc=1
!write(*,*)'inosubc_count=', inosubc_count
allocate &
(csfs_LS%csfs(icsf)%subc_cfg(csfs_LS%csfs(icsf)%nosubc))
allocate(csfs_LS%csfs(icsf)%subc(csfs_LS%csfs(icsf)%nosubc))
allocate(csfs_LS%csfs(icsf)%iM1(csfs_LS%csfs(icsf)%nosubc))
allocate(csfs_LS%csfs(icsf)%iM2(csfs_LS%csfs(icsf)%nosubc))
allocate(csfs_LS%csfs(icsf)%iJ(csfs_LS%csfs(icsf)%nosubc))
!GG Cia kaszas keisto!!! allocate(csfs_LS%csfs(icsf)%iJ(csfs_LS%csfs(icsf)%nosubc))
!uzpildom cfg ...
!read quantum numbers of each subshell
! do isubc=1,csfs_LS%csfs(icsf)%nosubc,1
isuba = 0
do isubc=1,inosubc_count,1
!read quantum numbers N, n, and l of csf configuration
read(cfg_line2(8*isubc-6:8*isubc-5),'(i2)') iN_T
read(cfg_line2(8*isubc-4:8*isubc-4),'(a1)') charl
iL_T= lval(charl)
read(cfg_line2(8*isubc-2:8*isubc-1),'(i2)') iN_big_T
if(iN_T .eq. shell_n_1 .and. iL_T .eq. shell_l_1) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_2 .and. iL_T .eq. shell_l_2) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_3 .and. iL_T .eq. shell_l_3) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_4 .and. iL_T .eq. shell_l_4) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_5 .and. iL_T .eq. shell_l_5) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_6 .and. iL_T .eq. shell_l_6) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_7 .and. iL_T .eq. shell_l_7) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_8 .and. iL_T .eq. shell_l_8) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_9 .and. iL_T .eq. shell_l_9) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_10 .and. iL_T .eq. shell_l_10) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_11 .and. iL_T .eq. shell_l_11) then
isuba = isuba + 1
else if(iN_T .eq. shell_n_12 .and. iL_T .eq. shell_l_12) then
isuba = isuba + 1
else
if(iN_big_T /= 4*iL_T+2) then
Iselect(icsf) = 0
exit
else
cycle
end if
end if
if (isuba == 1) then
Iselect(icsf) = 1
else if (isuba >= 2) then
if(iN_big_T /= 4*iL_T+2) then
Iselect(icsf) = 0
exit
else
cycle
end if
end if
iJJ(isuba) = isubc
csfs_LS%csfs(icsf)%subc_cfg(isuba)%iN_big = iN_big_T
csfs_LS%csfs(icsf)%subc_cfg(isuba)%in = iN_T
csfs_LS%csfs(icsf)%subc_cfg(isuba)%il= iL_T
if(I_CSF == 0) THEN
read(csf_line(8*isubc-7:8*isubc),'(a8)') somech
read(somech(5:6),'(I2)')imultiplicity
read(somech(7:7),'(a1)')charl
read(somech(8:8),'(I1)')itermnr
else if(I_CSF == 1) THEN
read(csf_line(4*isubc-3:4*isubc),'(a8)') somech
read(somech(1:2),'(I2)')imultiplicity
read(somech(3:3),'(a1)')charl
read(somech(4:4),'(I1)')itermnr
end if
if(imultiplicity.le.0) then
write(iwrite_log,'(a22,i4,a4,i1,a5,i2)') &
' error reading csf Nr. ',icsf,' 2*S',isubc, &
'+1 = ',imultiplicity
stop 'unrecognized csf Si'
end if
if(lval(charl).le.(-1)) then
write(iwrite_log,'(a22,i4,a2,i1,a5,i2)') &
' error reading csf Nr. ',icsf,' L',isubc,'= ',&
lval(charl)
stop 'unrecognized csf Li'
end if
if(itermnr.le.(-1)) then
write(iwrite_log,'(a22,i4,a3,i1,a5,i2)') &
' error reading csf Nr. ',icsf,' nr',isubc,'= ',itermnr
stop 'unrecognized csf nri'
end if
csfs_LS%csfs(icsf)%subc(isuba)%iS=imultiplicity-1
csfs_LS%csfs(icsf)%subc(isuba)%iL=lval(charl)*2
csfs_LS%csfs(icsf)%subc(isuba)%inr=itermnr
end do
if (isuba /= 1) then
Iselect(icsf) = 0
end if
if (Iselect(icsf) == 0) then
write(iwrite_log,'(I7,A)') icsf, cfg_line2
cycle
end if
csfs_LS%csfs(icsf)%iM1(1)=csfs_LS%csfs(icsf)%subc(1)%iL
csfs_LS%csfs(icsf)%iM2(1)=csfs_LS%csfs(icsf)%subc(1)%iS
j = iJJ(2)
if(I_CSF == 0) THEN
read( &
csf_line(8*inosubc_count+8*(j-1)-7:8*inosubc_count+8*(j-1)),&
'(a8)') somech
read(somech(5:6),'(I2)')imultiplicity
read(somech(7:7),'(a1)')charl
else if(I_CSF == 1) THEN
read( &
csf_line(4*inosubc_count+4*(j-1)-3:4*inosubc_count+4*(j-1)),&
'(a8)') somech
read(somech(1:2),'(I2)')imultiplicity
read(somech(3:3),'(a1)')charl
end if
csfs_LS%csfs(icsf)%iM1(2)=lval(charl)*2
csfs_LS%csfs(icsf)%iM2(2)=imultiplicity-1
end do
write(iwrite_log,*) &
"---------------------------------------------------------------"
! write(*,*) ' end subroutine cfgo1'
end subroutine cfgo1
!
!***********************************************************************
! *
subroutine cfgo2(I_CSF,cfg_line)
! *
! This subroutine up the arrays *
! csfs_LS%csfs, with data from iread_csf *
! *
!***********************************************************************
implicit none
!-----------------------------------------------
! D u m m y A r g u m e n t s
!-----------------------------------------------
integer, intent(in) :: I_CSF
character(len=72), intent(in) :: cfg_line
!-----------------------------------------------
! L o c a l V a r i a b l e s
!-----------------------------------------------
character(len=72) :: cfg_line2, csf_line
character(len=8) :: somech
character(len=1) :: somech1
character :: charl
integer :: lval
integer :: imultiplicity, itermnr
integer :: icsf, isuba, isubc, j, jj, i, ii
integer :: inosubc_count
integer :: shell_n_1, shell_l_1, shell_n_2, shell_l_2
integer :: shell_n_3, shell_l_3, shell_n_4, shell_l_4
integer :: shell_n_5, shell_l_5, shell_n_6, shell_l_6
integer :: shell_n_7, shell_l_7, shell_n_8, shell_l_8
integer :: shell_n_9, shell_l_9, shell_n_10, shell_l_10
integer :: shell_n_11, shell_l_11, shell_n_12, shell_l_12
integer :: iN_T, iL_T, iN_big_T, iJ1, iJ2
integer, dimension(2) :: iJJ
!-----------------------------------------------
shell_n_1 = -100
shell_n_2 = -100
shell_n_3 = -100
shell_n_4 = -100
shell_n_5 = -100
shell_n_6 = -100
shell_n_7 = -100
shell_n_8 = -100
shell_n_9 = -100
shell_n_10 = -100
shell_n_11 = -100
shell_n_12 = -100
allocate (Iselect(csfs_LS%nr_of_csfs))
! write(*,*) 'Specify shells for recoupling (no more than 12)'
! read(*,'(a56)') cfg_line
! write(*,*) &
! "List of the shells included in the recoupling:"
! write(*,*) cfg_line
! write(*,*) ""
! write(iwrite_log,*) &
! "List of the shells included in the recoupling:"
! write(iwrite_log,*) cfg_line
! write(iwrite_log,*)""
! write(iwrite_log,*) &
! "---------------------------------------------------------------"
! write(iwrite_log,*)"List of configurations which", &
! " are eliminated from the calculation"
! write(iwrite_log,*)''
! write(iwrite_log,*)" No. Configurations"
! write(iwrite_log,*) &
! "------ -------------------------------------------------------"
read(cfg_line(1:1),'(a1)') somech1
if (somech1(1:1) == ' ') then
if(cfg_line(4:4) == ' ' .or. cfg_line(4:4) .eq. ',') then
read(cfg_line(2:2),'(i1)') shell_n_1
read(cfg_line(3:3),'(a1)') somech1
jj=4
else if(cfg_line(5:5) == ' ' .or. cfg_line(5:5) .eq. ',') then
read(cfg_line(2:3),'(i2)') shell_n_1
read(cfg_line(4:4),'(a1)') somech1
jj=5
end if
else
if(cfg_line(3:3) == ' ' .or. cfg_line(3:3) .eq. ',') then
read(cfg_line(1:1),'(i1)') shell_n_1
read(cfg_line(2:2),'(a1)') somech1
jj=3
else if(cfg_line(4:4) == ' ' .or. cfg_line(4:4) .eq. ',') then
read(cfg_line(1:2),'(i2)') shell_n_1
read(cfg_line(3:3),'(a1)') somech1
jj=4
end if
end if
shell_l_1 = lval(somech1)
1 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj >= 57) then
write(*,*) 'Must be two shells for recoupling: cfgo1'
stop
end if
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 1
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_2
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_2
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_2 = lval(somech1)
2 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 2
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_3
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_3
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_3 = lval(somech1)
end if
3 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 3
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_4
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_4
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_4 = lval(somech1)
end if
4 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 4
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_5
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_5
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_5 = lval(somech1)
end if
5 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 5
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_6
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &
(cfg_line(jj+3:jj+3)==' '.or.cfg_line(jj+3:jj+3).eq.',')&
then
read(cfg_line(jj:jj+1),'(i2)') shell_n_6
read(cfg_line(jj+2:jj+2),'(a1)') somech1
jj=jj+3
end if
end if
shell_l_6 = lval(somech1)
end if
6 continue
read(cfg_line(jj:jj),'(a1)') somech1
if (jj <= 57) then
if (somech1 .eq. ' ' .or. somech1 .eq. ',') then
jj=jj+1
go to 6
else
if(cfg_line(jj+2:jj+2)==' '.or.cfg_line(jj+2:jj+2).eq.',') then
read(cfg_line(jj:jj),'(i1)') shell_n_7
read(cfg_line(jj+1:jj+1),'(a1)') somech1
jj=jj+2
else if &