diff --git a/stat_new/Makefile b/stat_new/Makefile index 7eeaca2..3db8da5 100644 --- a/stat_new/Makefile +++ b/stat_new/Makefile @@ -7,7 +7,7 @@ SOURCES=main.c coords.c int2str.c stat_print.c stat_select.c stat_sort.c summary OBJECTS=$(SOURCES:.c=.o) EXECUTABLE=statgen -$(STATGEN): $(SOURCES) $(EXECUTABLE) +$(PROJECT): $(SOURCES) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $@ diff --git a/stat_new/coords.c b/stat_new/coords.c index 8e7a82d..8bfea49 100644 --- a/stat_new/coords.c +++ b/stat_new/coords.c @@ -194,8 +194,8 @@ int reading_coords (char *filename, int type_inter, const int *label_atom, // 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+0] = not_tr_coords[3*i+0] - cell[0]; - 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]; label_mol[tr_num_atoms] = label_mol[i]; type_atoms[tr_num_atoms] = type_atoms[i]; diff --git a/stat_new/main.c b/stat_new/main.c index 9ce5876..c465f8f 100644 --- a/stat_new/main.c +++ b/stat_new/main.c @@ -4,6 +4,18 @@ #include +// prototypes +char conv (int, int); +int create_matrix (int, int, const int *, const int *, const float *, int, + const float *, int *); +int printing_agl (char *, char *, const int *, int, const int *, const int *, + const int *, const int *, int *); +int proc_matrix (int, const int *, int *, int *, int *, int *); +int reading_coords (char *, int, const int *, const float *, int *, int *, + int *, int *, int *, float *); +int summary_statistic (char *, int, int, const int *, const int *); + + int error_checking (const float *cell, int from, const char *input, int num_of_inter, const char *output, int to, int type_inter) { @@ -276,10 +288,10 @@ int main (int argc, char *argv[]) return 1; fscanf (f_inp, "%i", &num_atoms); fclose (f_inp); - coords = (float *) malloc (3 * num_atoms * sizeof (float)); - label_mol = (int *) malloc (num_atoms * sizeof (int)); - true_label_mol = (int *) malloc (num_atoms * sizeof (int)); - type_atoms = (int *) malloc (num_atoms * sizeof (int)); + coords = (float *) malloc (3 * 8 * num_atoms * sizeof (float)); + label_mol = (int *) malloc (8 * num_atoms * sizeof (int)); + true_label_mol = (int *) malloc (8 * num_atoms * sizeof (int)); + type_atoms = (int *) malloc (8 * num_atoms * sizeof (int)); // head printing_head (output, log, quiet, input, from, to, cell, type_inter, label_atom, @@ -302,29 +314,36 @@ int main (int argc, char *argv[]) agl = (int *) malloc (num_mol * num_mol * sizeof (int)); connect = (int *) malloc (num_mol * num_mol * sizeof (int)); num_mol_agl = (int *) malloc (num_mol * sizeof (int)); - if (num_mol_agl != NULL) - printf ("error\n"); stat = (int *) malloc (num_mol * sizeof (int)); stat_all = (int *) malloc (num_mol * sizeof (int)); } -// analyze - if (error == 0) + for (j=0; j -float radii (const float *a, const float *b) -/* a - [x, y, z] first point - * b - [x, y, z] second point - */ -{ - return sqrt (pow((a[0]-b[0]), 2) + pow((a[1]-b[1]), 2) + pow((a[2]-b[2]), 2)); -} - - int create_matrix (int num_mol, int num_atoms, const int *label_mol, const int *type_atoms, const float *coords, int num_of_inter, const float *crit, int *connect) @@ -32,9 +23,9 @@ int create_matrix (int num_mol, int num_atoms, const int *label_mol, * connect - connectivity graph for all molecules */ { - float x[2][3]; + float r; int cur_num_inter, i, j, k, l, num_inter, ***label_inter; -/* x - temporary coordinates +/* r - radius * cur_num_inter - current number of true interactions * num_inter - needed number of true interactions * label_inter - temporary massive of true interactions @@ -58,17 +49,17 @@ int create_matrix (int num_mol, int num_atoms, const int *label_mol, // if atoms from different molecules if (label_mol[i] != label_mol[j]) { - for (k=0; k<3; k++) - { - x[0][k] = coords[3*i+k]; - x[1][k] = coords[3*j+k]; - } + 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)); for (k=0; k