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 | ! la magnetització del sistema. |
Adrià Vilanova Martínez | ebb8779 | 2022-06-04 20:07:20 +0200 | [diff] [blame] | 3 | real*8 function magne(S, L) |
avm99963 | 45a8a46 | 2022-06-04 12:41:03 +0200 | [diff] [blame] | 4 | implicit none |
| 5 | integer*4, intent(in) :: L |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame] | 6 | integer*2, intent(out) :: S(1:128,1:128) |
avm99963 | 45a8a46 | 2022-06-04 12:41:03 +0200 | [diff] [blame] | 7 | integer*4 :: i, j |
| 8 | real*8 :: mag |
| 9 | mag = 0d0 |
| 10 | |
| 11 | do i = 1, L |
| 12 | do j = 1, L |
| 13 | mag = mag + S(i, j) |
| 14 | enddo |
| 15 | enddo |
| 16 | |
| 17 | magne = mag |
| 18 | return |
Adrià Vilanova Martínez | ebb8779 | 2022-06-04 20:07:20 +0200 | [diff] [blame] | 19 | end function magne |