mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-06-28 23:01:43 +00:00
Release mm_trj-1.0.1
This commit is contained in:
@ -3,22 +3,16 @@ Version : 1.0.1
|
||||
License : GPL
|
||||
|
||||
Usage:
|
||||
mm_radf -i INPUT -s FIRST,LAST -c X,Y,Z -a ... -o OUTPUT [ -r MIN,MAX ] [ -rs R_STEP ]
|
||||
[ -a MIN,MAX ] [ -as ANG_STEP ] [ -m ] [ -l LOGFILE ] [ -q ] [ -h ]
|
||||
mm_trj -i INPUT_TRJ -t INPUT_TYPE -s NUMBER -a INPUT_ATOMS -o OUTPUT [ -tt TOTAL_TYPES ]
|
||||
[ -l LOGFILE ] [ -q ] [ -h ]
|
||||
|
||||
Parametrs:
|
||||
-i - mask of input files
|
||||
-s - trajectory steps (integer)
|
||||
-c - cell size (float), A
|
||||
-a - atom types (integer). Format: 'ATOM1-ATOM2' or 'A1,A2,A3-B1,B2,B3'
|
||||
(will enable RDF calculation for center mass automaticaly)
|
||||
-o - output file name
|
||||
-r - minimal and maximal radii for analyze (float), A. Default is '2.0,15.0'
|
||||
-rs - radius step for analyze (float), A. Default is '0.2'
|
||||
-a - minimal and maximal angles for analyze (float), deg. Default is '0.0,90.0'
|
||||
-as - angle step for analyze (float), deg. This option will enable RADF
|
||||
calculation automaticaly
|
||||
-m - matrix output enable
|
||||
-i - input file name
|
||||
-t - type of trajectory. Supported formats: gmx, puma
|
||||
-s - number of trajectory steps (integer)
|
||||
-a - input file with atom types. See file format in manual
|
||||
-o - mask of output files
|
||||
-tt - number of different atom types. Default is 1024
|
||||
-l - log enable
|
||||
-q - quiet enable
|
||||
-h - show this help and exit
|
||||
|
@ -24,21 +24,15 @@
|
||||
* @section How-To-Use How to use
|
||||
* Usage:
|
||||
* <pre>
|
||||
* mm_radf -i INPUT -s FIRST,LAST -c X,Y,Z -a ... -o OUTPUT [ -r MIN,MAX ] [ -rs R_STEP ]
|
||||
* [ -a MIN,MAX ] [ -as ANG_STEP ] [ -m ] [ -l LOGFILE ] [ -q ] [ -h ]
|
||||
* mm_trj -i INPUT_TRJ -t INPUT_TYPE -s NUMBER -a INPUT_ATOMS -o OUTPUT [ -tt TOTAL_TYPES ]
|
||||
* [ -l LOGFILE ] [ -q ] [ -h ]
|
||||
* Parametrs:
|
||||
* -i - mask of input files
|
||||
* -s - trajectory steps (integer)
|
||||
* -c - cell size (float), A
|
||||
* -a - atom types (integer). Format: 'ATOM1-ATOM2' or 'A1,A2,A3-B1,B2,B3'
|
||||
* (will enable RDF calculation for center mass automaticaly)
|
||||
* -o - output file name
|
||||
* -r - minimal and maximal radii for analyze (float), A. Default is '2.0,15.0'
|
||||
* -rs - radius step for analyze (float), A. Default is '0.2'
|
||||
* -a - minimal and maximal angles for analyze (float), deg. Default is '0.0,90.0'
|
||||
* -as - angle step for analyze (float), deg. This option will enable RADF
|
||||
* calculation automaticaly
|
||||
* -m - matrix output enable
|
||||
* -i - input file name
|
||||
* -t - type of trajectory. Supported formats: gmx, puma
|
||||
* -s - number of trajectory steps (integer)
|
||||
* -a - input file with atom types. See file format in manual
|
||||
* -o - mask of output files
|
||||
* -tt - number of different atom types. Default is 1024
|
||||
* -l - log enable
|
||||
* -q - quiet enable
|
||||
* -h - show this help and exit
|
||||
@ -269,6 +263,7 @@ int main(int argc, char *argv[])
|
||||
error = 1;
|
||||
error = reading_atoms (input_at, &num_types, num_mol, num_atoms, ch_atom_types,
|
||||
atom_types, total_types);
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
sprintf (tmp_str, "%6cLog: %i;\n%6cQuiet: %i;\n%6cInput file: %s;\n%6cTrajectory type: %i;\n\
|
||||
|
Binary file not shown.
@ -2,11 +2,37 @@
|
||||
* @file
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "print_trj.h"
|
||||
|
||||
|
||||
/**
|
||||
* @fn translate_coords
|
||||
*/
|
||||
int translate_coords (const float coords, const float cell, float *trans)
|
||||
/**
|
||||
* @brief funtion that translates coordinate
|
||||
* @code
|
||||
*
|
||||
* @endcode
|
||||
*
|
||||
* @param coords coordinate
|
||||
* @param cell cell size
|
||||
* @param trans massive of translated coordinates
|
||||
*
|
||||
* @return 0 - exit without errors
|
||||
*/
|
||||
{
|
||||
trans[0] = coords;
|
||||
trans[1] = coords - cell;
|
||||
trans[2] = coords + cell;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @fn rw_gmx
|
||||
*/
|
||||
@ -34,5 +60,95 @@ int rw_gmx (const char *input, const int step, const char *output, const int num
|
||||
* @return 0 - exit without errors
|
||||
*/
|
||||
{
|
||||
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<step; i++)
|
||||
{
|
||||
// initial variables
|
||||
sprintf (filename, "%s.%03i", output, i+1);
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
sscanf (tmp_str, " natoms=%i%s", &atoms, tmp_str);
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
sscanf (tmp_str, " box[ 0]={%f%s", &cell[0], tmp_str);
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
sscanf (tmp_str, " box[ 1]={%f,%f%s", &cell[1], &cell[1], tmp_str);
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
sscanf (tmp_str, " box[ 2]={%f,%f,%f%s", &cell[2], &cell[2], &cell[2], tmp_str);
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
for (j=0; j<3; j++)
|
||||
cell[j] = 10 * cell[j];
|
||||
// coordinates
|
||||
for (j=0; j<atoms; j++)
|
||||
{
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
sscanf (tmp_str, " x[%i]={%f,%f,%f%s", &k, &coords[3*j+0], &coords[3*j+1],
|
||||
&coords[3*j+2], tmp_str);
|
||||
for (k=0; k<3; k++)
|
||||
coords[3*j+k] = 10 * coords[3*j+k];
|
||||
}
|
||||
// velocities
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
for (j=0; j<atoms; j++)
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
|
||||
// processing coordinates
|
||||
j = 0;
|
||||
while (j < atoms)
|
||||
for (k=0; k<num_types; k++)
|
||||
for (l=0; l<num_mol[k]; l++)
|
||||
{
|
||||
for (m=1; m<num_atoms[k]; m++)
|
||||
for (n=0; n<3; n++)
|
||||
{
|
||||
r_min = fabs (coords[3*(j+m)+n] - coords[3*j+n]);
|
||||
translate_coords (coords[3*(j+m)+n], cell[n], trans);
|
||||
if (fabs (trans[1] - coords[3*j+n]) < r_min)
|
||||
coords[3*(j+m)+n] = trans[1];
|
||||
if (fabs (trans[2] - coords[3*j+n]) < r_min)
|
||||
coords[3*(j+m)+n] = trans[2];
|
||||
}
|
||||
j += num_atoms[k];
|
||||
}
|
||||
j = 0;
|
||||
while (j < atoms)
|
||||
for (k=0; k<num_types; k++)
|
||||
for (l=0; l<num_mol[k]; l++)
|
||||
{
|
||||
for (m=0; m<3; m++)
|
||||
{
|
||||
while (coords[3*j+m] > cell[m]/2)
|
||||
for (n=j; n<j+num_atoms[k]; n++)
|
||||
coords[3*n+m] -= cell[m];
|
||||
while (coords[3*j+m] < -cell[m]/2)
|
||||
for (n=j; n<j+num_atoms[k]; n++)
|
||||
coords[3*n+m] += cell[m];
|
||||
}
|
||||
j += num_atoms[k];
|
||||
}
|
||||
|
||||
// write to output
|
||||
printing_trj (filename, atoms, num_types, num_mol, num_atoms, ch_atom_types,
|
||||
atom_types, coords);
|
||||
}
|
||||
|
||||
fclose (f_inp);
|
||||
|
||||
return 0;
|
||||
}
|
@ -5,10 +5,14 @@
|
||||
#ifndef READ_GMX_H
|
||||
#define READ_GMX_H
|
||||
|
||||
/**
|
||||
* @fn translate_coords
|
||||
*/
|
||||
/**
|
||||
* @fn rw_gmx
|
||||
*/
|
||||
|
||||
int translate_coords (const float, const float, float *);
|
||||
int rw_gmx (const char *, const int, const char *, const int, const int *,
|
||||
const int *, const char *, const int *, float *);
|
||||
|
||||
|
@ -39,6 +39,12 @@ int rw_puma (const char *input, const int step, const char *output, const int nu
|
||||
int atoms, i, j, k, l, m, n;
|
||||
FILE *f_inp;
|
||||
|
||||
/* filename output file name
|
||||
* cell cell size
|
||||
* atom number of atoms
|
||||
* f_inp input file
|
||||
*/
|
||||
|
||||
f_inp = fopen (input, "r");
|
||||
if (f_inp == NULL)
|
||||
return 1;
|
||||
@ -51,7 +57,7 @@ int rw_puma (const char *input, const int step, const char *output, const int nu
|
||||
sscanf (tmp_str, "%s%s%i%s", tmp_str, tmp_str, &atoms, tmp_str);
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
sscanf (tmp_str, "%f%f%f", &cell[0], &cell[1], &cell[2]);
|
||||
|
||||
// coordinates
|
||||
for (j=0; j<atoms; j++)
|
||||
{
|
||||
fgets (tmp_str, 256, f_inp);
|
||||
@ -64,18 +70,19 @@ int rw_puma (const char *input, const int step, const char *output, const int nu
|
||||
while (j < atoms)
|
||||
for (k=0; k<num_types; k++)
|
||||
for (l=0; l<num_mol[k]; l++)
|
||||
{
|
||||
for (m=0; m<3; m++)
|
||||
{
|
||||
for (m=0; m<3; m++)
|
||||
{
|
||||
while (coords[3*j+m] > cell[m]/2)
|
||||
for (n=j; n<j+num_atoms[k]; n++)
|
||||
coords[3*n+m] -= cell[m];
|
||||
while (coords[3*j+m] < -cell[m]/2)
|
||||
for (n=j; n<j+num_atoms[k]; n++)
|
||||
coords[3*n+m] += cell[m];
|
||||
}
|
||||
j += num_atoms[k];
|
||||
while (coords[3*j+m] > cell[m]/2)
|
||||
for (n=j; n<j+num_atoms[k]; n++)
|
||||
coords[3*n+m] -= cell[m];
|
||||
while (coords[3*j+m] < -cell[m]/2)
|
||||
for (n=j; n<j+num_atoms[k]; n++)
|
||||
coords[3*n+m] += cell[m];
|
||||
}
|
||||
j += num_atoms[k];
|
||||
}
|
||||
|
||||
// write to output
|
||||
printing_trj (filename, atoms, num_types, num_mol, num_atoms, ch_atom_types,
|
||||
atom_types, coords);
|
||||
|
@ -1,32 +0,0 @@
|
||||
NUMTYPES=2
|
||||
NUMMOL=3
|
||||
NUMAT=12
|
||||
CL=5
|
||||
CA=2
|
||||
CA=2
|
||||
CA=2
|
||||
CA=2
|
||||
CA=2
|
||||
CA=2
|
||||
HC=3
|
||||
HC=3
|
||||
HC=3
|
||||
HC=3
|
||||
HC=3
|
||||
NUMMOL=97
|
||||
NUMAT=15
|
||||
CL=1
|
||||
CT=4
|
||||
CA=2
|
||||
CA=2
|
||||
CA=2
|
||||
CA=2
|
||||
CA=2
|
||||
CA=2
|
||||
HC=3
|
||||
HC=3
|
||||
HC=3
|
||||
HC=3
|
||||
HC=3
|
||||
HC=3
|
||||
HC=3
|
Reference in New Issue
Block a user