mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-06-28 06:41:42 +00:00
added structure to all functions of library
This commit is contained in:
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
72
mathmech/mm/include/mathmech/var_types.h
Normal file
72
mathmech/mm/include/mathmech/var_types.h
Normal 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 */
|
@ -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)
|
||||
|
@ -4,32 +4,14 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mathmech/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
|
||||
*/
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -5,61 +5,35 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <mathmech/coords.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
/// <b>Work blocks</b>
|
||||
|
||||
*num_atoms = 0;
|
||||
*num_mol = 0;
|
||||
(*_system_info).num_atoms = 0;
|
||||
(*_system_info).num_mol = 0;
|
||||
|
||||
/// <pre> reading file </pre>
|
||||
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<atoms; i++)
|
||||
{
|
||||
@ -84,62 +57,64 @@ int reading_coords (const int mode, const char *filename, const int type_inter,
|
||||
for (j=0; j<type_inter; j++)
|
||||
if (cur_at_type == label_atom[j])
|
||||
{
|
||||
not_tr_coords[3**num_atoms+0] = cur_coords[0];
|
||||
not_tr_coords[3**num_atoms+1] = cur_coords[1];
|
||||
not_tr_coords[3**num_atoms+2] = cur_coords[2];
|
||||
_atom_info[(*_system_info).num_atoms].coords[0] = cur_coords[0];
|
||||
_atom_info[(*_system_info).num_atoms].coords[1] = cur_coords[1];
|
||||
_atom_info[(*_system_info).num_atoms].coords[2] = cur_coords[2];
|
||||
_atom_info[(*_system_info).num_atoms].ch_type_atoms[0] = at_symb[0];
|
||||
_atom_info[(*_system_info).num_atoms].ch_type_atoms[1] = at_symb[1];
|
||||
|
||||
if (ref_mol != cur_mol)
|
||||
{
|
||||
ref_mol = cur_mol;
|
||||
true_label_mol[*num_mol] = ref_mol;
|
||||
*num_mol = *num_mol + 1;
|
||||
true_label_mol[(*_system_info).num_mol] = ref_mol;
|
||||
(*_system_info).num_mol = (*_system_info).num_mol + 1;
|
||||
}
|
||||
label_mol[*num_atoms] = *num_mol - 1;
|
||||
type_atoms[*num_atoms] = j;
|
||||
_atom_info[(*_system_info).num_atoms].label_mol = (*_system_info).num_mol - 1;
|
||||
_atom_info[(*_system_info).num_atoms].type_atoms = j;
|
||||
|
||||
*num_atoms = *num_atoms + 1;
|
||||
(*_system_info).num_atoms = (*_system_info).num_atoms + 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
// mode == 1 (all atoms)
|
||||
not_tr_coords[3**num_atoms+0] = cur_coords[0];
|
||||
not_tr_coords[3**num_atoms+1] = cur_coords[1];
|
||||
not_tr_coords[3**num_atoms+2] = cur_coords[2];
|
||||
ch_type_atoms[2**num_atoms+0] = at_symb[0];
|
||||
ch_type_atoms[2**num_atoms+1] = at_symb[1];
|
||||
_atom_info[(*_system_info).num_atoms].coords[0] = cur_coords[0];
|
||||
_atom_info[(*_system_info).num_atoms].coords[1] = cur_coords[1];
|
||||
_atom_info[(*_system_info).num_atoms].coords[2] = cur_coords[2];
|
||||
_atom_info[(*_system_info).num_atoms].ch_type_atoms[0] = at_symb[0];
|
||||
_atom_info[(*_system_info).num_atoms].ch_type_atoms[1] = at_symb[1];
|
||||
|
||||
if (ref_mol != cur_mol)
|
||||
{
|
||||
ref_mol = cur_mol;
|
||||
true_label_mol[*num_mol] = ref_mol;
|
||||
*num_mol = *num_mol + 1;
|
||||
true_label_mol[(*_system_info).num_mol] = ref_mol;
|
||||
(*_system_info).num_mol = (*_system_info).num_mol + 1;
|
||||
}
|
||||
label_mol[*num_atoms] = *num_mol - 1;
|
||||
type_atoms[*num_atoms] = j;
|
||||
_atom_info[(*_system_info).num_atoms].label_mol = (*_system_info).num_mol - 1;
|
||||
_atom_info[(*_system_info).num_atoms].type_atoms = j;
|
||||
|
||||
*num_atoms = *num_atoms + 1;
|
||||
(*_system_info).num_atoms = (*_system_info).num_atoms + 1;
|
||||
break;
|
||||
case 2:
|
||||
// mode == 2 (selected molecules)
|
||||
for (j=0; j<type_inter; j++)
|
||||
if (cur_mol == label_atom[j])
|
||||
{
|
||||
not_tr_coords[3**num_atoms+0] = cur_coords[0];
|
||||
not_tr_coords[3**num_atoms+1] = cur_coords[1];
|
||||
not_tr_coords[3**num_atoms+2] = cur_coords[2];
|
||||
ch_type_atoms[2**num_atoms+0] = at_symb[0];
|
||||
ch_type_atoms[2**num_atoms+1] = at_symb[1];
|
||||
_atom_info[(*_system_info).num_atoms].coords[0] = cur_coords[0];
|
||||
_atom_info[(*_system_info).num_atoms].coords[1] = cur_coords[1];
|
||||
_atom_info[(*_system_info).num_atoms].coords[2] = cur_coords[2];
|
||||
_atom_info[(*_system_info).num_atoms].ch_type_atoms[0] = at_symb[0];
|
||||
_atom_info[(*_system_info).num_atoms].ch_type_atoms[1] = at_symb[1];
|
||||
|
||||
if (ref_mol != cur_mol)
|
||||
{
|
||||
ref_mol = cur_mol;
|
||||
true_label_mol[*num_mol] = ref_mol;
|
||||
*num_mol = *num_mol + 1;
|
||||
true_label_mol[(*_system_info).num_mol] = ref_mol;
|
||||
(*_system_info).num_mol = (*_system_info).num_mol + 1;
|
||||
}
|
||||
label_mol[*num_atoms] = *num_mol - 1;
|
||||
type_atoms[*num_atoms] = j;
|
||||
_atom_info[(*_system_info).num_atoms].label_mol = (*_system_info).num_mol - 1;
|
||||
_atom_info[(*_system_info).num_atoms].type_atoms = j;
|
||||
|
||||
*num_atoms = *num_atoms + 1;
|
||||
(*_system_info).num_atoms = (*_system_info).num_atoms + 1;
|
||||
}
|
||||
break;
|
||||
default: return 2;
|
||||
@ -148,23 +123,20 @@ int reading_coords (const int mode, const char *filename, const int type_inter,
|
||||
fclose (inp);
|
||||
|
||||
/// <pre> translation </pre>
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <pre> free memory </pre>
|
||||
free (not_tr_coords);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -4,28 +4,15 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <mathmech/envir_search.h>
|
||||
#include <mathmech/var_types.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
@ -5,22 +5,13 @@
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <mathmech/graph.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <mathmech/stat_select.h>
|
||||
#include <mathmech/stat_sort.h>
|
||||
#include <mathmech/summary_stat.h>
|
||||
#include <mathmech/var_types.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -5,25 +5,13 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <mathmech/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
|
||||
*/
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -4,36 +4,20 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mathmech/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 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<num_needed_mol; i++)
|
||||
for (j=0; j<8*num_atoms; j++)
|
||||
for (j=0; j<8*_system_info.num_atoms; j++)
|
||||
{
|
||||
if (j < num_atoms)
|
||||
{
|
||||
if (j < _system_info.num_atoms)
|
||||
cur_mol = 0;
|
||||
cur_atom_num = j;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_mol = ((j - num_atoms) % 7) + 1;
|
||||
cur_atom_num = (j - num_atoms) / 7;
|
||||
}
|
||||
if (needed_mol[i] == (8*label_mol[j]+cur_mol))
|
||||
cur_mol = ((j - _system_info.num_atoms) % 7) + 1;
|
||||
if (needed_mol[i] == (8*_atom_info[j].label_mol+cur_mol))
|
||||
{
|
||||
fprintf(f_out, "ATOM %5i %c%c MOL %4i %8.3f%8.3f%8.3f\n", cur_atom,
|
||||
ch_type_atoms[2*cur_atom_num+0], ch_type_atoms[2*cur_atom_num+1],
|
||||
i+1, coords[3*j+0], coords[3*j+1], coords[3*j+2]);
|
||||
_atom_info[j].ch_type_atoms[0], _atom_info[j].ch_type_atoms[1],
|
||||
i+1, _atom_info[j].coords[0], _atom_info[j].coords[1], _atom_info[j].coords[2]);
|
||||
cur_atom++;
|
||||
}
|
||||
}
|
||||
@ -66,4 +44,4 @@ int print_structure (const char *output, const int num_needed_mol, const int *ne
|
||||
fclose (f_out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mathmech/print_trj.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
@ -4,37 +4,22 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <mathmech/radf.h>
|
||||
#include <mathmech/var_types.h>
|
||||
|
||||
// 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<num_atoms; i++)
|
||||
for (j=0; j<8*num_atoms; j++)
|
||||
if (((type_atoms[i] == 0) && (type_atoms[j] == 1)) ||
|
||||
((type_atoms[i] == 1) && (type_atoms[j] == 0)))
|
||||
for (i=0; i<_system_info.num_atoms; i++)
|
||||
for (j=0; j<8*_system_info.num_atoms; j++)
|
||||
if (((_atom_info[i].type_atoms == 0) && (_atom_info[j].type_atoms == 1)) ||
|
||||
((_atom_info[i].type_atoms == 1) && (_atom_info[j].type_atoms == 0)))
|
||||
{
|
||||
r = sqrt (pow ((coords[3*i+0] - coords[3*j+0]), 2) +
|
||||
pow ((coords[3*i+1] - coords[3*j+1]), 2) +
|
||||
pow ((coords[3*i+2] - coords[3*j+2]), 2));
|
||||
r = sqrt (pow ((_atom_info[i].coords[0] - _atom_info[j].coords[0]), 2) +
|
||||
pow ((_atom_info[i].coords[1] - _atom_info[j].coords[1]), 2) +
|
||||
pow ((_atom_info[i].coords[2] - _atom_info[j].coords[2]), 2));
|
||||
|
||||
if ((r >= 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, ==7 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<num_atoms; i++)
|
||||
if ((type_atoms[i] == 0) || (type_atoms[i] == 3))
|
||||
for (j=0; j<8*num_atoms; j++)
|
||||
if (((type_atoms[i] == 0) && (type_atoms[j] == 3)) ||
|
||||
((type_atoms[i] == 3) && (type_atoms[j] == 0)))
|
||||
for (i=0; i<_system_info.num_atoms; i++)
|
||||
if ((_atom_info[i].type_atoms == 0) || (_atom_info[i].type_atoms == 3))
|
||||
for (j=0; j<8*_system_info.num_atoms; j++)
|
||||
if (((_atom_info[i].type_atoms == 0) && (_atom_info[j].type_atoms == 3)) ||
|
||||
((_atom_info[i].type_atoms == 3) && (_atom_info[j].type_atoms == 0)))
|
||||
{
|
||||
// set center for i-molecule
|
||||
for (l=0; l<3; l++)
|
||||
cur_coords[0][l] = coords[3*i+l];
|
||||
cur_coords[0][l] = _atom_info[i].coords[l];
|
||||
cur_at = 1;
|
||||
for (k=1; k<6; k++)
|
||||
if (label_mol[i+k] == label_mol[i])
|
||||
if ((type_atoms[i+k] == type_atoms[i] + 1) ||
|
||||
(type_atoms[i+k] == type_atoms[i] + 2))
|
||||
if (_atom_info[i+k].label_mol == _atom_info[i].label_mol)
|
||||
if ((_atom_info[i+k].type_atoms == _atom_info[i].type_atoms + 1) ||
|
||||
(_atom_info[i+k].type_atoms == _atom_info[i].type_atoms + 2))
|
||||
{
|
||||
cur_at++;
|
||||
for (l=0; l<3; l++)
|
||||
cur_coords[0][l] += coords[3*(i+k)+l];
|
||||
cur_coords[0][l] += _atom_info[i+k].coords[l];
|
||||
}
|
||||
if (cur_at == 3)
|
||||
for (l=0; l<3; l++)
|
||||
@ -123,20 +88,20 @@ int search_rdf_centr (const int num_atoms, const int *type_atoms, const int *lab
|
||||
return 1;
|
||||
// set center for j-molecule
|
||||
for (l=0; l<3; l++)
|
||||
cur_coords[1][l] = coords[3*j+l];
|
||||
cur_coords[1][l] = _atom_info[j].coords[l];
|
||||
cur_at = 1;
|
||||
if (j < num_atoms)
|
||||
if (j < _system_info.num_atoms)
|
||||
coef = 1;
|
||||
else
|
||||
coef = 7;
|
||||
for (k=1; k<6; k++)
|
||||
if (label_mol[j+coef*k] == label_mol[j])
|
||||
if ((type_atoms[j+coef*k] == type_atoms[j] + 1) ||
|
||||
(type_atoms[j+coef*k] == type_atoms[j] + 2))
|
||||
if (_atom_info[j+coef*k].label_mol == _atom_info[j].label_mol)
|
||||
if ((_atom_info[j+coef*k].type_atoms == _atom_info[j].type_atoms + 1) ||
|
||||
(_atom_info[j+coef*k].type_atoms == _atom_info[j].type_atoms + 2))
|
||||
{
|
||||
cur_at++;
|
||||
for (l=0; l<3; l++)
|
||||
cur_coords[1][l] += coords[3*(j+coef*k)+l];
|
||||
cur_coords[1][l] += _atom_info[j+coef*k].coords[l];
|
||||
}
|
||||
if (cur_at == 3)
|
||||
for (l=0; l<3; l++)
|
||||
@ -148,9 +113,9 @@ int search_rdf_centr (const int num_atoms, const int *type_atoms, const int *lab
|
||||
pow ((cur_coords[0][1] - cur_coords[1][1]), 2) +
|
||||
pow ((cur_coords[0][2] - cur_coords[1][2]), 2));
|
||||
|
||||
if ((r >= 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, ==7 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<num_atoms; i++)
|
||||
if ((type_atoms[i] == 0) || (type_atoms[i] == 3))
|
||||
for (j=0; j<8*num_atoms; j++)
|
||||
if (((type_atoms[i] == 0) && (type_atoms[j] == 3)) ||
|
||||
((type_atoms[i] == 3) && (type_atoms[j] == 0)))
|
||||
for (i=0; i<_system_info.num_atoms; i++)
|
||||
if ((_atom_info[i].type_atoms == 0) || (_atom_info[i].type_atoms == 3))
|
||||
for (j=0; j<8*_system_info.num_atoms; j++)
|
||||
if (((_atom_info[i].type_atoms == 0) && (_atom_info[j].type_atoms == 3)) ||
|
||||
((_atom_info[i].type_atoms == 3) && (_atom_info[j].type_atoms == 0)))
|
||||
{
|
||||
// set center for i-molecule
|
||||
plane_index[type_atoms[i]] = i;
|
||||
plane_index[_atom_info[i].type_atoms] = i;
|
||||
for (l=0; l<3; l++)
|
||||
cur_coords[0][l] = coords[3*i+l];
|
||||
cur_coords[0][l] = _atom_info[i].coords[l];
|
||||
cur_at = 1;
|
||||
for (k=1; k<6; k++)
|
||||
if (label_mol[i+k] == label_mol[i])
|
||||
if ((type_atoms[i+k] == type_atoms[i] + 1) ||
|
||||
(type_atoms[i+k] == type_atoms[i] + 2))
|
||||
if (_atom_info[i+k].label_mol == _atom_info[i].label_mol)
|
||||
if ((_atom_info[i+k].type_atoms == _atom_info[i].type_atoms + 1) ||
|
||||
(_atom_info[i+k].type_atoms == _atom_info[i].type_atoms + 2))
|
||||
{
|
||||
cur_at++;
|
||||
plane_index[type_atoms[i+k]] = i + k;
|
||||
plane_index[_atom_info[i+k].type_atoms] = i + k;
|
||||
for (l=0; l<3; l++)
|
||||
cur_coords[0][l] += coords[3*(i+k)+l];
|
||||
cur_coords[0][l] += _atom_info[i+k].coords[l];
|
||||
}
|
||||
if (cur_at == 3)
|
||||
for (l=0; l<3; l++)
|
||||
@ -229,23 +170,23 @@ int search_radf (const int num_atoms, const int *type_atoms, const int *label_mo
|
||||
else
|
||||
return 1;
|
||||
// set center for j-molecule
|
||||
plane_index[type_atoms[j]] = j;
|
||||
plane_index[_atom_info[j].type_atoms] = j;
|
||||
for (l=0; l<3; l++)
|
||||
cur_coords[1][l] = coords[3*j+l];
|
||||
cur_coords[1][l] = _atom_info[j].coords[l];
|
||||
cur_at = 1;
|
||||
if (j < num_atoms)
|
||||
if (j < _system_info.num_atoms)
|
||||
coef = 1;
|
||||
else
|
||||
coef = 7;
|
||||
for (k=1; k<6; k++)
|
||||
if (label_mol[j+coef*k] == label_mol[j])
|
||||
if ((type_atoms[j+coef*k] == type_atoms[j] + 1) ||
|
||||
(type_atoms[j+coef*k] == type_atoms[j] + 2))
|
||||
if (_atom_info[j+coef*k].label_mol == _atom_info[j].label_mol)
|
||||
if ((_atom_info[j+coef*k].type_atoms == _atom_info[j].type_atoms + 1) ||
|
||||
(_atom_info[j+coef*k].type_atoms == _atom_info[j].type_atoms + 2))
|
||||
{
|
||||
cur_at++;
|
||||
plane_index[type_atoms[j+coef*k]] = j + coef * k;
|
||||
plane_index[_atom_info[j+coef*k].type_atoms] = j + coef * k;
|
||||
for (l=0; l<3; l++)
|
||||
cur_coords[1][l] += coords[3*(j+coef*k)+l];
|
||||
cur_coords[1][l] += _atom_info[j+coef*k].coords[l];
|
||||
}
|
||||
if (cur_at == 3)
|
||||
for (l=0; l<3; l++)
|
||||
@ -257,30 +198,30 @@ int search_radf (const int num_atoms, const int *type_atoms, const int *label_mo
|
||||
pow ((cur_coords[0][1] - cur_coords[1][1]), 2) +
|
||||
pow ((cur_coords[0][2] - cur_coords[1][2]), 2));
|
||||
// define planes
|
||||
normal[0][0] = (coords[3*plane_index[1]+1] - coords[3*plane_index[0]+1]) *
|
||||
(coords[3*plane_index[2]+2] - coords[3*plane_index[0]+2]) -
|
||||
(coords[3*plane_index[1]+2] - coords[3*plane_index[0]+2]) *
|
||||
(coords[3*plane_index[2]+1] - coords[3*plane_index[0]+1]);
|
||||
normal[0][1] = (coords[3*plane_index[1]+2] - coords[3*plane_index[0]+2]) *
|
||||
(coords[3*plane_index[2]+0] - coords[3*plane_index[0]+0]) -
|
||||
(coords[3*plane_index[1]+0] - coords[3*plane_index[0]+0]) *
|
||||
(coords[3*plane_index[2]+2] - coords[3*plane_index[0]+2]);
|
||||
normal[0][2] = (coords[3*plane_index[1]+0] - coords[3*plane_index[0]+0]) *
|
||||
(coords[3*plane_index[2]+1] - coords[3*plane_index[0]+1]) -
|
||||
(coords[3*plane_index[1]+1] - coords[3*plane_index[0]+1]) *
|
||||
(coords[3*plane_index[2]+0] - coords[3*plane_index[0]+0]);
|
||||
normal[1][0] = (coords[3*plane_index[4]+1] - coords[3*plane_index[3]+1]) *
|
||||
(coords[3*plane_index[5]+2] - coords[3*plane_index[3]+2]) -
|
||||
(coords[3*plane_index[4]+2] - coords[3*plane_index[3]+2]) *
|
||||
(coords[3*plane_index[5]+1] - coords[3*plane_index[3]+1]);
|
||||
normal[1][1] = (coords[3*plane_index[4]+2] - coords[3*plane_index[3]+2]) *
|
||||
(coords[3*plane_index[5]+0] - coords[3*plane_index[3]+0]) -
|
||||
(coords[3*plane_index[4]+0] - coords[3*plane_index[3]+0]) *
|
||||
(coords[3*plane_index[5]+2] - coords[3*plane_index[3]+2]);
|
||||
normal[1][2] = (coords[3*plane_index[4]+0] - coords[3*plane_index[3]+0]) *
|
||||
(coords[3*plane_index[5]+1] - coords[3*plane_index[3]+1]) -
|
||||
(coords[3*plane_index[4]+1] - coords[3*plane_index[3]+1]) *
|
||||
(coords[3*plane_index[5]+0] - coords[3*plane_index[3]+0]);
|
||||
normal[0][0] = (_atom_info[plane_index[1]].coords[1] - _atom_info[plane_index[0]].coords[1]) *
|
||||
(_atom_info[plane_index[2]].coords[2] - _atom_info[plane_index[0]].coords[2]) -
|
||||
(_atom_info[plane_index[1]].coords[2] - _atom_info[plane_index[0]].coords[2]) *
|
||||
(_atom_info[plane_index[2]].coords[1] - _atom_info[plane_index[0]].coords[1]);
|
||||
normal[0][1] = (_atom_info[plane_index[1]].coords[2] - _atom_info[plane_index[0]].coords[2]) *
|
||||
(_atom_info[plane_index[2]].coords[0] - _atom_info[plane_index[0]].coords[0]) -
|
||||
(_atom_info[plane_index[1]].coords[0] - _atom_info[plane_index[0]].coords[0]) *
|
||||
(_atom_info[plane_index[2]].coords[2] - _atom_info[plane_index[0]].coords[2]);
|
||||
normal[0][2] = (_atom_info[plane_index[1]].coords[0] - _atom_info[plane_index[0]].coords[0]) *
|
||||
(_atom_info[plane_index[2]].coords[1] - _atom_info[plane_index[0]].coords[1]) -
|
||||
(_atom_info[plane_index[1]].coords[1] - _atom_info[plane_index[0]].coords[1]) *
|
||||
(_atom_info[plane_index[2]].coords[0] - _atom_info[plane_index[0]].coords[0]);
|
||||
normal[1][0] = (_atom_info[plane_index[4]].coords[1] - _atom_info[plane_index[3]].coords[1]) *
|
||||
(_atom_info[plane_index[5]].coords[2] - _atom_info[plane_index[3]].coords[2]) -
|
||||
(_atom_info[plane_index[4]].coords[2] - _atom_info[plane_index[3]].coords[2]) *
|
||||
(_atom_info[plane_index[5]].coords[1] - _atom_info[plane_index[3]].coords[1]);
|
||||
normal[1][1] = (_atom_info[plane_index[4]].coords[2] - _atom_info[plane_index[3]].coords[2]) *
|
||||
(_atom_info[plane_index[5]].coords[0] - _atom_info[plane_index[3]].coords[0]) -
|
||||
(_atom_info[plane_index[4]].coords[0] - _atom_info[plane_index[3]].coords[0]) *
|
||||
(_atom_info[plane_index[5]].coords[2] - _atom_info[plane_index[3]].coords[2]);
|
||||
normal[1][2] = (_atom_info[plane_index[4]].coords[0] - _atom_info[plane_index[3]].coords[0]) *
|
||||
(_atom_info[plane_index[5]].coords[1] - _atom_info[plane_index[3]].coords[1]) -
|
||||
(_atom_info[plane_index[4]].coords[1] - _atom_info[plane_index[3]].coords[1]) *
|
||||
(_atom_info[plane_index[5]].coords[0] - _atom_info[plane_index[3]].coords[0]);
|
||||
cos_ang = (normal[0][0] * normal[1][0] + normal[0][1] * normal[1][1] + normal[0][2] * normal[1][2]) /
|
||||
(sqrt (pow ((normal[0][0]), 2) + pow ((normal[0][1]), 2) + pow ((normal[0][2]), 2)) *
|
||||
sqrt (pow ((normal[1][0]), 2) + pow ((normal[1][1]), 2) + pow ((normal[1][2]), 2)));
|
||||
@ -288,12 +229,12 @@ int search_radf (const int num_atoms, const int *type_atoms, const int *label_mo
|
||||
if (ang > 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]++;
|
||||
}
|
||||
}
|
||||
|
@ -5,45 +5,23 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mathmech/radf_proc.h>
|
||||
#include <mathmech/var_types.h>
|
||||
|
||||
// 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<k; i++)
|
||||
{
|
||||
r = r_min + (0.5 + i) * r_step;
|
||||
dv = 4 * M_PI * pow (r, 2) * r_step;
|
||||
ro = num_atoms / (2 * cell[0] * cell[1] * cell[2]);
|
||||
norm = radf[i] / (dv * ro * num_atoms * step);
|
||||
r = _radf_info.r_min + (0.5 + i) * _radf_info.r_step;
|
||||
dv = 4 * M_PI * pow (r, 2) * _radf_info.r_step;
|
||||
ro = _system_info.num_atoms / (2 * _system_info.cell[0] * _system_info.cell[1] * _system_info.cell[2]);
|
||||
norm = radf[i] / (dv * ro * _system_info.num_atoms * (_system_info.last - _system_info.first + 1));
|
||||
if (matrix == 0)
|
||||
fprintf (f_out, " %9.4f %10.4e %9i %9.6f \n", r, dv, radf[i] / 2, norm);
|
||||
else
|
||||
@ -82,13 +60,13 @@ int print_result (const char *output, const int matrix, const int mode,
|
||||
case 1:
|
||||
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<k; i++)
|
||||
{
|
||||
r = r_min + (0.5 + i) * r_step;
|
||||
dv = 4 * M_PI * pow (r, 2) * r_step;
|
||||
ro = num_atoms / (3 * 2 * cell[0] * cell[1] * cell[2]);
|
||||
norm = radf[i] / (dv * ro * num_atoms / 3 * step);
|
||||
r = _radf_info.r_min + (0.5 + i) * _radf_info.r_step;
|
||||
dv = 4 * M_PI * pow (r, 2) * _radf_info.r_step;
|
||||
ro = _system_info.num_atoms / (3 * 2 * _system_info.cell[0] * _system_info.cell[1] * _system_info.cell[2]);
|
||||
norm = radf[i] / (dv * ro * _system_info.num_atoms / 3 * (_system_info.last - _system_info.first + 1));
|
||||
if (matrix == 0)
|
||||
fprintf (f_out, " %9.4f %10.4e %9i %9.6f \n", r, dv, radf[i] / 2, norm);
|
||||
else
|
||||
@ -99,13 +77,13 @@ int print_result (const char *output, const int matrix, const int mode,
|
||||
case 2:
|
||||
if (matrix == 0)
|
||||
fprintf (f_out, "| r | ang | dV | RDF | RDFnorm |\n----------------------------------------------------\n");
|
||||
k = (r_max - r_min) / r_step;
|
||||
n = (ang_max - ang_min) / ang_step;
|
||||
k = (_radf_info.r_max - _radf_info.r_min) / _radf_info.r_step;
|
||||
n = (_radf_info.ang_max - _radf_info.ang_min) / _radf_info.ang_step;
|
||||
if (matrix == 1)
|
||||
{
|
||||
fprintf (f_out, " r\\ang ");
|
||||
for (j=0; j<n; j++)
|
||||
fprintf (f_out, " %9.2f", ang_min+(0.5+j)*ang_step);
|
||||
fprintf (f_out, " %9.2f", _radf_info.ang_min+(0.5+j)*_radf_info.ang_step);
|
||||
fprintf (f_out, "\n");
|
||||
}
|
||||
for (i=0; i<k; i++)
|
||||
@ -114,11 +92,11 @@ int print_result (const char *output, const int matrix, const int mode,
|
||||
fprintf (f_out, " %9.4f", r);
|
||||
for (j=0; j<n; j++)
|
||||
{
|
||||
r = r_min + (0.5 + i) * r_step;
|
||||
ang = ang_min + (0.5 + j) * ang_step;
|
||||
dv = 4 * M_PI * pow (r, 2) * sin (M_PI * ang / 180) * r_step * (M_PI * ang_step / 180);
|
||||
ro = num_atoms / (3 * 2 * cell[0] * cell[1] * cell[2]);
|
||||
norm = radf[n*i+j] / (dv * ro * num_atoms / 3 * step);
|
||||
r = _radf_info.r_min + (0.5 + i) * _radf_info.r_step;
|
||||
ang = _radf_info.ang_min + (0.5 + j) * _radf_info.ang_step;
|
||||
dv = 4 * M_PI * pow (r, 2) * sin (M_PI * ang / 180) * _radf_info.r_step * (M_PI * _radf_info.ang_step / 180);
|
||||
ro = _system_info.num_atoms / (3 * 2 * _system_info.cell[0] * _system_info.cell[1] * _system_info.cell[2]);
|
||||
norm = radf[n*i+j] / (dv * ro * _system_info.num_atoms / 3 * (_system_info.last - _system_info.first + 1));
|
||||
if (matrix == 0)
|
||||
fprintf (f_out, " %9.4f %9.2f %10.4e %9i %9.6f \n", r, ang, dv, radf[n*i+j] / 2, norm);
|
||||
else
|
||||
@ -134,4 +112,4 @@ int print_result (const char *output, const int matrix, const int mode,
|
||||
fclose (f_out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,17 @@
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
/* Library for reading agglomerate from statgen-file
|
||||
*
|
||||
* Usage:
|
||||
* reading_agl (aglinput, &num_needed_mol, agl_class, needed_mol)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mathmech/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
|
||||
*/
|
||||
|
||||
{
|
||||
char connect[256], tmp_str[256];
|
||||
int i;
|
||||
|
@ -6,24 +6,13 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mathmech/print_trj.h>
|
||||
#include <mathmech/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
|
||||
*/
|
||||
{
|
||||
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;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <mathmech/print_trj.h>
|
||||
#include <mathmech/read_puma.h>
|
||||
|
||||
|
||||
/**
|
||||
@ -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];
|
||||
|
@ -4,23 +4,13 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <mathmech/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
|
||||
*/
|
||||
{
|
||||
float r, ref[3], rmin;
|
||||
int i, j, jmin;
|
||||
|
@ -2,26 +2,15 @@
|
||||
* @file
|
||||
*/
|
||||
|
||||
#include <mathmech/set_center.h>
|
||||
#include <mathmech/var_types.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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<num_atoms; i++)
|
||||
if (cur_mol != label_mol[i])
|
||||
for (i=0; i<_system_info.num_atoms; i++)
|
||||
if (cur_mol != _atom_info[i].label_mol)
|
||||
{
|
||||
for (j=0; j<8; j++)
|
||||
for (k=0; k<3; k++)
|
||||
centr_coords[3*(8*cur_mol+j)+k] = centr_coords[3*(8*cur_mol+j)+k] / at_in_mol;
|
||||
at_in_mol = 0;
|
||||
cur_mol = label_mol[i];
|
||||
cur_mol = _atom_info[i].label_mol;
|
||||
}
|
||||
else
|
||||
at_in_mol++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -6,36 +6,17 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <mathmech/graph.h>
|
||||
#include <mathmech/stat_print.h>
|
||||
#include <mathmech/var_types.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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,
|
||||
|
||||
/// <pre> print header </pre>
|
||||
fprintf (f_out, "FILE=%s\nSTATISTIC\n| n | N |\n-----------------\n", input);
|
||||
for (i=0; i<num_mol; i++)
|
||||
for (i=0; i<_system_info.num_mol; i++)
|
||||
if (stat[i] != 0)
|
||||
fprintf (f_out, " %7i %7i \n", i+1, stat[i]);
|
||||
fprintf (f_out, "-----------------\n");
|
||||
|
||||
/// <pre> print body </pre>
|
||||
for (i=0; i<num_mol; i++)
|
||||
for (i=0; i<_system_info.num_mol; i++)
|
||||
if (num_mol_agl[i] > 0)
|
||||
{
|
||||
/// <pre> creating connectivity graph </pre>
|
||||
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<num_mol_agl[i]; j++)
|
||||
label_matrix[agl[num_mol*i+j]] = j;
|
||||
label_matrix[agl[_system_info.num_mol*i+j]] = j;
|
||||
for (j=0; j<num_mol_agl[i]; j++)
|
||||
for (k=j+1; k<num_mol_agl[i]; k++)
|
||||
if (connect[num_mol*agl[num_mol*i+j]+agl[num_mol*i+k]] == 1)
|
||||
if (connect[_system_info.num_mol*agl[_system_info.num_mol*i+j]+agl[_system_info.num_mol*i+k]] == 1)
|
||||
{
|
||||
matrix[label_matrix[agl[num_mol*i+j]]*num_mol_agl[i]+label_matrix[agl[num_mol*i+k]]] = 1;
|
||||
matrix[label_matrix[agl[num_mol*i+k]]*num_mol_agl[i]+label_matrix[agl[num_mol*i+j]]] = 1;
|
||||
matrix[label_matrix[agl[_system_info.num_mol*i+j]]*num_mol_agl[i]+label_matrix[agl[_system_info.num_mol*i+k]]] = 1;
|
||||
matrix[label_matrix[agl[_system_info.num_mol*i+k]]*num_mol_agl[i]+label_matrix[agl[_system_info.num_mol*i+j]]] = 1;
|
||||
}
|
||||
|
||||
/// <pre> graph topology analyze </pre>
|
||||
@ -119,10 +100,10 @@ int printing_agl (const char *input, const char *output, const int *connect,
|
||||
fprintf (f_out, "\n");
|
||||
for (j=0; j<num_mol_agl[i]; j++)
|
||||
{
|
||||
fprintf (f_out, "%7i=", true_label_mol[agl[num_mol*i+j]]);
|
||||
fprintf (f_out, "%7i=", true_label_mol[agl[_system_info.num_mol*i+j]]);
|
||||
for (k=0; k<num_mol_agl[i]; k++)
|
||||
if (matrix[j*num_mol_agl[i]+k] == 1)
|
||||
fprintf (f_out, "%i,", true_label_mol[agl[num_mol*i+k]]);
|
||||
fprintf (f_out, "%i,", true_label_mol[agl[_system_info.num_mol*i+k]]);
|
||||
fprintf (f_out, "\n");
|
||||
}
|
||||
|
||||
|
@ -5,32 +5,15 @@
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <mathmech/stat_select.h>
|
||||
#include <mathmech/var_types.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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,
|
||||
|
||||
/// <b>Work blocks</b>
|
||||
|
||||
label_inter = (int ***) malloc (num_mol * sizeof (int **));
|
||||
for (i=0; i<num_mol; i++)
|
||||
label_inter = (int ***) malloc (_system_info.num_mol * sizeof (int **));
|
||||
for (i=0; i<_system_info.num_mol; i++)
|
||||
{
|
||||
label_inter[i] = (int **) malloc (num_mol * sizeof (int *));
|
||||
for (j=0; j<num_mol; j++)
|
||||
label_inter[i] = (int **) malloc (_system_info.num_mol * sizeof (int *));
|
||||
for (j=0; j<_system_info.num_mol; j++)
|
||||
{
|
||||
label_inter[i][j] = (int *) malloc (16 * sizeof (int));
|
||||
for (k=0; k<16; k++)
|
||||
@ -58,28 +41,28 @@ int create_matrix (const int num_mol, const int num_atoms, const int *label_mol,
|
||||
return 1;
|
||||
|
||||
/// <pre> creating initial connectivity matrix </pre>
|
||||
for (i=0; i<num_atoms*8; i++)
|
||||
for (j=i+1; j<num_atoms*8; j++)
|
||||
for (i=0; i<_system_info.num_atoms*8; i++)
|
||||
for (j=i+1; j<_system_info.num_atoms*8; j++)
|
||||
// if atoms from different molecules
|
||||
if (label_mol[i] != label_mol[j])
|
||||
if (_atom_info[i].label_mol != _atom_info[j].label_mol)
|
||||
{
|
||||
r = sqrt (pow ((coords[3*i+0]-coords[3*j+0]), 2) +
|
||||
pow ((coords[3*i+1]-coords[3*j+1]), 2) +
|
||||
pow ((coords[3*i+2]-coords[3*j+2]), 2));
|
||||
r = sqrt (pow ((_atom_info[i].coords[0]-_atom_info[j].coords[0]), 2) +
|
||||
pow ((_atom_info[i].coords[1]-_atom_info[j].coords[1]), 2) +
|
||||
pow ((_atom_info[i].coords[2]-_atom_info[j].coords[2]), 2));
|
||||
for (k=0; k<num_of_inter; k++)
|
||||
if (crit[16*k+4*type_atoms[i]+type_atoms[j]] != 0.0)
|
||||
if (r < crit[16*k+4*type_atoms[i]+type_atoms[j]])
|
||||
if (crit[16*k+4*_atom_info[i].type_atoms+_atom_info[j].type_atoms] != 0.0)
|
||||
if (r < crit[16*k+4*_atom_info[i].type_atoms+_atom_info[j].type_atoms])
|
||||
{
|
||||
label_inter[label_mol[i]][label_mol[j]][4*type_atoms[i]+type_atoms[j]] = 1;
|
||||
label_inter[label_mol[i]][label_mol[j]][4*type_atoms[j]+type_atoms[i]] = 1;
|
||||
label_inter[label_mol[j]][label_mol[i]][4*type_atoms[i]+type_atoms[j]] = 1;
|
||||
label_inter[label_mol[j]][label_mol[i]][4*type_atoms[j]+type_atoms[i]] = 1;
|
||||
label_inter[_atom_info[i].label_mol][_atom_info[j].label_mol][4*_atom_info[i].type_atoms+_atom_info[j].type_atoms] = 1;
|
||||
label_inter[_atom_info[i].label_mol][_atom_info[j].label_mol][4*_atom_info[j].type_atoms+_atom_info[i].type_atoms] = 1;
|
||||
label_inter[_atom_info[j].label_mol][_atom_info[i].label_mol][4*_atom_info[i].type_atoms+_atom_info[j].type_atoms] = 1;
|
||||
label_inter[_atom_info[j].label_mol][_atom_info[i].label_mol][4*_atom_info[j].type_atoms+_atom_info[i].type_atoms] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<num_mol; i++)
|
||||
for (j=0; j<num_mol; j++)
|
||||
connect[i*num_mol+j] = 0;
|
||||
for (i=0; i<_system_info.num_mol; i++)
|
||||
for (j=0; j<_system_info.num_mol; j++)
|
||||
connect[i*_system_info.num_mol+j] = 0;
|
||||
|
||||
/// <pre> processing of initial connectivity matrix </pre>
|
||||
for (k=0; k<num_of_inter; k++)
|
||||
@ -90,8 +73,8 @@ int create_matrix (const int num_mol, const int num_atoms, const int *label_mol,
|
||||
if (crit[16*k+l] != 0.0)
|
||||
num_inter++;
|
||||
|
||||
for (i=0; i<num_mol; i++)
|
||||
for (j=i+1; j<num_mol; j++)
|
||||
for (i=0; i<_system_info.num_mol; i++)
|
||||
for (j=i+1; j<_system_info.num_mol; j++)
|
||||
{
|
||||
cur_num_inter = 0;
|
||||
for (l=0; l<16; l++)
|
||||
@ -99,20 +82,20 @@ int create_matrix (const int num_mol, const int num_atoms, const int *label_mol,
|
||||
|
||||
if (cur_num_inter == num_inter)
|
||||
{
|
||||
connect[i*num_mol+j] = 1;
|
||||
connect[j*num_mol+i] = 1;
|
||||
connect[i*_system_info.num_mol+j] = 1;
|
||||
connect[j*_system_info.num_mol+i] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <pre> free memory</pre>
|
||||
for (i=0; i<num_mol; i++)
|
||||
for (i=0; i<_system_info.num_mol; i++)
|
||||
{
|
||||
for (j=0; j<num_mol; j++)
|
||||
for (j=0; j<_system_info.num_mol; j++)
|
||||
free (label_inter[i][j]);
|
||||
free (label_inter[i]);
|
||||
}
|
||||
free (label_inter);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -4,29 +4,15 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <mathmech/stat_sort.h>
|
||||
#include <mathmech/var_types.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
/// <b>Work blocks</b>
|
||||
|
||||
// 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<num_mol; i++)
|
||||
for (i=0; i<_system_info.num_mol; i++)
|
||||
{
|
||||
bin[i] = 1;
|
||||
stat[i] = 0;
|
||||
num_mol_agl[i] = 0;
|
||||
for (j=0; j<num_mol; j++)
|
||||
agl[num_mol*i+j] = 0;
|
||||
for (j=0; j<_system_info.num_mol; j++)
|
||||
agl[_system_info.num_mol*i+j] = 0;
|
||||
}
|
||||
|
||||
/// <pre> select non-bonded molecules </pre>
|
||||
for (i=0; i<num_mol; i++)
|
||||
for (i=0; i<_system_info.num_mol; i++)
|
||||
{
|
||||
p = 0;
|
||||
for (j=0; j<num_mol; j++)
|
||||
p += connect[i*num_mol+j];
|
||||
for (j=0; j<_system_info.num_mol; j++)
|
||||
p += connect[i*_system_info.num_mol+j];
|
||||
if (p == 0)
|
||||
{
|
||||
bin[i] = 0;
|
||||
@ -65,18 +51,18 @@ int proc_matrix (const int num_mol, const int *connect, int *num_mol_agl, int *a
|
||||
|
||||
/// <pre> unwraping of connectivity matrix </pre>
|
||||
p = 0;
|
||||
for (i=0; i<num_mol; i++)
|
||||
for (i=0; i<_system_info.num_mol; i++)
|
||||
if (bin[i] == 1)
|
||||
{
|
||||
agl[num_mol*p+num_mol_agl[p]] = i;
|
||||
agl[_system_info.num_mol*p+num_mol_agl[p]] = i;
|
||||
num_mol_agl[p]++;
|
||||
bin[i] = 0;
|
||||
|
||||
for (j=0; j<num_mol_agl[p]; j++)
|
||||
for (k=0; k<num_mol; k++)
|
||||
if ((connect[agl[num_mol*p+j]*num_mol+k] == 1) && (bin[k] == 1))
|
||||
for (k=0; k<_system_info.num_mol; k++)
|
||||
if ((connect[agl[_system_info.num_mol*p+j]*_system_info.num_mol+k] == 1) && (bin[k] == 1))
|
||||
{
|
||||
agl[num_mol*p+num_mol_agl[p]] = k;
|
||||
agl[_system_info.num_mol*p+num_mol_agl[p]] = k;
|
||||
num_mol_agl[p]++;
|
||||
bin[k] = 0;
|
||||
}
|
||||
@ -97,4 +83,4 @@ int proc_matrix (const int num_mol, const int *connect, int *num_mol_agl, int *a
|
||||
free (bin);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -27,28 +27,27 @@ int main(int argc, char *argv[])
|
||||
*/
|
||||
{
|
||||
char tmp_str[2048];
|
||||
int error, i, *tmp_int;
|
||||
int error, i, tmp_int;
|
||||
FILE *f_inp, *f_log;
|
||||
|
||||
char *ch_type_atoms, input[256], logfile[256], output[256];
|
||||
float cell[3], *coords;
|
||||
int *label_mol, log, *needed_mol, num_atoms, num_mol, quiet, *true_label_mol;
|
||||
char input[256], logfile[256], output[256];
|
||||
float cell[3];
|
||||
int log, *needed_mol, num_atoms, num_mol, quiet, *true_label_mol;
|
||||
atom_info *_atom_info;
|
||||
|
||||
/* ch_type_atoms massive of char atom types
|
||||
* input input file name
|
||||
/* input input file name
|
||||
* logfile log file name
|
||||
* output output file name
|
||||
*
|
||||
* cell sell size
|
||||
* coords massive of coordinates
|
||||
*
|
||||
* label_mol massive of numbers of molecule for atoms
|
||||
* log status of log-mode
|
||||
* needed_mol massive of numbers of needed molecule
|
||||
* num_atoms number of atoms
|
||||
* num_mol number of molecules
|
||||
* quiet status of quiet-mode
|
||||
* true_label_mol massive of true numbers of molecule for atoms
|
||||
* _atom_info atom information structure
|
||||
*/
|
||||
|
||||
set_defaults (input, &log, output, &quiet);
|
||||
@ -131,18 +130,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
fscanf (f_inp, "%i", &num_atoms);
|
||||
fclose (f_inp);
|
||||
ch_type_atoms = (char *) malloc (2 * num_atoms * sizeof (char));
|
||||
coords = (float *) malloc (3 * 8 * num_atoms * sizeof (float));
|
||||
label_mol = (int *) malloc (8 * num_atoms * sizeof (int));
|
||||
_atom_info = (atom_info *) malloc (8 * num_atoms * sizeof (atom_info));
|
||||
needed_mol = (int *) malloc (num_atoms * sizeof (int));
|
||||
tmp_int = (int *) malloc (8 * num_atoms * sizeof (int));
|
||||
true_label_mol = (int *) malloc (num_atoms * sizeof (int));
|
||||
// error checking
|
||||
if ((ch_type_atoms == NULL) ||
|
||||
(coords == NULL) ||
|
||||
(label_mol == NULL) ||
|
||||
if ((_atom_info == NULL) ||
|
||||
(needed_mol == NULL) ||
|
||||
(tmp_int == NULL) ||
|
||||
(true_label_mol == NULL))
|
||||
{
|
||||
print_message (quiet, stderr, log, f_log, 19, argv[0]);
|
||||
@ -159,8 +152,8 @@ int main(int argc, char *argv[])
|
||||
// reading coordinates
|
||||
print_message (quiet, stdout, log, f_log, 7, input);
|
||||
error = 1;
|
||||
error = reading_coords (1, input, tmp_int[0], tmp_int, cell, &num_mol, &num_atoms,
|
||||
true_label_mol, label_mol, tmp_int, coords, ch_type_atoms);
|
||||
error = reading_coords (1, input, tmp_int, &tmp_int, cell, &num_mol, &num_atoms,
|
||||
true_label_mol, _atom_info);
|
||||
|
||||
// print coordinates
|
||||
if (error == 0)
|
||||
@ -170,8 +163,7 @@ int main(int argc, char *argv[])
|
||||
for (i=0; i<num_mol; i++)
|
||||
needed_mol[i] = 8 * i;
|
||||
error = 1;
|
||||
error = print_structure (output, num_mol, needed_mol, num_atoms,
|
||||
label_mol, ch_type_atoms, coords);
|
||||
error = print_structure (output, num_mol, needed_mol, num_atoms, _atom_info);
|
||||
}
|
||||
if (error == 0)
|
||||
print_message (quiet, stderr, log, f_log, 12, output);
|
||||
@ -180,11 +172,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
print_message (quiet, stdout, log, f_log, 15, argv[0]);
|
||||
// free memory
|
||||
free (ch_type_atoms);
|
||||
free (coords);
|
||||
free (label_mol);
|
||||
free (_atom_info);
|
||||
free (needed_mol);
|
||||
free (tmp_int);
|
||||
free (true_label_mol);
|
||||
|
||||
print_message (quiet, stdout, log, f_log, 16, argv[0]);
|
||||
|
Reference in New Issue
Block a user