rewrite trajectory format to store coordinates

This commit is contained in:
arcan1s
2015-11-01 00:10:42 +03:00
parent ae9957b621
commit 2c44b229ee
13 changed files with 23 additions and 50 deletions

View File

@ -27,8 +27,6 @@
int error_checking (const char *aglinp, const system_info _system_info, const char *input,
const char *output)
{
if ((_system_info.cell[0] == 0.0) || (_system_info.cell[1] == 0.0) || (_system_info.cell[2] == 0.0))
return 11;
if (input[0] == '#')
return 12;
if (output[0] == '#')

View File

@ -81,11 +81,10 @@ int main(int argc, char *argv[])
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, "%sUsage:\n", tmp_str);
sprintf (tmp_str, "%smm_agl -a AGL_INP -i INPUT -c X,Y,Z -o OUTPUT [ -l LOGFILE ] [ -q ] [ -h ]\n\n", tmp_str);
sprintf (tmp_str, "%smm_agl -a AGL_INP -i INPUT -o OUTPUT [ -l LOGFILE ] [ -q ] [ -h ]\n\n", tmp_str);
sprintf (tmp_str, "%sParametrs:\n", tmp_str);
sprintf (tmp_str, "%s -a - input file with agglomerates (in format statgen)\n", tmp_str);
sprintf (tmp_str, "%s -i - input file with coordinates\n", tmp_str);
sprintf (tmp_str, "%s -c - cell size (float), A\n", tmp_str);
sprintf (tmp_str, "%s -o - output file name\n", tmp_str);
sprintf (tmp_str, "%s -l - log enable\n", tmp_str);
sprintf (tmp_str, "%s -q - quiet enable\n", tmp_str);
@ -105,13 +104,6 @@ int main(int argc, char *argv[])
strcpy (input, argv[i+1]);
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'c') && (argv[i][2] == '\0'))
// cell size
{
sscanf (argv[i+1], "%f,%f,%f", &_system_info.cell[0], &_system_info.cell[1],
&_system_info.cell[2]);
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'o') && (argv[i][2] == '\0'))
// output file
{

View File

@ -27,8 +27,6 @@
int error_checking (const system_info _system_info, const char *input,
const char *output)
{
if ((_system_info.cell[0] == 0.0) || (_system_info.cell[1] == 0.0) || (_system_info.cell[2] == 0.0))
return 11;
if (input[0] == '#')
return 12;
if (output[0] == '#')

View File

@ -81,11 +81,10 @@ int main(int argc, char *argv[])
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, "%sUsage:\n", tmp_str);
sprintf (tmp_str, "%smm_envir -i INPUT -c X,Y,Z -o OUTPUT [ -n NUM_OF_MOLECULE ] [ -r RADIUS ]\n", tmp_str);
sprintf (tmp_str, "%s [ -l LOGFILE ] [ -q ] [ -h ]\n\n", tmp_str);
sprintf (tmp_str, "%smm_envir -i INPUT -o OUTPUT [ -n NUM_OF_MOLECULE ] [ -r RADIUS ]\n", tmp_str);
sprintf (tmp_str, "%s [ -l LOGFILE ] [ -q ] [ -h ]\n\n", tmp_str);
sprintf (tmp_str, "%sParametrs:\n", tmp_str);
sprintf (tmp_str, "%s -i - input file name\n", tmp_str);
sprintf (tmp_str, "%s -c - cell size (float), A\n", tmp_str);
sprintf (tmp_str, "%s -o - output file name\n", tmp_str);
sprintf (tmp_str, "%s -n - number of molecule for search (integer). Default is 1\n", tmp_str);
sprintf (tmp_str, "%s -r - radius of environment (float). Default is 6.0\n", tmp_str);
@ -101,12 +100,6 @@ int main(int argc, char *argv[])
strcpy (input, argv[i+1]);
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'c') && (argv[i][2] == '\0'))
// cell size
{
sscanf (argv[i+1], "%f,%f,%f", &_system_info.cell[0], &_system_info.cell[1], &_system_info.cell[2]);
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'o') && (argv[i][2] == '\0'))
// output file
{

View File

@ -33,12 +33,13 @@
* @param ch_atom_types massive of char atom types
* @param atom_types massive of atom types
* @param coords massive of coordinates
* @param cell cell size
*
* @return 0 - exit without errors
*/
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);
const float *coords, const float *cell);
#endif /* PRINT_TRJ_H */

View File

@ -29,7 +29,7 @@ int reading_coords (const int mode, const char *filename, const int type_inter,
{
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], ref[3];
float cur_coords[3], ref[3], cur_cell[3];
FILE *inp;
/* cur_* temp variables
@ -132,6 +132,13 @@ int reading_coords (const int mode, const char *filename, const int type_inter,
default: return 2;
}
}
// cell sizes
fgets (file_string, 256, inp);
sscanf (file_string, "%f,%f,%f", &cur_cell[0], &cur_cell[1],
&cur_cell[2]);
(*_system_info).cell[0] = cur_cell[0];
(*_system_info).cell[1] = cur_cell[1];
(*_system_info).cell[2] = cur_cell[2];
fclose (inp);
/// <pre> translation </pre>

View File

@ -24,7 +24,7 @@
*/
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)
const float *coords, const float *cell)
{
int cur_mol, cur_type[2], i, j, k, l;
FILE *f_out;
@ -60,6 +60,8 @@ coords[3*i+1], coords[3*i+2], atom_types[cur_type[1]], cur_mol);
cur_type[0] += num_atoms[j];
}
}
fprintf (f_out, "%lf,%lf,%lf\n", cell[0], cell[1], cell[2]);
fclose (f_out);

