Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

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

563580 views
1
#include "typedef.h"
2
#include "getput.h"
3
#include "matrix.h"
4
/**************************************************************************\
5
@---------------------------------------------------------------------------
6
@---------------------------------------------------------------------------
7
@ FILE: put_bravais.c
8
@---------------------------------------------------------------------------
9
@---------------------------------------------------------------------------
10
@
11
\**************************************************************************/
12
13
14
/**************************************************************************\
15
@---------------------------------------------------------------------------
16
@ void fput_bravais(outfile, G, comment)
17
@ FILE *outfile;
18
@ bravais_TYP *G;
19
@ char *comment;
20
@ the same as put_bravais, but outfile must already have |
21
@ been opened |
22
@
23
@---------------------------------------------------------------------------
24
@
25
\**************************************************************************/
26
void fput_bravais(outfile, G, comment)
27
FILE *outfile;
28
bravais_TYP *G;
29
char *comment;
30
{
31
int i, j;
32
33
extern void fput_mat();
34
35
36
/*---------------------------------------------------------------*\
37
| print header line, i.e. gen_no, form_no, zentr_no, normal_no |
38
| and cen_no |
39
\*---------------------------------------------------------------*/
40
41
if(G->form_no == 0 && G->zentr_no == 0 && G->normal_no == 0 && G->cen_no == 0)
42
fprintf(outfile, "#%d %% number of generators", G->gen_no);
43
else
44
{
45
fprintf(outfile, "#g%d ", G->gen_no);
46
if(G->form_no != 0)
47
fprintf(outfile, "f%d ", G->form_no);
48
if(G->zentr_no != 0)
49
fprintf(outfile, "z%d ", G->zentr_no);
50
if(G->normal_no != 0)
51
fprintf(outfile, "n%d ", G->normal_no);
52
if(G->cen_no != 0)
53
fprintf(outfile, "c%d", G->cen_no);
54
}
55
if(comment != NULL)
56
{
57
fprintf(outfile, "%% %s", comment);
58
}
59
fprintf(outfile, "\n");
60
61
/*--------------------------------------------------------------------*\
62
| print the matrices |
63
\*--------------------------------------------------------------------*/
64
for(i=0; i<G->gen_no; i++)
65
{
66
#if 0
67
fprintf( outfile, "putting generator %d\n",i);
68
#endif
69
fput_mat(outfile, G->gen[i], "generator", 0);
70
#if 0
71
fprintf( outfile, "done\n");
72
#endif
73
}
74
for(i=0; i<G->form_no; i++)
75
{
76
Check_mat(G->form[i]);
77
fput_mat(outfile, G->form[i], "invariant form", 2);
78
}
79
for(i=0; i<G->zentr_no; i++)
80
fput_mat(outfile, G->zentr[i], "zentr", 0);
81
for(i=0; i<G->normal_no; i++)
82
{
83
Check_mat(G->normal[i]);
84
fput_mat(outfile, G->normal[i], "generator of normalizer", 2);
85
}
86
for(i=0; i<G->cen_no; i++)
87
{
88
Check_mat(G->cen[i]);
89
fput_mat(outfile, G->cen[i], "generator of centralizer", 2);
90
}
91
92
/*--------------------------------------------------------------------*\
93
| print order of the bravais-group |
94
\*--------------------------------------------------------------------*/
95
fput_order(outfile, G->divisors, G->order);
96
97
}
98
99
100
101
/**************************************************************************\
102
@---------------------------------------------------------------------------
103
@ void put_bravais(G, filename, comment)
104
@ bravais_TYP *G;
105
@ char *filename;
106
@ char *comment;
107
@
108
@ prints the bravais_TYP G to the file with name 'filename'.
109
@ If 'filename' == NULL, G is printed to standard output.
110
@ comment is a string to write comments that will be ignored if
111
@ the output is used as input for another programm
112
@---------------------------------------------------------------------------
113
@
114
\**************************************************************************/
115
void put_bravais(G, filename, comment)
116
bravais_TYP *G;
117
char *filename;
118
char *comment;
119
{
120
int i, j;
121
FILE *outfile;
122
123
extern void put_mat();
124
125
/*------------------------------------------------------------*\
126
| Open output file |
127
\*------------------------------------------------------------*/
128
if ( filename != NULL ) {
129
if ( (outfile = fopen (filename, "w")) == NULL ) {
130
fprintf (stderr, "put_bravais: Could not open %s\n", filename);
131
exit (4);
132
}
133
}
134
else
135
outfile = stdout;
136
137
138
/*--------------------------------------------------------------------*\
139
| print header line |
140
\*--------------------------------------------------------------------*/
141
142
/* changed by tilman on request to have an coherent bravais_TYP
143
if(G->form_no == 0 && G->zentr_no == 0 && G->normal_no == 0)
144
fprintf(outfile, "#%d %% number of generators", G->gen_no);
145
else */
146
{
147
fprintf(outfile, "#g%d ", G->gen_no);
148
if(G->form_no != 0)
149
fprintf(outfile, "f%d ", G->form_no);
150
if(G->zentr_no != 0)
151
fprintf(outfile, "z%d ", G->zentr_no);
152
if(G->normal_no != 0)
153
fprintf(outfile, "n%d ", G->normal_no);
154
if(G->cen_no != 0)
155
fprintf(outfile, "c%d ", G->cen_no);
156
}
157
if(comment != NULL)
158
{
159
fprintf(outfile, "%% %s", comment);
160
}
161
fprintf(outfile, "\n");
162
/*--------------------------------------------------------------------*\
163
| print the matrices |
164
\*--------------------------------------------------------------------*/
165
for(i=0; i<G->gen_no; i++)
166
fput_mat(outfile, G->gen[i], "generator", 0);
167
for(i=0; i<G->form_no; i++)
168
{
169
Check_mat(G->form[i]);
170
fput_mat(outfile, G->form[i], "invariant form", 2);
171
}
172
for(i=0; i<G->zentr_no; i++)
173
fput_mat(outfile, G->zentr[i], "zentr", 0);
174
for(i=0; i<G->normal_no; i++)
175
{
176
Check_mat(G->normal[i]);
177
fput_mat(outfile, G->normal[i], "generator of normalizer", 2);
178
}
179
for(i=0; i<G->cen_no; i++)
180
{
181
Check_mat(G->cen[i]);
182
fput_mat(outfile, G->cen[i], "generator of centralizer", 2);
183
}
184
185
/*--------------------------------------------------------------------*\
186
| print the order of the bravais_group |
187
\*--------------------------------------------------------------------*/
188
fput_order(outfile, G->divisors, G->order);
189
190
/*--------------------------------------------------------------------*\
191
| close output-file |
192
\*--------------------------------------------------------------------*/
193
if ( outfile != stdout ) {
194
fclose (outfile);
195
}
196
}
197
/*{{{}}}*/
198
199