1 FUNCTION HELECT(N,P,H,F) 2 IMPLICIT DOUBLE PRECISION (A-H,O-Z) 3 DIMENSION P(*), H(*), F(*) 4C*********************************************************************** 5C 6C SUBROUTINE CALCULATES THE ELECTRONIC ENERGY OF THE SYSTEM IN EV. 7C 8C ON ENTRY N = NUMBER OF ATOMIC ORBITALS. 9C P = DENSITY MATRIX, PACKED, LOWER TRIANGLE. 10C H = ONE-ELECTRON MATRIX, PACKED, LOWER TRIANGLE. 11C F = TWO-ELECTRON MATRIX, PACKED, LOWER TRIANGLE. 12C ON EXIT 13C HELECT = ELECTRONIC ENERGY. 14C 15C NO ARGUMENTS ARE CHANGED. 16C 17C*********************************************************************** 18 ED=0.0D00 19 EE=0.0D00 20 K=0 21 NN=N+1 22 DO 20 I=2,NN 23 K=K+1 24 JJ=I-1 25 ED=ED+P(K)*(H(K)+F(K)) 26 IF (I.EQ.NN) GO TO 20 27 DO 10 J=1,JJ 28 K=K+1 29 10 EE=EE+P(K)*(H(K)+F(K)) 30 20 CONTINUE 31 EE=EE+.5D00*ED 32 HELECT=EE 33 RETURN 34C 35 END 36