real*8 function ENERG(S, L, PBC) | |
integer*2 :: S(1:L, 1:L) | |
integer*4 :: I, J, L | |
integer*4 :: PBC(0:L+1) | |
real*8 :: ENE | |
ENE = 0.0d0 | |
do I = 1, L | |
do J = 1, L | |
ENE = ENE - S(I, J)*S(PBC(I + 1), J) - S(I, J)*S(I, PBC(J + 1)) | |
enddo | |
enddo | |
ENERG = ENE | |
return | |
endfunction |