xvgrclose(ord);
}
+enum
+{
+ axisSEL,
+ axisZ,
+ axisY,
+ axisX,
+ axisNR
+};
+
int gmx_h2order(int argc, char* argv[])
{
const char* desc[] = {
"dipole and the axis from the center of mass to the oxygen is calculated",
"instead of the angle between the dipole and a box axis."
};
- static int axis = 2; /* normal to memb. default z */
- static const char* axtitle = "Z";
- static int nslices = 0; /* nr of slices defined */
- t_pargs pa[] = { { "-d",
+ static const char* axisOption[axisNR + 1] = { nullptr, "Z", "Y", "X", nullptr };
+ static int nslices = 0; /* nr of slices defined */
+ // The struct that will hold the parsed user input
+ t_pargs pa[] = { { "-d",
FALSE,
- etSTR,
- { &axtitle },
+ etENUM,
+ { axisOption },
"Take the normal on the membrane in direction X, Y or Z." },
{ "-sl",
FALSE,
{ &nslices },
"Calculate order parameter as function of boxlength, dividing the box"
" in this number of slices." } };
- const char* bugs[] = {
+ const char* bugs[] = {
"The program assigns whole water molecules to a slice, based on the first "
"atom of three in the index file group. It assumes an order O,H,H. "
"Name is not important, but the order is. If this demand is not met, "
#define NFILE asize(fnm)
+ // Parse the user input in argv into pa
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, NFILE, fnm, asize(pa), pa,
asize(desc), desc, asize(bugs), bugs, &oenv))
{
return 0;
}
+
+ // Process the axis option chosen by the user to set the
+ // axis used for the computation. The useful choice is an
+ // axis normal to the membrane. Default is z-axis.
+ int axis = ZZ;
+ switch (nenum(axisOption))
+ {
+ case axisX: axis = XX; break;
+ case axisY: axis = YY; break;
+ case axisZ: axis = ZZ; break;
+ default: axis = ZZ;
+ }
+
bMicel = opt2bSet("-nm", NFILE, fnm);
top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType); /* read topology file */