added structure to all functions of library

This commit is contained in:
arcan1s
2014-01-28 03:11:30 +04:00
parent 38eb392e32
commit d88f3b317f
44 changed files with 945 additions and 819 deletions

View File

@ -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 */
#endif /* ATOM_TYPES_H */

View File

@ -5,12 +5,38 @@
#ifndef COORDS_H
#define COORDS_H
#include <mathmech/var_types.h>
/**
* @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 */
#endif /* COORDS_H */

View File

@ -5,10 +5,30 @@
#ifndef ENVIR_SEARCH_H
#define ENVIR_SEARCH_H
#include <mathmech/var_types.h>
/**
* @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 */
#endif /* ENVIR_SEARCH_H */

View File

@ -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 */
/**
* @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 */

View File

@ -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 */
#endif /* MESSAGES_H */

View File

@ -2,14 +2,31 @@
* @file
*/
#ifndef PRINT_STRUCTURE_H
#define PRINT_STRUCTURE_H
#ifndef PRINT_STRUCT_H
#define PRINT_STRUCT_H
#include <mathmech/var_types.h>
/**
* @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 */
#endif /* PRINT_STRUCT_H */

View File

@ -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 */
#endif /* PRINT_TRJ_H */

View File

@ -5,22 +5,69 @@
#ifndef RADF_H
#define RADF_H
#include <mathmech/var_types.h>
/**
* @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 */
#endif /* RADF_H */

View File

@ -5,12 +5,30 @@
#ifndef RADF_PROC_H
#define RADF_PROC_H
#include <mathmech/var_types.h>
/**
* @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 */
#endif /* RADF_PROC_H */

View File

@ -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 */
#endif /* READ_AGL_H */

View File

@ -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 */
#endif /* READ_GMX_H */

View File

@ -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 */
#endif /* READ_PUMA_H */

View File

@ -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 */
#endif /* SELECT_MOL_H */

View File

@ -5,10 +5,26 @@
#ifndef SET_CENTER_H
#define SET_CENTER_H
#include <mathmech/var_types.h>
/**
* @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 */
#endif /* SET_CENTER_H */

View File

@ -5,11 +5,38 @@
#ifndef STAT_PRINT_H
#define STAT_PRINT_H
#include <mathmech/var_types.h>
/**
* @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 */
#endif /* STAT_PRINT_H */

View File

@ -5,11 +5,29 @@
#ifndef STAT_SELECT_H
#define STAT_SELECT_H
#include <mathmech/var_types.h>
/**
* @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 */
#endif /* STAT_SELECT_H */

View File

@ -5,10 +5,31 @@
#ifndef STAT_SORT_H
#define STAT_SORT_H
#include <mathmech/var_types.h>
/**
* @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 */
#endif /* STAT_SORT_H */

View File

@ -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 */