GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
/* author: Oliver Heidbuechel */1/* last change: 07.02.2001 */23#include <ZZ.h>4#include<typedef.h>5#include<getput.h>6#include<matrix.h>7#include<longtools.h>8#include<tools.h>9#include"zass.h"10#include <base.h>11#include <bravais.h>12#include <graph.h>13#include <presentation.h>141516int INFO_LEVEL;17extern int SFLAG;18boolean GRAPH_DEBUG;19202122int main (int argc, char *argv[])23{24bravais_TYP *G, *R, **S;2526int i, anz, panz, OPT[6];2728char comment[1000],29file[1000];3031matrix_TYP **presentation,32**base;3334bahn **strong;353637read_header(argc, argv);38if ( (is_option('p') && FILEANZ < 4) || (!is_option('p') && FILEANZ < 3) ||39(is_option('h') && optionnumber('h') == 0) ){40printf("\n");41printf("Usage: %s 'file1' 'file2' [-p 'file3'] 'p_1' ... 'p_n' \n", argv[0]);42printf("\n");43printf("file1: Spacegroup R in standard affine form\n");44printf("file2: Pointgroup G of R (G->gen and G->normal have to generate the normalizer)\n");45printf("file3: (Optional) Presentation of G\n");46printf("p_i : primes\n");47printf("\n");48printf("Calculates the maximal klassengleich subgroups of R\n");49printf("with p_i-power index.\n");50printf("\n");51printf("Options:\n");52printf("-f : print the subgroups in files 'file1_j'\n");53printf("-h : gives this help\n");54printf("-d : only for debugging, do not use\n");55exit(11);56}57INFO_LEVEL = optionnumber('h');58if (INFO_LEVEL & 12){59SFLAG = 1;60}6162/* get data */63R = get_bravais(FILENAMES[0]);64G = get_bravais(FILENAMES[1]);65memset(G->divisors, 0, 100 * sizeof(int));66if (is_option('p')){67presentation = mget_mat(FILENAMES[2], &panz);68if (panz > 1){69fprintf(stderr, "you should only give a single matrix as presention\n");70exit(3);71}72for (i = 3; i < FILEANZ; i++){73G->divisors[atoi(FILENAMES[i])]++;74}75}76else{77base = get_base(G);78strong = strong_generators(base,G,TRUE);79presentation = (matrix_TYP **)calloc(1, sizeof(matrix_TYP *));80presentation[0] = pres(strong, G, OPT);81for (i = 0; i < G->dim; i++){82free_mat(base[i]);83free_bahn(strong[i]);84free(strong[i]);85}86free(strong);87free(base);88for (i = 2; i < FILEANZ; i++){89G->divisors[atoi(FILENAMES[i])]++;90}91}9293/* calculate the minimal klassengleich subgroups of prime-power-index */94S = max_k_sub(G, R, presentation[0], &anz, is_option('d'));9596/* print the minimal klassengleich subgroups of prime-power-index */97if (is_option('f')){98for (i = 0; i < anz; i++){99sprintf(comment, "%d-th maximal klassengleich subgroup of %s", i + 1, FILENAMES[0]);100sprintf(file, "%s_%d", FILENAMES[0], i + 1);101put_bravais(S[i], file, comment);102}103}104else{105for (i = 0; i < anz; i++){106sprintf(comment, "%d-th maximal klassengleich subgroup of %s", i + 1, FILENAMES[0]);107put_bravais(S[i], 0, comment);108}109}110111/* clean */112free_bravais(R);113free_bravais(G);114for (i = 0; i < anz; i++)115free_bravais(S[i]);116free(S);117free_mat(presentation[0]);118free(presentation);119120/* for debugging */121if (INFO_LEVEL & 12){122fprintf(stderr,"write pointer_statistics\n");123pointer_statistics(0,0);124}125126exit(0);127}128129130131132133134135136