2018-01-27 12:41:48 +01:00
|
|
|
subroutine searchdet(deti,add,dethi,addh)
|
2016-12-19 23:26:16 +01:00
|
|
|
BEGIN_DOC
|
|
|
|
! this subroutine is at the heart of the idea
|
|
|
|
! it will generate all the determinants in a fixed order
|
|
|
|
! then find the posistion of the determinant given and
|
|
|
|
! return it's position in add.
|
|
|
|
END_DOC
|
2018-01-27 12:41:48 +01:00
|
|
|
integer(kind=selected_int_kind(16)),INTENT(INOUT)::deti
|
2016-12-19 23:26:16 +01:00
|
|
|
integer(kind=selected_int_kind(16)),INTENT(INOUT)::add
|
2018-01-27 12:41:48 +01:00
|
|
|
integer(kind=selected_int_kind(16)),INTENT(INOUT)::dethi
|
2016-12-19 23:26:16 +01:00
|
|
|
integer(kind=selected_int_kind(16)),INTENT(INOUT)::addh
|
|
|
|
integer(kind=selected_int_kind(16))::dethsh
|
|
|
|
integer(kind=selected_int_kind(16))::a
|
2018-01-27 12:41:48 +01:00
|
|
|
integer(kind=selected_int_kind(16))::i,j
|
|
|
|
integer::count
|
|
|
|
logical::found
|
|
|
|
|
2016-12-19 23:26:16 +01:00
|
|
|
i=1
|
2018-01-27 12:41:48 +01:00
|
|
|
j=nt1
|
|
|
|
found=.FALSE.
|
|
|
|
do while(.not.found)
|
|
|
|
if(deth((i+j)/2,1).eq.dethi)then
|
|
|
|
addh=deth((i+j)/2,2)
|
|
|
|
found=.TRUE.
|
|
|
|
EXIT
|
|
|
|
elseif (abs(i-j).eq.1)then
|
|
|
|
if(deth(i,1).eq.dethi)then
|
|
|
|
addh=deth(i,2)
|
|
|
|
elseif(deth(j,1).eq.dethi)then
|
|
|
|
addh=deth(j,2)
|
2016-12-19 23:26:16 +01:00
|
|
|
endif
|
|
|
|
|
2018-01-27 12:41:48 +01:00
|
|
|
found=.TRUE.
|
|
|
|
EXIT
|
|
|
|
else
|
|
|
|
if(deth((i+j)/2,1).gt.dethi)then
|
|
|
|
j=(i+j)/2
|
2016-12-19 23:26:16 +01:00
|
|
|
else
|
2018-01-27 12:41:48 +01:00
|
|
|
i=(i+j)/2
|
2016-12-19 23:26:16 +01:00
|
|
|
endif
|
|
|
|
endif
|
2018-01-27 12:41:48 +01:00
|
|
|
enddo
|
2016-12-19 23:26:16 +01:00
|
|
|
|
2018-01-27 12:41:48 +01:00
|
|
|
i=1
|
|
|
|
j=nt2
|
|
|
|
found=.FALSE.
|
|
|
|
do while(.not.found)
|
|
|
|
if(det((i+j)/2,1).eq.deti)then
|
|
|
|
add=det((i+j)/2,2)
|
|
|
|
found=.TRUE.
|
|
|
|
EXIT
|
|
|
|
elseif (abs(i-j).eq.1)then
|
|
|
|
if(det(i,1).eq.deti)then
|
|
|
|
add=det(i,2)
|
|
|
|
elseif(det(j,1).eq.deti)then
|
|
|
|
add=det(j,2)
|
|
|
|
endif
|
|
|
|
found=.TRUE.
|
|
|
|
EXIT
|
|
|
|
else
|
|
|
|
if(det((i+j)/2,1).gt.deti)then
|
|
|
|
j=(i+j)/2
|
|
|
|
else
|
|
|
|
i=(i+j)/2
|
|
|
|
endif
|
|
|
|
endif
|
2016-12-19 23:26:16 +01:00
|
|
|
enddo
|
|
|
|
|
|
|
|
10 FORMAT(B64,I8,F8.2)
|
|
|
|
15 FORMAT(B64,I8,I8,I8)
|
|
|
|
11 FORMAT(B64,I3,B64)
|
|
|
|
12 FORMAT(I5,$)
|
|
|
|
13 FORMAT(B64,B64)
|
|
|
|
14 FORMAT(B64,I8)
|
|
|
|
16 FORMAT(B64,I8,I8)
|
|
|
|
end
|