GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/* last change: 06.02.01 by Oliver Heidbuechel */123#include <ZZ.h>4#include <typedef.h>5#include <presentation.h>6#include <matrix.h>7#include <bravais.h>8#include <base.h>9#include <datei.h>10#include <graph.h>111213/* -------------------------------------------------------------------- */14/* point_group */15/* extracts the linear part of the affine (space) group given in G. */16/* Note this is the point group of the space group in case the space */17/* group is given in standard form. */18/* -------------------------------------------------------------------- */19bravais_TYP *p_group(bravais_TYP *G)20{21bravais_TYP *H;2223int i;242526H = NULL;27H = init_bravais(G->dim-1);2829H->gen_no = G->gen_no;30H->gen = (matrix_TYP **) malloc(G->gen_no * sizeof(matrix_TYP *));31for (i=0;i<H->gen_no;i++){32H->gen[i] = copy_mat(G->gen[i]);33real_mat(H->gen[i],H->dim,G->dim);34real_mat(H->gen[i],H->dim,H->dim);35rat2kgv(H->gen[i]);36Check_mat(H->gen[i]);37}38return(H);39}40414243/* -------------------------------------------------------------------- */44/* plus_tranlationen: */45/* Adds translations to a spacegroup. */46/* -------------------------------------------------------------------- */47/* G : the space group */48/* mat: matrix (the cols are the translating vectors) */49/* -------------------------------------------------------------------- */5051void plus_translationen(bravais_TYP *G,52matrix_TYP *mat)53{54matrix_TYP *hilfsmat;5556int i, j;575859/* create a matrix for help */60hilfsmat = init_mat(G->dim, G->dim, "");61for (i=0; i<hilfsmat->rows; i++){62hilfsmat->array.SZ[i][i] = mat->kgv;63}64hilfsmat->kgv = mat->kgv;6566/* create the new translationmatrices for the spacegroup */67G->gen = realloc(G->gen,(G->gen_no + mat->cols)*sizeof(matrix_TYP));68for (i=0; i<mat->cols; i++){69G->gen[G->gen_no + i] = copy_mat(hilfsmat);70for (j=0; j<G->dim-1; j++)71G->gen[G->gen_no + i]->array.SZ[j][G->dim-1] =72mat->array.SZ[j][i];73Check_mat(G->gen[G->gen_no + i]);74}75G->gen_no = G->gen_no + mat->cols;7677/* clean up */78free_mat(hilfsmat);79}80818283/* -------------------------------------------------------------------- */84/* extract_c */85/* extracts the translational part of the affine (space) group G as a */86/* vector system (1-cozycle). */87/* -------------------------------------------------------------------- */88matrix_TYP *extract_c(bravais_TYP *G)89{90matrix_TYP *X;9192int i, kgv, j;9394X = NULL;959697X = init_mat(G->gen_no * (G->dim-1),1,"");98kgv = 1;99for (i=0;i<G->gen_no;i++){100rat2kgv(G->gen[i]);101kgv = kgv*G->gen[i]->kgv/GGT(kgv,G->gen[i]->kgv);102}103104/* set the cozycle */105X->kgv = kgv;106for(i=0;i<G->gen_no;i++)107for (j=0;j<G->dim-1;j++)108X->array.SZ[i*(G->dim-1)+j][0] = X->kgv/G->gen[i]->kgv *109G->gen[i]->array.SZ[j][G->dim-1];110Check_mat(X);111return(X);112}113114115116117118119120121122123124125126