GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#include "typedef.h"1#include "getput.h"2#include "matrix.h"3/**************************************************************************\4@---------------------------------------------------------------------------5@---------------------------------------------------------------------------6@ FILE: put_bravais.c7@---------------------------------------------------------------------------8@---------------------------------------------------------------------------9@10\**************************************************************************/111213/**************************************************************************\14@---------------------------------------------------------------------------15@ void fput_bravais(outfile, G, comment)16@ FILE *outfile;17@ bravais_TYP *G;18@ char *comment;19@ the same as put_bravais, but outfile must already have |20@ been opened |21@22@---------------------------------------------------------------------------23@24\**************************************************************************/25void fput_bravais(outfile, G, comment)26FILE *outfile;27bravais_TYP *G;28char *comment;29{30int i, j;3132extern void fput_mat();333435/*---------------------------------------------------------------*\36| print header line, i.e. gen_no, form_no, zentr_no, normal_no |37| and cen_no |38\*---------------------------------------------------------------*/3940if(G->form_no == 0 && G->zentr_no == 0 && G->normal_no == 0 && G->cen_no == 0)41fprintf(outfile, "#%d %% number of generators", G->gen_no);42else43{44fprintf(outfile, "#g%d ", G->gen_no);45if(G->form_no != 0)46fprintf(outfile, "f%d ", G->form_no);47if(G->zentr_no != 0)48fprintf(outfile, "z%d ", G->zentr_no);49if(G->normal_no != 0)50fprintf(outfile, "n%d ", G->normal_no);51if(G->cen_no != 0)52fprintf(outfile, "c%d", G->cen_no);53}54if(comment != NULL)55{56fprintf(outfile, "%% %s", comment);57}58fprintf(outfile, "\n");5960/*--------------------------------------------------------------------*\61| print the matrices |62\*--------------------------------------------------------------------*/63for(i=0; i<G->gen_no; i++)64{65#if 066fprintf( outfile, "putting generator %d\n",i);67#endif68fput_mat(outfile, G->gen[i], "generator", 0);69#if 070fprintf( outfile, "done\n");71#endif72}73for(i=0; i<G->form_no; i++)74{75Check_mat(G->form[i]);76fput_mat(outfile, G->form[i], "invariant form", 2);77}78for(i=0; i<G->zentr_no; i++)79fput_mat(outfile, G->zentr[i], "zentr", 0);80for(i=0; i<G->normal_no; i++)81{82Check_mat(G->normal[i]);83fput_mat(outfile, G->normal[i], "generator of normalizer", 2);84}85for(i=0; i<G->cen_no; i++)86{87Check_mat(G->cen[i]);88fput_mat(outfile, G->cen[i], "generator of centralizer", 2);89}9091/*--------------------------------------------------------------------*\92| print order of the bravais-group |93\*--------------------------------------------------------------------*/94fput_order(outfile, G->divisors, G->order);9596}979899100/**************************************************************************\101@---------------------------------------------------------------------------102@ void put_bravais(G, filename, comment)103@ bravais_TYP *G;104@ char *filename;105@ char *comment;106@107@ prints the bravais_TYP G to the file with name 'filename'.108@ If 'filename' == NULL, G is printed to standard output.109@ comment is a string to write comments that will be ignored if110@ the output is used as input for another programm111@---------------------------------------------------------------------------112@113\**************************************************************************/114void put_bravais(G, filename, comment)115bravais_TYP *G;116char *filename;117char *comment;118{119int i, j;120FILE *outfile;121122extern void put_mat();123124/*------------------------------------------------------------*\125| Open output file |126\*------------------------------------------------------------*/127if ( filename != NULL ) {128if ( (outfile = fopen (filename, "w")) == NULL ) {129fprintf (stderr, "put_bravais: Could not open %s\n", filename);130exit (4);131}132}133else134outfile = stdout;135136137/*--------------------------------------------------------------------*\138| print header line |139\*--------------------------------------------------------------------*/140141/* changed by tilman on request to have an coherent bravais_TYP142if(G->form_no == 0 && G->zentr_no == 0 && G->normal_no == 0)143fprintf(outfile, "#%d %% number of generators", G->gen_no);144else */145{146fprintf(outfile, "#g%d ", G->gen_no);147if(G->form_no != 0)148fprintf(outfile, "f%d ", G->form_no);149if(G->zentr_no != 0)150fprintf(outfile, "z%d ", G->zentr_no);151if(G->normal_no != 0)152fprintf(outfile, "n%d ", G->normal_no);153if(G->cen_no != 0)154fprintf(outfile, "c%d ", G->cen_no);155}156if(comment != NULL)157{158fprintf(outfile, "%% %s", comment);159}160fprintf(outfile, "\n");161/*--------------------------------------------------------------------*\162| print the matrices |163\*--------------------------------------------------------------------*/164for(i=0; i<G->gen_no; i++)165fput_mat(outfile, G->gen[i], "generator", 0);166for(i=0; i<G->form_no; i++)167{168Check_mat(G->form[i]);169fput_mat(outfile, G->form[i], "invariant form", 2);170}171for(i=0; i<G->zentr_no; i++)172fput_mat(outfile, G->zentr[i], "zentr", 0);173for(i=0; i<G->normal_no; i++)174{175Check_mat(G->normal[i]);176fput_mat(outfile, G->normal[i], "generator of normalizer", 2);177}178for(i=0; i<G->cen_no; i++)179{180Check_mat(G->cen[i]);181fput_mat(outfile, G->cen[i], "generator of centralizer", 2);182}183184/*--------------------------------------------------------------------*\185| print the order of the bravais_group |186\*--------------------------------------------------------------------*/187fput_order(outfile, G->divisors, G->order);188189/*--------------------------------------------------------------------*\190| close output-file |191\*--------------------------------------------------------------------*/192if ( outfile != stdout ) {193fclose (outfile);194}195}196/*{{{}}}*/197198199