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

563640 views
1
/* last change: 19.01.01 by Oliver Heidbuechel */
2
3
4
#include <ZZ.h>
5
#include <typedef.h>
6
#include <presentation.h>
7
#include <matrix.h>
8
#include <bravais.h>
9
#include <base.h>
10
#include <datei.h>
11
#include <longtools.h>
12
#include <graph.h>
13
#include <tsubgroups.h>
14
15
16
17
extern int OANZ;
18
extern matrix_TYP **OMAT;
19
extern int OFLAG;
20
/* boolean GRAPH = FALSE; */
21
22
23
24
/* -------------------------------------------------------------------- */
25
/* R: spacegroup in standard affine form without translations */
26
/* calculate all minimal k-supergroups of R */
27
/* T(R) has to be Z^n */
28
/* P is the point group of R with correct normalizer */
29
/* return the number of these groups via anz */
30
/* if bahnflag representatives under the operation of N_Aff_n (R) */
31
/* are returned */
32
/* debugflag == TRUE: do paranoia test */
33
/* -------------------------------------------------------------------- */
34
bravais_TYP **min_k_super(bravais_TYP *P,
35
bravais_TYP *R,
36
matrix_TYP *pres,
37
int *anz,
38
boolean bahnflag,
39
boolean debugflag,
40
int **length)
41
{
42
bravais_TYP **S,
43
*TR;
44
45
matrix_TYP *F, *std, *tmp2,
46
**gitter, **allgitter,
47
**N;
48
49
int p, i, j, Nanz, anzalt,
50
*list, *smallest, *kopiert;
51
52
53
anz[0] = 0;
54
OFLAG = TRUE;
55
OANZ = 0;
56
OMAT = (matrix_TYP **)malloc(1000 * sizeof(matrix_TYP *));
57
F = init_mat(P->dim, P->dim, "1");
58
59
/* calculate the superlattices */
60
for (p = 2; p < 100 ; p++){
61
if (P->divisors[p]){
62
TR = tr_bravais(P, 1, 0);
63
memset(TR->divisors, 0, 100 * sizeof(int));
64
TR->divisors[p] = 1;
65
66
/* TR ist changed in ZZ */
67
ZZ(TR, F, TR->divisors, NULL, "rbgl1", 0, 0, 0);
68
free_bravais(TR);
69
70
if (OANZ == anz[0]){
71
OMAT[OANZ] = init_mat(P->dim, P->dim, "");
72
for(i = 0; i < OMAT[OANZ]->rows; i++){
73
OMAT[OANZ]->array.SZ[i][i] = p;
74
}
75
Check_mat(OMAT[OANZ]);
76
OANZ++;
77
}
78
cleanup_prime();
79
}
80
anz[0] = OANZ;
81
}
82
83
OANZ = 0;
84
OFLAG = FALSE;
85
free_mat(F);
86
87
/* calculate the correct lattices */
88
allgitter = (matrix_TYP **)calloc(anz[0], sizeof(matrix_TYP *));
89
for (i = 0; i < anz[0]; i++){
90
allgitter[i] = mat_inv(OMAT[i]);
91
long_col_hnf(allgitter[i]);
92
free_mat(OMAT[i]);
93
}
94
free(OMAT);
95
96
if (bahnflag){
97
/* calculate the point group of the affine normalizer of R */
98
cen_to_norm(P);
99
N = PoaN(R, P, pres, &Nanz);
100
101
/* calculate orbit on lattices */
102
list = (int *)calloc(anz[0], sizeof(int));
103
length[0] = (int *)calloc(anz[0] + 1, sizeof(int));
104
smallest = (int *)calloc(anz[0] + 1, sizeof(int));
105
anzalt = anz[0];
106
anz[0] = orbit_on_lattices(allgitter, anzalt, N, Nanz, list,
107
length[0], smallest, NULL);
108
109
/* get representatives */
110
gitter = (matrix_TYP **)calloc(anz[0], sizeof(matrix_TYP *));
111
kopiert = (int *)calloc(anzalt, sizeof(int));
112
for (i = 1; i <= anz[0]; i++){
113
gitter[i - 1] = allgitter[smallest[i]];
114
kopiert[smallest[i]] = 1;
115
}
116
117
/* clean */
118
for (i = 0; i < Nanz; i++){
119
free_mat(N[i]);
120
}
121
for (i = 0; i < anzalt; i++){
122
if (kopiert[i] == 0)
123
free_mat(allgitter[i]);
124
}
125
free(kopiert);
126
free(N);
127
free(allgitter);
128
}
129
else{
130
gitter = allgitter;
131
}
132
133
/* calculate the groups */
134
S = (bravais_TYP **)calloc(anz[0], sizeof(bravais_TYP *));
135
for (i = 0; i < anz[0]; i++){
136
S[i] = copy_bravais(R);
137
plus_translationen(S[i], gitter[i]);
138
139
/* paranoia test */
140
if (debugflag){
141
std = copy_mat(gitter[i]);
142
long_col_hnf(std);
143
for (j = 0; j < P->gen_no; j++){
144
tmp2 = mat_mul(P->gen[j], gitter[i]);
145
long_col_hnf(tmp2);
146
if (cmp_mat(std, tmp2)){
147
fprintf(stderr, "Not G-invariant!!!\n");
148
exit(2);
149
}
150
free_mat(tmp2);
151
}
152
free_mat(std);
153
}
154
}
155
156
/* clean */
157
for (i = 0; i < anz[0]; i++){
158
free_mat(gitter[i]);
159
}
160
free(gitter);
161
if (bahnflag){
162
free(list);
163
free(smallest);
164
}
165
166
return(S);
167
}
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193