c c ----------------------------- c subroutine dis2mat(ein1,ein2,eout,rout,angle,axis,index1,index2,invert) c c analyzes EIN as a rotation matrix (assumed!) to find c the disorientation and return the corresponding matrix, EOUT, c the rotation ANGLE (degrees) and the AXIS of rotation (in the SST) c INDEX1 is the index to the first symm oper, INDEX2, the second c INVERT tells whether the rotations were taken in the opposite order c ROUT is the Rodrigues vector of the result c c rotation matrices supplied by EULER and are therefore active c rotations from ref. to crystal, or axis transformations from c crystal to ref c c a misorientation in the local frame must be calculated as c E1^T.E2, so with symmetry operators applied, c (E1.O1)^T(E2.O2) c real ein1(3,3),ein2(3,3),eout(3,3),angle,axis(3) real ea(3,3),eb(3,3),easym(3,3),ebsym(3,3),ec(3,3) real tracemax,anglemin,rout(3),rodr(4) integer index1,index2,invert c pi=4.*atan(1.) degrad=180./pi anglemin=pi index1=0 index2=0 invert=0 c do 3010, ii=1,2 c do 100, i=1,3 do 100, j=1,3 100 ea(i,j)=ein1(i,j) c do 110, i=1,3 do 110, j=1,3 110 eb(i,j)=ein2(i,j) c if(ii.eq.2) then do 200, i=1,3 do 200, j=1,3 200 ea(i,j)=ein2(i,j) c do 210, i=1,3 do 210, j=1,3 210 eb(i,j)=ein1(i,j) c endif c do 3000, i=1,24 call symm_apply(ea,easym,i) c do 2990, j=1,24 call symm_apply(eb,ebsym,i) c call atxb2c(easym,ebsym,ec) call m2r(ec,rodr,axis) if(rodr(4).lt.anglemin) then if(((rodr(1).ge.0..and.rodr(2).ge.0..and.rodr(3).ge.0.).and. & (rodr(1).ge.rodr(2).and.rodr(2).ge.rodr(3))) & ) then anglemin=rodr(4) index1=i index2=j invert=ii angle=rodr(4)*degrad rout(1)=rodr(1) rout(2)=rodr(2) rout(3)=rodr(3) endif endif c 2990 continue c end of inner loop 3000 continue c end of outer loop 3010 continue c loop for inverse of rotation c if(index1.eq.0) stop 'dis2mat failed!' c write(*,*) 'DIS2MAT result: ' write(*,"('DIS2MAT angle, rodrigues vec: ',4f8.3)") angle,rout write(*,"('DIS2MAT indices: ',3i4)") index1,index2,invert c return end c c ----------------------------- c