random values
[physik/morpheus.git] / main.c
1 /*
2  * morpheus - main.c
3  *
4  * this program tries helping to understand the amorphous depuration
5  * and recrystallization of SiCx while ion implanation. hopefully the program 
6  * will simulate the stabilization of the selforganizing structure in the
7  * observed behaviour.
8  *
9  * refs: 
10  *  - J. K. N. Lindner. Habilationsschrift, Universitaet Augsburg.
11  *  - Maik Haeberlen. Diplomarbeit, Universitaet Augsburg.
12  */
13
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include "defines.h"
17
18 /* global variables */
19 int sum_z_segments;
20
21 int usage()
22 {
23  puts("usage:");
24  puts("-h: help");
25  puts("-a <value> \t slope of C concentration with depth (default 1)");
26  puts("-c <value> \t concentration at depths 0 (default 0)");
27  puts("-x <value> \t # x segments (default 50)");
28  puts("-y <value> \t # y segments (default 50)");
29  puts("-z <value> \t # z segments (default 100)");
30  return -23;
31 }
32
33 int main(int argc,char **argv) {
34  int x_seg,y_seg,z_seg; /* amount of segments */
35  int x,y,z; /* segments */
36  int i; /* for counting */
37  int slope_cc,start_cc; /* C concentration: slope, c(0) */
38
39  /* default values */
40  x_seg=DEFAULT_X_SEG-1;
41  y_seg=DEFAULT_Y_SEG-1;
42  z_seg=DEFAULT_Z_SEG-1;
43  slope_cc=DEFAULT_SLOPE_CC;
44  start_cc=DEFAULT_START_CC;
45  
46  /* parse command args */
47  for(i=1;i<argc;i++)
48  {
49   if(argv[i][0]=='-')
50   {
51    switch(argv[i][1])
52    {
53     case 'h':
54      usage();
55      return 23;
56      break;
57     case 'a':
58      slope_cc=atoi(argv[++i]);
59      break;
60     case 'c':
61      start_cc=atoi(argv[++i]);
62      break;
63     case 'x':
64      x_seg=atoi(argv[++i]);
65      break;
66     case 'y':
67      y_seg=atoi(argv[++i]);
68      break;
69     case 'z':
70      z_seg=atoi(argv[++i]);
71      break;
72    }
73   } else usage();
74  }
75
76  /* calculate sum_z_segments one time! */
77  sum_z_segments=0;
78  for(i=0;i<z_seg;i++) sum_z_segments+=(start_cc+i*slope_cc);
79  printfd("debug: sum z segments -> %d\n",sum_z_segments);
80
81
82  /* testing ... */
83
84  for(i=0;i<100;i++)
85  {
86   x=rand_get(x_seg);
87   y=rand_get(y_seg);
88   z=rand_get_lgp(slope_cc,start_cc);
89   printf ("x=%d y=%d z=%d\n",x,y,z);
90  }
91  return 23;
92 }