mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-07-16 15:20:00 +00:00
+ added CMakeLists.txt
+ added headers + added library 'add_main.c' + some optimization
This commit is contained in:
@ -1,18 +1,18 @@
|
||||
/* Library for summary statistic
|
||||
* Usage:
|
||||
* summary_statistic (filename, number_of_step, number_of_molecules,
|
||||
* type_of_aglomerate, summary_statistic)
|
||||
* max_depth, type_of_aglomerate, summary_statistic)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int summary_statistic (const char *filename, const int step, const int num_mol,
|
||||
const int *type_agl, const int *stat_all)
|
||||
const int max_depth, const int *type_agl, const int *stat_all)
|
||||
/* filename - name of output file
|
||||
* step - number of steps
|
||||
* num_mol - number of molecules
|
||||
* max_depth - max depth for check cycles in graph analyze
|
||||
* type_agl - massive of numbers of aglomerate types
|
||||
* stat_all - massive of summary statistics
|
||||
*/
|
||||
@ -52,12 +52,29 @@ int summary_statistic (const char *filename, const int step, const int num_mol,
|
||||
fprintf (f_out, " %7i %7i %9.2f %9.5f %10.5f\n", i+1, stat_all[i], conc, p, pn);
|
||||
}
|
||||
|
||||
if (max_depth > 0)
|
||||
{
|
||||
// types of aglomerates
|
||||
x = type_agl[0] + type_agl[1];
|
||||
type[0] = type_agl[0];
|
||||
type[1] = type_agl[1];
|
||||
fprintf (f_out, "------------------------------------------------\n");
|
||||
fprintf (f_out, "LINEAR=%.5f\nCYCLE=%.5f\n", type[0]/x, type[1]/x);
|
||||
fprintf (f_out, "------------------------------------------------\n");
|
||||
// linear and cycle
|
||||
x = type_agl[0] + type_agl[1];
|
||||
type[0] = type_agl[0];
|
||||
type[1] = type_agl[1];
|
||||
fprintf (f_out, "LINEAR=%7.5f\nCYCLE=%7.5f\n--------------------\n", type[0]/x, type[1]/x);
|
||||
// branched
|
||||
type[0] = type_agl[2];
|
||||
type[1] = type_agl[3];
|
||||
fprintf (f_out, "NOT BRANCHED=%7.5f\nBRANCHED=%7.5f\n--------------------\n", type[0]/x, type[1]/x);
|
||||
// n_cycle
|
||||
x = 0;
|
||||
for (i=4; i<max_depth+2; i++)
|
||||
x += type_agl[i];
|
||||
for (i=4; i<max_depth+2; i++)
|
||||
{
|
||||
type[0] = type_agl[i];
|
||||
fprintf (f_out, "CYCLE_'%2i'=%7.5f\n", i-1, type[0]/x);
|
||||
}
|
||||
}
|
||||
|
||||
fclose (f_out);
|
||||
|
||||
|
Reference in New Issue
Block a user