-
Notifications
You must be signed in to change notification settings - Fork 11
/
quadrupole.f90
2055 lines (1595 loc) · 69 KB
/
quadrupole.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 quadrupole
use accuracy, only : hik, ik, rk, ark, cl, out,&
vellgt, planck, avogno, boltz, pi, small_
use diatom_module, only : job, Intensity, quantaT, eigen, basis,&
nQuadrupoles, quadrupoletm, duo_j0, fieldT, poten,&
three_j, jmin_global
use timer, only : IOstart, Arraystart, Arraystop, ArrayMinus,&
Timerstart, Timerstop, MemoryReport, &
TimerReport, memory_limit, memory_now
use symmetry, only : sym, correlate_to_Cs
private
public qm_tranint
type ElevelT
integer(ik) :: jind ! J index
integer(ik) :: igamma
integer(ik) :: ilevel
end type ElevelT
type(ElevelT), allocatable :: Elevel(:)
integer(ik) :: nEigenLevels
! Wilfrid Somogyi: Routine for evaluating the quadrupole moment matrix elements
! and linestrength equations. Adapted from dipole.f90 for the
! case of a symmetric tensor of rank two.
contains
subroutine qm_tranint
! computes the partition function and calls qm_intensity to calculate
! the electric quadrupole transition moments, linestrengths and
! intensities if required.
implicit none
! counter, indexes, etc.
real(rk) :: jMin, jMax, jValMin, jVal_
integer(ik) :: nJ, jInd
integer(ik) :: indLevel, indGamma, indState, guParity, &
indSym
! calculation variables
real(rk) :: energy, beta, expEn, part
integer(ik) :: irrep
real(rk), allocatable :: jVal(:), qPart(:,:)
! assorted
integer(ik) :: info, iVerbose = 4
! find the min and max J values to compute transitions for
jMax = maxval(Intensity%J(1:2))
jMin = minval(Intensity%J(1:2))
jMin = max(jmin_global, jMin)
! now find lowest possible J value of system to make sure all
! energies J > 0 are included in line list file regardless of the
! value Intensity%J, otherwise energy list numbering will not be
! consistent with the actual J values.
jValMin = 0
if ( mod(nint(2.0_rk * job%j_list(1)), 2) /= 0 ) jValMin = 0.5_rk
jValMin = max(jmin_global, jValMin)
! now count number of J states
jVal_ = jValMin
nJ = 1
do while ( jVal_ < jMax )
jVal_ = jVal_ + 1.0_rk
nJ = nJ + 1
enddo
! prepare arrays to store J values and partition functions
allocate(jVal(nJ), stat=info)
if ( info /= 0 ) then
stop 'qm_tranint allocation error: jVal - out of memory'
endif
allocate(qPart(20, nJ), stat=info)
if ( info /= 0 ) then
stop 'qm_tranint allocation error: qPart - out of memory'
endif
! add J values to array
jVal_ = jValMin
jInd = 1
Jval(jind) = Jval_
do while (Jval_<Jmax)
jind = jind + 1
Jval_ = Jval_ + 1.0_rk
Jval(jind) = Jval_
end do
call duo_j0(iverbose, jVal)
if ( job%shift_to_zpe ) then
do jInd = 1, nJ
jVal_ = jVal(jInd)
do indGamma = 1, sym%NrepresCs
!
irrep = correlate_to_Cs(indGamma, guParity)
!
do indLevel = 1, eigen(jInd, indGamma)%Nlevels
!
! for homonuclear Nrepres = 4 and the irrep can be
! reconstructed from parity and g/u
!
indState = eigen(jInd, indGamma)%quanta(indLevel)%istate
guParity = poten(indState)%parity%gu
indSym = correlate_to_Cs(indGamma, guParity)
!
if (Intensity%gns(indSym)<small_) cycle
! if energy of state < ZPE then adjust ZPE
energy = eigen(jInd, indGamma)%val(indLevel)
Intensity%ZPE = min(Intensity%ZPE, energy)
enddo
enddo
enddo
! write out result
if ( iverbose >= 2 ) then
write(out, '(/"Zero point energy (ZPE) = ",f18.6,"&
& (global zero, used for intensities)")') Intensity%ZPE
endif
if ( iverbose >= 4 ) then
write(out, "(/'Partition function = ',f18.4,'&
& T = ',f12.2)") Intensity%part_func, Intensity%temperature
endif
endif
select case ( trim(Intensity%action) )
case('ABSORPTION', 'EMISSION', 'TM')
call Sort_levels(iVerbose, nJ, jVal(1:nJ))
beta = planck * vellgt / (boltz * Intensity%temperature)
if ( Intensity%part_func < small_ ) then
Intensity%part_func = 0
do jInd = 1, nJ
jVal_ = jVal(jInd)
do indGamma = 1, sym%NrepresCs
do indLevel = 1, eigen(jInd, indGamma)%Nlevels
energy = eigen(jInd, indGamma)%val(indLevel)
irrep = eigen(jInd, indGamma)%quanta(indLevel)%igamma
! for homonuclear Nrepres = 4 and the irrep can be
! reconstructed from parity and g/u
indState = eigen(jInd, indGamma)%quanta(indLevel)%istate
guParity = poten(indState)%parity%gu
indSym = correlate_to_Cs(indGamma, guParity)
! calculate the Boltzmann exponent of the energy
expEn = exp( -(energy - Intensity%ZPE) * beta)
! add to partition function
Intensity%part_func = Intensity%part_func &
& + Intensity%gns(indSym) &
& * (2.0_rk*jVal_ + 1.0_rk) * expEn
enddo
enddo
enddo
! write out result
if ( iVerbose >= 4 ) then
write(out, &
"(/'Partition function = ',f18.4,' T = ',f12.2)" &
) intensity%part_func, intensity%temperature
endif
endif
! if absorption, emission of tm then calculate linestrengths
call qm_intensity(jVal, iVerbose)
write(out, '(/a)') 'done'
case('PARTFUNC')
write(out, '(/a)') 'compute partition function'
qPart = 0
do jInd = 1, nJ
jVal_ = jVal(jInd)
do indGamma = 1, sym%NrepresCs
do indLevel = 1, eigen(jInd, indGamma)%Nlevels
energy = eigen(jInd, indGamma)%val(indLevel)
irrep = eigen(jInd, indGamma)%quanta(indLevel)%igamma
! for homonuclear Nrepres = 4 and the irrep can be
! reconstructed from parity and g/u
indState = eigen(jInd, indGamma)%quanta(indLevel)%istate
guParity = poten(indState)%parity%gu
indSym = correlate_to_Cs(indGamma, guParity)
! calculate the Boltzmann exponent of the energy
expEn = exp( -(energy - Intensity%ZPE) * beta)
! add to partition function
qPart(irrep, jInd) = qPart(irrep, jInd) &
& + Intensity%gns(indSym) &
& * (2.0_rk*jVal_ + 1.0_rk) * expEn
enddo
enddo
enddo
! sum of partition function
part = sum(qPart(:,:))
do jInd = 1, nJ
do irrep = 1, sym%NrepresCs
write(out, '(i4,1x,f18.1,1x,es16.8)') &
irrep, jVal(jInd), qPart(irrep, jInd)
enddo
enddo
! write out result
write(out, '(es16.8)') part
end select
call MemoryReport
call TimerReport
end subroutine qm_tranint
subroutine qm_intensity(Jval, iVerbose)
! performs the actual transition moment, linestrength and intensity
! calculations when called by qm_tranint
implicit none
! I/O variables
real(rk), intent(in) :: jVal(:)
integer(ik), intent(in) :: iVerbose
! filenames, identifiers, etc.
character(len=cl) :: filename, ioname
integer(ik) :: enunit, transUnit, info
integer(ik), allocatable :: richUnit(:, :)
character(len=130) :: myFmt
character(len=12) :: char_Jf, char_Ji, char_LF
character(len=1) :: letLFa, letLFb
character(len=2) :: letLF, dir
integer(ik) :: nDecimals, alloc_p
! indexes and counters
integer(ik) :: nJ, Jmax_, indJ, indI, indF, IDj
integer(ik) :: iLFa, iLFb, iLF, iflag_rich
integer(ik) :: nTrans, indTrans, nLower
integer(ik) :: indGamma, guParity, indTau, &
indGammaI, indGammaF, indSymI, indSymF
integer(ik) :: nLevels, nLevelsI, nLevelsF,&
indLevelI, indLevelF
integer(ik) :: nLevelsG(sym%Nrepresen)
integer(ik) :: indRoot, k, k_
! (pseudo) quantum numbers
real(rk), allocatable :: vecI(:), vecF(:)
type(quantaT), pointer :: quantaI, quantaF
real(rk) :: j_, jI, jF
integer(ik) :: ivibI, ivibF, vI, vF, ilambdaI, ilambdaF,parityI
integer(ik) :: vF_, ilambdaF_
real(rk) :: spinI, spinF, sigmaI, sigmaF, &
omegaI, omegaF
real(rk) :: spinF_, sigmaF_, iomegaF_
character(len=10) :: statename
character(len=1) :: ef, pm, branch
! calculation variables
real(rk) :: energyI, energyF
integer(ik) :: istateI, istateF
integer(ik) :: nRepresen, dimenMax, dimenI, dimenF, &
iGammaPair(sym%nRepresen)
real(hik) :: matSize
real(rk) :: beta, inten_cm_mol, emcoef, A_coef_s_1, &
A_einst, boltz_fc, absorption_int, unitConv, vacPerm
real(rk) :: lande, nu_if, lineStr, linestr2, tm, ddot
real(rk), allocatable :: halfLineStr(:)
! cash transitons
real(rk),allocatable :: acoef_RAM(:),nu_ram(:)
integer(ik),allocatable :: indexi_RAM(:),indexf_RAM(:)
! logicals
logical :: intSpin = .true.
logical :: passed, passed_
call TimerStart('Intensity calculations')
! define values of some constants
beta = planck * vellgt / (boltz * Intensity%temperature)
inten_cm_mol = 8.0d-36*pi**3 / (3.0_rk * planck * vellgt)
emcoef = planck*vellgt/(4.0_rk*pi)
!
! vacuum permittivity (NIST 2018) - needs to be
! properly programmed later
vacPerm = 8.8541878128d-12
! conversion factor for Q[a.u] -> Q[S.I],
! h[erg.s] -> h[J.s] and nu_if[/cm] -> nu_if[/m]
unitConv = 2.012914458d-62
! calculate the common factor for the Einstein coefficient
A_coef_s_1 = unitConv*(8.0_rk * pi**5)/(5.0_rk * vacPerm * planck)
!
if ( sym%maxdegen > 2) then
write(out, "('qm_intensity: this procedure has not been tested&
& for the symmetries with degeneracies higher than 2...&
& In fact, this procedure has not been tested at all!')" &
)
endif
nRepresen = sym%NrepresCs
! define number of J states from input
nJ = size(Jval)
if ( trim(Intensity%linelist_file) /= 'NONE' ) then
! prepare and open the .states file
filename = trim(Intensity%linelist_file)//'.states'
write(ioname, '(a, i4)') 'Energy file'
call IOStart(trim(ioname), enunit)
open(unit = enunit, action='write', &
status='replace', file=filename)
! prepare and open the .trans file
filename = trim(Intensity%linelist_file)//'.trans'
write(ioname, '(a, i4)') 'Transition file'
call IOStart(trim(ioname), transUnit)
open(unit = transUnit, action='write', &
status='replace', file=filename)
! calculate matrix elements
if ( Intensity%matelem ) then
! define maximum J value
Jmax_ = nint( maxval(Jval(:)) )
allocate( richUnit(nJ, nJ) )
! loop over initial J states
do indI = 1, nJ
! assign value of initial J and write as string to char_Ji
jI = Jval(indI)
write(char_Ji, '(i12)') nint(jI)
do indF = 1, nJ
! assign value of final J
! only loop over jF > jI, permute to calculate others
jF = Jval(indF)
if ( jF < jI) cycle
! J selection rules
if ( nint(abs(jI - jF)) > 2 &
.or. nint(jI + jF) < 2 &
) cycle
! write to file final J value as string to char_Jf
write(char_Jf, '(i12)') nint(jF)
! New RichMol format - one file for all components
filename = 'matelem_Q'//&
'_j'//trim(adjustl(char_Ji))//&
'_j'//trim(adjustl(char_Jf))//&
'_'//trim(Intensity%linelist_file)//'.rchm'
! open RichMol file for matrix elements between jI, jF
call IOstart(trim(filename), richUnit(indI, indF))
open(unit = richUnit(indI, indF), action='write', &
status = 'replace', file=filename)
! add headers to RichMol file
write(richUnit(indI, indF), "('Start richmol format')")
write(richUnit(indI, indF), "('Q ',' 2',' 9')")
write(richUnit(indI, indF), "('M-tensor')")
! nine cartesian LF-components
do iLFa = 1, 3
letLFa = 'x'
if ( iLFa > 3) letLFa = 'y'
if ( iLFa > 6) letLFa = 'z'
do iLFb = 1, 3
letLFb = 'x'
if ( iLFb == 2) letLFb = 'y'
if ( iLFb == 3) letLFb = 'z'
! concatenate first and second index and convert iLFa
! and iLFb to a single running index over all 9 comps.
! 1=xx, 2=xy, 3=xz, 4=yx, 5=yy, 6=yz, 7=zx, 8=zy, 9=zz
letLF = letLFa//letLFb
iLF = 3*(iLFa - 1) + iLFb
! flag for imaginary components
iflag_rich = -1
if ( iLFa == 2 .and. iLFb /= 2 &
.or. iLFa /= 2 .and. iLFb == 2 &
) iflag_rich = 0
write(char_LF, '(i12)') iLF
write(richUnit(indI, indF), "('alpha',i5,i3,1x,a2)") &
iLF, iflag_rich, letLF
! calculate the part of the matrix element equation
! that corresponds to the molecule -> lab transformation
call do_LF_matrix_elements(iLFa, iLFb, &
richUnit(indI, indF), &
jI, jF)
enddo
! heading for next section
write(richUnit(indI, indF), "('K-tensor')")
enddo
enddo
enddo
endif
endif
! estimate the maximum size of the basis set
dimenMax = 0
do indJ = 1, nJ
do indGamma = 1, nRepresen
dimenMax = max(dimenmax, eigen(indJ, indGamma)%Ndimen)
enddo
enddo
! count the number of transitions that need to be calculated first
! this will help keep track of the calculation progress, also count
! the number of lower levels from which transitions occur
nTrans = 0
nLower = 0
indRoot = 0
! number of initial states
nLevels = nEigenLevels
! for a given symmetry, iGamma, with some g_ns(iGamma) we find
! it's counterpart jGamma /= iGamma with the same g_ns(iGamma). It
! is assumed that there is only one such pair in the case of
! absorption and emission calculations
call find_igamma_pair(iGammaPair)
call TimerStart('Intens_Filter-1')
do indI = 1, nJ
jI = JVal(indI)
!
do indGammaI = 1, nRepresen
nLevelsI = eigen(indI, indGammaI)%Nlevels
do indLevelI = 1, nLevelsI
! obtain the energy and quanta of the initial state
energyI = eigen(indI, indGammaI)%val(indLevelI)
! obtain the symmetry of the initial state
istateI = eigen(indI, indGammaI)%quanta(indLevelI)%iState
guParity = poten(istateI)%parity%gu
indSymI = correlate_to_Cs(indGammaI, guParity)
! check energy of lower state is in range and > ZPE
call energy_filter_ul(jI, energyI, passed, 'lower')
if ( .not. passed ) cycle
nLower = nLower + 1
do indF = 1, nJ
jF = jVal(indF)
do indGammaF = 1, nRepresen
nLevelsF = eigen(indF, indGammaF)%Nlevels
do indLevelF = 1, nLevelsF
! obtain the energy and quanta of the final state
energyF = eigen(indF, indGammaF)%val(indLevelF)
! obtain the symmetry of the final state
istateF = eigen(indF, indGammaF)&
%quanta(indLevelF)%iState
guParity = poten(istateF)%parity%gu
indSymF = correlate_to_Cs(indGammaF, guParity)
! check the Intensity of the transition passes filter
call intens_filter(jI, jF, energyI, energyF, &
indSymI, indSymF, iGammaPair, &
passed)
if ( Intensity%matelem ) then
call matelem_filter(jI, jF, energyI, energyF, &
indSymI, indSymF, iGammaPair, &
passed)
endif
if ( passed ) then
nTrans = nTrans + 1
endif
enddo
enddo
enddo
enddo
enddo
enddo
call TimerStop('Intens_Filter-1')
! we now count the number of states with a given symmetry
nLevelsG = 0
if ( mod(eigen(1,1)%quanta(1)%imulti, 2) == 0) intSpin = .false.
allocate(vecI(dimenMax), stat = info)
call ArrayStart('intensity-vecI', info, size(vecI), kind(vecI))
do indI = 1, nJ
jI = jVal(indI)
j_ = -1 ! for output in RichMol format (w/ mat. elems.)
do indGammaI = 1, nRepresen
! number of initial levels
nLevelsI = eigen(indI, indGammaI)%Nlevels
dimenI = eigen(indI, indGammaI)%Ndimen
do indLevelI = 1, nLevelsI
! obtain the energy of the initial state
energyI = eigen(indI, indGammaI)%val(indLevelI)
! obtain the symmetry of the state
istateI = eigen(indI, indGammaI)%quanta(indLevelI)%istate
guParity = poten(istateI)%parity%gu
indSymI = correlate_to_Cs(indGammaI, guParity)
! ignore states with zero nuclear spin statistical weighting
if ( Intensity%gns(indSymI) < small_ ) cycle
! indRoot is a running number over states
indRoot = indRoot + 1
eigen(indI, indGammaI)%quanta(indLevelI)%iroot = indRoot
if ( trim(Intensity%linelist_file) /= 'NONE') then
! assign quantum numbers for initial state
quantaI => eigen(indI, indGammaI)%quanta(indLevelI)
ivibI = quantaI%ivib
vI = quantaI%v
spinI = quantaI%spin
sigmaI = quantaI%sigma
ilambdaI = quantaI%ilambda
omegaI = quantaI%omega
parityI = quantaI%iparity
statename = trim(quantaI%name)
! reconstruct +/- and e/f parities
if ( parityI == 1) then
pm = '-'
else
pm = '+'
endif
if ( mod( nint(2.0_rk*jI), 2 ) == 1 ) then
indTau = mod( nint(jI - 0.5), 2 )
else
indTau = mod( nint(jI), 2 )
endif
if ( indTau == parityI ) then
ef = 'e'
else
ef = 'f'
endif
! the variable nDecimals determines the number of decimal
! places to which we print the energy levels. By default we
! use 6 decimals for energies up to 100,000 /cm, sacrificing
! more for higher energies in order that the value fits
! within the 12 allocated character spaces. The present
! format works for energies -10,000 /cm < E < 1e11 /cm.
nDecimals = 6 - max(0, &
int(log10(abs(energyI - Intensity%ZPE) + 1.d-6) - 4))
! if requested, calculate and print the Lande g-factor for
! the selected eigenstate
if ( Intensity%lande_calc ) then
lande = 0
vecI(1:dimenI) = eigen(indI, indGammaI)%&
vect(1:dimenI, indLevelI)
if ( jI > 0 ) then
do k = 1, dimenI
spinF = basis(indI)%icontr(k)%spin
sigmaF = basis(indI)%icontr(k)%sigma
ilambdaF = basis(indI)%icontr(k)%ilambda
omegaF = basis(indI)%icontr(k)%omega
vF = basis(indI)%icontr(k)%ivib
do k_ = 1, dimenI
spinF_ = basis(indI)%icontr(k)%spin
sigmaF_ = basis(indI)%icontr(k)%sigma
ilambdaF_ = basis(indI)%icontr(k)%ilambda
iomegaF_ = basis(indI)%icontr(k)%omega
vF_ = basis(indI)%icontr(k)%ivib
!!!!!
if ( ilambdaF /= ilambdaF_ &
.or. nint(spinF - spinF_) /= 0 &
.or. vF /= vF_ ) cycle
if ( k == k_ ) then
lande = lande + vecI(k)*vecI(k)*omegaF &
*(real(ilambdaF, rk) + 2.0023_rk*sigmaF)
elseif ( nint(abs(sigmaF_ - sigmaF)) == 1 ) then
lande = lande + vecI(k)*vecI(k_) &
*sqrt( &
spinF*(spinF + 1.0_rk) &
- sigmaF*(sigmaF + sigmaF_ - sigmaF) &
) &
*sqrt( &
jI*(jI + 1.0_rk) &
- omegaF*(omegaF + iomegaF_ - omegaF) &
) &
* (2.002319_rk/2.0_rk)
endif
enddo
enddo
lande = lande / ( jI*(jI + 1.0_rk) )
endif
! if integer spin, then integerise quantum numbers
if ( intSpin ) then
write(myFmt, '(A,i0,a)') &
"(i12,1x,f12.",ndecimals,",1x,i6,1x,i7,1x,f13.6,1x,&
&a1,1x,a1,1x,a10,1x,i3,1x,i2,2i8)"
write(enunit, myFmt) &
indRoot, energyI - Intensity%ZPE, &
nint( Intensity%gns(indSymI)*(2.0_rk*jI + 1.0_rk) ), &
nint(jI), lande, pm, ef, statename, &
vI, ilambdaI, nint(sigmaI), nint(omegaI)
! if not then write quantum numbers as reals
else
write(myFmt, '(A,i0,a)') &
"(i12,1x,f12.",ndecimals,",1x,i6,1x,f7.1,1x,f13.6,1x,&
&a1,1x,a1,1x,a10,1x,i3,1x,i2,2f8.1)"
write(enunit, myFmt) &
indRoot, (energyI - Intensity%ZPE), &
nint( Intensity%gns(indSymI)*(2.0_rk*jI + 1.0_rk) ), &
jI, lande, pm, ef, statename, &
vI, ilambdaI, sigmaI, omegaI
endif
! alternative format for RichMol matrix elements
elseif ( Intensity%matelem ) then
nDecimals = 6 - max(0, &
int(log10(abs(energyI - Intensity%ZPE) + 1.d-6) - 4))
if ( nint(2*jI) /= nint(2*j_) ) then
j_ = jI
IDj = 0
endif
IDj = IDj + 1
quantaI%iJ_ID = IDj
! if integer spin, then integerise quantum numbers
if ( intSpin ) then
write(myFmt, '(a)') &
"(i6,1x,i8,1x,i2,1x,i2,3x,e21.14,5x,a4,i3,1x,a2,i4,&
&1x,a2,f8.4,1x,i6,1x,i6,1x,i4,1x,i6,1x,a1,1x,a10)"
write(enunit, myFmt) &
nint(j_), IDj, parityI+1, 1, energyI-Intensity%ZPE, &
'tau:', parityI, 'j:', nint(j_), 'c', 1.000_rk, &
nint(omegaI), vI, ilambdaI, nint(sigmaI), pm, statename
! if not then write quantum numbers as reals
else
write(myFmt, '(A,i0,a)') &
"(i7,1x,i12,1x,i1,1x,i2,1x,f12.",ndecimals,&
",1x,f7.1,1x,i6,1x,i4,1x,f7.1,1x,a1,1x,a10)"
write(enunit, myFmt) &
nint(j_), IDj, parityI+1, 1, energyI-Intensity%ZPE, &
omegaI, vI, ilambdaI, sigmaI, pm, statename
endif
! standard output format if matelem or lande not required
else
nDecimals = 6 - max(0, &
int(log10(abs(energyI - Intensity%ZPE) + 1.d-6) - 4))
! if integer spin, then integerise quantum numbers
if ( intSpin ) then
write(myFmt, '(A,i0,a)') &
"(i12,1x,f12.", ndecimals, &
",1x,i6,1x,i7,1x,a1,1x,a1,1x,a10,1x,i3,1x,i2,2i8)"
write(enunit, myFmt) &
indRoot, energyI-Intensity%ZPE, &
nint( Intensity%gns(indSymI)*(2.0_rk*jI + 1.0_rk) ), &
nint(jI), pm, ef, statename, vI, ilambdaI, &
nint(sigmaI), nint(omegaI)
! if not then write quantum numbers as reals
else
write(myFmt, '(A,i0,a)') &
"(i12,1x,f12.", ndecimals, &
",1x,i6,1x,f7.1,1x,a1,1x,a1,1x,a10,1x,i3,1x,i2,2f8.1)"
write(enunit, myFmt) &
indRoot, energyI-Intensity%ZPE, &
nint( Intensity%gns(indSymI)*(2.0_rk*jI + 1.0_rk) ), &
jI, pm, ef, statename, vI, ilambdaI, sigmaI, omegaI
endif
endif
endif
call energy_filter_ul(jI, energyI, passed, 'upper')
call energy_filter_ul(jI, energyI, passed_, 'lower')
if ( .not. passed &
.and. .not. passed_) cycle
istateI = eigen(indI, indGammaI)%quanta(indLevelI)%istate
guParity = poten(istateI)%parity%gu
indSymI = correlate_to_Cs(indGammaI, guParity)
nLevelsG(indSymI) = nLevelsG(indSymI) + 1
enddo
enddo
enddo
deallocate(vecI)
call ArrayStop('intensity-vecI')
if ( trim(Intensity%linelist_file) /= "NONE") then
close(enunit, status='keep')
endif
write(myFmt, '(a,i0,a)') &
"('number of states for each sym = ',", sym%Nrepresen, "i8)"
write(out, myFmt) nLevelsG(:)
matSize = int( sum(nLevelsG(:)), hik )
if ( iVerbose >= 4 ) then
write(out, "(/'Quadrupole moment integration (i)...')")
endif
if ( nTrans == 0 ) then
write(out, "('qm_intensity: the transition filters are too tight:&
& no entry')")
stop 'qm_intensity: the filters are too tight'
endif
write(out, "(/'...done!')")
allocate(vecI(dimenMax), vecF(dimenMax), stat=info)
call ArrayStart('intensity-vectors', info, size(vecI), kind(vecI))
call ArrayStart('intensity-vectors', info, size(vecF), kind(vecF))
!!! why is this duplicated from above?
write(myFmt, '(a,i0,a)') &
"('number of states for each sym = ',", sym%Nrepresen, "i8)"
write(out, myFmt) nLevelsG(:)
if ( iVerbose >= 0 ) then
write(out, "('Total number of lower states = ',i8)") nLower
write(out, "('Total number of transitions = ',i8)") nTrans
endif
if ( iVerbose >= 0 ) then
write(out, "(/'Statistical weight g_ns =',4f12.1)") &
Intensity%gns(1:)
endif
! To speed up line strength evaluation, we perform the calculation:
! S_{if} = | <i|a|f> |^2 = | \sum_{nm} C_in C_fm <n|a|m> |^2
! in three steps:
! 1. Evaluate the expansion of the initial state:
! s_{im} = sum_{n} C_in <n|a|m>
! 2. Evaluate the product with the expansion of the final state:
! s_{if} = sum_{m} C_fm s_{im}
! 3. Square the result to obtain S_{if}
! S_{if} = s_{if}^2
!
! The transitory object s_{im} we refer to as 'half linestrength',
! with corresponding variable "half_linestr".
! initialise array to store eigenvectors
allocate(halfLineStr(dimenMax), stat=info)
call ArrayStart('halfLineStr', info, &
size(halfLineStr), kind(halfLineStr))
if ( iVerbose >= 5) call MemoryReport
!
if (trim(intensity%linelist_file)/="NONE") then
write(out,"(/'This is a line list production only, intensity print-out is swtitched off')")
write(out,"('To see intensities in the standard output remove the keyword LINELIST from INTENSITY'/)")
else
! prepare the table header
write(out, "(/a,a,a,a)") &
'Linestrength S(f<-i) [Debye**2],', &
'Transition moments [Debye],', &
'Einstein coefficient A(if) [1/s],', &
'and Intensities [cm/mol]'
! depending on the case we have different file formats
select case ( trim(intensity%action) )
! absorption lines
case('ABSORPTION')
write(out, &
! Fixed width output
"(/t5,'J',t7,'Gamma <-',t18,'J',t21,'Gamma',t27,'Typ',t37,&
&'Ei',t44,'<-',t52,'Ef',t64,'nu_if',8x,'S(f<-i)',10x,'A(if)',&
&12x,'I(f<-i)',7x,'State v lambda sigma omega <- State v &
&lambda sigma omega ')" &
!
! CSV output
! "('dir, J_i, Gamma_i, J_f, Gamma_f, Branch,&
! & E_i, Ef, nu_if,&
! & S_fi, A_if, I_fi,&
! & state_f, v_f, lambda_f, sigma_f, omega_f,&
! & state_i, v_i, lambda_i, sigma_i, omega_i')"&
)
dir = '<-'
! emission lines
case('EMISSION')
write(out, &
"(/t5,'J',t7,'Gamma ->',t18,'J',t21,'Gamma',t27,'Typ',t37,&
&'Ei',t44,'->',t52,'Ef',t64,'nu_if',8x,'S(i->f)',10x,'A(if)',&
&12x,'I(i->f)',7x,'State v lambda sigma omega -> State v &
&lambda sigma omega ')" &
)
dir = '->'
! Transition moments
case('TM')
write(out, &
"(/t4,'J',t6,'Gamma <-',t17,'J',t19,'Gamma',t25,'Typ',t35,&
&'Ei',t42,'<-',t52,'Ef',t65,'nu_if',10x,'TM(f->i)')" &
)
end select
endif
deallocate(vecF)
! ------------------------------------------------
! now begin the actual line intensity calculations
! ------------------------------------------------
! counter for the no. transitions
indTrans = 0
! loop over initial J states and assign corresponding J value
do indI = 1, nJ
jI = jVal(indI)
!
if (trim(intensity%linelist_file)/="NONE".and.iverbose>=4) write(out,"('J = ',f9.1)") jI
!
! loop over symmetries
do indGammaI = 1, nRepresen
! no. of levels in, and dimension of, basis for initial state
nLevelsI = eigen(indI, indGammaI)%nLevels
dimenI = eigen(indI, indGammaI)%nDimen
! loop over final J states and assign corresponding J value
do indF = 1, nJ
jF = jVal(indF)
! J selection rules for quadrupole operator
if ( abs(nint(jI - jF)) > 2 &
.or. abs(nint(jI + jF)) < 2) cycle
! loop over symmetries
do indGammaF = 1, nRepresen
! no. of levels in, and dimension of, basis for final state
nLevelsF = eigen(indF, indGammaF)%nLevels
dimenF = eigen(indF, indGammaF)%nDimen
! loop over levels in the initial state
loopLevelsI : do indLevelI = 1, nLevelsI
! energy and quantum numbers of initial state
energyI = eigen(indI, indGammaI)%val(indLevelI)
quantaI => eigen(indI, indGammaI)%quanta(indLevelI)
istateI = quantaI%istate ! electronic state
ivibI = quantaI%ivib ! vibrational (contracted)
vI = quantaI%v ! vibrational
spinI = quantaI%spin ! electron spin
sigmaI = quantaI%sigma ! spin projection
ilambdaI = quantaI%ilambda ! e- orb. ang. mom. projection
omegaI = quantaI%omega ! tot. ang. mom. proj. mol. ax.
! reconstruct symmetry for C2v case
guParity = poten(istateI)%parity%gu
indSymI = correlate_to_Cs(indGammaI, guParity)
! apply energy filter to initial (lower) state
call energy_filter_ul(jI, energyI, passed, 'lower')
if ( .not. passed ) cycle loopLevelsI
! vector of basis state coefficients for inital state
vecI(1:dimenI) = eigen(indI, indGammaI)&
%vect(1:dimenI, indLevelI)
!
halfLineStr = 0
!
! -----
! Before the actual calculations we check if there are any
! allowed transitions from current level of jI to any
! levels of jF, if not skip initial J state level.
! loop over levels in the final state to check for trans.
do indLevelF = 1, nLevelsF
energyF = eigen(indF, indGammaF)%val(indLevelF)
quantaF => eigen(indF, indGammaF)%quanta(indLevelF)
istateF = quantaF%istate ! electronic state
ivibF = quantaF%ivib ! vibrational (contracted)
vF = quantaF%v ! vibrational
spinF = quantaF%spin ! electron spin
sigmaF = quantaF%sigma ! spin projection
ilambdaF = quantaF%ilambda ! e- orb. ang. mom. projection
omegaF = quantaF%omega ! tot. ang. mom. proj. mol. ax
! reconstruct symmetry for C2v case
guParity = poten(istateF)%parity%gu
indSymF = correlate_to_Cs(indGammaF, guParity)
! apply transition intensity filter, result of which is
! overidden by mat. elem. filter if we want mat. elems.
call intens_filter(jI, jF, energyI, energyF, &
indSymI, indSymF, iGammaPair, passed)
if ( Intensity%matelem ) then
call matelem_filter(jI, jF, energyI, energyF, &
indSymI, indSymF, iGammaPair, passed)
endif
if ( passed ) exit