anchor.diff:                END IF
                 IF(IOLSAC .EQ. 1 ) THEN
                   IF(IPRT.GE.10) WRITE(6,*) ' Olsen Correction active '
  -                CALL REWINO(LU3)
  -                CALL FRMDSC(VEC2,NVAR,-1,LU3,IMZERO,IAMPACK)
  -                DELTA = INPROD(VEC1,VEC2,NVAR)
  -                CALL FRMDSC(VEC1,NVAR,-1,LU3,IMZERO,IAMPACK)
  -                CALL FRMDSC(VEC1,NVAR,-1,LU3,IMZERO,IAMPACK)
  +CNW             CALL REWINO(LU3)
  +CNW             CALL FRMDSC(VEC2,NVAR,-1,LU3,IMZERO,IAMPACK)
  +CNW             DELTA = INPROD(VEC1,VEC2,NVAR)
  +                DELTA = ga_ddot(VEC3(3),VEC3(1))
  +CNW             CALL FRMDSC(VEC1,NVAR,-1,LU3,IMZERO,IAMPACK)
  +CNW             CALL FRMDSC(VEC1,NVAR,-1,LU3,IMZERO,IAMPACK)
                   FACTOR = -DELTA/GAMMA
                   IF(IPRT.GE.10) WRITE(6,*) ' DELTA,GAMMA,FACTOR'
                   IF(IPRT.GE.10) WRITE(6,*)   DELTA,GAMMA,FACTOR
  -                CALL VECSUM(VEC1,VEC1,VEC2,FACTOR,1.0D0,NVAR)
  +CNW             CALL VECSUM(VEC1,VEC1,VEC2,FACTOR,1.0D0,NVAR)
  +                call ga_add(FACTOR,VEC3(1),1.0D0,VEC3(3),VEC3(1))
                   IF(IPRT.GE.600) THEN
                     WRITE(6,*) '  Modified new trial vector '
  -                  CALL WRTMAT(VEC1,1,NVAR,1,NVAR)
  +CNW               CALL WRTMAT(VEC1,1,NVAR,1,NVAR)
  +                  call ga_print(VEC3(1))
                   END IF
                 ELSE
                   IF(IPRT.GT.0) WRITE(6,*) 
        &          ' Inverse correction switched of'
  -                CALL REWINO(LU3)
  -                CALL FRMDSC(VEC1,NVAR,-1,LU3,IMZERO,IAMPACK)
  +CNW             CALL REWINO(LU3)
  +CNW             CALL FRMDSC(VEC1,NVAR,-1,LU3,IMZERO,IAMPACK)
                 END IF
               END IF
   *. 1.3 ORTHOGONALIZE TO ALL PREVIOUS VECTORS
  -           XNRMI =    INPROD(VEC1,VEC1,NVAR)
  -           CALL REWINO( LU1 )
  +           XNRMI = ga_ddot(VEC3(1),VEC3(1))
  +CNW        XNRMI =    INPROD(VEC1,VEC1,NVAR)
  +CNW        CALL REWINO( LU1 )
    
              DO 80 IVEC = 1,NVEC+IADD-1
  -             CALL FRMDSC(VEC2,NVAR,-1  ,LU1,IMZERO,IAMPACK)
  -             OVLAP = INPROD(VEC1,VEC2,NVAR)
  -             CALL VECSUM(VEC1,VEC1,VEC2,1.0D0,-OVLAP,NVAR)
  +CNW          CALL FRMDSC(VEC2,NVAR,-1  ,LU1,IMZERO,IAMPACK)
  +CNW          OVLAP = INPROD(VEC1,VEC2,NVAR)
  +CNW          CALL VECSUM(VEC1,VEC1,VEC2,1.0D0,-OVLAP,NVAR)
  +             OVLAP = ga_ddot(VEC3(1),VEC1(IVEC))
      80      CONTINUE
   *. 1.4 Normalize vector and check for linear dependency
              SCALE = INPROD(VEC1,VEC1,NVAR)
  
positive.code:        IADD = 0
         CONVER = .TRUE.
         DO 100 IROOT = 1, NROOT
           CALL SETVEC(VEC1,0.0D0,NVAR)
  *
           CALL REWINO( LU2)
           DO 60 IVEC = 1, NVEC
             CALL FRMDSC(VEC2,NVAR,-1  ,LU2,IMZERO,IAMPACK)
             FACTOR = AVEC((IROOT-1)*NVEC+IVEC)
             CALL VECSUM(VEC1,VEC1,VEC2,1.0D0,FACTOR,NVAR)
     60    CONTINUE
  *
           EIGAPR = EIG(ITER-1,IROOT)
           CALL REWINO( LU1)
           DO 50 IVEC = 1, NVEC
             CALL FRMDSC(VEC2,NVAR,-1  ,LU1,IMZERO,IAMPACK)
             FACTOR = -EIGAPR*AVEC((IROOT-1)*NVEC+ IVEC)
             CALL VECSUM(VEC1,VEC1,VEC2,1.0D0,FACTOR,NVAR)
     50    CONTINUE
             IF ( IPRT  .GE.600 ) THEN
               WRITE(6,*) '  ( HX - EX ) '
               CALL WRTMAT(VEC1,1,NVAR,1,NVAR)
             END IF
  *  STRANGE PLACE TO TEST CONVERGENCE , BUT ....
           RNORM = SQRT( INPROD(VEC1,VEC1,NVAR) )
           RNRM(ITER-1,IROOT) = RNORM
           IF(RNORM.LT. TEST ) THEN
              RTCNV(IROOT) = .TRUE.
  
negative.code: *          variational method
  *
         IMPLICIT DOUBLE PRECISION (A-H,O-Z)
         integer VEC1(2*NROOT),VEC2(2*NROOT),VEC3(2)
         REAL * 8   INPROD
         DIMENSION RNRM(MAXIT,NROOT),EIG(MAXIT,NROOT)
         DIMENSION APROJ(*),AVEC(*),WORK(*)
  