From d88f3b317fc490bd12af8b147574e37cd4c8218f Mon Sep 17 00:00:00 2001 From: arcan1s Date: Tue, 28 Jan 2014 03:11:30 +0400 Subject: [PATCH] added structure to all functions of library --- mathmech/agl/src/CMakeLists.txt | 9 +- mathmech/envir/src/CMakeLists.txt | 9 +- mathmech/mm/include/mathmech/atom_types.h | 26 +- mathmech/mm/include/mathmech/coords.h | 34 ++- mathmech/mm/include/mathmech/envir_search.h | 24 +- mathmech/mm/include/mathmech/graph.h | 73 +++++- mathmech/mm/include/mathmech/messages.h | 19 +- mathmech/mm/include/mathmech/print_struct.h | 27 +- mathmech/mm/include/mathmech/print_trj.h | 26 +- mathmech/mm/include/mathmech/radf.h | 63 ++++- mathmech/mm/include/mathmech/radf_proc.h | 26 +- mathmech/mm/include/mathmech/read_agl.h | 18 +- mathmech/mm/include/mathmech/read_gmx.h | 44 +++- mathmech/mm/include/mathmech/read_puma.h | 28 +- mathmech/mm/include/mathmech/select_mol.h | 17 +- mathmech/mm/include/mathmech/set_center.h | 20 +- mathmech/mm/include/mathmech/stat_print.h | 33 ++- mathmech/mm/include/mathmech/stat_select.h | 24 +- mathmech/mm/include/mathmech/stat_sort.h | 25 +- mathmech/mm/include/mathmech/var_types.h | 72 ++++++ mathmech/mm/src/CMakeLists.txt | 2 +- mathmech/mm/src/atom_types.c | 24 +- mathmech/mm/src/coords.c | 273 ++++++++++---------- mathmech/mm/src/envir_search.c | 25 +- mathmech/mm/src/graph.c | 54 +--- mathmech/mm/src/main.c | 1 + mathmech/mm/src/messages.c | 18 +- mathmech/mm/src/print_struct.c | 46 +--- mathmech/mm/src/print_trj.c | 22 +- mathmech/mm/src/radf.c | 235 +++++++---------- mathmech/mm/src/radf_proc.c | 70 ++--- mathmech/mm/src/read_agl.c | 21 +- mathmech/mm/src/read_gmx.c | 33 +-- mathmech/mm/src/read_puma.c | 21 +- mathmech/mm/src/select_mol.c | 14 +- mathmech/mm/src/set_center.c | 39 +-- mathmech/mm/src/stat_print.c | 47 +--- mathmech/mm/src/stat_select.c | 79 +++--- mathmech/mm/src/stat_sort.c | 50 ++-- mathmech/radf/src/CMakeLists.txt | 9 +- mathmech/statgen/src/CMakeLists.txt | 9 +- mathmech/trj/src/CMakeLists.txt | 9 +- mathmech/trj2pdb/src/CMakeLists.txt | 9 +- mathmech/trj2pdb/src/main.c | 37 +-- 44 files changed, 945 insertions(+), 819 deletions(-) create mode 100644 mathmech/mm/include/mathmech/var_types.h diff --git a/mathmech/agl/src/CMakeLists.txt b/mathmech/agl/src/CMakeLists.txt index 48b4ff3..6f66d32 100644 --- a/mathmech/agl/src/CMakeLists.txt +++ b/mathmech/agl/src/CMakeLists.txt @@ -14,9 +14,10 @@ message (STATUS "${SUBPROJECT} SOURCES: ${SOURCES}") message (STATUS "${SUBPROJECT} HEADERS: ${HEADERS}") # link libraries and compile -add_executable (${MM_PREFIX}${SUBPROJECT} ${SOURCES} ${HEADERS}) -add_dependencies (${MM_PREFIX}${SUBPROJECT} ${LIBRARIES}) -target_link_libraries (${MM_PREFIX}${SUBPROJECT} ${ADDITIONAL_LIB} ${LIBRARIES}) +add_executable (${SUBPROJECT} ${SOURCES} ${HEADERS}) +set_target_properties (${SUBPROJECT} PROPERTIES OUTPUT_NAME ${MM_PREFIX}${SUBPROJECT}) +add_dependencies (${SUBPROJECT} ${LIBRARIES}) +target_link_libraries (${SUBPROJECT} ${ADDITIONAL_LIB} ${LIBRARIES}) # install properties -install (TARGETS ${MM_PREFIX}${SUBPROJECT} DESTINATION bin) +install (TARGETS ${SUBPROJECT} DESTINATION bin) diff --git a/mathmech/envir/src/CMakeLists.txt b/mathmech/envir/src/CMakeLists.txt index 48b4ff3..6f66d32 100644 --- a/mathmech/envir/src/CMakeLists.txt +++ b/mathmech/envir/src/CMakeLists.txt @@ -14,9 +14,10 @@ message (STATUS "${SUBPROJECT} SOURCES: ${SOURCES}") message (STATUS "${SUBPROJECT} HEADERS: ${HEADERS}") # link libraries and compile -add_executable (${MM_PREFIX}${SUBPROJECT} ${SOURCES} ${HEADERS}) -add_dependencies (${MM_PREFIX}${SUBPROJECT} ${LIBRARIES}) -target_link_libraries (${MM_PREFIX}${SUBPROJECT} ${ADDITIONAL_LIB} ${LIBRARIES}) +add_executable (${SUBPROJECT} ${SOURCES} ${HEADERS}) +set_target_properties (${SUBPROJECT} PROPERTIES OUTPUT_NAME ${MM_PREFIX}${SUBPROJECT}) +add_dependencies (${SUBPROJECT} ${LIBRARIES}) +target_link_libraries (${SUBPROJECT} ${ADDITIONAL_LIB} ${LIBRARIES}) # install properties -install (TARGETS ${MM_PREFIX}${SUBPROJECT} DESTINATION bin) +install (TARGETS ${SUBPROJECT} DESTINATION bin) diff --git a/mathmech/mm/include/mathmech/atom_types.h b/mathmech/mm/include/mathmech/atom_types.h index 969a745..f81ed75 100644 --- a/mathmech/mm/include/mathmech/atom_types.h +++ b/mathmech/mm/include/mathmech/atom_types.h @@ -5,10 +5,32 @@ #ifndef ATOM_TYPES_H #define ATOM_TYPES_H + /** * @fn reading_atoms */ +int reading_atoms (const char *input_at, int *num_types, int *num_mol, int *num_atoms, + char *ch_atom_types, int *atom_types, const int total_types); +/** + * @brief function that reads atom types from input file + * @code + * reading_atoms (input_at, &num_types, num_mol, num_atoms, ch_atom_types, atom_types, + * total_types); + * @endcode + * + * @param input_at input file name with atom types + * @param num_types number of molecule types + * @param num_mol massive of number of molecules of selected type + * @param num_atoms massive of number of atoms of selected molecule + * @param ch_atom_types massive of char atom types + * @param atom_types massive of atom types + * @param total_types number of different atom types + * + * @return 1 - error in opening file + * @return 2 - error in file format + * @return 3 - memory error + * @return 0 - exit without errors + */ -int reading_atoms (const char *, int *, int *, int *, char *, int *, const int); -#endif /* ATOM_TYPES_H */ \ No newline at end of file +#endif /* ATOM_TYPES_H */ diff --git a/mathmech/mm/include/mathmech/coords.h b/mathmech/mm/include/mathmech/coords.h index 6bdf48e..de3e45f 100644 --- a/mathmech/mm/include/mathmech/coords.h +++ b/mathmech/mm/include/mathmech/coords.h @@ -5,12 +5,38 @@ #ifndef COORDS_H #define COORDS_H +#include + + /** * @fn reading_coords */ +int reading_coords (const int mode, const char *filename, const int type_inter, + const int *label_atom, system_info *_system_info, + int *true_label_mol, atom_info *_atom_info); +/** + * @brief function that reads coordinates from special file format + * @code + * reading_coords (0, filename, type_inter, label_atom, &_system_info, + * true_label_mol, _atom_info); + * @endcode + * + * @param mode mode of reading; '1' is statgen, '2' is envir or + * frad, '3' is agl + * @param filename input file name + * @param type_inter number of needed atoms + * (number of needed molecules) + * @param label_atom massive of needed atom types + * (massive of needed molecules) + * @param _system_info system information structure + * @param true_label_mol massive of true numbers of molecule for atoms + * @param _atom_info atom information structure + * + * @return 1 - file $filename does not exist + * @return 2 - unknown mode + * @return 3 - memory error + * @return 0 - exit without errors + */ -int reading_coords (const int, const char *, const int, const int *, - const float *, int *, int *, int *, int *, int *, float *, - char *); -#endif /* COORDS_H */ \ No newline at end of file +#endif /* COORDS_H */ diff --git a/mathmech/mm/include/mathmech/envir_search.h b/mathmech/mm/include/mathmech/envir_search.h index f40ae77..d5129c0 100644 --- a/mathmech/mm/include/mathmech/envir_search.h +++ b/mathmech/mm/include/mathmech/envir_search.h @@ -5,10 +5,30 @@ #ifndef ENVIR_SEARCH_H #define ENVIR_SEARCH_H +#include + + /** * @fn search_envir */ +int search_envir (const int num_of_mol, const system_info _system_info, const float *centr_coords, + const double rad, int *needed_mol, int *num_needed_mol); +/** + * @brief function that searchs environment + * @code + * search_envir (number_of_molecule, _system_info, centr_coords, rad, needed_mol, + * &num_needed_mol); + * @endcode + * + * @param num_of_mol number of molecule + * @param _system_info system information structure + * @param centr_coords massive of centered coordinates + * @param rad radius of environment sphere + * @param needed_mol massive of number of needed molecules + * @param num_needed_mol number of needed molecules + * + * @return 0 - exit without errors + */ -int search_envir (const int, const int, const float *, const double, int *, int *); -#endif /* ENVIR_SEARCH_H */ \ No newline at end of file +#endif /* ENVIR_SEARCH_H */ diff --git a/mathmech/mm/include/mathmech/graph.h b/mathmech/mm/include/mathmech/graph.h index bb660f3..f484228 100644 --- a/mathmech/mm/include/mathmech/graph.h +++ b/mathmech/mm/include/mathmech/graph.h @@ -5,22 +5,79 @@ #ifndef GRAPH_H #define GRAPH_H -/** - * @fn graph_analyze - */ + /** * @fn check_cycle */ +int check_cycle (const int N, const int *pn); +/** + * @brief function that calculates number of cycles in graph + * @code + * cycle = check_cycle (N, pn); + * @endcode + * + * @param N number of vertexes + * @param pn massive of number of vertexes with weight equals to i + * + * @return number of cycles + */ + + /** * @fn check_cycle_size */ +int check_cycle_size (const int N, const int *matrix, const int depth, int *n_cycle); +/** + * @brief function that returns number of cycles different size + * @code + * check_cycle_size (N, matrix, depth, n_cycle); + * @endcode + * + * @param N number of vertexes + * @param matrix connectivity matrix + * @param depth depth of search (maximum number of vertexes in cycle) + * @param n_cycle massive of number of cycle with number of vertexes + * equals to i + * + * @return 1 - memory error + * @return 0 - exit without errors + */ + + /** * @fn check_tail */ +int check_tail (const int *pn); +/** + * @brief function that calculates number of tails + * @code + * tails = check_tail (pn); + * @endcode + * + * @param pn massive of number of vertexes with weight equals to i + * + * @return number of tails + */ -int graph_analyze (const int, const int *, const int, int *); -int check_cycle (const int, const int *); -int check_cycle_size (const int, const int *, const int, int *); -int check_tail (const int *); -#endif /* GRAPH_H */ \ No newline at end of file +/** + * @fn graph_analyze + */ +int graph_analyze (const int N, const int *matrix, const int max_depth, int *iso); +/** + * @brief function that analyzes graph isomorhic class + * @code + * graph_analyze (N, matrix, max_depth, iso); + * @endcode + * + * @param N number of vertexes + * @param matrix connectivity matrix + * @param max_depth maximum depth of search for check_cycle_size + * @param iso isomorphism class + * + * @return 1 - memory error + * @return 0 - exit without errors + */ + + +#endif /* GRAPH_H */ diff --git a/mathmech/mm/include/mathmech/messages.h b/mathmech/mm/include/mathmech/messages.h index 6e6ed21..d394cd3 100644 --- a/mathmech/mm/include/mathmech/messages.h +++ b/mathmech/mm/include/mathmech/messages.h @@ -5,10 +5,25 @@ #ifndef MESSAGES_H #define MESSAGES_H + /** * @fn message */ +int message (const int log, const int mode, const char *text, FILE *output); +/** + * @brief function that prints messages to output + * @code + * message (log, mode, text, output); + * @endcode + * + * @param log equal to 1 if print to logfile + * @param mode number of message + * @param text additional text + * @param output output file (may be stdout) + * + * @return 1 - unknown mode + * @return 0 - exit without errors + */ -int message (const int, const int, const char *, FILE *); -#endif /* MESSAGES_H */ \ No newline at end of file +#endif /* MESSAGES_H */ diff --git a/mathmech/mm/include/mathmech/print_struct.h b/mathmech/mm/include/mathmech/print_struct.h index ad60ea8..88cb0f4 100644 --- a/mathmech/mm/include/mathmech/print_struct.h +++ b/mathmech/mm/include/mathmech/print_struct.h @@ -2,14 +2,31 @@ * @file */ -#ifndef PRINT_STRUCTURE_H -#define PRINT_STRUCTURE_H +#ifndef PRINT_STRUCT_H +#define PRINT_STRUCT_H + +#include + /** * @fn print_structure */ +int print_structure (const char *output, const int num_needed_mol, const int *needed_mol, + const system_info _system_info, const atom_info *_atom_info); +/** + * @brief function that prints structure to pdb file + * @code + * print_structure (output, num_needed_mol, needed_mol, _system_info, _atom_info); + * @endcode + * + * @param output output file name + * @param num_needed_mol number of needed molecules + * @param needed_mol massive of number of needed molecules + * @param _system_info system information structure + * @param _atom_info atom information structure + * + * @return 0 - exit without errors + */ -int print_structure (const char *, const int, const int *, const int, const int *, - const char *, const float *); -#endif /* PRINT_STRUCTURE_H */ \ No newline at end of file +#endif /* PRINT_STRUCT_H */ diff --git a/mathmech/mm/include/mathmech/print_trj.h b/mathmech/mm/include/mathmech/print_trj.h index e4033d9..81989d6 100644 --- a/mathmech/mm/include/mathmech/print_trj.h +++ b/mathmech/mm/include/mathmech/print_trj.h @@ -5,11 +5,31 @@ #ifndef PRINT_TRJ_H #define PRINT_TRJ_H + /** * @fn printing_trj */ +int printing_trj (const char *filename, const int atoms, const int num_types, const int *num_mol, + const int *num_atoms, const char *ch_atom_types, const int *atom_types, + const float *coords); +/** + * @brief function that prints trajectory snapshots + * @code + * printing_trj (filename, atoms, num_types, num_mol, num_atoms, ch_atom_types, + * atom_types, coords); + * @endcode + * + * @param filename output file name + * @param atoms number of atoms in system + * @param num_types number of molecule types + * @param num_mol massive of number of molecule of selected type + * @param num_atoms massive of number of atoms of selected molecule + * @param ch_atom_types massive of char atom types + * @param atom_types massive of atom types + * @param coords massive of coordinates + * + * @return 0 - exit without errors + */ -int printing_trj (const char *, const int, const int, const int *, const int *, - const char *, const int *, const float *); -#endif /* PRINT_TRJ_H */ \ No newline at end of file +#endif /* PRINT_TRJ_H */ diff --git a/mathmech/mm/include/mathmech/radf.h b/mathmech/mm/include/mathmech/radf.h index dca5716..9dcb432 100644 --- a/mathmech/mm/include/mathmech/radf.h +++ b/mathmech/mm/include/mathmech/radf.h @@ -5,22 +5,69 @@ #ifndef RADF_H #define RADF_H +#include + + /** * @fn search_rdf */ +int search_rdf (const system_info _system_info, const atom_info *_atom_info, + const radf_info _radf_info, int *radf); +/** + * @brief function that searchs molecule for rdf massive + * @code + * search_rdf (_system_info, _atom_info, _radf_info, radf); + * @endcode + * + * @param _system_info system information structure + * @param _atom_info atom information structure + * @param _radf_info radf information structure + * @param radf not normed RDF + * + * @return 0 - exit without errors + */ + + /** * @fn search_rdf_centr */ +int search_rdf_centr (const system_info _system_info, const atom_info *_atom_info, + const radf_info _radf_info, int *radf); +/** + * @brief function that searchs molecule for rdf massive by centered coordinates + * @code + * search_rdf_centr (_system_info, _atom_info, _radf_info, radf); + * @endcode + * + * @param _system_info system information structure + * @param _atom_info atom information structure + * @param _radf_info radf information structure + * @param radf not normed RDF + * + * @return 0 - exit without errors + * @return 1 - error in set center (missing atoms) + */ + + /** * @fn search_radf */ +int search_radf (const system_info _system_info, const atom_info *_atom_info, + const radf_info _radf_info, int *radf); +/** + * @brief function that searchs molecule for radf massive + * @code + * search_radf (_system_info, _atom_info, _radf_info, radf); + * @endcode + * + * @param _system_info system information structure + * @param _atom_info atom information structure + * @param _radf_info radf information structure + * @param radf not normed RDF + * + * @return 0 - exit without errors + * @return 1 - error in set center (missing atoms) + */ -int search_rdf (const int, const int *, const int *, const float *, const double, - const double, const double, int *); -int search_rdf_centr (const int, const int *, const int *, const float *, const double, - const double, const double, int *); -int search_radf (const int, const int *, const int *, const float *, const double, - const double, const double, const double, const double, const double, - int *); -#endif /* RADF_H */ \ No newline at end of file +#endif /* RADF_H */ diff --git a/mathmech/mm/include/mathmech/radf_proc.h b/mathmech/mm/include/mathmech/radf_proc.h index 828c149..844eba7 100644 --- a/mathmech/mm/include/mathmech/radf_proc.h +++ b/mathmech/mm/include/mathmech/radf_proc.h @@ -5,12 +5,30 @@ #ifndef RADF_PROC_H #define RADF_PROC_H +#include + + /** * @fn print_result */ +int print_result (const char *output, const int matrix, const int mode, + const system_info _system_info, const radf_info _radf_info, + const int *radf); +/** + * @brief function that print result to output file + * @code + * print_result (output, matrix, mode, _system_info, _radf_info, radf); + * @endcode + * + * @param output output file name + * @param matrix status of matrix-mode + * @param mode 1 - if RDF, 2 - if RDF for center mass, 3 - if RADF + * @param _system_info system information structure + * @param _radf_info radf information structure + * @param radf not normed RADF + * + * @return 0 - exit without errors + */ -int print_result (const char *, const int, const int, const int, const int, const double, - const double, const double, const double, const double, const double, - const float *, const int *); -#endif /* RADF_PROC_H */ \ No newline at end of file +#endif /* RADF_PROC_H */ diff --git a/mathmech/mm/include/mathmech/read_agl.h b/mathmech/mm/include/mathmech/read_agl.h index 1850289..09e8e1e 100644 --- a/mathmech/mm/include/mathmech/read_agl.h +++ b/mathmech/mm/include/mathmech/read_agl.h @@ -5,10 +5,24 @@ #ifndef READ_AGL_H #define READ_AGL_H + /** * @fn reading_agl */ +int reading_agl (const char *aglinp, int *num_needed_mol, char *agl_class, int *needed_mol); +/** + * @brief function that reads agglomerate from statgen-formated file + * @code + * reading_agl (aglinput, &num_needed_mol, agl_class, needed_mol); + * @endcode + * + * @param aglinp agglomerate file name + * @param num_needed_mol number of needed molecules + * @param agl_class agglomerate class + * @param needed_mol massive of numbed of needed molecules + * + * @return 0 - exit without errors + */ -int reading_agl (const char *, int *, char *, int *); -#endif /* READ_AGL_H */ \ No newline at end of file +#endif /* READ_AGL_H */ diff --git a/mathmech/mm/include/mathmech/read_gmx.h b/mathmech/mm/include/mathmech/read_gmx.h index 253219b..3801a5a 100644 --- a/mathmech/mm/include/mathmech/read_gmx.h +++ b/mathmech/mm/include/mathmech/read_gmx.h @@ -5,15 +5,51 @@ #ifndef READ_GMX_H #define READ_GMX_H + /** * @fn translate_coords */ +int translate_coords (const float coords, const float cell, float *trans); +/** + * @brief funtion that translates coordinate + * @code + * translate_coords (coords[3*i+j], cell[j], trans); + * @endcode + * + * @param coords coordinate + * @param cell cell size + * @param trans massive of translated coordinates + * + * @return 0 - exit without errors + */ + + /** * @fn rw_gmx */ +int rw_gmx (const char *input, const int step, const char *output, const int num_types, + const int *num_mol, const int *num_atoms, const char *ch_atom_types, + const int *atom_types, float *coords); +/** + * @brief function that read GROMACS trajectory file and write to output + * @code + * rw_gmx (input, step, output, num_types, num_mol, num_atoms, ch_atom_types, + * atom_types, coords); + * @endcode + * + * @param input input file name + * @param step number of trajectory steps + * @param output mask of output files + * @param num_types number of molecule types + * @param num_mol massive of number of molecule of selected type + * @param num_atoms massive of number of atoms of selected molecule + * @param ch_atom_types massive of char atom types + * @param atom_types massive of atom types + * @param coords massive of coordinates + * + * @return 1 - file does not exist + * @return 0 - exit without errors + */ -int translate_coords (const float, const float, float *); -int rw_gmx (const char *, const int, const char *, const int, const int *, - const int *, const char *, const int *, float *); -#endif /* READ_GMX_H */ \ No newline at end of file +#endif /* READ_GMX_H */ diff --git a/mathmech/mm/include/mathmech/read_puma.h b/mathmech/mm/include/mathmech/read_puma.h index 14713b8..4d376a1 100644 --- a/mathmech/mm/include/mathmech/read_puma.h +++ b/mathmech/mm/include/mathmech/read_puma.h @@ -5,11 +5,33 @@ #ifndef READ_PUMA_H #define READ_PUMA_H + /** * @fn rw_puma */ +int rw_puma (const char *input, const int step, const char *output, const int num_types, + const int *num_mol, const int *num_atoms, const char *ch_atom_types, + const int *atom_types, float *coords); +/** + * @brief function that read PUMA trajectory file and write to output + * @code + * rw_puma (input, step, output, num_types, num_mol, num_atoms, ch_atom_types, + * atom_types, coords); + * @endcode + * + * @param input input file name + * @param step number of trajectory steps + * @param output mask of output files + * @param num_types number of molecule types + * @param num_mol massive of number of molecule of selected type + * @param num_atoms massive of number of atoms of selected molecule + * @param ch_atom_types massive of char atom types + * @param atom_types massive of atom types + * @param coords massive of coordinates + * + * @return 1 - file does not exist + * @return 0 - exit without errors + */ -int rw_puma (const char *, const int, const char *, const int, const int *, - const int *, const char *, const int *, float *); -#endif /* READ_PUMA_H */ \ No newline at end of file +#endif /* READ_PUMA_H */ diff --git a/mathmech/mm/include/mathmech/select_mol.h b/mathmech/mm/include/mathmech/select_mol.h index 693cb59..4c16ac4 100644 --- a/mathmech/mm/include/mathmech/select_mol.h +++ b/mathmech/mm/include/mathmech/select_mol.h @@ -5,10 +5,23 @@ #ifndef SELECT_MOL_H #define SELECT_MOL_H + /** * @fn select_molecule */ +int select_molecule (const float *centr_coords, const int num_needed_mol, int *needed_mol); +/** + * @brief function that selects molecules from array of translated molecules + * @code + * select_molecule (centr_coords, num_needed_mol, needed_mol); + * @endcode + * + * @param centr_coords massive of centered coordinates + * @param num_needed_mol number of needed molecules + * @param needed_mol massive of number of needed molecules + * + * @return 0 - exit without errors + */ -int select_molecule (const float *, const int, int *); -#endif /* SELECT_MOL_H */ \ No newline at end of file +#endif /* SELECT_MOL_H */ diff --git a/mathmech/mm/include/mathmech/set_center.h b/mathmech/mm/include/mathmech/set_center.h index 73de6f7..b397fbf 100644 --- a/mathmech/mm/include/mathmech/set_center.h +++ b/mathmech/mm/include/mathmech/set_center.h @@ -5,10 +5,26 @@ #ifndef SET_CENTER_H #define SET_CENTER_H +#include + + /** * @fn set_center */ +int set_center (const system_info _system_info, const atom_info *_atom_info, + float *centr_coords); +/** + * @brief function that searchs center mass of molecules + * @code + * set_center (_system_info, _atom_info, centr_coords); + * @endcode + * + * @param _system_info system information structure + * @param _atom_info atom information structure + * @param centr_coords massive of centered coordinates + * + * @return 0 - exit without errors + */ -int set_center (const int, const int, const int *, const float *, float *); -#endif /* SET_CENTER_H */ \ No newline at end of file +#endif /* SET_CENTER_H */ diff --git a/mathmech/mm/include/mathmech/stat_print.h b/mathmech/mm/include/mathmech/stat_print.h index a6f26a4..4254b9d 100644 --- a/mathmech/mm/include/mathmech/stat_print.h +++ b/mathmech/mm/include/mathmech/stat_print.h @@ -5,11 +5,38 @@ #ifndef STAT_PRINT_H #define STAT_PRINT_H +#include + + /** * @fn printing_agl */ +int printing_agl (const char *input, const char *output, const int *connect, + const system_info _system_info, const int *true_label_mol, + const int *num_mol_agl, const int *agl, const int *stat, + const int max_depth, int *type_agl); +/** + * @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); + * @endcode + * + * @param input input file name + * @param output output file name + * @param connect connectivity graph for all molecules + * @param _system_info system information structure + * @param true_label_mol massive of true numbers of molecule for atoms + * @param num_mol_agl massive of number of molecules in agglomerates + * @param agl massive of agglomerates + * @param stat massive of statistic + * @param max_depth maximum depth for check cycles in graph analyze + * @param type_agl massive of number of agglomerate types + * + * @return 1 - memory error + * @return 0 - exit without errors + */ -int printing_agl (const char *, const char *, const int *, const int, const int *, - const int *, const int *, const int *, const int,int *); -#endif /* STAT_PRINT_H */ \ No newline at end of file +#endif /* STAT_PRINT_H */ diff --git a/mathmech/mm/include/mathmech/stat_select.h b/mathmech/mm/include/mathmech/stat_select.h index f3386b6..f6f46ac 100644 --- a/mathmech/mm/include/mathmech/stat_select.h +++ b/mathmech/mm/include/mathmech/stat_select.h @@ -5,11 +5,29 @@ #ifndef STAT_SELECT_H #define STAT_SELECT_H +#include + + /** * @fn create_matrix */ +int create_matrix (const system_info _system_info, const atom_info *_atom_info, + const int num_of_inter, const float *crit, int *connect); +/** + * @brief function that creates connectivity matrix + * @code + * int create_matrix (_system_info, _atom_info, num_of_inter, crit, connect); + * @endcode + * + * @param _system_info system information structure + * @param _atom_info atom information structure + * @param num_of_inter number of different interactions + * @param crit massive of criteria + * @param connect connectivity graph for all molecules + * + * @return 1 - memory error + * @return 0 - exit without errors + */ -int create_matrix (const int, const int, const int *, const int *, const float *, - const int, const float *, int *); -#endif /* STAT_SELECT_H */ \ No newline at end of file +#endif /* STAT_SELECT_H */ diff --git a/mathmech/mm/include/mathmech/stat_sort.h b/mathmech/mm/include/mathmech/stat_sort.h index fa8e3e6..c694aea 100644 --- a/mathmech/mm/include/mathmech/stat_sort.h +++ b/mathmech/mm/include/mathmech/stat_sort.h @@ -5,10 +5,31 @@ #ifndef STAT_SORT_H #define STAT_SORT_H +#include + + /** * @fn proc_matrix */ +int proc_matrix (const system_info _system_info, const int *connect, int *num_mol_agl, + int *agl, int *stat, int *stat_all); +/** + * @brief function that processes connectivity matrix + * @code + * proc_matrix (_system_info, connect_matrix, num_of_molecules_in_agglomerates, + * agglomerates, statistic, summary_statistic); + * @endcode + * + * @param _system_info system information structure + * @param connect connectivity graph for all molecules + * @param num_mol_agl massive of number of molecules in agglomerates + * @param agl massive of agglomerates + * @param stat massive of statistic + * @param stat_all massive of summary statistic + * + * @return 1 - memory error + * @return 0 - exit without errors + */ -int proc_matrix (const int, const int *, int *, int *, int *, int *); -#endif /* STAT_SORT_H */ \ No newline at end of file +#endif /* STAT_SORT_H */ diff --git a/mathmech/mm/include/mathmech/var_types.h b/mathmech/mm/include/mathmech/var_types.h new file mode 100644 index 0000000..c211ea2 --- /dev/null +++ b/mathmech/mm/include/mathmech/var_types.h @@ -0,0 +1,72 @@ +/** + * @file + */ + +#ifndef VAR_TYPES_H +#define VAR_TYPES_H + + +/** + * @struct atom_info + */ +typedef struct +{ + int label_mol; + int type_atoms; + char ch_type_atoms[2]; + float coords[3]; +} atom_info; +/** + * @brief atom information structure + * @var label_mol massive of numbers of molecule for atoms + * @var type_atoms massive of atom types + * @var coords massive of coordinates + * @var ch_type_atoms massive of char atom types + */ + + +/** + * @struct radf_info + */ +typedef struct +{ + float r_min; + float r_max; + float r_step; + float ang_min; + float ang_max; + float ang_step; +} radf_info; +/** + * @brief radf information structure + * @var r_min minimal radius + * @var r_max maximal radius + * @var r_step radius step + * @var ang_min minimal angle + * @var ang_max minimal angle + * @var ang_step angle step + */ + + +/** + * @struct system_info + */ +typedef struct +{ + int first; + int last; + float cell[3]; + int num_atoms; + int num_mol; +} system_info; +/** + * @brief system information structure + * @var first last trajectory step + * @var last first trajectory step + * @var cell cell size + * @var num_atoms number of atoms + * @var num_mol number of molecules + */ + + +#endif /* VAR_TYPES_H */ diff --git a/mathmech/mm/src/CMakeLists.txt b/mathmech/mm/src/CMakeLists.txt index aa7c94f..f4ed7e2 100644 --- a/mathmech/mm/src/CMakeLists.txt +++ b/mathmech/mm/src/CMakeLists.txt @@ -1,6 +1,6 @@ # set files file (GLOB SOURCES *.c) -file (GLOB HEADERS $*.h) +file (GLOB HEADERS *.h) # set library if (CMAKE_COMPILER_IS_GNUCXX) diff --git a/mathmech/mm/src/atom_types.c b/mathmech/mm/src/atom_types.c index fff01b1..9cf32b1 100644 --- a/mathmech/mm/src/atom_types.c +++ b/mathmech/mm/src/atom_types.c @@ -4,32 +4,14 @@ #include +#include + /** * @fn reading_atoms */ int reading_atoms (const char *input_at, int *num_types, int *num_mol, int *num_atoms, char *ch_atom_types, int *atom_types, const int total_types) -/** - * @brief function that reads atom types from input file - * @code - * reading_atoms (input_at, &num_types, num_mol, num_atoms, ch_atom_types, atom_types, - * total_types); - * @endcode - * - * @param input_at input file name with atom types - * @param num_types number of molecule types - * @param num_mol massive of number of molecules of selected type - * @param num_atoms massive of number of atoms of selected molecule - * @param ch_atom_types massive of char atom types - * @param atom_types massive of atom types - * @param total_types number of different atom types - * - * @return 1 - error in opening file - * @return 2 - error in file format - * @return 3 - memory error - * @return 0 - exit without errors - */ { char at_symb[2], tmp_str[256]; int at_ndx, i, j, total_atoms; @@ -84,4 +66,4 @@ int reading_atoms (const char *input_at, int *num_types, int *num_mol, int *num_ fclose (f_inp); return 0; -} \ No newline at end of file +} diff --git a/mathmech/mm/src/coords.c b/mathmech/mm/src/coords.c index e7438cb..156991e 100644 --- a/mathmech/mm/src/coords.c +++ b/mathmech/mm/src/coords.c @@ -5,61 +5,35 @@ #include #include +#include + + /** * @fn reading_coords */ int reading_coords (const int mode, const char *filename, const int type_inter, - const int *label_atom, const float *cell, int *num_mol, - int *num_atoms, int *true_label_mol, int *label_mol, - int *type_atoms, float *coords, char *ch_type_atoms) -/** - * @brief function that reads coordinates from special file format - * @code - * reading_coords (0, filename, type_inter, label_atom, cell, &num_mol, &num_atoms, - * true_label_mol, label_mol, type_atoms, coords, ch_type_atoms); - * @endcode - * - * @param mode mode of reading; '1' is statgen, '2' is envir or - * frad, '3' is agl - * @param filename input file name - * @param type_inter number of needed atoms - * (number of needed molecules) - * @param label_atom massive of needed atom types - * (massive of needed molecules) - * @param cell massive of cell size - * @param num_mol number of molecules - * @param num_atoms number of atoms - * @param true_label_mol massive of true numbers of molecule for atoms - * @param label_mol massive of numbers of molecule for atoms - * @param type_atoms massive of atom types - * @param coords massive of coordinates - * @param ch_type_atoms massive of char atom types - * - * @return 1 - file $filename does not exist - * @return 2 - unknown mode - * @return 0 - exit without errors - */ + const int *label_atom, system_info *_system_info, + int *true_label_mol, atom_info *_atom_info) { char at_symb[32], file_string[256]; int atoms, cur_at_num, cur_at_type, cur_mol, i, j, tr_num_atoms, ref_mol, x, y; - float cur_coords[3], *not_tr_coords, ref[3]; + float cur_coords[3], ref[3]; FILE *inp; /* cur_* temp variables * at_symb temp variable * file_string temp string variable * atoms total number of atoms in system - * tr_num_atoms number of translated atoms (must be 8*num_atoms) + * tr_num_atoms number of translated atoms (must be 8(*_system_info).num_atoms) * ref_mol number of molecule for reference in translation - * not_tr_coords massive of not translated coordinates * ref massive of coordinates of reference molecule * inp input file */ /// Work blocks - *num_atoms = 0; - *num_mol = 0; + (*_system_info).num_atoms = 0; + (*_system_info).num_mol = 0; ///
   reading file 
