mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-06-29 07:05:48 +00:00
Removed nested conditions
This commit is contained in:
@ -222,11 +222,11 @@ int main(int argc, char *argv[])
|
|||||||
true_label_mol = (int *) malloc (num_atoms * sizeof (int));
|
true_label_mol = (int *) malloc (num_atoms * sizeof (int));
|
||||||
// error checking
|
// error checking
|
||||||
if ((ch_type_atoms == NULL) ||
|
if ((ch_type_atoms == NULL) ||
|
||||||
(coords == NULL) ||
|
(coords == NULL) ||
|
||||||
(label_mol == NULL) ||
|
(label_mol == NULL) ||
|
||||||
(needed_mol == NULL) ||
|
(needed_mol == NULL) ||
|
||||||
(tmp_int == NULL) ||
|
(tmp_int == NULL) ||
|
||||||
(true_label_mol == NULL))
|
(true_label_mol == NULL))
|
||||||
{
|
{
|
||||||
print_message (quiet, stderr, log, f_log, 19, argv[0]);
|
print_message (quiet, stderr, log, f_log, 19, argv[0]);
|
||||||
return 3;
|
return 3;
|
||||||
@ -248,6 +248,7 @@ int main(int argc, char *argv[])
|
|||||||
print_message (quiet, stdout, log, f_log, 8, tmp_str);
|
print_message (quiet, stdout, log, f_log, 8, tmp_str);
|
||||||
// reading coordinates
|
// reading coordinates
|
||||||
print_message (quiet, stdout, log, f_log, 7, input);
|
print_message (quiet, stdout, log, f_log, 7, input);
|
||||||
|
error = 1;
|
||||||
error = reading_coords (2, input, num_needed_mol, needed_mol, cell, &num_mol,
|
error = reading_coords (2, input, num_needed_mol, needed_mol, cell, &num_mol,
|
||||||
&num_atoms, true_label_mol, label_mol, tmp_int, coords,
|
&num_atoms, true_label_mol, label_mol, tmp_int, coords,
|
||||||
ch_type_atoms);
|
ch_type_atoms);
|
||||||
@ -257,31 +258,32 @@ int main(int argc, char *argv[])
|
|||||||
print_message (quiet, stderr, log, f_log, 19, argv[0]);
|
print_message (quiet, stderr, log, f_log, 19, argv[0]);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// analyze
|
// analyze
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
{
|
{
|
||||||
sprintf (tmp_str, "%6cNumber of molecules: %i; %6cNumber of atoms: %i\n",
|
sprintf (tmp_str, "%6cNumber of molecules: %i; %6cNumber of atoms: %i\n",
|
||||||
' ', num_mol, ' ', num_atoms);
|
' ', num_mol, ' ', num_atoms);
|
||||||
print_message (quiet, stdout, log, f_log, 8, tmp_str);
|
print_message (quiet, stdout, log, f_log, 8, tmp_str);
|
||||||
error = 1;
|
error = 1;
|
||||||
error = set_center (num_atoms, num_mol, label_mol, coords, centr_coords);
|
error = set_center (num_atoms, num_mol, label_mol, coords, centr_coords);
|
||||||
if (error == 0)
|
|
||||||
{
|
|
||||||
print_message (quiet, stderr, log, f_log, 20, argv[0]);
|
|
||||||
error = 1;
|
|
||||||
error = select_molecule (centr_coords, num_needed_mol, needed_mol);
|
|
||||||
if (error == 0)
|
|
||||||
{
|
|
||||||
print_message (quiet, stderr, log, f_log, 4, argv[0]);
|
|
||||||
error = 1;
|
|
||||||
error = print_structure (output, num_needed_mol, needed_mol, num_atoms,
|
|
||||||
label_mol, ch_type_atoms, coords);
|
|
||||||
print_message (quiet, stderr, log, f_log, 12, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (error == 0)
|
||||||
|
{
|
||||||
|
print_message (quiet, stderr, log, f_log, 20, argv[0]);
|
||||||
|
error = 1;
|
||||||
|
error = select_molecule (centr_coords, num_needed_mol, needed_mol);
|
||||||
|
}
|
||||||
|
if (error == 0)
|
||||||
|
{
|
||||||
|
print_message (quiet, stderr, log, f_log, 4, argv[0]);
|
||||||
|
error = 1;
|
||||||
|
error = print_structure (output, num_needed_mol, needed_mol, num_atoms,
|
||||||
|
label_mol, ch_type_atoms, coords);
|
||||||
|
}
|
||||||
|
if (error == 0)
|
||||||
|
print_message (quiet, stderr, log, f_log, 12, output);
|
||||||
|
|
||||||
print_message (quiet, stderr, log, f_log, 13, argv[0]);
|
print_message (quiet, stderr, log, f_log, 13, argv[0]);
|
||||||
|
|
||||||
|
@ -231,10 +231,10 @@ int main(int argc, char *argv[])
|
|||||||
true_label_mol = (int *) malloc (num_atoms * sizeof (int));
|
true_label_mol = (int *) malloc (num_atoms * sizeof (int));
|
||||||
// error checking
|
// error checking
|
||||||
if ((ch_type_atoms == NULL) ||
|
if ((ch_type_atoms == NULL) ||
|
||||||
(coords == NULL) ||
|
(coords == NULL) ||
|
||||||
(label_mol == NULL) ||
|
(label_mol == NULL) ||
|
||||||
(tmp_int == NULL) ||
|
(tmp_int == NULL) ||
|
||||||
(true_label_mol == NULL))
|
(true_label_mol == NULL))
|
||||||
{
|
{
|
||||||
print_message (quiet, stderr, log, f_log, 19, argv[0]);
|
print_message (quiet, stderr, log, f_log, 19, argv[0]);
|
||||||
return 3;
|
return 3;
|
||||||
@ -249,6 +249,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// reading coordinates
|
// reading coordinates
|
||||||
print_message (quiet, stdout, log, f_log, 7, input);
|
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,
|
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);
|
true_label_mol, label_mol, tmp_int, coords, ch_type_atoms);
|
||||||
centr_coords = (float *) malloc (3 * 8 * num_mol * sizeof (float));
|
centr_coords = (float *) malloc (3 * 8 * num_mol * sizeof (float));
|
||||||
@ -261,7 +262,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
// error checking
|
// error checking
|
||||||
if ((centr_coords == NULL) ||
|
if ((centr_coords == NULL) ||
|
||||||
(needed_mol == NULL))
|
(needed_mol == NULL))
|
||||||
{
|
{
|
||||||
print_message (quiet, stderr, log, f_log, 19, argv[0]);
|
print_message (quiet, stderr, log, f_log, 19, argv[0]);
|
||||||
return 3;
|
return 3;
|
||||||
@ -272,22 +273,23 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
error = 1;
|
error = 1;
|
||||||
error = set_center (num_atoms, num_mol, label_mol, coords, centr_coords);
|
error = set_center (num_atoms, num_mol, label_mol, coords, centr_coords);
|
||||||
if (error == 0)
|
|
||||||
{
|
|
||||||
print_message (quiet, stderr, log, f_log, 20, argv[0]);
|
|
||||||
error = 1;
|
|
||||||
error = search_envir (num_of_mol, num_mol, centr_coords, rad, needed_mol,
|
|
||||||
&num_needed_mol);
|
|
||||||
if (error == 0)
|
|
||||||
{
|
|
||||||
print_message (quiet, stderr, log, f_log, 21, argv[0]);
|
|
||||||
error = 1;
|
|
||||||
error = print_structure (output, num_needed_mol, needed_mol, num_atoms,
|
|
||||||
label_mol, ch_type_atoms, coords);
|
|
||||||
print_message (quiet, stderr, log, f_log, 12, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (error == 0)
|
||||||
|
{
|
||||||
|
print_message (quiet, stderr, log, f_log, 20, argv[0]);
|
||||||
|
error = 1;
|
||||||
|
error = search_envir (num_of_mol, num_mol, centr_coords, rad, needed_mol,
|
||||||
|
&num_needed_mol);
|
||||||
|
}
|
||||||
|
if (error == 0)
|
||||||
|
{
|
||||||
|
print_message (quiet, stderr, log, f_log, 21, argv[0]);
|
||||||
|
error = 1;
|
||||||
|
error = print_structure (output, num_needed_mol, needed_mol, num_atoms,
|
||||||
|
label_mol, ch_type_atoms, coords);
|
||||||
|
}
|
||||||
|
if (error == 0)
|
||||||
|
print_message (quiet, stderr, log, f_log, 12, output);
|
||||||
|
|
||||||
print_message (quiet, stdout, log, f_log, 13, argv[0]);
|
print_message (quiet, stdout, log, f_log, 13, argv[0]);
|
||||||
|
|
||||||
|
@ -393,9 +393,9 @@ needed_at[1], needed_at[2], needed_at[3], needed_at[4], needed_at[5]);
|
|||||||
r_step, ang_min, ang_max, ang_step, radf);
|
r_step, ang_min, ang_max, ang_step, radf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (error == 0)
|
|
||||||
print_message (quiet, stdout, log, f_log, 22, argv[0]);
|
|
||||||
}
|
}
|
||||||
|
if (error == 0)
|
||||||
|
print_message (quiet, stdout, log, f_log, 22, argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_message (quiet, stdout, log, f_log, 13, argv[0]);
|
print_message (quiet, stdout, log, f_log, 13, argv[0]);
|
||||||
|
@ -414,21 +414,21 @@ int main (int argc, char *argv[])
|
|||||||
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)
|
|
||||||
{
|
|
||||||
print_message (quiet, stdout, log, f_log, 10, argv[0]);
|
|
||||||
error = 1;
|
|
||||||
error = proc_matrix (num_mol, connect, num_mol_agl, agl, stat, stat_all);
|
|
||||||
if (error == 0)
|
|
||||||
{
|
|
||||||
print_message (quiet, stdout, log, f_log, 11, argv[0]);
|
|
||||||
error = printing_agl (filename, output, connect, num_mol, true_label_mol,
|
|
||||||
num_mol_agl, agl, stat, max_depth, type_agl);
|
|
||||||
if (error == 0)
|
|
||||||
print_message (quiet, stdout, log, f_log, 12, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (error == 0)
|
||||||
|
{
|
||||||
|
print_message (quiet, stdout, log, f_log, 10, argv[0]);
|
||||||
|
error = 1;
|
||||||
|
error = proc_matrix (num_mol, connect, num_mol_agl, agl, stat, stat_all);
|
||||||
|
}
|
||||||
|
if (error == 0)
|
||||||
|
{
|
||||||
|
print_message (quiet, stdout, log, f_log, 11, argv[0]);
|
||||||
|
error = printing_agl (filename, output, connect, num_mol, true_label_mol,
|
||||||
|
num_mol_agl, agl, stat, max_depth, type_agl);
|
||||||
|
}
|
||||||
|
if (error == 0)
|
||||||
|
print_message (quiet, stdout, log, f_log, 12, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_message (quiet, stdout, log, f_log, 13, argv[0]);
|
print_message (quiet, stdout, log, f_log, 13, argv[0]);
|
||||||
|
Reference in New Issue
Block a user