anchor.diff:  !    E_2SS = 0.0d0
   
       do i=MOZero,nOcc
  -      do j=MOZero,nOcc
  +      do j=MOZero,i-1
           do a=nOcc+1,nmo
  -          do b=nOcc+1,nmo
  -            
  -!            Dijab = Eps(a+1,1)+Eps(b+1,1)-Eps(i+1,1)-Eps(j+1,1)
  -!            Elccd = Elccd - t2(i,a,j,b)*MOI(iajb)/Dijab
  -!            Elccd = Elccd - t2(i,a,j,b)*(MOI(iajb)-MOI(ibja))/Dijab
  -            Dijab = (Eps_SO(a) + Eps_SO(b) - Eps_SO(i) - Eps_SO(j))
  -            !write(*,*) "Dijab",p3,p4,h1,h2,Dijab
  -            !write(*,*) "tabij",t2(a,b,i,j)
  -            if(t2(a,b,i,j) /= 0.0d0)then
  -              Elccd = Elccd - 0.25d0*t2(a,b,i,j)*AMO(i,j,a,b)/Dijab
  -            endif
  -
  +          do b=nOcc+1,a-1
  +            Elccd = Elccd + 1.0d0*t2(a,b,i,j)*AMO(i,j,a,b)
             enddo
           enddo
         enddo
  
positive.code:     t2old = 0.0d0
      Dijab = 1.0d0
  
    do iT2=1,150 ! T amplitude loop
      Elccd  = 0.0d0
      t2old  = 0.5*(t2+t2old) ! uses mixing
      !T2 equations
      do i=MOZero,nOcc
        do j=MOZero,nOcc    
          do a=nOcc+1,nmo
            do b=nOcc+1,nmo
  
  !           [ + 1.0 ] * v ( p3 p4 h1 h2 )
              in1 = 1.0d0 * AMO(a,b,i,j)
              !write(*,*) i,j,a,b,in1
  
  !           [ - 1.0 + 1.0 * P( p4 p3 h1 h2 => p3 p4 h1 h2 ) ] * Sum ( p5 ) * f ( p4 p5 ) * t ( p5 p3 h1 h2 ) done
              do d = nOcc+1,nmo
                if ((d == a) .or. (d == b)) then
                    cycle 
                endif
                in1 = in1 + 1.0d0 * F_SO(b,d) * t2old(a,d,i,j)
                in1 = in1 + 1.0d0 * F_SO(a,d) * t2old(d,b,i,j)
              enddo
  
  !           [ - 1.0 + 1.0 * P( p3 p4 h1 h2 => p3 p4 h2 h1 ) ] * Sum ( h5 ) * f ( h5 h1 ) * t ( p3 p4 h5 h2 ) done
              do k = MOZero,nOcc
                if ((k == i) .or. (k == j)) then
                    cycle
                endif
                in1 = in1 - 1.0d0 * F_SO(k,j) * t2old(a,b,i,k)
                in1 = in1 - 1.0d0 * F_SO(k,i) * t2old(a,b,k,j)
              enddo
  
  !           [ + 0.5 ] * Sum ( h5 h6 ) * t ( p3 p4 h5 h6 ) * v ( h5 h6 h1 h2 ) done
              do k = MOZero,nOcc
                do l = MOZero,nOcc
                  if ((k == i) .or. (k == j)) then
                      cycle
                  elseif ((l == i) .or. (l == j)) then
                      cycle
                  endif
                  in1 = in1 + 0.5d0 * t2old(a,b,k,l) * AMO(i,j,k,l)
                enddo
              enddo
  
  
negative.code: !            - 1.0 * P( p3 p4 h2 h1 => p3 p4 h1 h2 ) 
  !            + 1.0 * P( p3 p4 h2 h1 => p4 p3 h1 h2 ) ] 
  !          * Sum ( p5 h6 ) * t ( p5 p3 h6 h2 ) * v ( h6 p4 h1 p5 ) done
              do c = nOcc+1,nmo
                do k = MOZero,nOcc
                  in1 = in1 - 1.0d0 * t2old(a,c,i,k) * AMO(k,b,j,c)
                  in1 = in1 + 1.0d0 * t2old(b,c,i,k) * AMO(k,a,j,c)
                  in1 = in1 + 1.0d0 * t2old(a,c,j,k) * AMO(k,b,i,c)
                  in1 = in1 - 1.0d0 * t2old(b,c,j,k) * AMO(k,a,i,c)
                enddo
              enddo
  
  !            write(*,*) "t2   ",p3,p4,h1,h2,AMO(p3,p4,h1,h2),AMO(h1,h2,p3,p4)
  !            Dijab = (Eps_SO(p3) + Eps_SO(p4) - Eps_SO(h1) - Eps_SO(h2))
              t2(a,b,i,j) =  1.0d0*in1/Dijab
  
            enddo
          enddo
  