Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame] | 1 | ! Retorna, donada una matriu d'spins S d'un sistema de mida LxL, |
| 2 | ! l'energia del sistema. |
Adrià Vilanova Martínez | ebb8779 | 2022-06-04 20:07:20 +0200 | [diff] [blame] | 3 | real*8 function energ(S, L) |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame] | 4 | integer*2 :: S(1:128, 1:128) |
avm99963 | 45a8a46 | 2022-06-04 12:41:03 +0200 | [diff] [blame] | 5 | integer*4 :: I, J, L, PBC |
| 6 | real*8 :: ENE |
| 7 | ENE = 0.0d0 |
| 8 | do I = 1, L |
| 9 | do J = 1, L |
| 10 | ENE = ENE - S(I, J)*S(PBC(I + 1, L), J) - S(I, J)*S(I, PBC(J + 1, L)) |
| 11 | enddo |
| 12 | enddo |
| 13 | ENERG = ENE |
| 14 | return |
| 15 | endfunction |