      subroutine su3mult_m_m_m(am1,am2,rm) ! Bernd Berg Mar 02 2008. 
c Alexei Bazavov Oct 20 2005. Multiply SU(2) matrix (m) by matrix (m) 
c                             and put result in matrix (m).
c am1 -- matrix 1
c am2 -- matrix 2
c rm -- resulting matrix
      include '../../Libs/Fortran/implicit.sta'
      include '../../Libs/Fortran/constants.par'
      dimension am1(1:18),am2(1:18),rm(1:18)

      rm(1)=am1(1)*am2(1)-am1(10)*am2(10)+
     &      am1(2)*am2(4)-am1(11)*am2(13)+
     &      am1(3)*am2(7)-am1(12)*am2(16)
      rm(10)=am1(1)*am2(10)+am1(10)*am2(1)+
     &       am1(2)*am2(13)+am1(11)*am2(4)+
     &       am1(3)*am2(16)+am1(12)*am2(7)
      rm(2)=am1(1)*am2(2)-am1(10)*am2(11)+
     &      am1(2)*am2(5)-am1(11)*am2(14)+
     &      am1(3)*am2(8)-am1(12)*am2(17)
      rm(11)=am1(1)*am2(11)+am1(10)*am2(2)+
     &       am1(2)*am2(14)+am1(11)*am2(5)+
     &       am1(3)*am2(17)+am1(12)*am2(8)
      rm(3)=am1(1)*am2(3)-am1(10)*am2(12)+
     &      am1(2)*am2(6)-am1(11)*am2(15)+
     &      am1(3)*am2(9)-am1(12)*am2(18)
      rm(12)=am1(1)*am2(12)+am1(10)*am2(3)+
     &       am1(2)*am2(15)+am1(11)*am2(6)+
     &       am1(3)*am2(18)+am1(12)*am2(9)
      rm(4)=am1(4)*am2(1)-am1(13)*am2(10)+
     &      am1(5)*am2(4)-am1(14)*am2(13)+
     &      am1(6)*am2(7)-am1(15)*am2(16)
      rm(13)=am1(4)*am2(10)+am1(13)*am2(1)+
     &       am1(5)*am2(13)+am1(14)*am2(4)+
     &       am1(6)*am2(16)+am1(15)*am2(7)
      rm(5)=am1(4)*am2(2)-am1(13)*am2(11)+
     &      am1(5)*am2(5)-am1(14)*am2(14)+
     &      am1(6)*am2(8)-am1(15)*am2(17)
      rm(14)=am1(4)*am2(11)+am1(13)*am2(2)+
     &       am1(5)*am2(14)+am1(14)*am2(5)+
     &       am1(6)*am2(17)+am1(15)*am2(8)
      rm(6)=am1(4)*am2(3)-am1(13)*am2(12)+
     &      am1(5)*am2(6)-am1(14)*am2(15)+
     &      am1(6)*am2(9)-am1(15)*am2(18)
      rm(15)=am1(4)*am2(12)+am1(13)*am2(3)+
     &       am1(5)*am2(15)+am1(14)*am2(6)+
     &       am1(6)*am2(18)+am1(15)*am2(9)
      rm(7)=am1(7)*am2(1)-am1(16)*am2(10)+
     &      am1(8)*am2(4)-am1(17)*am2(13)+
     &      am1(9)*am2(7)-am1(18)*am2(16)
      rm(16)=am1(7)*am2(10)+am1(16)*am2(1)+
     &       am1(8)*am2(13)+am1(17)*am2(4)+
     &       am1(9)*am2(16)+am1(18)*am2(7)
      rm(8)=am1(7)*am2(2)-am1(16)*am2(11)+
     &      am1(8)*am2(5)-am1(17)*am2(14)+
     &      am1(9)*am2(8)-am1(18)*am2(17)
      rm(17)=am1(7)*am2(11)+am1(16)*am2(2)+
     &       am1(8)*am2(14)+am1(17)*am2(5)+
     &       am1(9)*am2(17)+am1(18)*am2(8)
      rm(9)=am1(7)*am2(3)-am1(16)*am2(12)+
     &      am1(8)*am2(6)-am1(17)*am2(15)+
     &      am1(9)*am2(9)-am1(18)*am2(18)
      rm(18)=am1(7)*am2(12)+am1(16)*am2(3)+
     &       am1(8)*am2(15)+am1(17)*am2(6)+
     &       am1(9)*am2(18)+am1(18)*am2(9)

      return
      end
