Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame] | 1 | ! Inicialitza la matriu d'spins S aleatòriament, donada la mida del sistema L |
| 2 | ! i una llavor inicial SEED. Tot i que S té mida 128x128 només les primeres L |
| 3 | ! files i L columnes s'utilitzen. |
Adrià Vilanova Martínez | ebb8779 | 2022-06-04 20:07:20 +0200 | [diff] [blame] | 4 | subroutine generateSpinMatrix(S, L, SEED) |
avm99963 | 45a8a46 | 2022-06-04 12:41:03 +0200 | [diff] [blame] | 5 | use iso_fortran_env |
| 6 | implicit none |
| 7 | integer*4, intent(in) :: L |
| 8 | integer*4, intent(in) :: SEED |
Adrià Vilanova Martínez | 24d8701 | 2022-06-16 00:29:59 +0200 | [diff] [blame] | 9 | integer*2, intent(out) :: S(1:128,1:128) |
avm99963 | 45a8a46 | 2022-06-04 12:41:03 +0200 | [diff] [blame] | 10 | integer*4 :: i, j |
| 11 | integer(int32) :: genrand_int31 |
| 12 | |
| 13 | call init_genrand(SEED) |
| 14 | |
| 15 | do i = 1, L |
| 16 | do j = 1, L |
| 17 | if (genrand_int31() < 2**30) then |
| 18 | S(i, j) = 1 |
| 19 | else |
| 20 | S(i, j) = -1 |
| 21 | endif |
| 22 | enddo |
| 23 | enddo |
Adrià Vilanova Martínez | ebb8779 | 2022-06-04 20:07:20 +0200 | [diff] [blame] | 24 | end subroutine generateSpinMatrix |