grasp
grasp copied to clipboard
rtab*.f90 code
Hi everyone, I find the rtab*.f90 program files convert configurations' quantum labels may not be considered the occupation of electrons in d, f ,g ... subshells over ten. So I changed some code to fix it.
! Replace (n) with ^n
if ((labelstring(i:i).eq.'(').and.(labelstring(i+2:i+2).eq.')')) then
labelstring(i:i) = '^'
labelstring(i+2:i+2) = ' '
end if
end do
change to
! Replace (n) with ^n
if ((labelstring(i:i).eq.'(').and.(labelstring(i+2:i+2).eq.')')) then
labelstring(i:i) = '^'
labelstring(i+2:i+2) = ' '
else if ((labelstring(i:i).eq.'(').and.(labelstring(i+3:i+3).eq.')')) then
dummystring = labelstring
labelstring(1:i-1) = dummystring(1:i-1)
labelstring(i:i) = '^'
labelstring(i+1:i+1) = '{'
labelstring(i+2:i+3) = dummystring(i+1:i+2)
labelstring(i+4:i+4) = '}'
labelstring(i+5:144) = dummystring(i+4:143)
end if
And
! If integer1 and S, P, D, F, G, H, I, K, L, M, N and integer2 replace with (^integer1_integer2S), (^integer1_integer2P), etc
do l = 1,15
ncase = 0
do i = 1,142
do j = 48,57
do k = 48,57
char1 = labelstring(i:i)
char2 = labelstring(i+1:i+1)
char3 = labelstring(i+2:i+2)
if ((ichar(char1).eq.j).and.(ichar(char3).eq.k).and.((char2.ne.'~').and.(char2.ne.' ').and.(char2.ne.'_'))) then
dummystring = labelstring
labelstring(1:i-1) = dummystring(1:i-1)
labelstring(i:i+6) = '(^'//char1//'_'//char3//char2//')'
labelstring(i+7:145) = dummystring(i+3:141)
ncase = ncase + 1
end if
end do
end do
if (ncase.eq.1) exit
end do
change to
! If integer1 and S, P, D, F, G, H, I, K, L, M, N and integer2 replace with (^integer1_integer2S), (^integer1_integer2P), etc
do l = 1,15
ncase = 0
do i = 1,142
do j = 48,57
do k = 48,57
char1 = labelstring(i:i)
char2 = labelstring(i+1:i+1)
char3 = labelstring(i+2:i+2)
if ((ichar(char1).eq.j).and.(ichar(char3).eq.k).and. ((char2.ne.'~').and.(char2.ne.' ').and.(char2.ne.'_').and.(char2.ne.'}'))) then
dummystring = labelstring
labelstring(1:i-1) = dummystring(1:i-1)
labelstring(i:i+6) = '('//'^'//char1//'_'//char3//char2//')'
labelstring(i+7:145) = dummystring(i+3:141)
ncase = ncase + 1
end if
end do
end do
if (ncase.eq.1) exit
end do
Have a nice day.