/* * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * Evgeniy Alekseev wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return * ---------------------------------------------------------------------------- */ /** * @file read_gmx.c * Source code of mathmech library * @author Evgeniy Alekseev (arcanis) * @copyright Beerware * @bug No known bugs */ #include #include #include #include /** * @fn translate_coords */ int translate_coords (const float coords, const float cell, float *trans) { trans[0] = coords; trans[1] = coords - cell; trans[2] = coords + cell; return 0; } /** * @fn rw_gmx */ int rw_gmx (const char *input, const int step, const char *output, const int num_types, const int *num_mol, const int *num_atoms, const char *ch_atom_types, const int *atom_types, float *coords) { char filename[256], tmp_str[256]; float cell[3], trans[3], r_min; int atoms, i, j, k, l, m, n; FILE *f_inp; /* filename output file name * cell cell size * trans translated coordinates * r_min minimal radius * atom number of atoms * f_inp input file */ f_inp = fopen (input, "r"); if (f_inp == NULL) return 1; for (i=0; i cell[m]/2) for (n=j; n