-
Notifications
You must be signed in to change notification settings - Fork 1
/
basort.f90
56 lines (55 loc) · 1.7 KB
/
basort.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
! File created at Fri Jun 5 21:58:55 PDT 2020
! Original source code: basort.f
subroutine basort (cvi,nvi,cro,eint,ilev,jlev,klev,nlev,n)
implicit double precision (a-h,o-z)
!
! -----------------------------------------------------------------
! This subroutine sorts the channels in the input
! basis set in order of increasing a,v,j,k.
! -----------------------------------------------------------------
!
dimension cvi(nvi,n),cro(3,n)
dimension eint(n),ilev(n),jlev(n),klev(n),nlev(n)
!
do j = 1,n-1
k = j
do i = j+1,n
if (ilev(i) .lt. ilev(k)) k = i
if (ilev(i) .gt. ilev(k)) go to 1
if (nlev(i) .lt. nlev(k)) k = i
if (nlev(i) .gt. nlev(k)) go to 1
if (jlev(i) .lt. jlev(k)) k = i
if (jlev(i) .gt. jlev(k)) go to 1
if (klev(i) .lt. klev(k)) k = i
1 continue
enddo
if (k .ne. j) then
do i = 1,nvi
cswap = cvi(i,j)
cvi(i,j) = cvi(i,k)
cvi(i,k) = cswap
enddo
do i = 1,3
cswap = cro(i,j)
cro(i,j) = cro(i,k)
cro(i,k) = cswap
enddo
eswap = eint(j)
eint(j) = eint(k)
eint(k) = eswap
iswap = ilev(j)
ilev(j) = ilev(k)
ilev(k) = iswap
jswap = jlev(j)
jlev(j) = jlev(k)
jlev(k) = jswap
kswap = klev(j)
klev(j) = klev(k)
klev(k) = kswap
nswap = nlev(j)
nlev(j) = nlev(k)
nlev(k) = nswap
endif
enddo
return
end