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

@ -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);