#include "dump2analysis.h" void ArgCheck(PARAM *arg){ if (strcmp(arg->mode, "") == 0){ printf("-m mode is required.\n"); Error(); } } int ArgCheckInputOutput(PARAM *arg){ int flag = 0; if (strcmp(arg->infile, "") == 0){ printf("-i infile is required.\n"); flag = flag + 1; } if (strcmp(arg->outfile, "") == 0){ printf("-o outfile is required.\n"); flag = flag + 2; } return flag; } void Error(){ printf("Usage: dump2analysis hoge options hoge.lammpstrj\n"); printf("Options:\n"); printf(" -h --help show this help message\n"); printf(" -m --mode=str mode gr or msd...\n"); printf("--------------------------------------------------------\n"); printf(" -a --Aid=str Atom \"a\" ids 1,2... must be > 0\n"); printf(" -b --Bid=str Atom \"b\" ids 1,2... must be > 0\n"); printf(" -c --Cid=str Atom \"c\" ids 1,2... must be > 0\n"); printf("--------------------------------------------------------\n"); printf(" -x --Aelem=str Atom \"a\" element\n"); printf(" -y --Belem=str Atom \"b\" element\n"); printf(" -z --Celem=str Atom \"c\" element\n"); printf("--------------------------------------------------------\n"); printf(" -s --Atype=%%d Atom \"a\" type number\n"); printf(" -t --Btype=%%d Atom \"b\" type number\n"); printf(" -u --Ctype=%%d Atom \"c\" type number\n"); printf("--------------------------------------------------------\n"); printf(" -i --in=str Input file name\n"); printf(" -o --out=str Output file name\n"); printf("--------------------------------------------------------\n"); printf("-m --mode=str\n"); printf(" -m gr calculate radial distribution function\n"); printf(" -m msd calculate mean square displacement\n"); printf(" -m angle calculate angle distribution\n"); printf(" -m cube density map analysis (cube file)\n"); printf(" -m cube_radius density map analysis with finite radius (cube file)\n"); printf(" -m cube_jump jump map analysis (cube file)\n"); printf(" -m vcorr velocity correlation function\n"); printf(" -m rcorr rotational correlation function\n"); printf(" -m vanHove caclulate van Hove function\n"); exit(1); } int CheckArgAtomSelect(PARAM *p){ int n=0; /* Aid, Aelem, Atypeを2つ以上指定している */ if ((p->Aid[0] != 0 && strcmp(p->Aelem, "") != 0 && p->Atype != -1) || (p->Aid[0] != 0 && strcmp(p->Aelem, "") == 0 && p->Atype != -1) || (p->Aid[0] != 0 && strcmp(p->Aelem, "") != 0 && p->Atype == -1) || (p->Aid[0] == 0 && strcmp(p->Aelem, "") != 0 && p->Atype != -1)) return -1; /* Bid, Belem, Btypeを2つ以上指定している */ if ((p->Bid[0] != 0 && strcmp(p->Belem, "") != 0 && p->Btype != -1) || (p->Bid[0] != 0 && strcmp(p->Belem, "") == 0 && p->Btype != -1) || (p->Bid[0] != 0 && strcmp(p->Belem, "") != 0 && p->Btype == -1) || (p->Bid[0] == 0 && strcmp(p->Belem, "") != 0 && p->Btype != -1)) return -1; /* Cid, Celem, Ctypeを2つ以上指定している */ if ((p->Cid[0] != 0 && strcmp(p->Celem, "") != 0 && p->Ctype != -1) || (p->Cid[0] != 0 && strcmp(p->Celem, "") == 0 && p->Ctype != -1) || (p->Cid[0] != 0 && strcmp(p->Celem, "") != 0 && p->Ctype == -1) || (p->Cid[0] == 0 && strcmp(p->Celem, "") != 0 && p->Ctype != -1)) return -1; /* Aが指定されている */ if (p->Aid[0] != 0 || strcmp(p->Aelem, "") != 0 || p->Atype != -1) n = n + 1; /* Bが指定されている */ if (p->Bid[0] != 0 || strcmp(p->Belem, "") != 0 || p->Btype != -1) n = n + 2; /* Cが指定されている */ if (p->Cid[0] != 0 || strcmp(p->Celem, "") != 0 || p->Ctype != -1) n = n + 4; return n; }