program ese implicit none integer i,j,nat real*8 e,d,bohr real*8 ,allocatable::r(:,:),z(:) bohr=0.529177249d0 open(9,file='FILE.X') read(9,*) read(9,*)nat allocate(z(nat),r(nat,3)) do 1 i=1,nat 1 read(9,*)z(i),(r(i,j),j=1,3) close(9) r=r/bohr e=0.0d0 do 3 i=1,nat do 3 j=i+1,nat d=sqrt((r(i,1)-r(j,1))**2+(r(i,2)-r(j,2))**2+(r(i,3)-r(j,3))**2) 3 e=e+z(i)*z(j)/d write(6,60)e 60 format(F19.9) end