cb89d8a8997471d10cb227ebede2be58458d5478
[physik/ising.git] / ising.c
1 /*
2  * ising.c - visualization of ising spins in an N x N lattice
3  *
4  * ... actually N x M
5  *
6  * author: hackbard@hackdaworld.dyndns.org
7  *
8  */
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <math.h>
14 #include "dfbapi.h"
15
16 #define X 50
17 #define Y 50
18 #define MAX_T 200
19
20 int main(int argc, char **argv)
21 {
22  unsigned char *atom;
23  int max_x,x_c,max_y,y_c;
24  int i,j;
25  unsigned int T;
26  double M;
27  double beta;
28  double delta_e;
29
30  /* display stuff */
31  d2_lattice d2_l;
32
33  /* we will parse argv later ... */
34  max_x=X;
35  max_y=Y;
36
37  d2_lattice_init(&argc,argv,&d2_l,max_x,max_y);
38
39  atom=(unsigned char *)(malloc(max_x*max_y*sizeof(unsigned char)));
40  
41  d2_l.status=atom;
42  
43  /* begin at T=0 M=1 situation */
44  memset(atom,0,max_x*max_y*sizeof(unsigned char));
45
46  for(T=1;T<MAX_T;T++)
47  {
48   beta=1.0/T; /* k_B = 1 */
49   /* do N*N itterations, we will need more */
50   for(i=0;i<max_x*max_y;i++)
51   {
52
53  for(x_c=0;x_c<max_x-1;x_c++)
54  {
55   for(y_c=0;y_c<max_y-1;y_c++)
56   {
57    delta_e=0;
58    // delta_e+=(-1*(int)(atom
59   }
60   
61  }
62
63   }
64   d2_lattice_draw(&d2_l,0,0,0,NULL);
65  }
66
67  getchar();
68
69  return 1;
70 }