From: hackbard Date: Sat, 10 May 2003 16:30:10 +0000 (+0000) Subject: small improvements X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b0284bdece2ea77808548ae52197def2741f874;p=physik%2Fising.git small improvements --- diff --git a/ising.c b/ising.c index 4ff3ba8..b92cf99 100644 --- a/ising.c +++ b/ising.c @@ -7,33 +7,60 @@ * */ +#define _GNU_SOURCE #include #include #include #include #include +#include +#include +#include +#include #include "dfbapi.h" #define X 200 #define Y 200 -#define MAX_T 10 +#define I 20 +#define S 1 + +int usage(void) +{ + puts("usage:"); + puts(""); + puts("-h \t show this help"); + puts("-o \t save T - M values to file"); + puts("-i \t specify itteration value"); + puts("-x \t # x lattice sites"); + puts("-y \t # y lattice sites"); + puts("-s \t spin interaction strength"); + puts("-r \t run in interactive mode (still in work)"); + + return 1; +} int main(int argc, char **argv) { unsigned char *atom; - char *arg_v[4]; + char *arg_v[7]; char m_text[64]; char t_text[64]; char b_text[64]; + char s_text[64]; + char output_file[64]; + int of_fd=0; int max_x,x_c,max_y,y_c; int i; + int itt; int count_p; - unsigned int T; - double S; - int M; + double T; + double s; + int M=0; double beta; double delta_e; + int runfree=0; + double max_T; /* random stuff*/ srand(time(0)); @@ -41,26 +68,111 @@ int main(int argc, char **argv) /* display stuff */ d2_lattice d2_l; - /* we will parse argv later ... */ max_x=X; max_y=Y; - + itt=I; + s=S; + strcpy(output_file,""); + /* parse argv */ + for(i=1;i0;T-=.05) { - beta=5.0/T; /* k_B = 1 */ - /* do 100 itterations, we will need more */ - for(i=0;i<100;i++) + beta=1.0/T; /* k_B = 1 */ + for(i=0;i