projects
/
physik
/
ising.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f4bf5eb
)
fixed boundary cond. bug
author
hackbard
<hackbard>
Sat, 10 May 2003 02:39:51 +0000
(
02:39
+0000)
committer
hackbard
<hackbard>
Sat, 10 May 2003 02:39:51 +0000
(
02:39
+0000)
ising.c
patch
|
blob
|
history
diff --git
a/ising.c
b/ising.c
index
e43b4be
..
4ff3ba8
100644
(file)
--- a/
ising.c
+++ b/
ising.c
@@
-12,19
+12,20
@@
#include <string.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <math.h>
#include <time.h>
+
#include "dfbapi.h"
#define X 200
#define Y 200
#include "dfbapi.h"
#define X 200
#define Y 200
-#define MAX_T 10
0
+#define MAX_T 10
int main(int argc, char **argv)
{
unsigned char *atom;
char *arg_v[4];
int main(int argc, char **argv)
{
unsigned char *atom;
char *arg_v[4];
- char m_text[
30
];
- char t_text[
30
];
- char b_text[
30
];
+ char m_text[
64
];
+ char t_text[
64
];
+ char b_text[
64
];
int max_x,x_c,max_y,y_c;
int i;
int count_p;
int max_x,x_c,max_y,y_c;
int i;
int count_p;
@@
-57,21
+58,21
@@
int main(int argc, char **argv)
for(T=1;T<MAX_T;T++)
{
for(T=1;T<MAX_T;T++)
{
- beta=
20
.0/T; /* k_B = 1 */
- /* do 10 itterations, we will need more */
- for(i=0;i<10;i++)
+ beta=
5
.0/T; /* k_B = 1 */
+ /* do 10
0
itterations, we will need more */
+ for(i=0;i<10
0
;i++)
{
{
+ M=0;
for(x_c=0;x_c<max_x;x_c++)
{
for(y_c=0;y_c<max_y;y_c++)
{
count_p=0;
for(x_c=0;x_c<max_x;x_c++)
{
for(y_c=0;y_c<max_y;y_c++)
{
count_p=0;
- M=0;
- if((*(atom+x_c+((2*y_c+1)%max_y)*max_x))&1) ++count_p;
- if((*(atom+x_c+((2*y_c-1)%max_y)*max_x))&1) ++count_p;
- if((*(atom+((2*x_c+1)%max_x)+y_c*max_x))&1) ++count_p;
- if((*(atom+((2*x_c-1)%max_x)+y_c*max_x))&1) ++count_p;
+ if((*(atom+x_c+((y_c+max_y+1)%max_y)*max_x))&1) ++count_p;
+ if((*(atom+x_c+((y_c+max_y-1)%max_y)*max_x))&1) ++count_p;
+ if((*(atom+((max_x+x_c+1)%max_x)+y_c*max_x))&1) ++count_p;
+ if((*(atom+((max_x+x_c-1)%max_x)+y_c*max_x))&1) ++count_p;
if(((*(atom+x_c+y_c*max_x))&1)==0) count_p=4-count_p;
delta_e=(2*count_p-4)*S;
if(delta_e<0) *(atom+x_c+y_c*max_x)=(*(atom+x_c+y_c*max_x)+1)&1;
if(((*(atom+x_c+y_c*max_x))&1)==0) count_p=4-count_p;
delta_e=(2*count_p-4)*S;
if(delta_e<0) *(atom+x_c+y_c*max_x)=(*(atom+x_c+y_c*max_x)+1)&1;
@@
-80,14
+81,14
@@
int main(int argc, char **argv)
if(1.0*rand()/RAND_MAX<exp(-1.0*delta_e*beta))
*(atom+x_c+y_c*max_x)=(*(atom+x_c+y_c*max_x)+1)&1;
}
if(1.0*rand()/RAND_MAX<exp(-1.0*delta_e*beta))
*(atom+x_c+y_c*max_x)=(*(atom+x_c+y_c*max_x)+1)&1;
}
- if((*(atom+x_c+
((2*y_c+1)%max_y)
*max_x))&1) ++M;
+ if((*(atom+x_c+
y_c
*max_x))&1) ++M;
}
}
}
}
- sprintf(t_text,"
T
= %d",T);
+ sprintf(t_text,"
temp
= %d",T);
arg_v[1]=t_text;
arg_v[1]=t_text;
- sprintf(b_text,"b = %f",beta);
+ sprintf(b_text,"b
eta
= %f",beta);
arg_v[2]=b_text;
arg_v[2]=b_text;
- sprintf(m_text,"
M
= %f",1.0-2.0*M/(max_x*max_y));
+ sprintf(m_text,"
magn
= %f",1.0-2.0*M/(max_x*max_y));
arg_v[3]=m_text;
d2_lattice_draw(&d2_l,0,0,3,arg_v);
}
arg_v[3]=m_text;
d2_lattice_draw(&d2_l,0,0,3,arg_v);
}