GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include "typedef.h"1#include "datei.h"2#include "getput.h"34/***************************************************************************5@6@---------------------------------------------------------------------------7@8@ FILE: lattice_tools.c9@10@---------------------------------------------------------------------------11@12***************************************************************************/131415/***************************************************************************16@17@---------------------------------------------------------------------------18@19@ lattice_element *init_lattice_element()20@21@ initializes a lattice_element, and allocates memory for res->symbol22@ via calloc(100*sizeof(char));23@24@---------------------------------------------------------------------------25@26***************************************************************************/27lattice_element *init_lattice_element()28{29lattice_element *res;3031res = (lattice_element *) malloc(1 * sizeof(lattice_element));3233res->grp = NULL;34res->symbol = (char *) calloc(100 , sizeof(char));35res->almost = -1;36res->zclass = -1;37res->alpha = -1;38res->N_orbits = 0;39res->TR = NULL;4041return res;42}4344/***************************************************************************45@46@---------------------------------------------------------------------------47@48@ void free_lattice_element(lattice_element *x)49@50@ frees all stuff assigned in x, and x itself51@52@---------------------------------------------------------------------------53@54***************************************************************************/55void free_lattice_element(lattice_element *x)56{57int i;5859if (x->grp != NULL) free_bravais(x->grp);60for (i=0;i<x->N_orbits;i++) free_mat(x->TR[i]);61free(x->symbol);62if (x->TR != NULL) free(x->TR);6364free(x);65}6667/***************************************************************************68@69@---------------------------------------------------------------------------70@71@---------------------------------------------------------------------------72@73***************************************************************************/74lattice_element *fget_lattice_element(FILE *F,int OPTION)75{76lattice_element *E;7778E = init_lattice_element();79fscanf(F,"%s %d %d\n",E->symbol,&E->almost,&E->zclass);8081fscanf(F,"%d\n",&E->alpha);8283E->TR = fmget_mat(F,&E->N_orbits);8485/* sometimes we want to get hold of the group in the catalog as well */86if (OPTION){87E->grp = brav_from_datei(E->symbol,E->almost,E->zclass);88}8990return E;91}9293/***************************************************************************94@95@---------------------------------------------------------------------------96@97@---------------------------------------------------------------------------98@99***************************************************************************/100void fput_lattice_element(lattice_element *E,FILE *F)101{102int i;103104if (F==NULL) F = stdout;105106fprintf(F,"Symbol: %s almost: %d zclass: %d\n",107E->symbol,E->almost,E->zclass);108109fprintf(F,"alpha : %d\n",E->alpha);110111fprintf(F,"#%d\n",E->N_orbits);112113for (i=0;i<E->N_orbits;i++){114fput_mat(F,E->TR[i],NULL,2);115}116117if (E->grp != NULL) put_bravais(E->grp,NULL,NULL);118119return ;120}121122123124