From 1db71b413081978fab707bd455dfd5d68dfb49b2 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Mon, 17 Dec 2012 14:39:32 +0400 Subject: [PATCH] Added mol2rtp --- mol2rtp/README | 24 +++++++++++++ mol2rtp/mol2rtp.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 mol2rtp/README create mode 100644 mol2rtp/mol2rtp.c diff --git a/mol2rtp/README b/mol2rtp/README new file mode 100644 index 0000000..b16d5f5 --- /dev/null +++ b/mol2rtp/README @@ -0,0 +1,24 @@ + mol2rtp +Version: 1.0 +Author: Evgeniy Alexeev aka arcanis +Email: esalexeev@gmail.com + + +mol2rtp convert *.mol2 file in GROMACS topology +file (*.rtp). + +Usage: + mol2rtp [MOL2.FILE] [RTP.FILE] +For example: + mol2rtp exmpl.mol2 exmpl.rtp + +NOTE: You must edit molecular mechanics atom types +in output *.rtp-file, because atom types in *.mol2 +file don't match GROMACS atom types. + + +Compile: + gcc mol2rtp.c -o mol2rtp +Dependence: + * gcc + * lib: string.h, stdlib.c, stdio.h diff --git a/mol2rtp/mol2rtp.c b/mol2rtp/mol2rtp.c new file mode 100644 index 0000000..1ea8ae4 --- /dev/null +++ b/mol2rtp/mol2rtp.c @@ -0,0 +1,88 @@ +#include +#include +#include + + +void main(int argc, char *argv[]) +{ + int i, j, n_bonds, n_angles, num[2]; + char q[256], label[512][4], type[4]; + double charge; + FILE *inp, *out; + + + if (argc == 1) + { + printf ("Error: Parametrs is not enable!\n"); + printf ("Usage --help or -h for help\n"); + exit(0); + } + if ((argv[1][0] == '-' && argv[1][1] == '-' && argv[1][2] == 'h' && argv[1][3] == 'e' && argv[1][4] == 'l', argv[1][5] == 'p') || (argv[1][0] == '-' && argv[1][1] == 'h')) + { + printf ("mol2rtp convert *.mol2 file in GROMACS topology file *.rtp\n"); + printf ("NOTE: You must edit MM atom type in *.rtp file\n"); + printf ("Usage: mol2rtp [MOL2.FILE] [RTP.FILE]\n"); + printf ("Evgeniy Alexeev aka arcanis\n"); + printf ("email: esalexeev@gmail.com\n"); + exit(0); + } + else + if (argc == 2) + { + printf ("Error: Parametrs is not enable!\n"); + printf ("Usage --help or -h for help\n"); + exit(0); + } + + + printf ("mol2rtp V.1.0\n"); + inp = fopen (argv[1], "r+"); + if (inp == NULL) + { + printf ("File %s is not found!\n", argv[1]); + exit(0); + } + out = fopen (argv[2], "w+"); + + + fgets (q, 255, inp); + fgets (q, 255, inp); + fscanf (inp, "%i", &n_bonds); + fscanf (inp, "%i", &n_angles); + for (i=0; i<5; i++) + fgets (q, 255, inp); + + + printf ("Enter molecule name: "); + scanf ("%s", q); + fprintf (out, "[ %s ]\n [ atoms ]\n", q); + for (i=0; i