diff --git a/stat_new/coords b/stat_new/coords index 82e3cb9..fc2e2bb 100755 Binary files a/stat_new/coords and b/stat_new/coords differ diff --git a/stat_new/coords.c b/stat_new/coords.c index df4dbfd..2639307 100644 --- a/stat_new/coords.c +++ b/stat_new/coords.c @@ -2,7 +2,8 @@ * * Usage: * reading_coords (filename, type_interaction, labels, cell, - * &number_of_molecules, &number_of_atoms, label_molecule, type_atoms, coords) + * &number_of_molecules, &number_of_atoms, true_label_molecule, label_molecule, + * type_atoms, coords) */ #include @@ -28,13 +29,15 @@ char conv (int fnumb, int dig_pos) int reading_coords (char *filename, int type_inter, const int *label_atom, const float *cell, int *num_mol, int *num_atoms, - int *label_mol, int *type_atoms, float *coords) + int *true_label_mol, int *label_mol, + int *type_atoms, float *coords) /* filename - name of file with coordinates * type_inter - type interaction (number of molecules for interaction) * label_atom - types of atom for interaction * cell - cell dimension * num_mol - number of molecules for writing coordinates * num_atoms - number of atoms for writing coordinates + * true_label_mol - massive of true numbers of molecule for atoms * label_mol - massive of numbers of molecule for atoms * type_atoms - massive of atom types for atoms * coords - massive of coordinates @@ -57,7 +60,7 @@ int reading_coords (char *filename, int type_inter, const int *label_atom, *num_mol = 0; // Reading file - inp = fopen (filename, "r+"); + inp = fopen (filename, "r"); if (inp == NULL) return 1; @@ -77,9 +80,10 @@ int reading_coords (char *filename, int type_inter, const int *label_atom, if (ref_mol != atoi (&file_string[53])) { ref_mol = atoi (&file_string[53]); + true_label_mol[*num_mol] = ref_mol; *num_mol = *num_mol + 1; } - label_mol[*num_atoms] = num_mol - 1; + label_mol[*num_atoms] = *num_mol - 1; type_atoms[*num_atoms] = j; *num_atoms = *num_atoms + 1; @@ -287,13 +291,6 @@ int reading_coords (char *filename, int type_inter, const int *label_atom, } } -// Reading number of molecules -// *num_mol = 1; -// ref_mol = label_mol[0]; -// for (i=0; i<*num_atoms; i++) -// if (ref_mol != label_mol[i]) -// *num_mol = *num_mol + 1; -// return 0; } diff --git a/stat_new/stat b/stat_new/stat index af87dba..f973372 100755 Binary files a/stat_new/stat and b/stat_new/stat differ diff --git a/stat_new/stat_print.c b/stat_new/stat_print.c new file mode 100644 index 0000000..df6b145 --- /dev/null +++ b/stat_new/stat_print.c @@ -0,0 +1,109 @@ +/* Library for printing aglomerates + * + * Usage: + * printing_agl (input_file, output_file, number_of_molecules, + * true_label_molecules, num_of_molecules_in_aglomerates, aglomerates, statistic) + */ + +#include +#include + + +int printing_agl (char *input, char *output, const int *connect, int num_mol, + const int *true_label_mol, const int *num_mol_agl, + const int *agl, const int *stat) +/* input - name of file with coordinates + * output - name of output file + * connect - connectivity graph for all molecules + * num_mol - number of molecules + * true_label_mol - massive of true numbers of molecule for atoms + * num_mol_agl - massive of numbers of molecule in aglomerates + * agl - massive of aglomerates + * stat - massive of statistics + */ +{ + int i, iso, j, k, p, type, *label_matrix, **matrix; + FILE *f_out; +/* iso - isomorphic graph in database + * type - number of cycle in aglomerates + * label_matrix - massive of indexes of molecule + * matrix - connectivity graph + */ + + f_out = fopen (output, "a"); + +// head + fprintf (f_out, "FILE=%s\nSTATISTIC:\n| n | N |\n-----------------", input); + for (i=0; i 0) + { +// creating connectivity graph + matrix = (int **) malloc (num_mol_agl[i] * sizeof (int *)); + for (j=0; j #include -int proc_matrix (int num_mol, const int *connect, int max_size, int *num_mol_agl, int *agl, int *stat) +int proc_matrix (int num_mol, const int *connect, int *num_mol_agl, int *agl, + int *stat, int *stat_all) +/* num_mol - number of molecules + * connect - connectivity graph for all molecules + * num_mol_agl - massive of numbers of molecule in aglomerates + * agl - massive of aglomerates + * stat - massive of statistics + * stat_all - massive of summary statistics + */ { int i, j, k, p, *bin; + /* p - weight / graph index + * bin - binary massive of labels + */ // definition and zeroing bin = (int *) malloc (num_mol * sizeof (int)); for (i=0; i