SUBROUTINE tdv2fb1(t,chi,w,jdeg,mord,nmax,peigv) USE Numeric_Kinds_Module USE FileUnits_Module USE Max_Module USE Matrices_Module USE CMatt1_Module IMPLICIT NONE !============================================================================== ! Construct transformation matrix between angles and rotational functions. ! The first index of t is angles, second index labels rotational functions. ! Chi is filled with dvr points, w with corresponding weights. ! Note that dimension of resulting matrices is (jdeg-mord+1)x(jdeg-mord+1) !============================================================================== LOGICAL ::peigv INTEGER :: n, l, jdeg, mord, nmax, i, j, k REAL(dp) :: t(nmax,jdeg-mord+1),chi(nmax),w(nmax) !============================================================================== n=jdeg-mord+1 l=mord IF (n.gt.maxang.or.n.gt.nmax) THEN WRITE(Output_Unit,*)'ERROR in tdv2fb1:',n,maxang,nmax STOP 'tdv2fb1' ENDIF !============================================================================== ! Construct the matrix of cos over the legendre polynomials DO i=1,n j=i-1+l IF(i.ne.n)cmat(i,i+1)=sqrt((j+l+1.d0)*(j-l+1.d0)/((2.d0*j+1.d0)*(2.d0*j+3.d0))) IF(i.ne.1)cmat(i,i-1)=sqrt((j+l)*(j-l)/((2.d0*j+1.d0)*(2.d0*j-1.d0))) ENDDO !============================================================================== ! Diagonalize cmat and put eigenvectors in t and eigenvalues in chi k=0 DO i=1,n DO j=1,i k=k+1 sd(k)=cmat(i,j) ENDDO ENDDO CALL tdiagrw(sd,chi,rdt,subd,n,maxang,maxangv) DO j=1,n IF (rdt(1,j).lt.0.d0.and.Abs(rdt(1,j)).gt.1.d-12) THEN DO i=1,n rdt(i,j)=-1.d0*rdt(i,j) ENDDO ENDIF ENDDO DO i=1,n DO j=1,n t(i,j)=rdt(j,i) ! t(i,j)=rdt(i,j) ENDDO ENDDO RETURN END