mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-07-22 18:19:58 +00:00
fixed statgen
This commit is contained in:
@ -18,9 +18,8 @@ int printing_agl (const char *input, const char *output, const int *connect,
|
||||
/**
|
||||
* @brief function that prints agglomerates to output file
|
||||
* @code
|
||||
* printing_agl (input_file, output_file, number_of_molecules, true_label_molecules,
|
||||
* num_of_molecules_in_agglomerates, agglomerates, statistic, max_depth,
|
||||
* type_of_agglomerate);
|
||||
* printing_agl (input, output, connect, _system_info, true_label_mol, num_mol_agl,
|
||||
* agl, stat, max_depth, type_agl);
|
||||
* @endcode
|
||||
*
|
||||
* @param input input file name
|
||||
|
@ -16,7 +16,7 @@ int create_matrix (const system_info _system_info, const atom_info *_atom_info,
|
||||
/**
|
||||
* @brief function that creates connectivity matrix
|
||||
* @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
|
||||
*
|
||||
* @param _system_info system information structure
|
||||
|
@ -5,11 +5,29 @@
|
||||
#ifndef SUMMARY_STAT_H
|
||||
#define SUMMARY_STAT_H
|
||||
|
||||
#include <mathmech/var_types.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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 */
|
||||
|
@ -4,28 +4,15 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mathmech/summary_stat.h>
|
||||
#include <mathmech/var_types.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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)
|
||||
/**
|
||||
* @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;
|
||||
int i, index;
|
||||
@ -38,7 +25,7 @@ int summary_statistic (const char *filename, const int step, const int num_mol,
|
||||
*/
|
||||
|
||||
index = 0;
|
||||
for (i=0; i<num_mol; i++)
|
||||
for (i=0; i<_system_info.num_mol; i++)
|
||||
if (stat_all[i] != 0)
|
||||
index = i;
|
||||
|
||||
@ -51,12 +38,12 @@ int summary_statistic (const char *filename, const int step, const int num_mol,
|
||||
{
|
||||
// calculating concentrates
|
||||
x = stat_all[i];
|
||||
y = step;
|
||||
y = _system_info.to - _system_info.from + 1;
|
||||
conc = x / y;
|
||||
|
||||
// calculating probabilityes
|
||||
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;
|
||||
pn = (i + 1) * p;
|
||||
|
||||
@ -90,4 +77,4 @@ int summary_statistic (const char *filename, const int step, const int num_mol,
|
||||
fclose (f_out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user