mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-07-16 07:10:00 +00:00
rewrite trajectory format to store coordinates
This commit is contained in:
@ -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>
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user