CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
#include "typedef.h"
2
#include "tools.h"
3
#include "datei.h"
4
#include "getput.h"
5
#include "matrix.h"
6
7
main (int argc, char *argv[])
8
9
{
10
char *filename;
11
char string[80];
12
char *fn,
13
*family_name;
14
symbol_out **B;
15
bravais_TYP *S;
16
matrix_TYP *X;
17
int ad_no = 0; /* number of homogenously decomposable groups in this family */
18
FILE *outfile;
19
int i,j;
20
21
extern bravais_TYP *Z_class();
22
extern symbol_out *read_symbol();
23
extern symbol_out *get_symbol();
24
25
/* scan_argv (argc, argv, &filename); */
26
/* changed to conform with the rest of the carat package */
27
read_header(argc,argv);
28
if (FILEANZ > 0)
29
filename = FILENAMES[0];
30
else
31
filename = NULL;
32
33
if ((is_option('h') && optionnumber('h') == 0) ||
34
FILEANZ > 1){
35
printf("Usage: %s [file]\n",argv[0]);
36
printf("\n");
37
printf("file: (OPTIONAL) contains a set of commands for Datei, which are otherwise\n");
38
printf(" asked from stdin.\n");
39
printf("\n");
40
printf("Accesses the catalog of bravais groups up to dimension 6.\n");
41
printf("\n");
42
printf("The first input for the catalog is the family symbol, whose grammar is\n");
43
printf("described in detail in the CARAT manual. It is build up from atomic symbols\n");
44
printf("which are seperated by `,' or `;' to indicate diagonals and direct products.\n");
45
printf("We just state the two important rules here:\n");
46
printf("\n");
47
printf(" LIST OF 'ATOMS':\n");
48
printf(" dim1: 1\n");
49
printf(" dim2: 2-1 2-1' 2-2 2-2'\n");
50
printf(" dim3: 3\n");
51
printf(" dim4: 4-1 4-1' 4-2 4-2' 4-3 4-3'\n");
52
printf(" dim5: 5-1 5-2\n");
53
printf(" dim6: 6-1 6-2 6-2' 6-3 6-3' 6-4 6-4'\n");
54
printf("\n");
55
printf("Meaning of `,': (X 0 0)\n");
56
printf(" A,A,A stands for groups of the form (0 X 0) with X in A\n");
57
printf(" (0 0 X)\n");
58
printf("Meaning of `;':\n");
59
printf(" A;B stands for groups of the form (X 0)\n");
60
printf(" (0 Y) with X in A and Y in B.\n");
61
printf("NOTE: The primed atoms 2-1' and 2-2' only occur in multiples, seperated by `,'.\n");
62
printf("Examples: 2-1,2-1;2-1 (degree 6)\n");
63
printf(" 1;1;1 (degree 3)\n");
64
printf(" 3,3 (degree 6)\n");
65
printf(" 4-1;1 (degree 5)\n");
66
printf("\n");
67
printf("Cf.: Symbol, Bravais_type.\n");
68
printf("Note: Bravais_catalog is a synonym for Datei.\n");
69
if (is_option('h')){
70
exit(0);
71
}
72
else{
73
exit(31);
74
}
75
}
76
77
78
B = (symbol_out **) malloc(1 *sizeof(symbol_out *));
79
B[0] = read_symbol(filename);
80
ad_no++;
81
family_name = (char *) malloc(80 *sizeof(char));
82
strcpy(family_name, B[0]->fn);
83
/*
84
fprintf(stderr,"B[0]->fn: %s\n",B[0]->fn);
85
*/
86
family_name = strstr(family_name, "dim");
87
family_name = family_name+5;
88
get_zentr(B[0]);
89
while(B[ad_no-1]->fn != NULL)
90
{
91
B = (symbol_out **) realloc(B, (ad_no+1) *sizeof(symbol_out *));
92
filename = B[ad_no-1]->fn;
93
B[ad_no] = get_symbol(filename);
94
ad_no++;
95
}
96
printf("The crystal-family %s contains %d homogeneously decomposable bravais-groups with\n", family_name, ad_no);
97
j=0;
98
for(i=0; i<ad_no; i++)
99
{
100
if(j != 0)
101
{
102
if(j == ad_no -1)
103
printf(" resp. ");
104
else
105
printf(", ");
106
}
107
printf(" %d", (B[i]->grp->zentr_no+1));
108
j = 1;
109
}
110
printf("\n Z-classes of Bravais groups.\n");
111
112
113
printf("Do you want to calculate bravais-groups? (y or n): ");
114
fn = (char *) malloc(80 *sizeof(char));
115
scanf( "%[ \t\n]", fn);
116
scanf( "%[^\n]", fn);
117
while(strncmp(fn, "y", 1) != 0 && strncmp(fn, "n", 1) != 0)
118
{
119
scanf( "%[ \t\n]", fn);
120
scanf( "%[^\n]", fn);
121
}
122
if(strncmp(fn, "n", 1) == 0)
123
exit(3);
124
125
/*-----------------------------------------------------*\
126
| read and open output-file |
127
\*-----------------------------------------------------*/
128
printf("Please input a filename (stdout = standard output): ");
129
scanf( "%[ \t\n]", fn);
130
scanf( "%[^\n]", fn);
131
if(strncmp(fn, "stdout", 6) == 0)
132
fn = NULL;
133
if(fn == NULL)
134
outfile = stdout;
135
else
136
outfile = fopen( fn, "w");
137
138
printf("Which bravais-groups should be printed? (a(ll) or s(election): ");
139
scanf( "%[ \t\n]", string);
140
scanf( "%[^\n]", string);
141
while(strncmp(string, "a", 1) != 0 && strncmp(string, "s", 1) != 0)
142
{
143
scanf( "%[ \t\n]", string);
144
scanf( "%[^\n]", string);
145
}
146
147
if(strncmp(string, "a", 1) == 0)
148
{
149
for(i=0; i<ad_no; i++)
150
{
151
fput_bravais(outfile, B[i]->grp, "homogenously decomposable bravais-group");
152
fflush(outfile);
153
for(j=0; j<B[i]->grp->zentr_no; j++)
154
{
155
X = B[i]->grp->zentr[j];
156
S = Z_class(B[i]->grp, X);
157
fput_bravais(outfile, S, "not homogenously decomposable bravais-group");
158
fflush(outfile);
159
free_bravais(S);
160
}
161
}
162
exit(3);
163
}
164
165
strncpy(string, "y", 1);
166
while(strncmp(string, "y", 1) == 0)
167
{
168
printf("Please enter index i of homogeneously decomposable bravais-group, 1<= i<= %d: ", ad_no);
169
scanf("%d", &i);
170
i--;
171
if(i<0 || i>= ad_no)
172
printf("There is no homogenously decomposable bravais-group of this index\n");
173
else
174
{
175
printf("Please enter index j of bravais-group belonging to this homogenously decomposable\n");
176
printf("1 <= j =< %d: ", (B[i]->grp->zentr_no+1));
177
scanf("%d", &j);
178
j--;
179
if(j== 0)
180
fput_bravais(outfile, B[i]->grp, "homogeneously decomposable bravais-group");
181
else
182
{
183
j--;
184
if(j<0 || j>=B[i]->grp->zentr_no)
185
printf("There is no bravais-group of this index\n");
186
else
187
{
188
X = B[i]->grp->zentr[j];
189
S = Z_class(B[i]->grp, X);
190
fput_bravais(outfile, S, "not homogeneously decomposable bravais-group");
191
free_bravais(S);
192
}
193
}
194
}
195
printf("Do you want further bravais-groups? (y or n): ");
196
scanf( "%[ \t\n]", string);
197
scanf( "%[^\n]", string);
198
while(strncmp(string, "y", 1) != 0 && strncmp(string, "n", 1) != 0)
199
{
200
scanf( "%[ \t\n]", string);
201
scanf( "%[^\n]", string);
202
}
203
204
/* inserted to enable multiple output files, tilman 05/06/97 */
205
if (strncmp(string,"y",1) == 0){
206
printf("If you want a different file, insert it: (no/filename)");
207
if (fn == NULL) fn = (char *) malloc(1024*sizeof(char));
208
scanf( "%[ \t\n]", fn);
209
scanf( "%[^\n]", fn);
210
if (strcmp(fn,"no") != 0){
211
fclose (outfile);
212
outfile = fopen( fn, "w");
213
}
214
}
215
}
216
217
if ( outfile != stdout ) {
218
fclose (outfile);
219
}
220
221
exit(0);
222
}
223
/*{{{}}}*/
224
225