mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-07-04 01:25:47 +00:00
Prerelease statgen 1.0.1
This commit is contained in:
1165
stat/STAT_GEN.c
1165
stat/STAT_GEN.c
File diff suppressed because it is too large
Load Diff
@ -1,9 +0,0 @@
|
|||||||
Mask: meth
|
|
||||||
Trajectory step: 1 3 (first; last)
|
|
||||||
Cell dimention: 24.42 24.40 24.49 (a; b; c)
|
|
||||||
Parametr: 2 (0 - gen.stat; 1 - gen.stat and bonds length; 2 - gen.stat and bonds length and form of agl; 3 - stat for once molecule)
|
|
||||||
Interaction: 2 (1 - mono; 2 - di)
|
|
||||||
Atom types: 6 21 (1st atom, 2nd atom; or atom)
|
|
||||||
Criteria: 3.2 2.4 (1-1 criterion, 1-2 criterion; or 1-1 criterion)
|
|
||||||
Num of mol.for stat: 4
|
|
||||||
Output: out_all.dat
|
|
@ -6,6 +6,7 @@ int error_checking (const float *, const int, const char *, const int, const int
|
|||||||
int printing_head (const char *, const int, const int, const char *, const int,
|
int printing_head (const char *, const int, const int, const char *, const int,
|
||||||
const int, const float *, const int, const int *, const int,
|
const int, const float *, const int, const int *, const int,
|
||||||
const float *, const int);
|
const float *, const int);
|
||||||
|
int print_message (const int, FILE *, const int, FILE *, const int, const char *);
|
||||||
int set_defaults (float *, int *, char *, int *, int *, int *, char *, int *,
|
int set_defaults (float *, int *, char *, int *, int *, int *, char *, int *,
|
||||||
int *, int *);
|
int *, int *);
|
||||||
|
|
||||||
|
@ -13,15 +13,7 @@ set (PRIVATE_CLASSES)
|
|||||||
# headers only files
|
# headers only files
|
||||||
SET (HEADERS_ONLY)
|
SET (HEADERS_ONLY)
|
||||||
# public srcs
|
# public srcs
|
||||||
set (PUBLIC_CLASSES add_main
|
set (PUBLIC_CLASSES)
|
||||||
coords
|
|
||||||
graph
|
|
||||||
int2char
|
|
||||||
messages
|
|
||||||
stat_print
|
|
||||||
stat_select
|
|
||||||
stat_sort
|
|
||||||
summary_stat)
|
|
||||||
# public headers
|
# public headers
|
||||||
set (PUBLIC_HEADERS)
|
set (PUBLIC_HEADERS)
|
||||||
# shared libraries
|
# shared libraries
|
||||||
@ -31,6 +23,17 @@ else ()
|
|||||||
set (ADDITIONAL_LIB)
|
set (ADDITIONAL_LIB)
|
||||||
endif()
|
endif()
|
||||||
set (SOURCES)
|
set (SOURCES)
|
||||||
|
# for library
|
||||||
|
set (LIBRARY_NAME stat)
|
||||||
|
set (LIB_SOURCES add_main
|
||||||
|
coords
|
||||||
|
graph
|
||||||
|
int2char
|
||||||
|
messages
|
||||||
|
stat_print
|
||||||
|
stat_select
|
||||||
|
stat_sort
|
||||||
|
summary_stat)
|
||||||
|
|
||||||
# append list
|
# append list
|
||||||
foreach (class ${PRIVATE_CLASSES})
|
foreach (class ${PRIVATE_CLASSES})
|
||||||
@ -49,12 +52,15 @@ foreach (class ${PUBLIC_CLASSES})
|
|||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
# link libraries and compile
|
# link libraries and compile
|
||||||
|
add_library (${LIBRARY_NAME} SHARED ${LIB_SOURCES})
|
||||||
add_executable (${PROJECT} ${MAIN_SOURCES} ${SOURCES})
|
add_executable (${PROJECT} ${MAIN_SOURCES} ${SOURCES})
|
||||||
target_link_libraries (${PROJECT} ${ADDITIONAL_LIB})
|
target_link_libraries (${PROJECT} ${ADDITIONAL_LIB} ${LIBRARY_NAME})
|
||||||
|
|
||||||
# install properties
|
# install properties
|
||||||
INSTALL (TARGETS ${PROJECT}
|
INSTALL (TARGETS ${PROJECT}
|
||||||
DESTINATION bin)
|
DESTINATION bin)
|
||||||
|
INSTALL (TARGETS ${LIBRARY_NAME}
|
||||||
|
DESTINATION lib${LIB_SUFFIX})
|
||||||
if (ADD_INCLUDE)
|
if (ADD_INCLUDE)
|
||||||
INSTALL (FILES ${PUBLIC_HEADERS}
|
INSTALL (FILES ${PUBLIC_HEADERS}
|
||||||
DESTINATION include/${PROJECT})
|
DESTINATION include/${PROJECT})
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
// #include "messages.h"
|
||||||
|
|
||||||
|
|
||||||
int error_checking (const float *cell, const int from, const char *input,
|
int error_checking (const float *cell, const int from, const char *input,
|
||||||
@ -36,7 +39,7 @@ int printing_head (const char *output, const int log, const int quiet,
|
|||||||
FILE *f_out;
|
FILE *f_out;
|
||||||
|
|
||||||
f_out = fopen (output, "w");
|
f_out = fopen (output, "w");
|
||||||
fprintf (f_out, "statgen ::: V.1.0.0 ::: 2013-07-17\n\n");
|
fprintf (f_out, "statgen ::: V.1.0.1 ::: 2013-07-23\n\n");
|
||||||
fprintf (f_out, "CONFIGURATION\n");
|
fprintf (f_out, "CONFIGURATION\n");
|
||||||
|
|
||||||
fprintf (f_out, "LOG=%i\nQUIET=%i\n", log, quiet);
|
fprintf (f_out, "LOG=%i\nQUIET=%i\n", log, quiet);
|
||||||
@ -64,6 +67,18 @@ int printing_head (const char *output, const int log, const int quiet,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int print_message (const int quiet, FILE *std_output, const int log, FILE *f_log,
|
||||||
|
const int mode, const char *str)
|
||||||
|
{
|
||||||
|
if (quiet != 1)
|
||||||
|
message (0, mode, str, std_output);
|
||||||
|
if (log == 1)
|
||||||
|
message (1, mode, str, f_log);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int set_defaults (float *cell, int *from, char *input, int *log, int *max_depth,
|
int set_defaults (float *cell, int *from, char *input, int *log, int *max_depth,
|
||||||
int *num_of_inter, char *output, int *to, int *type_inter, int *quiet)
|
int *num_of_inter, char *output, int *to, int *type_inter, int *quiet)
|
||||||
{
|
{
|
||||||
|
@ -105,6 +105,9 @@ int graph_analyze (const int N, const int *matrix, const int max_depth, int *iso
|
|||||||
// convert to matrix of weight
|
// convert to matrix of weight
|
||||||
pn = (int *) malloc (N * sizeof (int));
|
pn = (int *) malloc (N * sizeof (int));
|
||||||
n_cycle = (int *) malloc ((depth - 2) * sizeof (int));
|
n_cycle = (int *) malloc ((depth - 2) * sizeof (int));
|
||||||
|
if ((pn == NULL) ||
|
||||||
|
(n_cycle == NULL))
|
||||||
|
return 1;
|
||||||
for (i=0; i<N; i++)
|
for (i=0; i<N; i++)
|
||||||
pn[i] = 0;
|
pn[i] = 0;
|
||||||
for (i=0; i<N; i++)
|
for (i=0; i<N; i++)
|
||||||
@ -129,5 +132,5 @@ int graph_analyze (const int N, const int *matrix, const int max_depth, int *iso
|
|||||||
free (n_cycle);
|
free (n_cycle);
|
||||||
free (pn);
|
free (pn);
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
@ -78,7 +78,7 @@ int main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
sprintf (tmp_str, " statgen\n");
|
sprintf (tmp_str, " statgen\n");
|
||||||
sprintf (tmp_str, "%sProgram for analyze molecular dynamic trajectories\n", tmp_str);
|
sprintf (tmp_str, "%sProgram for analyze molecular dynamic trajectories\n", tmp_str);
|
||||||
sprintf (tmp_str, "%sVersion : 1.0.0 License : GPL\n", tmp_str);
|
sprintf (tmp_str, "%sVersion : 1.0.1 License : GPL\n", tmp_str);
|
||||||
sprintf (tmp_str, "%s Evgeniy Alekseev aka arcanis\n", tmp_str);
|
sprintf (tmp_str, "%s Evgeniy Alekseev aka arcanis\n", tmp_str);
|
||||||
sprintf (tmp_str, "%s E-mail : esalexeev@gmail.com\n\n", tmp_str);
|
sprintf (tmp_str, "%s E-mail : esalexeev@gmail.com\n\n", tmp_str);
|
||||||
sprintf (tmp_str, "%sUsage:\n", tmp_str);
|
sprintf (tmp_str, "%sUsage:\n", tmp_str);
|
||||||
@ -132,6 +132,8 @@ int main (int argc, char *argv[])
|
|||||||
type_inter++;
|
type_inter++;
|
||||||
|
|
||||||
label_atom = (int *) malloc (type_inter * sizeof (int));
|
label_atom = (int *) malloc (type_inter * sizeof (int));
|
||||||
|
if (label_atom == NULL)
|
||||||
|
return 1;
|
||||||
switch (type_inter)
|
switch (type_inter)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@ -198,16 +200,8 @@ int main (int argc, char *argv[])
|
|||||||
if (log == 1)
|
if (log == 1)
|
||||||
f_log = fopen (logfile, "w");
|
f_log = fopen (logfile, "w");
|
||||||
|
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 0, argv[0]);
|
||||||
{
|
print_message (quiet, stdout, log, f_log, 1, argv[0]);
|
||||||
message (0, 0, argv[0], stdout);
|
|
||||||
message (0, 1, argv[0], stdout);
|
|
||||||
}
|
|
||||||
if (log == 1)
|
|
||||||
{
|
|
||||||
message (1, 0, argv[0], f_log);
|
|
||||||
message (1, 1, argv[0], f_log);
|
|
||||||
}
|
|
||||||
|
|
||||||
// error checking
|
// error checking
|
||||||
error = error_checking (cell, from, input, max_depth, num_of_inter, output, to,
|
error = error_checking (cell, from, input, max_depth, num_of_inter, output, to,
|
||||||
@ -221,10 +215,7 @@ int main (int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 2, argv[0]);
|
||||||
message (0, 2, argv[0], stdout);
|
|
||||||
if (log == 1)
|
|
||||||
message (1, 2, argv[0], f_log);
|
|
||||||
|
|
||||||
// processing
|
// processing
|
||||||
// initial variables
|
// initial variables
|
||||||
@ -235,10 +226,7 @@ int main (int argc, char *argv[])
|
|||||||
filename[k+2] = conv (from, 2);
|
filename[k+2] = conv (from, 2);
|
||||||
filename[k+3] = conv (from, 1);
|
filename[k+3] = conv (from, 1);
|
||||||
filename[k+4] = '\0';
|
filename[k+4] = '\0';
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 3, filename);
|
||||||
message (0, 3, filename, stdout);
|
|
||||||
if (log == 1)
|
|
||||||
message (1, 3, filename, f_log);
|
|
||||||
f_inp = fopen (filename, "r");
|
f_inp = fopen (filename, "r");
|
||||||
if (f_inp == NULL)
|
if (f_inp == NULL)
|
||||||
{
|
{
|
||||||
@ -282,58 +270,31 @@ int main (int argc, char *argv[])
|
|||||||
// set type_agl to zero
|
// set type_agl to zero
|
||||||
for (i=0; i<max_depth+2; i++)
|
for (i=0; i<max_depth+2; i++)
|
||||||
type_agl[i] = 0;
|
type_agl[i] = 0;
|
||||||
if (quiet != 1)
|
sprintf (tmp_str, "%6cOutput file: '%s';\n%6cLog: %i;\n%6cQuiet: %i;\n\
|
||||||
{
|
|
||||||
sprintf (tmp_str, "%6cOutput file: '%s';\n%6cLog: %i;\n%6cQuiet: %i;\n\
|
|
||||||
%6cMask: %s;\n%6cFirst step: %i;\n%6cLast step: %i;\n%6cCell size: %.4f, %.4f, %.4f;\n\
|
%6cMask: %s;\n%6cFirst step: %i;\n%6cLast step: %i;\n%6cCell size: %.4f, %.4f, %.4f;\n\
|
||||||
%6cSelect atoms: %i", ' ', output, ' ', log, ' ', quiet, ' ', input, ' ', from,
|
%6cSelect atoms: %i", ' ', output, ' ', log, ' ', quiet, ' ', input, ' ', from,
|
||||||
' ' , to, ' ', cell[0], cell[1], cell[2], ' ' , label_atom[0]);
|
' ' , to, ' ', cell[0], cell[1], cell[2], ' ' , label_atom[0]);
|
||||||
for (i=1; i<type_inter; i++)
|
for (i=1; i<type_inter; i++)
|
||||||
sprintf (tmp_str, "%s,%i", tmp_str, label_atom[i]);
|
sprintf (tmp_str, "%s,%i", tmp_str, label_atom[i]);
|
||||||
sprintf (tmp_str, "%s;\n", tmp_str);
|
sprintf (tmp_str, "%s;\n", tmp_str);
|
||||||
for (i=0; i<num_of_inter; i++)
|
for (i=0; i<num_of_inter; i++)
|
||||||
{
|
|
||||||
sprintf (tmp_str, "%s%6cInteraction: ", tmp_str, ' ');
|
|
||||||
for (j=0; j<16; j++)
|
|
||||||
if ((crit[16*i+j] != 0.0) &&
|
|
||||||
((j != 4) && (j != 8) && (j != 9) && (j != 12) && (j != 13) && (j != 14)))
|
|
||||||
sprintf (tmp_str, "%s%i-%i:%4.2f,", tmp_str, j/4, j%4, crit[16*i+j]);
|
|
||||||
sprintf (tmp_str, "%s;\n", tmp_str);
|
|
||||||
}
|
|
||||||
sprintf (tmp_str, "%s%6cIsomorphism check: %i\n", tmp_str, ' ', max_depth);
|
|
||||||
message (0, 5, tmp_str, stdout);
|
|
||||||
}
|
|
||||||
if (log == 1)
|
|
||||||
{
|
{
|
||||||
sprintf (tmp_str, "%34cOutput file: '%s';\n%34cLog: %i;\n%34cQuiet: %i;\n\
|
sprintf (tmp_str, "%s%6cInteraction: ", tmp_str, ' ');
|
||||||
%34cMask: %s;\n%34cFirst step: %i;\n%34cLast step: %i;\n%34cCell size: %.4f, %.4f, %.4f;\n\
|
for (j=0; j<16; j++)
|
||||||
%34cSelect atoms: %i", ' ', output, ' ', log, ' ', quiet, ' ', input, ' ', from,
|
if ((crit[16*i+j] != 0.0) &&
|
||||||
' ' , to, ' ', cell[0], cell[1], cell[2], ' ' , label_atom[0]);
|
((j != 4) && (j != 8) && (j != 9) && (j != 12) && (j != 13) && (j != 14)))
|
||||||
for (i=1; i<type_inter; i++)
|
sprintf (tmp_str, "%s%i-%i:%4.2f,", tmp_str, j/4, j%4, crit[16*i+j]);
|
||||||
sprintf (tmp_str, "%s,%i", tmp_str, label_atom[i]);
|
|
||||||
sprintf (tmp_str, "%s;\n", tmp_str);
|
sprintf (tmp_str, "%s;\n", tmp_str);
|
||||||
for (i=0; i<num_of_inter; i++)
|
|
||||||
{
|
|
||||||
sprintf (tmp_str, "%s%34cInteraction: ", tmp_str, ' ');
|
|
||||||
for (j=0; j<16; j++)
|
|
||||||
if ((crit[16*i+j] != 0.0) &&
|
|
||||||
((j != 4) && (j != 8) && (j != 9) && (j != 12) && (j != 13) && (j != 14)))
|
|
||||||
sprintf (tmp_str, "%s%i-%i:%4.2f,", tmp_str, j/4, j%4, crit[16*i+j]);
|
|
||||||
sprintf (tmp_str, "%s;\n", tmp_str);
|
|
||||||
}
|
|
||||||
sprintf (tmp_str, "%s%34cIsomorphism check: %i\n", tmp_str, ' ', max_depth);
|
|
||||||
message (1, 5, tmp_str, f_log);
|
|
||||||
}
|
}
|
||||||
|
sprintf (tmp_str, "%s%6cIsomorphism check: %i\n", tmp_str, ' ', max_depth);
|
||||||
|
print_message (quiet, stdout, log, f_log, 5, tmp_str);
|
||||||
|
|
||||||
// head
|
// head
|
||||||
printing_head (output, log, quiet, input, from, to, cell, type_inter, label_atom,
|
printing_head (output, log, quiet, input, from, to, cell, type_inter, label_atom,
|
||||||
num_of_inter, crit, max_depth);
|
num_of_inter, crit, max_depth);
|
||||||
|
|
||||||
// main cycle
|
// main cycle
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 6, argv[0]);
|
||||||
message (0, 6, argv[0], stdout);
|
|
||||||
if (log == 1)
|
|
||||||
message (1, 6, argv[0], f_log);
|
|
||||||
for (i=from; i<to+1; i++)
|
for (i=from; i<to+1; i++)
|
||||||
{
|
{
|
||||||
// reading coordinates
|
// reading coordinates
|
||||||
@ -341,26 +302,14 @@ int main (int argc, char *argv[])
|
|||||||
filename[k+2] = conv (i, 2);
|
filename[k+2] = conv (i, 2);
|
||||||
filename[k+3] = conv (i, 1);
|
filename[k+3] = conv (i, 1);
|
||||||
filename[k+4] = '\0';
|
filename[k+4] = '\0';
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 7, filename);
|
||||||
message (0, 7, filename, stdout);
|
|
||||||
if (log == 1)
|
|
||||||
message (1, 7, filename, f_log);
|
|
||||||
error = reading_coords (filename, type_inter, label_atom, cell, &num_mol,
|
error = reading_coords (filename, type_inter, label_atom, cell, &num_mol,
|
||||||
&num_atoms, true_label_mol, label_mol, type_atoms, coords);
|
&num_atoms, true_label_mol, label_mol, type_atoms, coords);
|
||||||
if (error != 1)
|
if (error != 1)
|
||||||
{
|
{
|
||||||
if (quiet != 1)
|
sprintf (tmp_str, "%6cNumber of molecules: %i; %6cNumber of atoms: %i\n",
|
||||||
{
|
|
||||||
sprintf (tmp_str, "%6cNumber of molecules: %i\n%6cNumber of atoms: %i\n",
|
|
||||||
' ', num_mol, ' ', num_atoms);
|
' ', num_mol, ' ', num_atoms);
|
||||||
message (0, 8, tmp_str, stdout);
|
print_message (quiet, stdout, log, f_log, 8, tmp_str);
|
||||||
}
|
|
||||||
if (log == 1)
|
|
||||||
{
|
|
||||||
sprintf (tmp_str, "%6cNumber of molecules: %i\n%34cNumber of atoms: %i\n",
|
|
||||||
' ', num_mol, ' ', num_atoms);
|
|
||||||
message (1, 8, tmp_str, f_log);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// resize dynamic arrays
|
// resize dynamic arrays
|
||||||
@ -387,62 +336,37 @@ int main (int argc, char *argv[])
|
|||||||
fputs (tmp_str, f_log);
|
fputs (tmp_str, f_log);
|
||||||
return 18;
|
return 18;
|
||||||
}
|
}
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 9, argv[0]);
|
||||||
message (0, 9, argv[0], stdout);
|
|
||||||
if (log == 1)
|
|
||||||
message (1, 9, argv[0], f_log);
|
|
||||||
|
|
||||||
// analyze
|
// analyze
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
{
|
{
|
||||||
error = 1;
|
error = 1;
|
||||||
error = create_matrix (num_mol, num_atoms, label_mol, type_atoms, coords,
|
error = create_matrix (num_mol, num_atoms, label_mol, type_atoms, coords,
|
||||||
num_of_inter, crit, connect);
|
num_of_inter, crit, connect);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
{
|
{
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 10, argv[0]);
|
||||||
message (0, 10, argv[0], stdout);
|
|
||||||
if (log == 1)
|
|
||||||
message (1, 10, argv[0], f_log);
|
|
||||||
error = 1;
|
error = 1;
|
||||||
error = proc_matrix (num_mol, connect, num_mol_agl, agl, stat, stat_all);
|
error = proc_matrix (num_mol, connect, num_mol_agl, agl, stat, stat_all);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
{
|
{
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 11, argv[0]);
|
||||||
message (0, 11, argv[0], stdout);
|
|
||||||
if (log == 1)
|
|
||||||
message (1, 11, argv[0], f_log);
|
|
||||||
error = printing_agl (filename, output, connect, num_mol, true_label_mol,
|
error = printing_agl (filename, output, connect, num_mol, true_label_mol,
|
||||||
num_mol_agl, agl, stat, max_depth, type_agl);
|
num_mol_agl, agl, stat, max_depth, type_agl);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
{
|
print_message (quiet, stdout, log, f_log, 12, output);
|
||||||
if (quiet != 1)
|
|
||||||
message (0, 12, output, stdout);
|
|
||||||
if (log == 1)
|
|
||||||
message (1, 12, output, f_log);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 13, argv[0]);
|
||||||
{
|
print_message (quiet, stdout, log, f_log, 14, output);
|
||||||
message (0, 13, argv[0], stdout);
|
|
||||||
message (0, 14, output, stdout);
|
|
||||||
}
|
|
||||||
if (log == 1)
|
|
||||||
{
|
|
||||||
message (1, 13, argv[0], f_log);
|
|
||||||
message (1, 14, output, f_log);
|
|
||||||
}
|
|
||||||
// tail
|
// tail
|
||||||
summary_statistic (output, step, num_mol, max_depth, type_agl, stat_all);
|
summary_statistic (output, step, num_mol, max_depth, type_agl, stat_all);
|
||||||
|
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 15, argv[0]);
|
||||||
message (0, 15, argv[0], stdout);
|
|
||||||
if (log == 1)
|
|
||||||
message (1, 15, argv[0], f_log);
|
|
||||||
// free memory
|
// free memory
|
||||||
free (agl);
|
free (agl);
|
||||||
free (connect);
|
free (connect);
|
||||||
@ -456,10 +380,7 @@ int main (int argc, char *argv[])
|
|||||||
free (type_agl);
|
free (type_agl);
|
||||||
free (type_atoms);
|
free (type_atoms);
|
||||||
|
|
||||||
if (quiet != 1)
|
print_message (quiet, stdout, log, f_log, 16, argv[0]);
|
||||||
message (0, 16, argv[0], stdout);
|
|
||||||
if (log == 1)
|
|
||||||
message (1, 16, argv[0], f_log);
|
|
||||||
|
|
||||||
if (log == 1)
|
if (log == 1)
|
||||||
fclose (f_log);
|
fclose (f_log);
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
/* Library for printing messages at stdout
|
/* Library for printing messages at output
|
||||||
*
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* message (log, mode, text, stdout)
|
* message (log, mode, text, output)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
int message (const int log, const int mode, const char *text, FILE *stdout)
|
int message (const int log, const int mode, const char *text, FILE *output)
|
||||||
/* mode - number of message
|
/* mode - number of message
|
||||||
* text - additional text
|
* text - additional text
|
||||||
*/
|
*/
|
||||||
@ -18,17 +18,17 @@ int message (const int log, const int mode, const char *text, FILE *stdout)
|
|||||||
if (log == 1)
|
if (log == 1)
|
||||||
{
|
{
|
||||||
char time_str[256];
|
char time_str[256];
|
||||||
time_t t = time(NULL);
|
time_t t = time (NULL);
|
||||||
struct tm* aTm = localtime(&t);
|
struct tm* aTm = localtime (&t);
|
||||||
sprintf(time_str, "[%04d-%02d-%02d %02d:%02d:%02d] [%2i]: ", aTm->tm_year+1900,
|
sprintf (time_str, "[%04d-%02d-%02d %02d:%02d:%02d] [%2i]: ", aTm->tm_year+1900,
|
||||||
aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec, mode);
|
aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec, mode);
|
||||||
fputs (time_str, stdout);
|
fputs (time_str, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
sprintf (out, "Starting program: '%s' (Ver.1.0.0)\n", text);
|
sprintf (out, "Starting program: '%s'\n", text);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sprintf (out, "Checking errors\n");
|
sprintf (out, "Checking errors\n");
|
||||||
@ -79,6 +79,6 @@ int message (const int log, const int mode, const char *text, FILE *stdout)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs (out, stdout);
|
fputs (out, output);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -27,7 +27,7 @@ int printing_agl (const char *input, const char *output, const int *connect,
|
|||||||
* type_agl - massive of numbers of aglomerate types
|
* type_agl - massive of numbers of aglomerate types
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int i, *iso, j, k, *label_matrix, *matrix;
|
int error, i, *iso, j, k, *label_matrix, *matrix;
|
||||||
FILE *f_out;
|
FILE *f_out;
|
||||||
/* iso - isomorphic graph in database
|
/* iso - isomorphic graph in database
|
||||||
* label_matrix - massive of indexes of molecule
|
* label_matrix - massive of indexes of molecule
|
||||||
@ -36,6 +36,8 @@ int printing_agl (const char *input, const char *output, const int *connect,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
iso = (int *) malloc (max_depth * sizeof (int));
|
iso = (int *) malloc (max_depth * sizeof (int));
|
||||||
|
if (iso == NULL)
|
||||||
|
return 1;
|
||||||
f_out = fopen (output, "a");
|
f_out = fopen (output, "a");
|
||||||
|
|
||||||
// head
|
// head
|
||||||
@ -50,14 +52,14 @@ int printing_agl (const char *input, const char *output, const int *connect,
|
|||||||
if (num_mol_agl[i] > 0)
|
if (num_mol_agl[i] > 0)
|
||||||
{
|
{
|
||||||
// creating connectivity graph
|
// creating connectivity graph
|
||||||
matrix = (int *) malloc (num_mol_agl[i] * num_mol_agl[i] * sizeof (int));
|
|
||||||
for (j=0; j<num_mol_agl[i]; j++)
|
|
||||||
for (k=0; k<num_mol_agl[i]; k++)
|
|
||||||
matrix[num_mol_agl[i]*j+k] = 0;
|
|
||||||
label_matrix = (int *) malloc (num_mol * sizeof (int));
|
label_matrix = (int *) malloc (num_mol * sizeof (int));
|
||||||
|
matrix = (int *) malloc (num_mol_agl[i] * num_mol_agl[i] * sizeof (int));
|
||||||
if ((matrix == NULL) ||
|
if ((matrix == NULL) ||
|
||||||
(label_matrix == NULL))
|
(label_matrix == NULL))
|
||||||
return 1;
|
return 1;
|
||||||
|
for (j=0; j<num_mol_agl[i]; j++)
|
||||||
|
for (k=0; k<num_mol_agl[i]; k++)
|
||||||
|
matrix[num_mol_agl[i]*j+k] = 0;
|
||||||
|
|
||||||
for (j=0; j<num_mol_agl[i]; j++)
|
for (j=0; j<num_mol_agl[i]; j++)
|
||||||
label_matrix[agl[num_mol*i+j]] = j;
|
label_matrix[agl[num_mol*i+j]] = j;
|
||||||
@ -71,7 +73,9 @@ int printing_agl (const char *input, const char *output, const int *connect,
|
|||||||
|
|
||||||
// graph topology analyze
|
// graph topology analyze
|
||||||
if (max_depth > 0)
|
if (max_depth > 0)
|
||||||
graph_analyze (num_mol_agl[i], matrix, max_depth, iso);
|
error = graph_analyze (num_mol_agl[i], matrix, max_depth, iso);
|
||||||
|
if (error > 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
// printing class of aglomerate
|
// printing class of aglomerate
|
||||||
fprintf (f_out, "AGL=%i=", num_mol_agl[i]);
|
fprintf (f_out, "AGL=%i=", num_mol_agl[i]);
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
# set directories
|
# set directories
|
||||||
set ("${PROJECT}_BINARY_DIR" bin)
|
set (${PROJECT}_BINARY_DIR bin)
|
||||||
set ("${PROJECT}_SOURCE_DIR" src:include)
|
set (${PROJECT}_SOURCE_DIR src:include)
|
||||||
set ("${PROJECT}_LIB_DIR" lib)
|
set (${PROJECT}_LIB_DIR lib)
|
||||||
|
|
||||||
set (CMAKE_INCLUDE_PATH ${${PROJECT}_SOURCE_DIR})
|
set (CMAKE_INCLUDE_PATH ${${PROJECT}_SOURCE_DIR})
|
||||||
set (CMAKE_LIBRARY_PATH ${${PROJECT}_LIB_DIR})
|
set (CMAKE_LIBRARY_PATH ${${PROJECT}_LIB_DIR})
|
||||||
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/${${PROJECT}_BINARY_DIR})
|
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/${${PROJECT}_BINARY_DIR})
|
||||||
set (CMAKE_VERBOSE_MAKEFILE ON)
|
set (CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
set (CMAKE_BUILD_TYPE Debug)
|
|
||||||
|
|
||||||
if ( WITH_DEBUG_MODE )
|
if ( WITH_DEBUG_MODE )
|
||||||
ADD_DEFINITIONS ( -DDEBUG_MODE=1 )
|
ADD_DEFINITIONS ( -DDEBUG_MODE=1 )
|
||||||
@ -18,5 +17,5 @@ if ( CMAKE_COMPILER_IS_GNUCXX )
|
|||||||
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")
|
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")
|
||||||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||||
else ()
|
else ()
|
||||||
message ("not yet")
|
message ("Not enabled")
|
||||||
endif ()
|
endif ()
|
Reference in New Issue
Block a user