inp = fopen (filename, "r"); @@ -68,7 +42,6 @@ int reading_coords (const int mode, const char *filename, const int type_inter, ref_mol = -1; fscanf (inp, "%i", &atoms); - not_tr_coords = (float *) malloc (3 * atoms * sizeof (float)); fgets (file_string, 256, inp); for (i=0; i translation - tr_num_atoms = *num_atoms; - for (i=0; i<*num_atoms; i++) - for (j=0; j<3; j++) - coords[3*i+j] = not_tr_coords[3*i+j]; + tr_num_atoms = (*_system_info).num_atoms; // assign initial value to reference coordinates - ref_mol = label_mol[0]; + ref_mol = _atom_info[0].label_mol; for (i=0; i<3; i++) - ref[i] = coords[3*0+i]; + ref[i] = _atom_info[0].coords[i]; - for (i=0; i<*num_atoms; i++) + for (i=0; i<(*_system_info).num_atoms; i++) { - if (label_mol[i] != ref_mol) + if (_atom_info[i].label_mol != ref_mol) { - ref_mol = label_mol[i]; + ref_mol = _atom_info[i].label_mol; for (j=0; j<3; j++) - ref[j] = not_tr_coords[3*i+j]; + ref[j] = _atom_info[i].coords[j]; } for (x=0; x<3; x++) @@ -174,12 +146,14 @@ int reading_coords (const int mode, const char *filename, const int type_inter, { for (j=0; j<3; j++) if (j == x) - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] - cell[j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j] - (*_system_info).cell[j]; else - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } else @@ -187,12 +161,14 @@ int reading_coords (const int mode, const char *filename, const int type_inter, { for (j=0; j<3; j++) if (j == x) - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] + cell[j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j] + (*_system_info).cell[j]; else - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } } @@ -206,12 +182,14 @@ int reading_coords (const int mode, const char *filename, const int type_inter, { for (j=0; j<3; j++) if ((j == x) || (j == y)) - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] - cell[j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j] - (*_system_info).cell[j]; else - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } @@ -220,12 +198,14 @@ int reading_coords (const int mode, const char *filename, const int type_inter, { for (j=0; j<3; j++) if ((j == x) || (j == y)) - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] + cell[j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j] + (*_system_info).cell[j]; else - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } } @@ -237,15 +217,17 @@ int reading_coords (const int mode, const char *filename, const int type_inter, for (j=0; j<3; j++) { if (j == x) - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] + cell[j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j] + (*_system_info).cell[j]; if (j == y) - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] - cell[j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j] - (*_system_info).cell[j]; if ((j != x) && (j != y)) - coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j]; + _atom_info[tr_num_atoms].coords[j] = _atom_info[i].coords[j]; } - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } } @@ -253,102 +235,115 @@ int reading_coords (const int mode, const char *filename, const int type_inter, if ((ref[0] >= 0.0) && (ref[1] >= 0.0) && (ref[2] >= 0.0)) // if x and y and z >= 0.0 A { - coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0]; - coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1]; - coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2]; + _atom_info[tr_num_atoms].coords[0] = _atom_info[i].coords[0] - (*_system_info).cell[0]; + _atom_info[tr_num_atoms].coords[1] = _atom_info[i].coords[1] - (*_system_info).cell[1]; + _atom_info[tr_num_atoms].coords[2] = _atom_info[i].coords[2] - (*_system_info).cell[2]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } if ((ref[0] >= 0.0) && (ref[1] >= 0.0) && (ref[2] < 0.0)) // if x and y >= 0.0 A and z < 0.0 A { - coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0]; - coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1]; - coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2]; + _atom_info[tr_num_atoms].coords[0] = _atom_info[i].coords[0] - (*_system_info).cell[0]; + _atom_info[tr_num_atoms].coords[1] = _atom_info[i].coords[1] - (*_system_info).cell[1]; + _atom_info[tr_num_atoms].coords[2] = _atom_info[i].coords[2] + (*_system_info).cell[2]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } if ((ref[0] >= 0.0) && (ref[1] < 0.0) && (ref[2] >= 0.0)) // if x and z >= 0.0 A and y < 0.0 A { - coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0]; - coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1]; - coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2]; + _atom_info[tr_num_atoms].coords[0] = _atom_info[i].coords[0] - (*_system_info).cell[0]; + _atom_info[tr_num_atoms].coords[1] = _atom_info[i].coords[1] + (*_system_info).cell[1]; + _atom_info[tr_num_atoms].coords[2] = _atom_info[i].coords[2] - (*_system_info).cell[2]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } if ((ref[0] < 0.0) && (ref[1] >= 0.0) && (ref[2] >= 0.0)) // if y and z >= 0.0 A and x < 0.0 A { - coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0]; - coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1]; - coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2]; + _atom_info[tr_num_atoms].coords[0] = _atom_info[i].coords[0] + (*_system_info).cell[0]; + _atom_info[tr_num_atoms].coords[1] = _atom_info[i].coords[1] - (*_system_info).cell[1]; + _atom_info[tr_num_atoms].coords[2] = _atom_info[i].coords[2] - (*_system_info).cell[2]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } if ((ref[0] < 0.0) && (ref[1] < 0.0) && (ref[2] >= 0.0)) // if x and y < 0.0 A and z >= 0.0 A { - coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0]; - coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1]; - coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2]; + _atom_info[tr_num_atoms].coords[0] = _atom_info[i].coords[0] + (*_system_info).cell[0]; + _atom_info[tr_num_atoms].coords[1] = _atom_info[i].coords[1] + (*_system_info).cell[1]; + _atom_info[tr_num_atoms].coords[2] = _atom_info[i].coords[2] - (*_system_info).cell[2]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } if ((ref[0] < 0.0) && (ref[1] >= 0.0) && (ref[2] < 0.0)) // if x and z < 0.0 A and y >= 0.0 A { - coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0]; - coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1]; - coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2]; + _atom_info[tr_num_atoms].coords[0] = _atom_info[i].coords[0] + (*_system_info).cell[0]; + _atom_info[tr_num_atoms].coords[1] = _atom_info[i].coords[1] - (*_system_info).cell[1]; + _atom_info[tr_num_atoms].coords[2] = _atom_info[i].coords[2] + (*_system_info).cell[2]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } if ((ref[0] >= 0.0) && (ref[1] < 0.0) && (ref[2] < 0.0)) // if x >= 0.0 A and y and z < 0.0 A { - coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0]; - coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1]; - coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2]; + _atom_info[tr_num_atoms].coords[0] = _atom_info[i].coords[0] - (*_system_info).cell[0]; + _atom_info[tr_num_atoms].coords[1] = _atom_info[i].coords[1] + (*_system_info).cell[1]; + _atom_info[tr_num_atoms].coords[2] = _atom_info[i].coords[2] + (*_system_info).cell[2]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } if ((ref[0] < 0.0) && (ref[1] < 0.0) && (ref[2] < 0.0)) // if x and y and z < 0.0 A { - coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0]; - coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1]; - coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2]; + _atom_info[tr_num_atoms].coords[0] = _atom_info[i].coords[0] + (*_system_info).cell[0]; + _atom_info[tr_num_atoms].coords[1] = _atom_info[i].coords[1] + (*_system_info).cell[1]; + _atom_info[tr_num_atoms].coords[2] = _atom_info[i].coords[2] + (*_system_info).cell[2]; - label_mol[tr_num_atoms] = label_mol[i]; - type_atoms[tr_num_atoms] = type_atoms[i]; + _atom_info[tr_num_atoms].label_mol = _atom_info[i].label_mol; + _atom_info[tr_num_atoms].type_atoms = _atom_info[i].type_atoms; + _atom_info[tr_num_atoms].ch_type_atoms[0] = _atom_info[i].ch_type_atoms[0]; + _atom_info[tr_num_atoms].ch_type_atoms[1] = _atom_info[i].ch_type_atoms[1]; tr_num_atoms++; } } -///
   free memory 
- free (not_tr_coords); - return 0; -} \ No newline at end of file +} diff --git a/mathmech/mm/src/envir_search.c b/mathmech/mm/src/envir_search.c index 919af2a..85a230d 100644 --- a/mathmech/mm/src/envir_search.c +++ b/mathmech/mm/src/envir_search.c @@ -4,28 +4,15 @@ #include +#include +#include + /** * @fn search_envir */ -int search_envir (const int num_of_mol, const int num_mol, const float *centr_coords, +int search_envir (const int num_of_mol, const system_info _system_info, const float *centr_coords, const double rad, int *needed_mol, int *num_needed_mol) -/** - * @brief function that searchs environment - * @code - * search_envir (number_of_molecule, num_mol, centr_coords, rad, needed_mol, - * &num_needed_mol); - * @endcode - * - * @param num_of_mol number of molecule - * @param num_mol number of molecules - * @param centr_coords massive of centered coordinates - * @param rad radius of environment sphere - * @param needed_mol massive of number of needed molecules - * @param num_needed_mol number of needed molecules - * - * @return 0 - exit without errors - */ { float r; int i; @@ -35,7 +22,7 @@ int search_envir (const int num_of_mol, const int num_mol, const float *centr_co *num_needed_mol = 0; - for (i=0; i<8*num_mol; i++) + for (i=0; i<8*_system_info.num_mol; i++) { r = sqrt (pow ((centr_coords[3*i+0]-centr_coords[3*8*(num_of_mol-1)+0]), 2) + pow ((centr_coords[3*i+1]-centr_coords[3*8*(num_of_mol-1)+1]), 2) + @@ -48,4 +35,4 @@ int search_envir (const int num_of_mol, const int num_mol, const float *centr_co } return 0; -} \ No newline at end of file +} diff --git a/mathmech/mm/src/graph.c b/mathmech/mm/src/graph.c index 327e238..d4a51e7 100644 --- a/mathmech/mm/src/graph.c +++ b/mathmech/mm/src/graph.c @@ -5,22 +5,13 @@ #include #include +#include + /** * @fn check_cycle */ int check_cycle (const int N, const int *pn) -/** - * @brief function that calculates number of cycles in graph - * @code - * cycle = check_cycle (N, pn); - * @endcode - * - * @param N number of vertexes - * @param pn massive of number of vertexes with weight equals to i - * - * @return number of cycles - */ { int cycle, i; @@ -42,21 +33,6 @@ int check_cycle (const int N, const int *pn) * @fn check_cycle_size */ int check_cycle_size (const int N, const int *matrix, const int depth, int *n_cycle) -/** - * @brief function that returns number of cycles different size - * @code - * check_cycle_size (N, matrix, depth, n_cycle); - * @endcode - * - * @param N number of vertexes - * @param matrix connectivity matrix - * @param depth depth of search (maximum number of vertexes in cycle) - * @param n_cycle massive of number of cycle with number of vertexes - * equals to i - * - * @return 1 - memory error - * @return 0 - exit without errors - */ { int cur_N, cycle, i, j, k, n, p, *vertex; @@ -114,16 +90,6 @@ int check_cycle_size (const int N, const int *matrix, const int depth, int *n_cy * @fn check_tail */ int check_tail (const int *pn) -/** - * @brief function that calculates number of tails - * @code - * tails = check_tail (pn); - * @endcode - * - * @param pn massive of number of vertexes with weight equals to i - * - * @return number of tails - */ { return pn[1]; } @@ -133,20 +99,6 @@ int check_tail (const int *pn) * @fn graph_analyze */ int graph_analyze (const int N, const int *matrix, const int max_depth, int *iso) -/** - * @brief function that analyzes graph isomorhic class - * @code - * graph_analyze (N, matrix, max_depth, iso); - * @endcode - * - * @param N number of vertexes - * @param matrix connectivity matrix - * @param max_depth maximum depth of search for check_cycle_size - * @param iso isomorphism class - * - * @return 1 - memory error - * @return 0 - exit without errors - */ { int depth, i, j, *n_cycle, p, *pn; @@ -192,4 +144,4 @@ int graph_analyze (const int N, const int *matrix, const int max_depth, int *iso free (pn); return 0; -} \ No newline at end of file +} diff --git a/mathmech/mm/src/main.c b/mathmech/mm/src/main.c index 05402c9..141e465 100644 --- a/mathmech/mm/src/main.c +++ b/mathmech/mm/src/main.c @@ -25,6 +25,7 @@ #include #include #include +#include /** diff --git a/mathmech/mm/src/messages.c b/mathmech/mm/src/messages.c index 140cea8..ec05860 100644 --- a/mathmech/mm/src/messages.c +++ b/mathmech/mm/src/messages.c @@ -5,25 +5,13 @@ #include #include +#include + /** * @fn message */ int message (const int log, const int mode, const char *text, FILE *output) -/** - * @brief function that prints messages to output - * @code - * message (log, mode, text, output); - * @endcode - * - * @param log equal to 1 if print to logfile - * @param mode number of message - * @param text additional text - * @param output output file (may be stdout) - * - * @return 1 - unknown mode - * @return 0 - exit without errors - */ { char out[4096]; @@ -116,4 +104,4 @@ int message (const int log, const int mode, const char *text, FILE *output) fputs (out, output); return 0; -} \ No newline at end of file +} diff --git a/mathmech/mm/src/print_struct.c b/mathmech/mm/src/print_struct.c index 46d9b90..8f33f29 100644 --- a/mathmech/mm/src/print_struct.c +++ b/mathmech/mm/src/print_struct.c @@ -4,36 +4,20 @@ #include +#include +#include + /** * @fn print_structure */ int print_structure (const char *output, const int num_needed_mol, const int *needed_mol, - const int num_atoms, const int *label_mol, const char *ch_type_atoms, - const float *coords) -/** - * @brief function that prints structure to pdb file - * @code - * print_structure (output, num_needed_mol, needed_mol, num_atoms, label_mol, - * char_type_atoms, coords); - * @endcode - * - * @param output output file name - * @param num_needed_mol number of needed molecules - * @param needed_mol massive of number of needed molecules - * @param num_atoms number of atoms - * @param label_mol massive of numbers of molecule for atoms - * @param ch_type_atoms massive of char atom types - * @param coords massive of coordinates - * - * @return 0 - exit without errors - */ + const system_info _system_info, const atom_info *_atom_info) { - int cur_atom, cur_atom_num, cur_mol, i, j; + int cur_atom, cur_mol, i, j; FILE *f_out; /* cur_atom current atom - * cur_atom_num true atom number * cur_mol current molecule * f_out output file */ @@ -42,23 +26,17 @@ int print_structure (const char *output, const int num_needed_mol, const int *ne f_out = fopen (output, "w"); for (i=0; i +#include + /** * @fn printing_trj @@ -11,24 +13,6 @@ int printing_trj (const char *filename, const int atoms, const int num_types, const int *num_mol, const int *num_atoms, const char *ch_atom_types, const int *atom_types, const float *coords) -/** - * @brief function that prints trajectory snapshots - * @code - * printing_trj (filename, atoms, num_types, num_mol, num_atoms, ch_atom_types, - * atom_types, coords); - * @endcode - * - * @param filename output file name - * @param atoms number of atoms in system - * @param num_types number of molecule types - * @param num_mol massive of number of molecule of selected type - * @param num_atoms massive of number of atoms of selected molecule - * @param ch_atom_types massive of char atom types - * @param atom_types massive of atom types - * @param coords massive of coordinates - * - * @return 0 - exit without errors - */ { int cur_mol, cur_type[2], i, j, k, l; FILE *f_out; @@ -68,4 +52,4 @@ coords[3*i+1], coords[3*i+2], atom_types[cur_type[1]], cur_mol); fclose (f_out); return 0; -} \ No newline at end of file +} diff --git a/mathmech/mm/src/radf.c b/mathmech/mm/src/radf.c index c9e60b1..47cca24 100644 --- a/mathmech/mm/src/radf.c +++ b/mathmech/mm/src/radf.c @@ -4,37 +4,22 @@ #include +#include +#include + // pi #if !defined __USE_BSD && !defined __USE_XOPEN #ifndef M_PI #define M_PI 3.14159265358979323846 -#endif /* __USE_BSD && __USE_XOPEN */ #endif /* M_PI */ +#endif /* __USE_BSD && __USE_XOPEN */ /** * @fn search_rdf */ -int search_rdf (const int num_atoms, const int *type_atoms, const int *label_mol, - const float *coords, const double r_min, const double r_max, - const double r_step, int *radf) -/** - * @brief function that searchs molecule for rdf massive - * @code - * search_rdf (num_atoms, type_atoms, label_mol, coords, r_min, r_max, r_step, radf); - * @endcode - * - * @param num_atoms number of atoms - * @param type_atoms massive of atom types - * @param label_mol massive of numbers of molecule for atoms - * @param coords massive of coordinates - * @param r_min minimal radius - * @param r_max maximal radius - * @param r_step radius step - * @param radf not normed RDF - * - * @return 0 - exit without errors - */ +int search_rdf (const system_info _system_info, const atom_info *_atom_info, + const radf_info _radf_info, int *radf) { float r; int i, j, k; @@ -42,18 +27,18 @@ int search_rdf (const int num_atoms, const int *type_atoms, const int *label_mol /* r radius */ - for (i=0; i= r_min) && (r <= r_max)) + if ((r >= _radf_info.r_min) && (r <= _radf_info.r_max)) { - k = (r - r_min) / r_step; + k = (r - _radf_info.r_min) / _radf_info.r_step; radf[k]++; } } @@ -65,56 +50,36 @@ int search_rdf (const int num_atoms, const int *type_atoms, const int *label_mol /** * @fn search_rdf_centr */ -int search_rdf_centr (const int num_atoms, const int *type_atoms, const int *label_mol, - const float *coords, const double r_min, const double r_max, - const double r_step, int *radf) -/** - * @brief function that searchs molecule for rdf massive by centered coordinates - * @code - * search_rdf_centr (num_atoms, type_atoms, label_mol, coords, r_min, r_max, r_step, - * radf); - * @endcode - * - * @param num_atoms number of atoms - * @param type_atoms massive of atom types - * @param label_mol massive of numbers of molecule for atoms - * @param coords massive of coordinates - * @param r_min minimal radius - * @param r_max maximal radius - * @param r_step radius step - * @param radf not normed RDF - * - * @return 0 - exit without errors - * @return 1 - error in set center (missing atoms) - */ +int search_rdf_centr (const system_info _system_info, const atom_info *_atom_info, + const radf_info _radf_info, int *radf) { float r, cur_coords[2][3]; int coef, cur_at, i, j, k, l; /* cur_coords centered coordinates * r radius - * coef ==1 if j=num_atoms + * coef ==1 if j<_system_info.num_atoms, ==7 if j>=_system_info.num_atoms * cur_at number of founded atoms */ - for (i=0; i= r_min) && (r <= r_max)) + if ((r >= _radf_info.r_min) && (r <= _radf_info.r_max)) { - k = (r - r_min) / r_step; + k = (r - _radf_info.r_min) / _radf_info.r_step; radf[k]++; } } @@ -162,32 +127,8 @@ int search_rdf_centr (const int num_atoms, const int *type_atoms, const int *lab /** * @fn search_radf */ -int search_radf (const int num_atoms, const int *type_atoms, const int *label_mol, - const float *coords, const double r_min, const double r_max, - const double r_step, const double ang_min, const double ang_max, - const double ang_step, int *radf) -/** - * @brief function that searchs molecule for radf massive - * @code - * search_radf (num_atoms, type_atoms, label_mol, coords, r_min, r_max, r_step, - * ang_min, ang_max, ang_step, radf); - * @endcode - * - * @param num_atoms number of atoms - * @param type_atoms massive of atom types - * @param label_mol massive of numbers of molecule for atoms - * @param coords massive of coordinates - * @param r_min minimal radius - * @param r_max maximal radius - * @param r_step radius step - * @param ang_min minimal angle - * @param ang_max maximal angle - * @param ang_step anlge step - * @param radf not normed RADF - * - * @return 0 - exit without errors - * @return 1 - error in set center (missing atoms) - */ +int search_radf (const system_info _system_info, const atom_info *_atom_info, + const radf_info _radf_info, int *radf) { float ang, cos_ang, cur_coords[2][3], normal[2][3], r; int coef, cur_at, i, j, k, l, n, n_max, plane_index[6]; @@ -196,32 +137,32 @@ int search_radf (const int num_atoms, const int *type_atoms, const int *label_mo * cur_coords centered coordinates * normal normal to planes * r radius - * coef ==1 if j=num_atoms + * coef ==1 if j<_system_info.num_atoms, ==7 if j>=_system_info.num_atoms * cur_at number of founded atoms * n_max range of angles * plane_index atoms forming plane */ - for (i=0; i 90) ang = 180 - ang; - n_max = (ang_max - ang_min) / ang_step; - if ((r >= r_min) && (r <= r_max)) - if ((ang >= ang_min) && (ang <= ang_max)) + n_max = (_radf_info.ang_max - _radf_info.ang_min) / _radf_info.ang_step; + if ((r >= _radf_info.r_min) && (r <= _radf_info.r_max)) + if ((ang >= _radf_info.ang_min) && (ang <= _radf_info.ang_max)) { - k = (r - r_min) / r_step; - n = (ang - ang_min) / ang_step; + k = (r - _radf_info.r_min) / _radf_info.r_step; + n = (ang - _radf_info.ang_min) / _radf_info.ang_step; radf[n_max*k+n]++; } } diff --git a/mathmech/mm/src/radf_proc.c b/mathmech/mm/src/radf_proc.c index 9c32a3f..23a7509 100644 --- a/mathmech/mm/src/radf_proc.c +++ b/mathmech/mm/src/radf_proc.c @@ -5,45 +5,23 @@ #include #include +#include +#include + // pi #if !defined __USE_BSD && !defined __USE_XOPEN #ifndef M_PI #define M_PI 3.14159265358979323846 -#endif /* __USE_BSD && __USE_XOPEN */ #endif /* M_PI */ +#endif /* __USE_BSD && __USE_XOPEN */ /** * @fn print_result */ int print_result (const char *output, const int matrix, const int mode, - const int step, const int num_atoms, const double r_min, - const double r_max, const double r_step, const double ang_min, - const double ang_max, const double ang_step, const float *cell, + const system_info _system_info, const radf_info _radf_info, const int *radf) -/** - * @brief function that print result to output file - * @code - * print_result (output, matrix, mode, step, num_atoms, r_min, r_max, r_step, ang_min, - * ang_max, ang_step, cell, radf); - * @endcode - * - * @param output output file name - * @param matrix status of matrix-mode - * @param mode 1 - if RDF, 2 - if RDF for center mass, 3 - if RADF - * @param step $(to - from + 1) - * @param num_atoms number of atoms - * @param r_min minimal radius - * @param r_max maximal radius - * @param r_step radius step - * @param ang_min minimal angle - * @param ang_max maximal angle - * @param ang_step angle step - * @param cell cell size - * @param radf not normed RADF - * - * @return 0 - exit without errors - */ { float ang, dv, norm, r, ro; int i, j, k, n; @@ -65,13 +43,13 @@ int print_result (const char *output, const int matrix, const int mode, case 0: if (matrix == 0) fprintf (f_out, "| r | dV | RDF | RDFnorm |\n------------------------------------------\n"); - k = (r_max - r_min) / r_step; + k = (_radf_info.r_max - _radf_info.r_min) / _radf_info.r_step; for (i=0; i +#include + /** * @fn reading_agl */ int reading_agl (const char *aglinp, int *num_needed_mol, char *agl_class, int *needed_mol) -/** - * @brief function that reads agglomerate from statgen-formated file - * @code - * reading_agl (aglinput, &num_needed_mol, agl_class, needed_mol); - * @endcode - * - * @param aglinp agglomerate file name - * @param num_needed_mol number of needed molecules - * @param agl_class agglomerate class - * @param needed_mol massive of numbed of needed molecules - * - * @return 0 - exit without errors - */ + { char connect[256], tmp_str[256]; int i; diff --git a/mathmech/mm/src/read_gmx.c b/mathmech/mm/src/read_gmx.c index ddad5d2..66fb84a 100644 --- a/mathmech/mm/src/read_gmx.c +++ b/mathmech/mm/src/read_gmx.c @@ -6,24 +6,13 @@ #include #include +#include /** * @fn translate_coords */ int translate_coords (const float coords, const float cell, float *trans) -/** - * @brief funtion that translates coordinate - * @code - * translate_coords (coords[3*i+j], cell[j], trans); - * @endcode - * - * @param coords coordinate - * @param cell cell size - * @param trans massive of translated coordinates - * - * @return 0 - exit without errors - */ { trans[0] = coords; trans[1] = coords - cell; @@ -39,26 +28,6 @@ int translate_coords (const float coords, const float cell, float *trans) int rw_gmx (const char *input, const int step, const char *output, const int num_types, const int *num_mol, const int *num_atoms, const char *ch_atom_types, const int *atom_types, float *coords) -/** - * @brief function that read GROMACS trajectory file and write to output - * @code - * rw_gmx (input, step, output, num_types, num_mol, num_atoms, ch_atom_types, - * atom_types, coords); - * @endcode - * - * @param input input file name - * @param step number of trajectory steps - * @param output mask of output files - * @param num_types number of molecule types - * @param num_mol massive of number of molecule of selected type - * @param num_atoms massive of number of atoms of selected molecule - * @param ch_atom_types massive of char atom types - * @param atom_types massive of atom types - * @param coords massive of coordinates - * - * @return 1 - file does not exist - * @return 0 - exit without errors - */ { char filename[256], tmp_str[256]; float cell[3], trans[3], r_min; diff --git a/mathmech/mm/src/read_puma.c b/mathmech/mm/src/read_puma.c index dc1c211..7d1b348 100644 --- a/mathmech/mm/src/read_puma.c +++ b/mathmech/mm/src/read_puma.c @@ -5,6 +5,7 @@ #include #include +#include /** @@ -13,26 +14,6 @@ int rw_puma (const char *input, const int step, const char *output, const int num_types, const int *num_mol, const int *num_atoms, const char *ch_atom_types, const int *atom_types, float *coords) -/** - * @brief function that read PUMA trajectory file and write to output - * @code - * rw_puma (input, step, output, num_types, num_mol, num_atoms, ch_atom_types, - * atom_types, coords); - * @endcode - * - * @param input input file name - * @param step number of trajectory steps - * @param output mask of output files - * @param num_types number of molecule types - * @param num_mol massive of number of molecule of selected type - * @param num_atoms massive of number of atoms of selected molecule - * @param ch_atom_types massive of char atom types - * @param atom_types massive of atom types - * @param coords massive of coordinates - * - * @return 1 - file does not exist - * @return 0 - exit without errors - */ { char filename[256], tmp_str[256]; float cell[3]; diff --git a/mathmech/mm/src/select_mol.c b/mathmech/mm/src/select_mol.c index feb1397..a805a6f 100644 --- a/mathmech/mm/src/select_mol.c +++ b/mathmech/mm/src/select_mol.c @@ -4,23 +4,13 @@ #include +#include + /** * @fn select_molecule */ int select_molecule (const float *centr_coords, const int num_needed_mol, int *needed_mol) -/** - * @brief function that selects molecules from array of translated molecules - * @code - * select_molecule (centr_coords, num_needed_mol, needed_mol); - * @endcode - * - * @param centr_coords massive of centered coordinates - * @param num_needed_mol number of needed molecules - * @param needed_mol massive of number of needed molecules - * - * @return 0 - exit without errors - */ { float r, ref[3], rmin; int i, j, jmin; diff --git a/mathmech/mm/src/set_center.c b/mathmech/mm/src/set_center.c index 59cf83c..9815087 100644 --- a/mathmech/mm/src/set_center.c +++ b/mathmech/mm/src/set_center.c @@ -2,26 +2,15 @@ * @file */ +#include +#include + /** * @fn set_center */ -int set_center (const int num_atoms, const int num_mol, const int *label_mol, - const float *coords, float *centr_coords) -/** - * @brief function that searchs center mass of molecules - * @code - * set_center (num_of_atoms, num_of_molecules, label_molecules, coords, centr_coords); - * @endcode - * - * @param num_atoms number of atoms - * @param num_mol number of molecules - * @param label_mol massive of numbers of molecule for atoms - * @param coords massive of coordinates - * @param centr_coords massive of centered coordinates - * - * @return 0 - exit without errors - */ +int set_center (const system_info _system_info, const atom_info *_atom_info, + float *centr_coords) { int at_in_mol, cur_mol, i, j, k; @@ -29,33 +18,33 @@ int set_center (const int num_atoms, const int num_mol, const int *label_mol, * cur_mol current molecule */ - for (i=0; i<8*num_mol; i++) + for (i=0; i<8*_system_info.num_mol; i++) for (j=0; j<3; j++) centr_coords[i*3+j] = 0.0; - for (i=0; i<8*num_atoms; i++) + for (i=0; i<8*_system_info.num_atoms; i++) { - if (i < num_atoms) + if (i < _system_info.num_atoms) cur_mol = 0; else - cur_mol = ((i - num_atoms) % 7) + 1; + cur_mol = ((i - _system_info.num_atoms) % 7) + 1; for (j=0; j<3; j++) - centr_coords[3*(8*label_mol[i]+cur_mol)+j] += coords[3*i+j]; + centr_coords[3*(8*_atom_info[i].label_mol+cur_mol)+j] += _atom_info[i].coords[j]; } at_in_mol = 0; cur_mol = 0; - for (i=0; i #include +#include +#include /** * @fn printing_agl */ int printing_agl (const char *input, const char *output, const int *connect, - const int num_mol, const int *true_label_mol, const int *num_mol_agl, - const int *agl, const int *stat, const int max_depth, int *type_agl) -/** - * @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); - * @endcode - * - * @param input input file name - * @param output output file name - * @param connect connectivity graph for all molecules - * @param num_mol number of molecules - * @param true_label_mol massive of true numbers of molecule for atoms - * @param num_mol_agl massive of number of molecules in agglomerates - * @param agl massive of agglomerates - * @param stat massive of statistic - * @param max_depth maximum depth for check cycles in graph analyze - * @param type_agl massive of number of agglomerate types - * - * @return 1 - memory error - * @return 0 - exit without errors - */ + const system_info _system_info, const int *true_label_mol, + const int *num_mol_agl, const int *agl, const int *stat, + const int max_depth, int *type_agl) { int error, i, *iso, j, k, *label_matrix, *matrix; FILE *f_out; @@ -55,17 +36,17 @@ int printing_agl (const char *input, const char *output, const int *connect, ///
   print header 
