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
/* last change: 06.02.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 <graph.h>
12
13
14
/* -------------------------------------------------------------------- */
15
/* point_group */
16
/* extracts the linear part of the affine (space) group given in G. */
17
/* Note this is the point group of the space group in case the space */
18
/* group is given in standard form. */
19
/* -------------------------------------------------------------------- */
20
bravais_TYP *p_group(bravais_TYP *G)
21
{
22
bravais_TYP *H;
23
24
int i;
25
26
27
H = NULL;
28
H = init_bravais(G->dim-1);
29
30
H->gen_no = G->gen_no;
31
H->gen = (matrix_TYP **) malloc(G->gen_no * sizeof(matrix_TYP *));
32
for (i=0;i<H->gen_no;i++){
33
H->gen[i] = copy_mat(G->gen[i]);
34
real_mat(H->gen[i],H->dim,G->dim);
35
real_mat(H->gen[i],H->dim,H->dim);
36
rat2kgv(H->gen[i]);
37
Check_mat(H->gen[i]);
38
}
39
return(H);
40
}
41
42
43
44
/* -------------------------------------------------------------------- */
45
/* plus_tranlationen: */
46
/* Adds translations to a spacegroup. */
47
/* -------------------------------------------------------------------- */
48
/* G : the space group */
49
/* mat: matrix (the cols are the translating vectors) */
50
/* -------------------------------------------------------------------- */
51
52
void plus_translationen(bravais_TYP *G,
53
matrix_TYP *mat)
54
{
55
matrix_TYP *hilfsmat;
56
57
int i, j;
58
59
60
/* create a matrix for help */
61
hilfsmat = init_mat(G->dim, G->dim, "");
62
for (i=0; i<hilfsmat->rows; i++){
63
hilfsmat->array.SZ[i][i] = mat->kgv;
64
}
65
hilfsmat->kgv = mat->kgv;
66
67
/* create the new translationmatrices for the spacegroup */
68
G->gen = realloc(G->gen,(G->gen_no + mat->cols)*sizeof(matrix_TYP));
69
for (i=0; i<mat->cols; i++){
70
G->gen[G->gen_no + i] = copy_mat(hilfsmat);
71
for (j=0; j<G->dim-1; j++)
72
G->gen[G->gen_no + i]->array.SZ[j][G->dim-1] =
73
mat->array.SZ[j][i];
74
Check_mat(G->gen[G->gen_no + i]);
75
}
76
G->gen_no = G->gen_no + mat->cols;
77
78
/* clean up */
79
free_mat(hilfsmat);
80
}
81
82
83
84
/* -------------------------------------------------------------------- */
85
/* extract_c */
86
/* extracts the translational part of the affine (space) group G as a */
87
/* vector system (1-cozycle). */
88
/* -------------------------------------------------------------------- */
89
matrix_TYP *extract_c(bravais_TYP *G)
90
{
91
matrix_TYP *X;
92
93
int i, kgv, j;
94
95
X = NULL;
96
97
98
X = init_mat(G->gen_no * (G->dim-1),1,"");
99
kgv = 1;
100
for (i=0;i<G->gen_no;i++){
101
rat2kgv(G->gen[i]);
102
kgv = kgv*G->gen[i]->kgv/GGT(kgv,G->gen[i]->kgv);
103
}
104
105
/* set the cozycle */
106
X->kgv = kgv;
107
for(i=0;i<G->gen_no;i++)
108
for (j=0;j<G->dim-1;j++)
109
X->array.SZ[i*(G->dim-1)+j][0] = X->kgv/G->gen[i]->kgv *
110
G->gen[i]->array.SZ[j][G->dim-1];
111
Check_mat(X);
112
return(X);
113
}
114
115
116
117
118
119
120
121
122
123
124
125
126