Minor changes to fenomens p4

Change-Id: I2eafd58ea0a4dbb32f5f2e94ca05d9a472949a0d
diff --git a/quad10/fenomens/lab/p4/MC-2.f90 b/quad10/fenomens/lab/p4/MC-2.f90
index 3a2260d..48c6a11 100644
--- a/quad10/fenomens/lab/p4/MC-2.f90
+++ b/quad10/fenomens/lab/p4/MC-2.f90
@@ -3,8 +3,8 @@
   use iso_fortran_env
   implicit none
   integer*4 :: L
-  real*8 :: MAGNE, ENERG, TEMP, E, DIFE, DELTA, M, SUMA, V1, V2, V3, V4, W(-8:8)
-  integer*4 :: I, J, IMC, MCTOT, MCINI, MCD, IPAS, N, SEED, NSEED, SEED0, PBC
+  real*8 :: magne, energ, TEMP, E, DIFE, DELTA, M, SUMA, W(-8:8)
+  integer*4 :: I, J, IMC, MCTOT, MCINI, MCD, IPAS, N, SEED, NSEED, SEED0, pbc
   integer :: genrand_int31
   character(100) :: NOM
 
@@ -43,23 +43,22 @@
     print *, "Seed: ", SEED
 
     ! Inicialitzem la matriu d'spins aleatòriament
-    call WRITECONFIGSEED(S, L, SEED)
+    call generateSpinMatrix(S, L, SEED)
 
-    E = ENERG(S, L)
-    M = MAGNE(S, L)
+    E = energ(S, L)
+    M = magne(S, L)
     !write (12, *) "0", E, M
 
     ! Iterem amb el mètode de Montecarlo
     do IMC = 1, MCTOT
       do IPAS = 1, N
         ! LOS LOOPS HACEN COSAS
-        I = MOD(genrand_int31(), L) + 1
-        J = MOD(genrand_int31(), L) + 1
-        V1 = S(PBC(I - 1, L), J)
-        V2 = S(PBC(I + 1, L), J)
-        V3 = S(I, PBC(J - 1, L))
-        V4 = S(I, PBC(J + 1, L))
-        SUMA = V1 + V2 + V3 + V4
+        I = mod(genrand_int31(), L) + 1
+        J = mod(genrand_int31(), L) + 1
+        SUMA = S(PBC(I - 1, L), J) + &
+               S(PBC(I + 1, L), J) + &
+               S(I, PBC(J - 1, L)) + &
+               S(I, PBC(J + 1, L))
         DIFE = 2*SUMA*S(I, J)
 
         if (DIFE > 0) then
diff --git a/quad10/fenomens/lab/p4/Makefile b/quad10/fenomens/lab/p4/Makefile
index 761b3f7..f02529f 100644
--- a/quad10/fenomens/lab/p4/Makefile
+++ b/quad10/fenomens/lab/p4/Makefile
@@ -5,21 +5,17 @@
 all: MC-2.o
 make_out_folder:
 	mkdir -p out data_out
-MC-2.o: make_out_folder mt19937ar.o writeconfigseed.o magne.o energ.o str.o pbc.o MC-2.f90
+MC-2.o: make_out_folder mt19937ar.o generateSpinMatrix.o magne.o energ.o pbc.o MC-2.f90
 	$(FC) $(FC_FLAGS) -c MC-2.f90
-	$(FC) $(FC_FLAGS) MC-2.o writeconfigseed.o mt19937ar.o magne.o energ.o str.o pbc.o -o out/mc2
+	$(FC) $(FC_FLAGS) MC-2.o generateSpinMatrix.o mt19937ar.o magne.o energ.o pbc.o -o out/mc2
 mt19937ar.o: mt19937ar.f
 	$(FC) $(FC_FLAGS) -c mt19937ar.f
-writeconfig.o: writeconfig.f90
-	$(FC) $(FC_FLAGS) -c writeconfig.f90
-writeconfigseed.o: writeconfigseed.f90
-	$(FC) $(FC_FLAGS) -c writeconfigseed.f90
+generateSpinMatrix.o: generateSpinMatrix.f90
+	$(FC) $(FC_FLAGS) -c generateSpinMatrix.f90
 magne.o: magne.f90
 	$(FC) $(FC_FLAGS) -c magne.f90
 energ.o: energ.f90
 	$(FC) $(FC_FLAGS) -c energ.f90
-str.o: str.f90
-	$(FC) $(FC_FLAGS) -c str.f90
 pbc.o: pbc.f90
 	$(FC) $(FC_FLAGS) -c pbc.f90
 