View File

@ -126,7 +126,7 @@ int rw_gmx (const char *input, const int step, const char *output, const int num
// write to output
printing_trj (filename, atoms, num_types, num_mol, num_atoms, ch_atom_types,
atom_types, coords);
atom_types, coords, cell);
}
fclose (f_inp);

View File

@ -78,7 +78,7 @@ int rw_puma (const char *input, const int step, const char *output, const int nu
// write to output
printing_trj (filename, atoms, num_types, num_mol, num_atoms, ch_atom_types,
atom_types, coords);
atom_types, coords, cell);
}
fclose (f_inp);

View File

@ -28,8 +28,6 @@
int error_checking (const char *input, const int num_needed_at, const int *needed_at,
const char *output, const system_info _system_info)
{
if ((_system_info.cell[0] == 0.0) || (_system_info.cell[1] == 0.0) || (_system_info.cell[2] == 0.0))
return 11;
if (input[0] == '#')
return 12;
if (output[0] == '#')

View File

@ -81,13 +81,12 @@ int main(int argc, char *argv[])
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, "%sUsage:\n", tmp_str);
sprintf (tmp_str, "%smm_radf -i INPUT -s FIRST,LAST -c X,Y,Z -at ... -o OUTPUT [ -r MIN,MAX ]\n", tmp_str);
sprintf (tmp_str, "%s [ -rs R_STEP ] [ -a MIN,MAX ] [ -as ANG_STEP ] [ -m ]\n", tmp_str);
sprintf (tmp_str, "%s [ -l LOGFILE ] [ -q ] [ -h ]\n\n", tmp_str);
sprintf (tmp_str, "%smm_radf -i INPUT -s FIRST,LAST -at ... -o OUTPUT [ -r MIN,MAX ] [ -rs R_STEP ]\n", tmp_str);
sprintf (tmp_str, "%s [ -a MIN,MAX ] [ -as ANG_STEP ] [ -m ]\n", tmp_str);
sprintf (tmp_str, "%s [ -l LOGFILE ] [ -q ] [ -h ]\n\n", tmp_str);
sprintf (tmp_str, "%sParametrs:\n", tmp_str);
sprintf (tmp_str, "%s -i - mask of input files\n", tmp_str);
sprintf (tmp_str, "%s -s - trajectory steps (integer)\n", tmp_str);
sprintf (tmp_str, "%s -c - cell size (float), A\n", tmp_str);
sprintf (tmp_str, "%s -at - atom types (integer). Format: 'AT1-AT2' or 'A1,A2,A3-B1,B2,B3'\n", tmp_str);
sprintf (tmp_str, "%s (will enable RDF calculation for center mass automaticaly)\n", tmp_str);
sprintf (tmp_str, "%s -o - output file name\n", tmp_str);
@ -123,12 +122,6 @@ int main(int argc, char *argv[])
}
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'c') && (argv[i][2] == '\0'))
// cell size
{
sscanf (argv[i+1], "%f,%f,%f", &_system_info.cell[0], &_system_info.cell[1], &_system_info.cell[2]);
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'a') && (argv[i][2] == 't') && (argv[i][3] == '\0'))
// atom types
{

View File

@ -30,8 +30,6 @@ int error_checking (const system_info _system_info, const char *input, const int
{
if ((type_inter == 0) || (type_inter > 4))
return 11;
if ((_system_info.cell[0] == 0.0) || (_system_info.cell[1] == 0.0) || (_system_info.cell[2] == 0.0))
return 12;
if ((_system_info.to == -1) || (_system_info.from == -1))
return 13;
if (num_of_inter == 0)

View File

@ -107,12 +107,11 @@ int main (int argc, char *argv[])
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, "%sUsage:\n", tmp_str);
sprintf (tmp_str, "%smm_statgen -i INPUT -s FIRST,LAST -c X,Y,Z -a ... -r ... -o OUTPUT [ -g DEPTH ]\n", tmp_str);
sprintf (tmp_str, "%s [ -l LOGFILE ] [ -q ] [ -h ]\n\n", tmp_str);
sprintf (tmp_str, "%smm_statgen -i INPUT -s FIRST,LAST -a ... -r ... -o OUTPUT [ -g DEPTH ]\n", tmp_str);
sprintf (tmp_str, "%s [ -l LOGFILE ] [ -q ] [ -h ]\n\n", tmp_str);
sprintf (tmp_str, "%sParametrs:\n", tmp_str);
sprintf (tmp_str, "%s -i - mask of input files\n", tmp_str);
sprintf (tmp_str, "%s -s - trajectory steps (integer)\n", tmp_str);
sprintf (tmp_str, "%s -c - cell size (float), A\n", tmp_str);
sprintf (tmp_str, "%s -a - atom types (integer). Format: 'ATOM1' or 'ATOM1,ATOM2' or etc\n", tmp_str);
sprintf (tmp_str, "%s -r - criteria (float), A. Format: '0-0:2.4,0-1:3.0' means 0-0\n", tmp_str);
sprintf (tmp_str, "%s interaction (<2.4 A) and 0-1 (<3.0) are needed. This flag can be\n", tmp_str);
@ -144,12 +143,6 @@ int main (int argc, char *argv[])
}
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'c') && (argv[i][2] == '\0'))
// cell size
{
sscanf (argv[i+1], "%f,%f,%f", &_system_info.cell[0], &_system_info.cell[1], &_system_info.cell[2]);
i++;
}
else if ((argv[i][0] == '-') && (argv[i][1] == 'a') && (argv[i][2] == '\0'))
// atom types
{