1* 2* $Id$ 3* 4 subroutine fci_det_to_walk(idet, owalk, mwalk) 5 implicit none 6#include "fciinfo.fh" 7c 8c Given the index of a determinant, idet, return the 9c corresponding lexical weights of orbital and primitive 10c spin functions. Without having an index vector the 11c length of the CI expansion the only way to do this 12c is with a binary search, so this operation costs 13c about log2(ndets). 14c 15 integer idet ! [input] Index into determinant CI vector 16 integer owalk ! [output] Corresponding orbital walk 17 integer mwalk ! [output] Corresponding primitive spin function walk 18c 19 integer left, right, middle 20c 21 left = 1 22 right = nwalko 23c 24 10 middle = (left+right)/2 25 if (indexo(middle) .ge. idet) then 26 right = middle 27 else 28 left = middle 29 endif 30 if ((right-left) .gt. 1) goto 10 31c 32 if (indexo(right) .lt. idet) then 33 owalk = right 34 else 35 owalk = left 36 endif 37c 38c Adjust for walks of incorrect symmetry 39c 40 20 if (indexo(owalk).eq.indexo(owalk+1)) then 41 owalk = owalk + 1 42 goto 20 43 endif 44c 45 mwalk = idet - indexo(owalk) 46c 47 if (mwalk.le.0 .or. mwalk.gt.(indexo(owalk+1)-indexo(owalk))) 48 $ call fci_err('fci_det_to_walk: bad mwalk ', mwalk) 49c 50 end 51 52