fprintf (f_out, "FILE=%s\nSTATISTIC\n| n | N |\n-----------------\n", input); - for (i=0; i print body - for (i=0; i 0) { ///
      creating connectivity graph 
- label_matrix = (int *) malloc (num_mol * sizeof (int)); + label_matrix = (int *) malloc (_system_info.num_mol * sizeof (int)); matrix = (int *) malloc (num_mol_agl[i] * num_mol_agl[i] * sizeof (int)); if ((matrix == NULL) || (label_matrix == NULL)) @@ -75,13 +56,13 @@ int printing_agl (const char *input, const char *output, const int *connect, matrix[num_mol_agl[i]*j+k] = 0; for (j=0; j graph topology analyze @@ -119,10 +100,10 @@ int printing_agl (const char *input, const char *output, const int *connect, fprintf (f_out, "\n"); for (j=0; j #include +#include +#include + /** * @fn create_matrix */ -int create_matrix (const int num_mol, const int num_atoms, const int *label_mol, - const int *type_atoms, const float *coords, const int num_of_inter, - const float *crit, int *connect) -/** - * @brief function that creates connectivity matrix - * @code - * create_matrix (number_of_molecules, number_of_atoms, label_molecule, type_atoms, - * coords, number_of_interactions, criteria, connect_matrix); - * @endcode - * - * @param num_mol number of molecules - * @param num_atoms number of atoms - * @param label_mol massive of numbers of molecule for atoms - * @param type_atoms massive of atom types - * @param coords massive of coordinates - * @param num_of_inter number of different interactions - * @param crit massive of criteria - * @param connect connectivity graph for all molecules - * - * @return 1 - memory error - * @return 0 - exit without errors - */ +int create_matrix (const system_info _system_info, const atom_info *_atom_info, + const int num_of_inter, const float *crit, int *connect) { float r; int cur_num_inter, i, j, k, l, num_inter, ***label_inter; @@ -43,11 +26,11 @@ int create_matrix (const int num_mol, const int num_atoms, const int *label_mol, /// Work blocks - label_inter = (int ***) malloc (num_mol * sizeof (int **)); - for (i=0; i creating initial connectivity matrix - for (i=0; i processing of initial connectivity matrix for (k=0; k free memory - for (i=0; i +#include +#include + /** * @fn proc_matrix */ -int proc_matrix (const int num_mol, const int *connect, int *num_mol_agl, int *agl, - int *stat, int *stat_all) -/** - * @brief function that processes connectivity matrix - * @code - * proc_matrix (number_of_molecules, connect_matrix, num_of_molecules_in_agglomerates, - * agglomerates, statistic, summary_statistic); - * @endcode - * - * @param num_mol number of molecules - * @param connect connectivity graph for all molecules - * @param num_mol_agl massive of number of molecules in agglomerates - * @param agl massive of agglomerates - * @param stat massive of statistic - * @param stat_all massive of summary statistic - * - * @return 1 - memory error - * @return 0 - exit without errors - */ +int proc_matrix (const system_info _system_info, const int *connect, int *num_mol_agl, + int *agl, int *stat, int *stat_all) { int i, j, k, p, *bin; @@ -37,24 +23,24 @@ int proc_matrix (const int num_mol, const int *connect, int *num_mol_agl, int *a /// Work blocks // definition and zeroing - bin = (int *) malloc (num_mol * sizeof (int)); + bin = (int *) malloc (_system_info.num_mol * sizeof (int)); if (bin == NULL) return 1; - for (i=0; i select non-bonded molecules - for (i=0; i unwraping of connectivity matrix p = 0; - for (i=0; i