1      SUBROUTINE DERI0 (E,N, SCALAR,DIAG,FRACT,NBO)
2      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
3      DIMENSION  E(N), SCALAR(*), DIAG(*), NBO(3)
4C
5C     COMPUTE THE DIAGONAL DOMINANT PART OF THE SUPER-MATRIX AND
6C     DEFINE THE SCALAR COEFFICIENTS APPLIED ON EACH ROW OF THE
7C     SUPER LINEAR SYSTEM IN ORDER TO REDUCE THE EIGENVALUE SPECTRUM OF
8C     THE ELECTRONIC HESSIAN,
9C     THUS SPEEDING CONVERGENCE OF RELAXATION PROCESS IN 'DERI2'.
10C  INPUT
11C     E(N)             : EIGENVALUES OF FOCK MATRIX.
12C     N                : NUMBER OF M.O.
13C     NBO(3)           : OCCUPANCY BOUNDARIES.
14C     FRACT            : PARTIAL OCCUPANCY OF 'OPEN' SHELLS.
15C     SCALAR(MINEAR)   : SCALE APPLIED ON EACH COLUMN AND ROW OF THE
16C                        SYMMETRIC SUPER SYSTEM.
17C
18      SHIFT=2.36D0
19C
20C     DOMINANT DIAGONAL PART OF THE SUPER-MATRIX.
21C     -------------------------------------------
22      NOPEN=NBO(1)+NBO(2)
23      CONST=1.D-3
24      L=1
25      IF(NBO(2).GT.0 .AND. NBO(1).GT.0) THEN
26C        OPEN-CLOSED
27         DO 10 J=1,NBO(1)
28            DO 10 I=NBO(1)+1,NOPEN
29               DIAG(L)=(E(I)-E(J))/(2.D0-FRACT+CONST)
30   10    L=L+1
31      ENDIF
32      IF(NBO(3).GT.0 .AND. NBO(1).GT.0) THEN
33C	 VIRTUAL-CLOSED
34         DO 20 J=1,NBO(1)
35            DO 20 I=NOPEN+1,N
36               DIAG(L)=(E(I)-E(J))/2.D0
37   20    L=L+1
38      ENDIF
39      IF(NBO(3).NE.0 .AND. NBO(2).NE.0) THEN
40C        VIRTUAL-OPEN
41         DO 30 J=NBO(1)+1,NOPEN
42            DO 30 I=NOPEN+1,N
43               DIAG(L)=(E(I)-E(J))/(FRACT+CONST)
44   30    L=L+1
45      ENDIF
46C
47C     TAKE SCALE FACTORS AS (SHIFT-DIAG)**(-0.5) .
48C     ------------------------------------------
49      DO 40 I=1,L-1
50   40 SCALAR(I)=SQRT(1.D0/MAX(0.3D0*DIAG(I),DIAG(I)-SHIFT))
51      RETURN
52      END
53