diff --git a/quad10/fenomens/lab/p4/energ.f90 b/quad10/fenomens/lab/p4/energ.f90
index ba7841c..431a296 100644
--- a/quad10/fenomens/lab/p4/energ.f90
+++ b/quad10/fenomens/lab/p4/energ.f90
@@ -1,4 +1,4 @@
-real*8 function ENERG(S, L)
+real*8 function energ(S, L)
   integer*2 :: S(1:64, 1:64)
   integer*4 :: I, J, L, PBC
   real*8 :: ENE
diff --git a/quad10/fenomens/lab/p4/writeconfigseed.f90 b/quad10/fenomens/lab/p4/generateSpinMatrix.f90
similarity index 82%
rename from quad10/fenomens/lab/p4/writeconfigseed.f90
rename to quad10/fenomens/lab/p4/generateSpinMatrix.f90
index 3d4bd13..0128119 100644
--- a/quad10/fenomens/lab/p4/writeconfigseed.f90
+++ b/quad10/fenomens/lab/p4/generateSpinMatrix.f90
@@ -1,4 +1,4 @@
-subroutine WRITECONFIGSEED(S, L, SEED)
+subroutine generateSpinMatrix(S, L, SEED)
   use iso_fortran_env
   implicit none
   integer*4, intent(in) :: L
@@ -18,4 +18,4 @@
       endif
     enddo
   enddo
-end subroutine WRITECONFIGSEED
+end subroutine generateSpinMatrix
diff --git a/quad10/fenomens/lab/p4/generateTemps.js b/quad10/fenomens/lab/p4/generateTemps.js
deleted file mode 100644
index 6352a62..0000000
--- a/quad10/fenomens/lab/p4/generateTemps.js
+++ /dev/null
@@ -1,8 +0,0 @@
-let b = 1.4
-let s = ""
-while (b <= 3.4) {
-    s += b.toPrecision(2) + " ";
-    b += 0.1
-}
-s += b.toPrecision(2) + " ";
-console.log(s)
diff --git a/quad10/fenomens/lab/p4/generateTemps2.js b/quad10/fenomens/lab/p4/generateTemps2.js
deleted file mode 100644
index 035b98c..0000000
--- a/quad10/fenomens/lab/p4/generateTemps2.js
+++ /dev/null
@@ -1,8 +0,0 @@
-let b = 2.1
-let s = ""
-while (b <= 2.4) {
-    s += b.toPrecision(3) + " ";
-    b += 0.02
-}
-s += b.toPrecision(3) + " ";
-console.log(s)
diff --git a/quad10/fenomens/lab/p4/magne.f90 b/quad10/fenomens/lab/p4/magne.f90
index be56bc9..118a965 100644
--- a/quad10/fenomens/lab/p4/magne.f90
+++ b/quad10/fenomens/lab/p4/magne.f90
@@ -1,4 +1,4 @@
-real*8 function MAGNE(S, L)
+real*8 function magne(S, L)
   implicit none
   integer*4, intent(in) :: L
   integer*2, intent(out) :: S(1:64,1:64)
@@ -14,4 +14,4 @@
 
   magne = mag
   return
-end function MAGNE
+end function magne
diff --git a/quad10/fenomens/lab/p4/str.f90 b/quad10/fenomens/lab/p4/str.f90
deleted file mode 100644
index 31cd529..0000000
--- a/quad10/fenomens/lab/p4/str.f90
+++ /dev/null
@@ -1,6 +0,0 @@
-character(len=20) function str(k)
-  ! "Convert an integer to string."
-  integer, intent(in) :: k
-  write (str, *) k
-  str = adjustl(str)
-end function str
diff --git a/quad10/fenomens/lab/p4/writeconfig.f90 b/quad10/fenomens/lab/p4/writeconfig.f90
deleted file mode 100644
index b356d17..0000000
--- a/quad10/fenomens/lab/p4/writeconfig.f90
+++ /dev/null
@@ -1,20 +0,0 @@
-subroutine WRITECONFIG(S, L)
-  implicit none
-  integer*4, intent(in) :: L
-  integer*2, intent(out) :: S(1:64,1:64)
-  integer*4 :: SEED, i, j
-  real*8 :: genrand_real2
-
-  SEED = 23456
-  call init_genrand(SEED)
-
-  do i = 1, L
-    do j = 1, L
-      if (genrand_real2() < .5d0) then
-        S(i, j) = 1
-      else
-        S(i, j) = -1
-      endif
-    enddo
-  enddo
-end subroutine WRITECONFIG