GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include"typedef.h"1#include"bravais.h"2#include"matrix.h"3#include"symm.h"4#include"autgrp.h"56/*******************************************************************************7@8@-------------------------------------------------------------------------------9@ FILE: bravais_tools.h10@11@-------------------------------------------------------------------------------12@13*******************************************************************************/1415/*******************************************************************************16@17@------------------------------------------------------------------------------18@19@ bravais_TYP *bravais_group(bravais_TYP *H,int flag)20@21@ Calculates the bravais group of H. the result G of this function22@ will have G->gen and G->form assigned.23@ The program relies on H->form to be correct if it is given.24@ If flag>0, then the function will pair reduce the first form.25@ It is save to use this optiuon, but slower in well behaved examples.26@------------------------------------------------------------------------------27@28******************************************************************************/29bravais_TYP *bravais_group(bravais_TYP *H,int flag)30{31int i,32F_no;3334matrix_TYP **F,35*PF,36*ID,37*SV;3839bravais_TYP *G;4041ID = init_mat(H->dim,H->dim,"1");42PF = rform(H->gen,H->gen_no,ID,101);4344if (!flag){45SV = short_vectors(PF,max_diagonal_entry(PF),0,0,0,&i);46}4748/* calculate the formspace if not given */49if (H->form_no == 0){50H->form = formspace(H->gen,H->gen_no,1,&H->form_no);51}5253/* F will hold input for autgrp */54F_no = H->form_no;55F = (matrix_TYP **) malloc( (F_no+1) * sizeof(matrix_TYP *));56for (i=0;i<F_no;i++) F[i+1] = copy_mat(H->form[i]);57F[0] = PF;5859if (!flag){60/* call autgrp to get the result */61G = autgrp(F,F_no+1,SV,NULL,0,NULL);62}63else{64G = pr_aut(F,F_no+1,NULL,0,NULL);65}6667/* copy the forms to G->form */68G->form = (matrix_TYP **) malloc(F_no * sizeof(matrix_TYP *));69G->form_no = F_no;70for (i=0;i<G->form_no;i++) G->form[i] = F[i+1];7172/* clean up */73free(F);74free_mat(PF);75if (!flag) free_mat(SV);76free_mat(ID);7778return G;79}8081/****************************************************************************82@83@----------------------------------------------------------------------------84@85@ bravais_TYP *copy_bravais(bravais_TYP *H)86@87@ copies all data form H to the result. Nothing is checked.88@----------------------------------------------------------------------------89@90*****************************************************************************/91bravais_TYP *copy_bravais(bravais_TYP *H)92{9394int i;9596bravais_TYP *G;9798G = init_bravais(H->dim);99100if (H->order != 0){101G->order = H->order;102memcpy(G->divisors,H->divisors,100*sizeof(int));103}104if (H->gen_no != 0){105G->gen = (matrix_TYP **) malloc(H->gen_no * sizeof(matrix_TYP *));106for (i=0;i<H->gen_no;i++) G->gen[i] = copy_mat(H->gen[i]);107G->gen_no = H->gen_no;108}109if (H->cen_no != 0){110G->cen = (matrix_TYP **) malloc(H->cen_no * sizeof(matrix_TYP *));111for (i=0;i<H->cen_no;i++) G->cen[i] = copy_mat(H->cen[i]);112G->cen_no = H->cen_no;113}114if (H->normal_no != 0){115G->normal = (matrix_TYP **) malloc(H->normal_no * sizeof(matrix_TYP *));116for (i=0;i<H->normal_no;i++) G->normal[i] = copy_mat(H->normal[i]);117G->normal_no = H->normal_no;118}119if (H->form_no != 0){120G->form = (matrix_TYP **) malloc(H->form_no * sizeof(matrix_TYP *));121for (i=0;i<H->form_no;i++) G->form[i] = copy_mat(H->form[i]);122G->form_no = H->form_no;123}124if (H->zentr_no != 0){125G->zentr = (matrix_TYP **) malloc(H->zentr_no * sizeof(matrix_TYP *));126for (i=0;i<H->zentr_no;i++) G->zentr[i] = copy_mat(H->zentr[i]);127G->zentr_no = H->zentr_no;128}129130return G;131132}133134135