/**
* @file
*/
/**
* @mainpage mm_statgen
* @image latex ./logo.png
*
* @section intro_sec Introduction
*
* About this program:
*
* - Program that analyzes molecular dynamic trajectories using topological analysis
*
*
* Developer:
*
* - Evgeniy Alekseev aka arcanis
*
* License:
*
*
* @section How-To-Use How to use
* Usage:
*
* mm_statgen -i INPUT -s FIRST,LAST -c X,Y,Z -a ... -r ... -o OUTPUT [ -g DEPTH ]
* [ -l LOGFILE ] [ -q ] [ -h ]
*
* Parametrs:
* -i - mask of input files
* -s - trajectory steps (integer)
* -c - cell size (float), A
* -a - atom types (integer). Format: 'ATOM1' or 'ATOM1,ATOM2' or etc
* -r - criteria (float), A. Format: '0-0:2.4,0-1:3.0' means 0-0-interaction
* (<2.4 A) and 0-1 (<3.0) are needed. This flag can be used multiple times
* -o - output file name
* -g - check graph isomorphism. DEPTH is max depth for check cycles (>= 3)
* -l - log enable
* -q - quiet enable
* -h - show this help and exit
*
*
* @page Install
*
* @section Requirements Requirements
* The application mm_statgen requires the following external stuff:
* - cmake >= 2.8
* - gcc >= 4.8
*
* @section How-To How to install
*
* @subsection Linux Linux
* @code
* mkdir build && cd build
* cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ../
* make
* make install
* @endcode
*
* @subsection Windows Windows
* @code
* create project file using 'cmake'
* compile project
* @endcode
* You may also download compiled executable file for Win_x86.
*
* @page Changelog
* V.1.0.1 (2013-07-27)
* * initial release
*/
#include
#include
#include
#include
#include
#include "add_main.h"
#include "coords.h"
#include "messages.h"
#include "stat_print.h"
#include "stat_select.h"
#include "stat_sort.h"
#include "summary_stat.h"
/**
* @fn main
*/
int main (int argc, char *argv[])
/**
* @return 1 - error in error_checking
* @return 2 - input file does not exist
* @return 3 - memory error
* @return 4 - unknown flag
* @return 0 - exit without errors
*/
{
char filename[256], tmp_str[2048];
int error, i, index, j, label[2];
float label_fl;
FILE *f_inp, *f_log;
char input[256], logfile[256], output[256];
float cell[3], *coords, *crit;
int *agl, *connect, from, *label_atom, *label_mol, log, max_depth, num_atoms,
num_mol, *num_mol_agl, num_of_inter, *stat, *stat_all, step, to,
*true_label_mol, *type_agl, *type_atoms, type_inter, quiet;
/* input mask of trajectory files
* logfile log file name
* output output file name
*
* cell massive of cell size
* coords massive of coordinates
* crit massive of criteria
*
* agl massive of aglomerates
* connect connectivity graph for all molecules
* from first trajectory step
* label_atom massive of atom types for interactions
* label_mol massive of numbers of molecule for atoms
* log status of log-mode
* max_depth maximum depth for check cycles in graph analyze
* num_atoms number of atoms
* num_mol number of molecules
* num_mol_agl massive of number of molecules in aglomerates
* num_of_inter number of different interactions
* stat massive of statistic
* stat_all massive of summary statistic
* step $(to - from + 1)
* to last trajectory step
* true_label_mol massive of true numbers of molecule for atoms
* type_agl massive of number of aglomerate types
* type_atoms massive of atom types
* type_inter number of atoms for interactions
* quiet status of quiet-mode
*/
set_defaults (cell, &from, input, &log, &max_depth, &num_of_inter, output, &to,
&type_inter, &quiet);
// reading number of interactions
for (i=1; i 0)
{
crit = (float *) malloc ( 16 * num_of_inter * sizeof (float));
if (crit == NULL)
return 3;
for (i=0; i<16*num_of_inter; i++)
crit[i] = 0.0;
num_of_inter = 0;
}
// reading arguments
for (i=1; i= 3)\n", tmp_str);
sprintf (tmp_str, "%s -l - log enable\n", tmp_str);
sprintf (tmp_str, "%s -q - quiet enable\n", tmp_str);
sprintf (tmp_str, "%s -h - show this help and exit\n", tmp_str);
fputs (tmp_str, stdout);
return 0;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'i') && (argv[i][2] == '\0'))
// mask of input files
{
strcpy (input, argv[i+1]);
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 's') && (argv[i][2] == '\0'))
// steps
{
sscanf (argv[i+1], "%i,%i", &from, &to);
if (from > to)
{
to += from;
from = to - from;
to -= from;
}
step = to - from + 1;
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'c') && (argv[i][2] == '\0'))
// cell size
{
sscanf (argv[i+1], "%f,%f,%f", &cell[0], &cell[1], &cell[2]);
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'a') && (argv[i][2] == '\0'))
// atom types
{
type_inter = 1;
for (j=0; j