fixed statgen

This commit is contained in:
arcan1s
2014-01-28 05:34:53 +04:00
parent 30630ca541
commit 26fc6b9e7e
7 changed files with 184 additions and 186 deletions

View File

@ -18,9 +18,8 @@ int printing_agl (const char *input, const char *output, const int *connect,
/** /**
* @brief function that prints agglomerates to output file * @brief function that prints agglomerates to output file
* @code * @code
* printing_agl (input_file, output_file, number_of_molecules, true_label_molecules, * printing_agl (input, output, connect, _system_info, true_label_mol, num_mol_agl,
* num_of_molecules_in_agglomerates, agglomerates, statistic, max_depth, * agl, stat, max_depth, type_agl);
* type_of_agglomerate);
* @endcode * @endcode
* *
* @param input input file name * @param input input file name

View File

@ -16,7 +16,7 @@ int create_matrix (const system_info _system_info, const atom_info *_atom_info,
/** /**
* @brief function that creates connectivity matrix * @brief function that creates connectivity matrix
* @code * @code
* int create_matrix (_system_info, _atom_info, num_of_inter, crit, connect); * create_matrix (_system_info, _atom_info, num_of_inter, crit, connect);
* @endcode * @endcode
* *
* @param _system_info system information structure * @param _system_info system information structure

View File

@ -5,11 +5,29 @@
#ifndef SUMMARY_STAT_H #ifndef SUMMARY_STAT_H
#define SUMMARY_STAT_H #define SUMMARY_STAT_H
#include <mathmech/var_types.h>
/** /**
* @fn summary_statistic * @fn summary_statistic
*/ */
int summary_statistic (const char *filename, const system_info _system_info,
const int max_depth, const int *type_agl, const int *stat_all);
/**
* @brief function that prints summary statistic
* @code
* summary_statistic (filename, _system_info, max_depth, type_agl, stat_all);
* @endcode
*
* @param filename output file name
* @param _system_info system information structure
* @param num_mol number of molecules
* @param max_depth maximum depth for check cycles in graph analyze
* @param type_agl massive of number of agglomerate types
* @param stat_all massive of summary statistic
*
* @return 0 - exit without errors
*/
int summary_statistic (const char *, const int, const int, const int, const int *,
const int *);
#endif /* SUMMARY_STAT_H */ #endif /* SUMMARY_STAT_H */

View File

@ -4,28 +4,15 @@
#include <stdio.h> #include <stdio.h>
#include <mathmech/summary_stat.h>
#include <mathmech/var_types.h>
/** /**
* @fn summary_statistic * @fn summary_statistic
*/ */
int summary_statistic (const char *filename, const int step, const int num_mol, int summary_statistic (const char *filename, const system_info _system_info,
const int max_depth, const int *type_agl, const int *stat_all) const int max_depth, const int *type_agl, const int *stat_all)
/**
* @brief function that prints summary statistic
* @code
* summary_statistic (filename, number_of_step, number_of_molecules, max_depth,
* type_of_agglomerate, summary_statistic);
* @endcode
*
* @param filename output file name
* @param step number of steps
* @param num_mol number of molecules
* @param max_depth maximum depth for check cycles in graph analyze
* @param type_agl massive of number of agglomerate types
* @param stat_all massive of summary statistic
*
* @return 0 - exit without errors
*/
{ {
float conc, p, pn, type[2], x, y; float conc, p, pn, type[2], x, y;
int i, index; int i, index;
@ -38,7 +25,7 @@ int summary_statistic (const char *filename, const int step, const int num_mol,
*/ */
index = 0; index = 0;
for (i=0; i<num_mol; i++) for (i=0; i<_system_info.num_mol; i++)
if (stat_all[i] != 0) if (stat_all[i] != 0)
index = i; index = i;
@ -51,12 +38,12 @@ int summary_statistic (const char *filename, const int step, const int num_mol,
{ {
// calculating concentrates // calculating concentrates
x = stat_all[i]; x = stat_all[i];
y = step; y = _system_info.to - _system_info.from + 1;
conc = x / y; conc = x / y;
// calculating probabilityes // calculating probabilityes
x = (i + 1) * stat_all[i]; x = (i + 1) * stat_all[i];
y = step * num_mol; y = (_system_info.to - _system_info.from + 1) * _system_info.num_mol;
p = x / y; p = x / y;
pn = (i + 1) * p; pn = (i + 1) * p;
@ -90,4 +77,4 @@ int summary_statistic (const char *filename, const int step, const int num_mol,
fclose (f_out); fclose (f_out);
return 0; return 0;
} }

View File

@ -4,47 +4,23 @@
#include <stdio.h> #include <stdio.h>
#include "add_main.h"
#include <version.h> #include <version.h>
#include <mathmech/messages.h> #include <mathmech/messages.h>
#include <mathmech/var_types.h>
/** /**
* @fn error_checking * @fn error_checking
*/ */
int error_checking (const float *cell, const int from, const char *input, int error_checking (const system_info _system_info, const char *input, const int max_depth,
const int max_depth, const int num_of_inter, const char *output, const int num_of_inter, const char *output, const int type_inter)
const int to, const int type_inter)
/**
* @brief function that checks errors in input variables
* @code
* error_checking (cell, from, input, max_depth, num_of_inter, output, to,
* type_inter);
* @endcode
*
* @param cell massive of cell size
* @param from first trajectory step
* @param input mask of trajectory files
* @param max_depth max depth for check cycles in graph analyze
* @param num_of_inter number of different interactions
* @param output output file name
* @param to last trajectory step
* @param type_inter number of atoms for interactions
*
* @return 11 - error in 'type_inter'
* @return 12 - error in 'cell'
* @return 13 - error in 'to' or 'from'
* @return 14 - error in 'num_of_inter'
* @return 15 - error in 'input'
* @return 16 - error in 'output'
* @return 19 - error in 'max_depth'
* @return 0 - exit without errors
*/
{ {
if ((type_inter == 0) || (type_inter > 4)) if ((type_inter == 0) || (type_inter > 4))
return 11; return 11;
if ((cell[0] == 0.0) || (cell[1] == 0.0) || (cell[2] == 0.0)) if ((_system_info.cell[0] == 0.0) || (_system_info.cell[1] == 0.0) || (_system_info.cell[2] == 0.0))
return 12; return 12;
if ((to == -1) || (from == -1)) if ((_system_info.to == -1) || (_system_info.from == -1))
return 13; return 13;
if (num_of_inter == 0) if (num_of_inter == 0)
return 14; return 14;
@ -63,31 +39,9 @@ int error_checking (const float *cell, const int from, const char *input,
* @fn printing_head * @fn printing_head
*/ */
int printing_head (const char *output, const int log, const int quiet, int printing_head (const char *output, const int log, const int quiet,
const char *input, const int from, const int to, const float *cell, const char *input, const system_info _system_info,
const int type_inter, const int *label_atom, const int type_inter, const int *label_atom,
const int num_of_inter, const float *crit, const int max_depth) const int num_of_inter, const float *crit, const int max_depth)
/**
* @brief function that prints header in output file
* @code
* printing_head (output, log, quiet, input, from, to, cell, type_inter, label_atom,
* num_of_inter, crit, max_depth);
* @endcode
*
* @param output output file nams
* @param log status of log-mode
* @param quiet status of quiet-mode
* @param input mask of trajectory files
* @param from first trajectory step
* @param to last trajectory step
* @param cell massive of cell size
* @param type_inter number of atoms for interactions
* @param label_atom massive of atom types for interactions
* @param num_of_inter number of different interactions
* @param crit massive of criteria
* @param max_depth maximum depth for check cycles in graph analyze
*
* @return 0 - exit without errors
*/
{ {
int i, j; int i, j;
FILE *f_out; FILE *f_out;
@ -97,8 +51,9 @@ int printing_head (const char *output, const int log, const int quiet,
fprintf (f_out, "CONFIGURATION\n"); fprintf (f_out, "CONFIGURATION\n");
fprintf (f_out, "LOG=%i\nQUIET=%i\n", log, quiet); fprintf (f_out, "LOG=%i\nQUIET=%i\n", log, quiet);
fprintf (f_out, "MASK=%s\nFIRST=%i\nLAST=%i\n", input, from, to); fprintf (f_out, "MASK=%s\nFIRST=%i\nLAST=%i\n", input, _system_info.from, _system_info.to);
fprintf (f_out, "CELL=%.4f,%.4f,%.4f\n", cell[0], cell[1], cell[2]); fprintf (f_out, "CELL=%.4f,%.4f,%.4f\n", _system_info.cell[0], _system_info.cell[1],
_system_info.cell[2]);
fprintf (f_out, "ATOMS=%i", label_atom[0]); fprintf (f_out, "ATOMS=%i", label_atom[0]);
for (i=1; i<type_inter; i++) for (i=1; i<type_inter; i++)
fprintf (f_out, ",%i", label_atom[i]); fprintf (f_out, ",%i", label_atom[i]);
@ -126,21 +81,6 @@ int printing_head (const char *output, const int log, const int quiet,
*/ */
int print_message (const int quiet, FILE *std_output, const int log, FILE *f_log, int print_message (const int quiet, FILE *std_output, const int log, FILE *f_log,
const int mode, const char *str) const int mode, const char *str)
/**
* @brief function that prints message in log and stdout
* @code
* print_message (quiet, stdout, log, f_log, 0, str);
* @endcode
*
* @param quiet status of quiet-mode
* @param std_output stdout
* @param log status of log-mode
* @param f_log log file
* @param mode number of message in "messages.c"
* @param str additional text in message
*
* @return 0 - exit without errors
*/
{ {
if ((quiet != 1) && (std_output != stderr)) if ((quiet != 1) && (std_output != stderr))
message (0, mode, str, std_output); message (0, mode, str, std_output);
@ -154,40 +94,20 @@ int print_message (const int quiet, FILE *std_output, const int log, FILE *f_log
/** /**
* @fn set_defaults * @fn set_defaults
*/ */
int set_defaults (float *cell, int *from, char *input, int *log, int *max_depth, int set_defaults (system_info *_system_info, char *input, int *log, int *max_depth,
int *num_of_inter, char *output, int *to, int *type_inter, int *quiet) int *num_of_inter, char *output, int *type_inter, int *quiet)
/**
* @brief function that sets default values of variables
* @code
* set_defaults (cell, &from, input, &log, &max_depth, &num_of_inter, output, &to,
* &type_inter, &quiet);
* @endcode
*
* @param cell massive of cell size
* @param from first trajectory step
* @param input mask of trajectory files
* @param log status of log-mode
* @param max_depth maximum depth for check cycles in graph analyze
* @param num_of_inter number of different interactions
* @param output output file name
* @param to last trajectory step
* @param type_inter number of atoms for interactions
* @param quiet status of quiet-mode
*
* @return 0 - exit without errors
*/
{ {
int i; int i;
for (i=0; i<3; i++) for (i=0; i<3; i++)
cell[i] = 0.0; (*_system_info).cell[i] = 0.0;
*from = -1; (*_system_info).from = -1;
input[0] = '#'; input[0] = '#';
*log = 0; *log = 0;
*max_depth = 0; *max_depth = 0;
*num_of_inter = 0; *num_of_inter = 0;
output[0] = '#'; output[0] = '#';
*to = -1; (*_system_info).to = -1;
*type_inter = 0; *type_inter = 0;
*quiet = 0; *quiet = 0;

View File

@ -5,26 +5,112 @@
#ifndef ADD_MAIN_H #ifndef ADD_MAIN_H
#define ADD_MAIN_H #define ADD_MAIN_H
#include <mathmech/var_types.h>
/** /**
* @fn error_checking * @fn error_checking
*/ */
int error_checking (const system_info _system_info, const char *input, const int max_depth,
const int num_of_inter, const char *output, const int type_inter);
/**
* @brief function that checks errors in input variables
* @code
* error_checking (_system_info, input, max_depth, num_of_inter, output, type_inter);
* @endcode
*
* @param _system_info system information structure
* @param input mask of trajectory files
* @param max_depth max depth for check cycles in graph analyze
* @param num_of_inter number of different interactions
* @param output output file name
* @param type_inter number of atoms for interactions
*
* @return 11 - error in 'type_inter'
* @return 12 - error in 'cell'
* @return 13 - error in 'to' or 'from'
* @return 14 - error in 'num_of_inter'
* @return 15 - error in 'input'
* @return 16 - error in 'output'
* @return 19 - error in 'max_depth'
* @return 0 - exit without errors
*/
/** /**
* @fn printing_head * @fn printing_head
*/ */
int printing_head (const char *output, const int log, const int quiet,
const char *input, const system_info _system_info,
const int type_inter, const int *label_atom,
const int num_of_inter, const float *crit, const int max_depth);
/**
* @brief function that prints header in output file
* @code
* printing_head (output, log, quiet, input, _system_info, type_inter, label_atom,
* num_of_inter, crit, max_depth);
* @endcode
*
* @param output output file nams
* @param log status of log-mode
* @param quiet status of quiet-mode
* @param input mask of trajectory files
* @param _system_info system information structure
* @param type_inter number of atoms for interactions
* @param label_atom massive of atom types for interactions
* @param num_of_inter number of different interactions
* @param crit massive of criteria
* @param max_depth maximum depth for check cycles in graph analyze
*
* @return 0 - exit without errors
*/
/** /**
* @fn print_message * @fn print_message
*/ */
int print_message (const int quiet, FILE *std_output, const int log, FILE *f_log,
const int mode, const char *str);
/**
* @brief function that prints message in log and stdout
* @code
* print_message (quiet, stdout, log, f_log, 0, str);
* @endcode
*
* @param quiet status of quiet-mode
* @param std_output stdout
* @param log status of log-mode
* @param f_log log file
* @param mode number of message in "messages.c"
* @param str additional text in message
*
* @return 0 - exit without errors
*/
/** /**
* @fn set_defaults * @fn set_defaults
*/ */
int set_defaults (system_info *_system_info, char *input, int *log, int *max_depth,
int *num_of_inter, char *output, int *type_inter, int *quiet);
/**
* @brief function that sets default values of variables
* @code
* set_defaults (&_system_info, input, &log, &max_depth, &num_of_inter, output,
* &type_inter, &quiet);
* @endcode
*
* @param _system_info system information structure
* @param input mask of trajectory files
* @param log status of log-mode
* @param max_depth maximum depth for check cycles in graph analyze
* @param num_of_inter number of different interactions
* @param output output file name
* @param type_inter number of atoms for interactions
* @param quiet status of quiet-mode
*
* @return 0 - exit without errors
*/
int error_checking (const float *, const int, const char *, const int, const int,
const char *, const int, const int);
int printing_head (const char *, const int, const int, const char *, const int,
const int, const float *, const int, const int *, const int,
const float *, const int);
int print_message (const int, FILE *, const int, FILE *, const int, const char *);
int set_defaults (float *, int *, char *, int *, int *, int *, char *, int *,
int *, int *);
#endif /* ADD_MAIN_H */ #endif /* ADD_MAIN_H */

View File

@ -16,6 +16,7 @@
#include <mathmech/stat_select.h> #include <mathmech/stat_select.h>
#include <mathmech/stat_sort.h> #include <mathmech/stat_sort.h>
#include <mathmech/summary_stat.h> #include <mathmech/summary_stat.h>
#include <mathmech/var_types.h>
/** /**
@ -36,42 +37,37 @@ int main (int argc, char *argv[])
FILE *f_inp, *f_log; FILE *f_inp, *f_log;
char input[256], logfile[256], output[256]; char input[256], logfile[256], output[256];
float cell[3], *coords, *crit; float *crit;
int *agl, *connect, from, *label_atom, *label_mol, log, max_depth, num_atoms, int *agl, *connect, *label_atom, log, max_depth, *num_mol_agl, num_of_inter, *stat,
num_mol, *num_mol_agl, num_of_inter, *stat, *stat_all, step, to, *stat_all, *true_label_mol, *type_agl, type_inter, quiet;
*true_label_mol, *type_agl, *type_atoms, type_inter, quiet; atom_info *_atom_info;
system_info _system_info;
/* input mask of trajectory files /* input mask of trajectory files
* logfile log file name * logfile log file name
* output output file name * output output file name
* *
* cell massive of cell size
* coords massive of coordinates
* crit massive of criteria * crit massive of criteria
* *
* agl massive of agglomerates * agl massive of agglomerates
* connect connectivity graph for all molecules * connect connectivity graph for all molecules
* from first trajectory step
* label_atom massive of atom types for interactions * label_atom massive of atom types for interactions
* label_mol massive of numbers of molecule for atoms
* log status of log-mode * log status of log-mode
* max_depth maximum depth for check cycles in graph analyze * max_depth maximum depth for check cycles in graph analyze
* num_atoms number of atoms
* num_mol number of molecules
* num_mol_agl massive of number of molecules in agglomerates * num_mol_agl massive of number of molecules in agglomerates
* num_of_inter number of different interactions * num_of_inter number of different interactions
* stat massive of statistic * stat massive of statistic
* stat_all massive of summary statistic * stat_all massive of summary statistic
* step $(to - from + 1)
* to last trajectory step
* true_label_mol massive of true numbers of molecule for atoms * true_label_mol massive of true numbers of molecule for atoms
* type_agl massive of number of agglomerate types * type_agl massive of number of agglomerate types
* type_atoms massive of atom types
* type_inter number of atoms for interactions * type_inter number of atoms for interactions
* quiet status of quiet-mode * quiet status of quiet-mode
*
* _atom_info atom information structure
* _system_info system information structure
*/ */
set_defaults (cell, &from, input, &log, &max_depth, &num_of_inter, output, &to, set_defaults (&_system_info, input, &log, &max_depth, &num_of_inter, output,
&type_inter, &quiet); &type_inter, &quiet);
// reading number of interactions // reading number of interactions
@ -125,20 +121,19 @@ int main (int argc, char *argv[])
else if ((argv[i][0] == '-') && (argv[i][1] == 's') && (argv[i][2] == '\0')) else if ((argv[i][0] == '-') && (argv[i][1] == 's') && (argv[i][2] == '\0'))
// steps // steps
{ {
sscanf (argv[i+1], "%i,%i", &from, &to); sscanf (argv[i+1], "%i,%i", &_system_info.from, &_system_info.to);
if (from > to) if (_system_info.from > _system_info.to)
{ {
to += from; _system_info.to += _system_info.from;
from = to - from; _system_info.from = _system_info.to - _system_info.from;
to -= from; _system_info.to -= _system_info.from;
} }
step = to - from + 1;
i++; i++;
} }
else if ((argv[i][0] == '-') && (argv[i][1] == 'c') && (argv[i][2] == '\0')) else if ((argv[i][0] == '-') && (argv[i][1] == 'c') && (argv[i][2] == '\0'))
// cell size // cell size
{ {
sscanf (argv[i+1], "%f,%f,%f", &cell[0], &cell[1], &cell[2]); sscanf (argv[i+1], "%f,%f,%f", &_system_info.cell[0], &_system_info.cell[1], &_system_info.cell[2]);
i++; i++;
} }
else if ((argv[i][0] == '-') && (argv[i][1] == 'a') && (argv[i][2] == '\0')) else if ((argv[i][0] == '-') && (argv[i][1] == 'a') && (argv[i][2] == '\0'))
@ -227,7 +222,7 @@ int main (int argc, char *argv[])
print_message (quiet, stdout, log, f_log, 1, argv[0]); print_message (quiet, stdout, log, f_log, 1, argv[0]);
// error checking // error checking
error = error_checking (cell, from, input, max_depth, num_of_inter, output, to, error = error_checking (_system_info, input, max_depth, num_of_inter, output,
type_inter); type_inter);
if (error != 0) if (error != 0)
{ {
@ -239,7 +234,7 @@ int main (int argc, char *argv[])
// processing // processing
// initial variables // initial variables
sprintf (filename, "%s.%03i", input, from); sprintf (filename, "%s.%03i", input, _system_info.from);
print_message (quiet, stdout, log, f_log, 3, filename); print_message (quiet, stdout, log, f_log, 3, filename);
f_inp = fopen (filename, "r"); f_inp = fopen (filename, "r");
if (f_inp == NULL) if (f_inp == NULL)
@ -247,13 +242,11 @@ int main (int argc, char *argv[])
print_message (quiet, stderr, log, f_log, 18, filename); print_message (quiet, stderr, log, f_log, 18, filename);
return 2; return 2;
} }
fscanf (f_inp, "%i", &num_atoms); fscanf (f_inp, "%i", &_system_info.num_atoms);
fclose (f_inp); fclose (f_inp);
coords = (float *) malloc (3 * 8 * num_atoms * sizeof (float)); _atom_info = (atom_info *) malloc (8 * _system_info.num_atoms * sizeof (atom_info));
label_mol = (int *) malloc (8 * num_atoms * sizeof (int)); true_label_mol = (int *) malloc (_system_info.num_atoms * sizeof (int));
true_label_mol = (int *) malloc (num_atoms * sizeof (int));
type_agl = (int *) malloc ((max_depth + 2) * sizeof (int)); type_agl = (int *) malloc ((max_depth + 2) * sizeof (int));
type_atoms = (int *) malloc (8 * num_atoms * sizeof (int));
// temporary declaration of variables // temporary declaration of variables
agl = (int *) malloc (2 * 2 * sizeof (int)); agl = (int *) malloc (2 * 2 * sizeof (int));
connect = (int *) malloc (2 * 2 * sizeof (int)); connect = (int *) malloc (2 * 2 * sizeof (int));
@ -261,11 +254,9 @@ int main (int argc, char *argv[])
stat = (int *) malloc (2 * sizeof (int)); stat = (int *) malloc (2 * sizeof (int));
stat_all = (int *) malloc (2 * sizeof (int)); stat_all = (int *) malloc (2 * sizeof (int));
// error checking // error checking
if ((coords == NULL) || if ((_atom_info == NULL) ||
(label_mol == NULL) ||
(true_label_mol == NULL) || (true_label_mol == NULL) ||
(type_agl == NULL) || (type_agl == NULL) ||
(type_atoms == NULL) ||
(agl == NULL) || (agl == NULL) ||
(connect == NULL) || (connect == NULL) ||
(num_mol_agl == NULL) || (num_mol_agl == NULL) ||
@ -280,8 +271,9 @@ int main (int argc, char *argv[])
type_agl[i] = 0; type_agl[i] = 0;
sprintf (tmp_str, "%6cOutput file: '%s';\n%6cLog: %i;\n%6cQuiet: %i;\n\ sprintf (tmp_str, "%6cOutput file: '%s';\n%6cLog: %i;\n%6cQuiet: %i;\n\
%6cMask: %s;\n%6cFirst step: %i;\n%6cLast step: %i;\n%6cCell size: %.4f, %.4f, %.4f;\n\ %6cMask: %s;\n%6cFirst step: %i;\n%6cLast step: %i;\n%6cCell size: %.4f, %.4f, %.4f;\n\
%6cSelect atoms: %i", ' ', output, ' ', log, ' ', quiet, ' ', input, ' ', from, %6cSelect atoms: %i", ' ', output, ' ', log, ' ', quiet, ' ', input, ' ', _system_info.from,
' ' , to, ' ', cell[0], cell[1], cell[2], ' ' , label_atom[0]); ' ' , _system_info.to, ' ', _system_info.cell[0], _system_info.cell[1], _system_info.cell[2],
' ' , label_atom[0]);
for (i=1; i<type_inter; i++) for (i=1; i<type_inter; i++)
sprintf (tmp_str, "%s,%i", tmp_str, label_atom[i]); sprintf (tmp_str, "%s,%i", tmp_str, label_atom[i]);
sprintf (tmp_str, "%s;\n", tmp_str); sprintf (tmp_str, "%s;\n", tmp_str);
@ -298,35 +290,34 @@ int main (int argc, char *argv[])
print_message (quiet, stdout, log, f_log, 5, tmp_str); print_message (quiet, stdout, log, f_log, 5, tmp_str);
// head // head
printing_head (output, log, quiet, input, from, to, cell, type_inter, label_atom, printing_head (output, log, quiet, input, _system_info, type_inter, label_atom,
num_of_inter, crit, max_depth); num_of_inter, crit, max_depth);
// main cycle // main cycle
print_message (quiet, stdout, log, f_log, 6, argv[0]); print_message (quiet, stdout, log, f_log, 6, argv[0]);
for (i=from; i<to+1; i++) for (i=_system_info.from; i<_system_info.to+1; i++)
{ {
// reading coordinates // reading coordinates
sprintf (filename, "%s.%03i", input, i); sprintf (filename, "%s.%03i", input, i);
print_message (quiet, stdout, log, f_log, 7, filename); print_message (quiet, stdout, log, f_log, 7, filename);
error = reading_coords (0, filename, type_inter, label_atom, cell, &num_mol, error = reading_coords (0, filename, type_inter, label_atom, &_system_info,
&num_atoms, true_label_mol, label_mol, type_atoms, true_label_mol, _atom_info);
coords, tmp_str);
if (error == 0) if (error == 0)
{ {
sprintf (tmp_str, "%6cNumber of molecules: %i; %6cNumber of atoms: %i\n", sprintf (tmp_str, "%6cNumber of molecules: %i; %6cNumber of atoms: %i\n",
' ', num_mol, ' ', num_atoms); ' ', _system_info.num_mol, ' ', _system_info.num_atoms);
print_message (quiet, stdout, log, f_log, 8, tmp_str); print_message (quiet, stdout, log, f_log, 8, tmp_str);
} }
// resize dynamic arrays // resize dynamic arrays
agl = (int *) realloc (agl, num_mol * num_mol * sizeof (int)); agl = (int *) realloc (agl, _system_info.num_mol * _system_info.num_mol * sizeof (int));
connect = (int *) realloc (connect, num_mol * num_mol * sizeof (int)); connect = (int *) realloc (connect, _system_info.num_mol * _system_info.num_mol * sizeof (int));
num_mol_agl = (int *) realloc (num_mol_agl, num_mol * sizeof (int)); num_mol_agl = (int *) realloc (num_mol_agl, _system_info.num_mol * sizeof (int));
stat = (int *) realloc (stat, num_mol * sizeof (int)); stat = (int *) realloc (stat, _system_info.num_mol * sizeof (int));
if (i == from) if (i == _system_info.from)
{ {
stat_all = (int *) realloc (stat_all, num_mol * sizeof (int)); stat_all = (int *) realloc (stat_all, _system_info.num_mol * sizeof (int));
for (j=0; j<num_mol; j++) for (j=0; j<_system_info.num_mol; j++)
stat_all[j] = 0; stat_all[j] = 0;
} }
// error checking // error checking
@ -345,19 +336,18 @@ int main (int argc, char *argv[])
if (error == 0) if (error == 0)
{ {
error = 1; error = 1;
error = create_matrix (num_mol, num_atoms, label_mol, type_atoms, coords, error = create_matrix (_system_info, _atom_info, num_of_inter, crit, connect);
num_of_inter, crit, connect);
} }
if (error == 0) if (error == 0)
{ {
print_message (quiet, stdout, log, f_log, 10, argv[0]); print_message (quiet, stdout, log, f_log, 10, argv[0]);
error = 1; error = 1;
error = proc_matrix (num_mol, connect, num_mol_agl, agl, stat, stat_all); error = proc_matrix (_system_info, connect, num_mol_agl, agl, stat, stat_all);
} }
if (error == 0) if (error == 0)
{ {
print_message (quiet, stdout, log, f_log, 11, argv[0]); print_message (quiet, stdout, log, f_log, 11, argv[0]);
error = printing_agl (filename, output, connect, num_mol, true_label_mol, error = printing_agl (filename, output, connect, _system_info, true_label_mol,
num_mol_agl, agl, stat, max_depth, type_agl); num_mol_agl, agl, stat, max_depth, type_agl);
} }
if (error == 0) if (error == 0)
@ -367,21 +357,19 @@ int main (int argc, char *argv[])
print_message (quiet, stdout, log, f_log, 13, argv[0]); print_message (quiet, stdout, log, f_log, 13, argv[0]);
print_message (quiet, stdout, log, f_log, 14, output); print_message (quiet, stdout, log, f_log, 14, output);
// tail // tail
summary_statistic (output, step, num_mol, max_depth, type_agl, stat_all); summary_statistic (output, _system_info, max_depth, type_agl, stat_all);
print_message (quiet, stdout, log, f_log, 15, argv[0]); print_message (quiet, stdout, log, f_log, 15, argv[0]);
// free memory // free memory
free (_atom_info);
free (agl); free (agl);
free (connect); free (connect);
free (coords);
free (crit); free (crit);
free (label_mol);
free (num_mol_agl); free (num_mol_agl);
free (stat); free (stat);
free (stat_all); free (stat_all);
free (true_label_mol); free (true_label_mol);
free (type_agl); free (type_agl);
free (type_atoms);
print_message (quiet, stdout, log, f_log, 16, argv[0]); print_message (quiet, stdout, log, f_log, 16, argv[0]);