ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/applications/dynamicProps/DynamicPropsCmd.cpp
(Generate patch)

Comparing:
trunk/src/applications/dynamicProps/DynamicPropsCmd.c (file contents), Revision 1183 by xsun, Tue Oct 2 12:05:25 2007 UTC vs.
trunk/src/applications/dynamicProps/DynamicPropsCmd.cpp (file contents), Revision 1939 by gezelter, Thu Oct 31 18:18:57 2013 UTC

# Line 1 | Line 1
1   /*
2 <  File autogenerated by gengetopt version 2.16
2 >  File autogenerated by gengetopt version 2.22.4
3    generated with the following command:
4 <  gengetopt -F DynamicPropsCmd
4 >  gengetopt --file-name=DynamicPropsCmd --unamed-opts
5  
6    The developers of gengetopt consider the fixed text that goes in all
7    gengetopt output files to be in the public domain:
# Line 17 | Line 17
17   #include <stdlib.h>
18   #include <string.h>
19  
20 < #include "getopt.h"
20 > #ifndef FIX_UNUSED
21 > #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
22 > #endif
23  
24 + #ifdef WIN32
25 + #include "utils/wingetopt.h"
26 + #else
27 + #include <getopt.h>
28 + #endif
29 +
30   #include "DynamicPropsCmd.h"
31  
32 + const char *gengetopt_args_info_purpose = "";
33 +
34 + const char *gengetopt_args_info_usage = "Usage: DynamicProps [OPTIONS]... [FILES]...";
35 +
36 + const char *gengetopt_args_info_description = "";
37 +
38 + const char *gengetopt_args_info_help[] = {
39 +  "  -h, --help                    Print help and exit",
40 +  "  -V, --version                 Print version and exit",
41 +  "  -i, --input=filename          input dump file",
42 +  "  -o, --output=filename         output file name",
43 +  "      --sele1=selection script  select first stuntdouble set",
44 +  "      --sele2=selection script  select second stuntdouble set (if sele2 is not \n                                  set, use script from sele1)",
45 +  "      --order=INT               Lengendre Polynomial Order",
46 +  "  -z, --nzbins=INT              Number of Z bins  (default=`100')",
47 +  "  -m, --memory=memory specification\n                                Available memory (defaults to 2G)  \n                                  (default=`2G')",
48 +  "\n Group: dynamicProps\n   an option of this group is required",
49 +  "  -s, --selecorr                selection correlation function",
50 +  "  -r, --rcorr                   rmsd",
51 +  "  -v, --vcorr                   velocity correlation function",
52 +  "  -d, --dcorr                   dipole correlation function",
53 +  "  -l, --lcorr                   Lengendre correlation function",
54 +  "      --lcorrZ                  Lengendre correlation function binned by Z",
55 +  "      --cohZ                    Lengendre correlation function for OH bond \n                                  vectors binned by Z",
56 +  "  -M, --sdcorr                  System dipole correlation function",
57 +  "      --r_rcorr                 Radial rmsd",
58 +  "      --thetacorr               Angular rmsd",
59 +  "      --drcorr                  Directional rmsd for particles with unit \n                                  vectors",
60 +  "      --helfandEcorr            Helfand moment for thermal conductvity",
61 +  "  -p, --momentum                Helfand momentum for viscosity",
62 +  "      --stresscorr              Stress tensor correlation function",
63 +    0
64 + };
65 +
66 + typedef enum {ARG_NO
67 +  , ARG_STRING
68 +  , ARG_INT
69 + } cmdline_parser_arg_type;
70 +
71   static
72   void clear_given (struct gengetopt_args_info *args_info);
73   static
74   void clear_args (struct gengetopt_args_info *args_info);
75  
76   static int
77 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error);
77 > cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
78 >                        struct cmdline_parser_params *params, const char *additional_error);
79  
80   static int
81   cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
# Line 45 | Line 93 | void clear_given (struct gengetopt_args_info *args_inf
93    args_info->sele1_given = 0 ;
94    args_info->sele2_given = 0 ;
95    args_info->order_given = 0 ;
96 +  args_info->nzbins_given = 0 ;
97 +  args_info->memory_given = 0 ;
98 +  args_info->selecorr_given = 0 ;
99    args_info->rcorr_given = 0 ;
100    args_info->vcorr_given = 0 ;
101    args_info->dcorr_given = 0 ;
102    args_info->lcorr_given = 0 ;
103 +  args_info->lcorrZ_given = 0 ;
104 +  args_info->cohZ_given = 0 ;
105 +  args_info->sdcorr_given = 0 ;
106    args_info->r_rcorr_given = 0 ;
107    args_info->thetacorr_given = 0 ;
54  args_info->actioncorr_given = 0 ;
108    args_info->drcorr_given = 0 ;
109 +  args_info->helfandEcorr_given = 0 ;
110 +  args_info->momentum_given = 0 ;
111 +  args_info->stresscorr_given = 0 ;
112    args_info->dynamicProps_group_counter = 0 ;
113   }
114  
115   static
116   void clear_args (struct gengetopt_args_info *args_info)
117   {
118 +  FIX_UNUSED (args_info);
119    args_info->input_arg = NULL;
120    args_info->input_orig = NULL;
121    args_info->output_arg = NULL;
# Line 68 | Line 125 | void clear_args (struct gengetopt_args_info *args_info
125    args_info->sele2_arg = NULL;
126    args_info->sele2_orig = NULL;
127    args_info->order_orig = NULL;
128 +  args_info->nzbins_arg = 100;
129 +  args_info->nzbins_orig = NULL;
130 +  args_info->memory_arg = gengetopt_strdup ("2G");
131 +  args_info->memory_orig = NULL;
132    
133   }
134  
135 + static
136 + void init_args_info(struct gengetopt_args_info *args_info)
137 + {
138 +
139 +
140 +  args_info->help_help = gengetopt_args_info_help[0] ;
141 +  args_info->version_help = gengetopt_args_info_help[1] ;
142 +  args_info->input_help = gengetopt_args_info_help[2] ;
143 +  args_info->output_help = gengetopt_args_info_help[3] ;
144 +  args_info->sele1_help = gengetopt_args_info_help[4] ;
145 +  args_info->sele2_help = gengetopt_args_info_help[5] ;
146 +  args_info->order_help = gengetopt_args_info_help[6] ;
147 +  args_info->nzbins_help = gengetopt_args_info_help[7] ;
148 +  args_info->memory_help = gengetopt_args_info_help[8] ;
149 +  args_info->selecorr_help = gengetopt_args_info_help[10] ;
150 +  args_info->rcorr_help = gengetopt_args_info_help[11] ;
151 +  args_info->vcorr_help = gengetopt_args_info_help[12] ;
152 +  args_info->dcorr_help = gengetopt_args_info_help[13] ;
153 +  args_info->lcorr_help = gengetopt_args_info_help[14] ;
154 +  args_info->lcorrZ_help = gengetopt_args_info_help[15] ;
155 +  args_info->cohZ_help = gengetopt_args_info_help[16] ;
156 +  args_info->sdcorr_help = gengetopt_args_info_help[17] ;
157 +  args_info->r_rcorr_help = gengetopt_args_info_help[18] ;
158 +  args_info->thetacorr_help = gengetopt_args_info_help[19] ;
159 +  args_info->drcorr_help = gengetopt_args_info_help[20] ;
160 +  args_info->helfandEcorr_help = gengetopt_args_info_help[21] ;
161 +  args_info->momentum_help = gengetopt_args_info_help[22] ;
162 +  args_info->stresscorr_help = gengetopt_args_info_help[23] ;
163 +  
164 + }
165 +
166   void
167   cmdline_parser_print_version (void)
168   {
169 <  printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
169 >  printf ("%s %s\n",
170 >     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
171 >     CMDLINE_PARSER_VERSION);
172   }
173  
174 + static void print_help_common(void) {
175 +  cmdline_parser_print_version ();
176 +
177 +  if (strlen(gengetopt_args_info_purpose) > 0)
178 +    printf("\n%s\n", gengetopt_args_info_purpose);
179 +
180 +  if (strlen(gengetopt_args_info_usage) > 0)
181 +    printf("\n%s\n", gengetopt_args_info_usage);
182 +
183 +  printf("\n");
184 +
185 +  if (strlen(gengetopt_args_info_description) > 0)
186 +    printf("%s\n\n", gengetopt_args_info_description);
187 + }
188 +
189   void
190   cmdline_parser_print_help (void)
191   {
192 <  cmdline_parser_print_version ();
193 <  printf("\nUsage: DynamicProps [OPTIONS]...\n\n");
194 <  printf("%s\n","  -h, --help                    Print help and exit");
195 <  printf("%s\n","  -V, --version                 Print version and exit");
87 <  printf("%s\n","  -i, --input=filename          input dump file");
88 <  printf("%s\n","  -o, --output=filename         output file name");
89 <  printf("%s\n","      --sele1=selection script  select first stuntdouble set");
90 <  printf("%s\n","      --sele2=selection script  select second stuntdouble set (if sele2 is not \n                                  set, use script from sele1)");
91 <  printf("%s\n","      --order=INT               Lengendre Polynomial Order");
92 <  printf("%s\n","\n Group: dynamicProps\n   an option of this group is required");
93 <  printf("%s\n","  -r, --rcorr                   rmsd");
94 <  printf("%s\n","  -v, --vcorr                   velocity correlation function");
95 <  printf("%s\n","  -d, --dcorr                   dipole correlation function");
96 <  printf("%s\n","  -l, --lcorr                   Lengendre correlation function");
97 <  printf("%s\n","      --r_rcorr                 Radial rmsd");
98 <  printf("%s\n","      --thetacorr               Angular rmsd");
99 <  printf("%s\n","      --actioncorr              Action correlation function");
100 <  printf("%s\n","      --drcorr                  Directional rmsd for particles with unit \n                                  vectors");
101 <  
192 >  int i = 0;
193 >  print_help_common();
194 >  while (gengetopt_args_info_help[i])
195 >    printf("%s\n", gengetopt_args_info_help[i++]);
196   }
197  
198   void
# Line 106 | Line 200 | cmdline_parser_init (struct gengetopt_args_info *args_
200   {
201    clear_given (args_info);
202    clear_args (args_info);
203 +  init_args_info (args_info);
204 +
205 +  args_info->inputs = 0;
206 +  args_info->inputs_num = 0;
207   }
208  
209 + void
210 + cmdline_parser_params_init(struct cmdline_parser_params *params)
211 + {
212 +  if (params)
213 +    {
214 +      params->override = 0;
215 +      params->initialize = 1;
216 +      params->check_required = 1;
217 +      params->check_ambiguity = 0;
218 +      params->print_errors = 1;
219 +    }
220 + }
221 +
222 + struct cmdline_parser_params *
223 + cmdline_parser_params_create(void)
224 + {
225 +  struct cmdline_parser_params *params =
226 +    (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
227 +  cmdline_parser_params_init(params);  
228 +  return params;
229 + }
230 +
231   static void
232 + free_string_field (char **s)
233 + {
234 +  if (*s)
235 +    {
236 +      free (*s);
237 +      *s = 0;
238 +    }
239 + }
240 +
241 +
242 + static void
243   cmdline_parser_release (struct gengetopt_args_info *args_info)
244   {
245 +  unsigned int i;
246 +  free_string_field (&(args_info->input_arg));
247 +  free_string_field (&(args_info->input_orig));
248 +  free_string_field (&(args_info->output_arg));
249 +  free_string_field (&(args_info->output_orig));
250 +  free_string_field (&(args_info->sele1_arg));
251 +  free_string_field (&(args_info->sele1_orig));
252 +  free_string_field (&(args_info->sele2_arg));
253 +  free_string_field (&(args_info->sele2_orig));
254 +  free_string_field (&(args_info->order_orig));
255 +  free_string_field (&(args_info->nzbins_orig));
256 +  free_string_field (&(args_info->memory_arg));
257 +  free_string_field (&(args_info->memory_orig));
258    
259 <  if (args_info->input_arg)
259 >  
260 >  for (i = 0; i < args_info->inputs_num; ++i)
261 >    free (args_info->inputs [i]);
262 >
263 >  if (args_info->inputs_num)
264 >    free (args_info->inputs);
265 >
266 >  clear_given (args_info);
267 > }
268 >
269 >
270 > static void
271 > write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
272 > {
273 >  FIX_UNUSED (values);
274 >  if (arg) {
275 >    fprintf(outfile, "%s=\"%s\"\n", opt, arg);
276 >  } else {
277 >    fprintf(outfile, "%s\n", opt);
278 >  }
279 > }
280 >
281 >
282 > int
283 > cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
284 > {
285 >  int i = 0;
286 >
287 >  if (!outfile)
288      {
289 <      free (args_info->input_arg); /* free previous argument */
290 <      args_info->input_arg = 0;
119 <    }
120 <  if (args_info->input_orig)
121 <    {
122 <      free (args_info->input_orig); /* free previous argument */
123 <      args_info->input_orig = 0;
124 <    }
125 <  if (args_info->output_arg)
126 <    {
127 <      free (args_info->output_arg); /* free previous argument */
128 <      args_info->output_arg = 0;
129 <    }
130 <  if (args_info->output_orig)
131 <    {
132 <      free (args_info->output_orig); /* free previous argument */
133 <      args_info->output_orig = 0;
134 <    }
135 <  if (args_info->sele1_arg)
136 <    {
137 <      free (args_info->sele1_arg); /* free previous argument */
138 <      args_info->sele1_arg = 0;
139 <    }
140 <  if (args_info->sele1_orig)
141 <    {
142 <      free (args_info->sele1_orig); /* free previous argument */
143 <      args_info->sele1_orig = 0;
144 <    }
145 <  if (args_info->sele2_arg)
146 <    {
147 <      free (args_info->sele2_arg); /* free previous argument */
148 <      args_info->sele2_arg = 0;
149 <    }
150 <  if (args_info->sele2_orig)
151 <    {
152 <      free (args_info->sele2_orig); /* free previous argument */
153 <      args_info->sele2_orig = 0;
154 <    }
155 <  if (args_info->order_orig)
156 <    {
157 <      free (args_info->order_orig); /* free previous argument */
158 <      args_info->order_orig = 0;
289 >      fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
290 >      return EXIT_FAILURE;
291      }
292 +
293 +  if (args_info->help_given)
294 +    write_into_file(outfile, "help", 0, 0 );
295 +  if (args_info->version_given)
296 +    write_into_file(outfile, "version", 0, 0 );
297 +  if (args_info->input_given)
298 +    write_into_file(outfile, "input", args_info->input_orig, 0);
299 +  if (args_info->output_given)
300 +    write_into_file(outfile, "output", args_info->output_orig, 0);
301 +  if (args_info->sele1_given)
302 +    write_into_file(outfile, "sele1", args_info->sele1_orig, 0);
303 +  if (args_info->sele2_given)
304 +    write_into_file(outfile, "sele2", args_info->sele2_orig, 0);
305 +  if (args_info->order_given)
306 +    write_into_file(outfile, "order", args_info->order_orig, 0);
307 +  if (args_info->nzbins_given)
308 +    write_into_file(outfile, "nzbins", args_info->nzbins_orig, 0);
309 +  if (args_info->memory_given)
310 +    write_into_file(outfile, "memory", args_info->memory_orig, 0);
311 +  if (args_info->selecorr_given)
312 +    write_into_file(outfile, "selecorr", 0, 0 );
313 +  if (args_info->rcorr_given)
314 +    write_into_file(outfile, "rcorr", 0, 0 );
315 +  if (args_info->vcorr_given)
316 +    write_into_file(outfile, "vcorr", 0, 0 );
317 +  if (args_info->dcorr_given)
318 +    write_into_file(outfile, "dcorr", 0, 0 );
319 +  if (args_info->lcorr_given)
320 +    write_into_file(outfile, "lcorr", 0, 0 );
321 +  if (args_info->lcorrZ_given)
322 +    write_into_file(outfile, "lcorrZ", 0, 0 );
323 +  if (args_info->cohZ_given)
324 +    write_into_file(outfile, "cohZ", 0, 0 );
325 +  if (args_info->sdcorr_given)
326 +    write_into_file(outfile, "sdcorr", 0, 0 );
327 +  if (args_info->r_rcorr_given)
328 +    write_into_file(outfile, "r_rcorr", 0, 0 );
329 +  if (args_info->thetacorr_given)
330 +    write_into_file(outfile, "thetacorr", 0, 0 );
331 +  if (args_info->drcorr_given)
332 +    write_into_file(outfile, "drcorr", 0, 0 );
333 +  if (args_info->helfandEcorr_given)
334 +    write_into_file(outfile, "helfandEcorr", 0, 0 );
335 +  if (args_info->momentum_given)
336 +    write_into_file(outfile, "momentum", 0, 0 );
337 +  if (args_info->stresscorr_given)
338 +    write_into_file(outfile, "stresscorr", 0, 0 );
339    
340 <  clear_given (args_info);
340 >
341 >  i = EXIT_SUCCESS;
342 >  return i;
343   }
344  
345   int
# Line 175 | Line 356 | cmdline_parser_file_save(const char *filename, struct
356        return EXIT_FAILURE;
357      }
358  
359 <  if (args_info->help_given) {
179 <    fprintf(outfile, "%s\n", "help");
180 <  }
181 <  if (args_info->version_given) {
182 <    fprintf(outfile, "%s\n", "version");
183 <  }
184 <  if (args_info->input_given) {
185 <    if (args_info->input_orig) {
186 <      fprintf(outfile, "%s=\"%s\"\n", "input", args_info->input_orig);
187 <    } else {
188 <      fprintf(outfile, "%s\n", "input");
189 <    }
190 <  }
191 <  if (args_info->output_given) {
192 <    if (args_info->output_orig) {
193 <      fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig);
194 <    } else {
195 <      fprintf(outfile, "%s\n", "output");
196 <    }
197 <  }
198 <  if (args_info->sele1_given) {
199 <    if (args_info->sele1_orig) {
200 <      fprintf(outfile, "%s=\"%s\"\n", "sele1", args_info->sele1_orig);
201 <    } else {
202 <      fprintf(outfile, "%s\n", "sele1");
203 <    }
204 <  }
205 <  if (args_info->sele2_given) {
206 <    if (args_info->sele2_orig) {
207 <      fprintf(outfile, "%s=\"%s\"\n", "sele2", args_info->sele2_orig);
208 <    } else {
209 <      fprintf(outfile, "%s\n", "sele2");
210 <    }
211 <  }
212 <  if (args_info->order_given) {
213 <    if (args_info->order_orig) {
214 <      fprintf(outfile, "%s=\"%s\"\n", "order", args_info->order_orig);
215 <    } else {
216 <      fprintf(outfile, "%s\n", "order");
217 <    }
218 <  }
219 <  if (args_info->rcorr_given) {
220 <    fprintf(outfile, "%s\n", "rcorr");
221 <  }
222 <  if (args_info->vcorr_given) {
223 <    fprintf(outfile, "%s\n", "vcorr");
224 <  }
225 <  if (args_info->dcorr_given) {
226 <    fprintf(outfile, "%s\n", "dcorr");
227 <  }
228 <  if (args_info->lcorr_given) {
229 <    fprintf(outfile, "%s\n", "lcorr");
230 <  }
231 <  if (args_info->r_rcorr_given) {
232 <    fprintf(outfile, "%s\n", "r_rcorr");
233 <  }
234 <  if (args_info->thetacorr_given) {
235 <    fprintf(outfile, "%s\n", "thetacorr");
236 <  }
237 <  if (args_info->actioncorr_given) {
238 <    fprintf(outfile, "%s\n", "actioncorr");
239 <  }
240 <  if (args_info->drcorr_given) {
241 <    fprintf(outfile, "%s\n", "drcorr");
242 <  }
243 <  
359 >  i = cmdline_parser_dump(outfile, args_info);
360    fclose (outfile);
361  
246  i = EXIT_SUCCESS;
362    return i;
363   }
364  
# Line 253 | Line 368 | cmdline_parser_free (struct gengetopt_args_info *args_
368    cmdline_parser_release (args_info);
369   }
370  
371 <
257 < /* gengetopt_strdup() */
258 < /* strdup.c replacement of strdup, which is not standard */
371 > /** @brief replacement of strdup, which is not standard */
372   char *
373   gengetopt_strdup (const char *s)
374   {
375 <  char *result = NULL;
375 >  char *result = 0;
376    if (!s)
377      return result;
378  
# Line 271 | Line 384 | static void
384   }
385  
386   static void
274 reset_group_dynamicProps(struct gengetopt_args_info *args_info);
275
276 static void
387   reset_group_dynamicProps(struct gengetopt_args_info *args_info)
388   {
389    if (! args_info->dynamicProps_group_counter)
390      return;
391    
392 +  args_info->selecorr_given = 0 ;
393    args_info->rcorr_given = 0 ;
394    args_info->vcorr_given = 0 ;
395    args_info->dcorr_given = 0 ;
396    args_info->lcorr_given = 0 ;
397 +  args_info->lcorrZ_given = 0 ;
398 +  args_info->cohZ_given = 0 ;
399 +  args_info->sdcorr_given = 0 ;
400    args_info->r_rcorr_given = 0 ;
401    args_info->thetacorr_given = 0 ;
288  args_info->actioncorr_given = 0 ;
402    args_info->drcorr_given = 0 ;
403 +  args_info->helfandEcorr_given = 0 ;
404 +  args_info->momentum_given = 0 ;
405 +  args_info->stresscorr_given = 0 ;
406  
407    args_info->dynamicProps_group_counter = 0;
408   }
409  
410   int
411 < cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
411 > cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
412   {
413    return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
414   }
415  
416   int
417 < cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
417 > cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
418 >                   struct cmdline_parser_params *params)
419   {
420    int result;
421 +  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
422  
423 <  result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL);
423 >  if (result == EXIT_FAILURE)
424 >    {
425 >      cmdline_parser_free (args_info);
426 >      exit (EXIT_FAILURE);
427 >    }
428 >  
429 >  return result;
430 > }
431  
432 + int
433 + cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
434 + {
435 +  int result;
436 +  struct cmdline_parser_params params;
437 +  
438 +  params.override = override;
439 +  params.initialize = initialize;
440 +  params.check_required = check_required;
441 +  params.check_ambiguity = 0;
442 +  params.print_errors = 1;
443 +
444 +  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
445 +
446    if (result == EXIT_FAILURE)
447      {
448        cmdline_parser_free (args_info);
# Line 318 | Line 457 | cmdline_parser_required (struct gengetopt_args_info *a
457   {
458    int result = EXIT_SUCCESS;
459  
460 <  if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
460 >  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
461      result = EXIT_FAILURE;
462  
463    if (result == EXIT_FAILURE)
# Line 334 | Line 473 | cmdline_parser_required2 (struct gengetopt_args_info *
473   cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
474   {
475    int error = 0;
476 +  FIX_UNUSED (additional_error);
477  
478 +  /* checks for required options */
479    if (! args_info->input_given)
480      {
481        fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : ""));
482        error = 1;
483      }
484 +  
485    if (args_info->dynamicProps_group_counter == 0)
486      {
487 <      fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required.%s\n", prog_name, args_info->dynamicProps_group_counter, (additional_error ? additional_error : ""));
487 >      fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required%s.\n", prog_name, args_info->dynamicProps_group_counter, (additional_error ? additional_error : ""));
488        error = 1;
489      }
490    
491  
492 +  /* checks for dependences among options */
493 +
494    return error;
495 + }
496 +
497 +
498 + static char *package_name = 0;
499 +
500 + /**
501 + * @brief updates an option
502 + * @param field the generic pointer to the field to update
503 + * @param orig_field the pointer to the orig field
504 + * @param field_given the pointer to the number of occurrence of this option
505 + * @param prev_given the pointer to the number of occurrence already seen
506 + * @param value the argument for this option (if null no arg was specified)
507 + * @param possible_values the possible values for this option (if specified)
508 + * @param default_value the default value (in case the option only accepts fixed values)
509 + * @param arg_type the type of this option
510 + * @param check_ambiguity @see cmdline_parser_params.check_ambiguity
511 + * @param override @see cmdline_parser_params.override
512 + * @param no_free whether to free a possible previous value
513 + * @param multiple_option whether this is a multiple option
514 + * @param long_opt the corresponding long option
515 + * @param short_opt the corresponding short option (or '-' if none)
516 + * @param additional_error possible further error specification
517 + */
518 + static
519 + int update_arg(void *field, char **orig_field,
520 +               unsigned int *field_given, unsigned int *prev_given,
521 +               char *value, const char *possible_values[],
522 +               const char *default_value,
523 +               cmdline_parser_arg_type arg_type,
524 +               int check_ambiguity, int override,
525 +               int no_free, int multiple_option,
526 +               const char *long_opt, char short_opt,
527 +               const char *additional_error)
528 + {
529 +  char *stop_char = 0;
530 +  const char *val = value;
531 +  int found;
532 +  char **string_field;
533 +  FIX_UNUSED (field);
534 +
535 +  stop_char = 0;
536 +  found = 0;
537 +
538 +  if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
539 +    {
540 +      if (short_opt != '-')
541 +        fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
542 +               package_name, long_opt, short_opt,
543 +               (additional_error ? additional_error : ""));
544 +      else
545 +        fprintf (stderr, "%s: `--%s' option given more than once%s\n",
546 +               package_name, long_opt,
547 +               (additional_error ? additional_error : ""));
548 +      return 1; /* failure */
549 +    }
550 +
551 +  FIX_UNUSED (default_value);
552 +    
553 +  if (field_given && *field_given && ! override)
554 +    return 0;
555 +  if (prev_given)
556 +    (*prev_given)++;
557 +  if (field_given)
558 +    (*field_given)++;
559 +  if (possible_values)
560 +    val = possible_values[found];
561 +
562 +  switch(arg_type) {
563 +  case ARG_INT:
564 +    if (val) *((int *)field) = strtol (val, &stop_char, 0);
565 +    break;
566 +  case ARG_STRING:
567 +    if (val) {
568 +      string_field = (char **)field;
569 +      if (!no_free && *string_field)
570 +        free (*string_field); /* free previous string */
571 +      *string_field = gengetopt_strdup (val);
572 +    }
573 +    break;
574 +  default:
575 +    break;
576 +  };
577 +
578 +  /* check numeric conversion */
579 +  switch(arg_type) {
580 +  case ARG_INT:
581 +    if (val && !(stop_char && *stop_char == '\0')) {
582 +      fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
583 +      return 1; /* failure */
584 +    }
585 +    break;
586 +  default:
587 +    ;
588 +  };
589 +
590 +  /* store the original value */
591 +  switch(arg_type) {
592 +  case ARG_NO:
593 +    break;
594 +  default:
595 +    if (value && orig_field) {
596 +      if (no_free) {
597 +        *orig_field = value;
598 +      } else {
599 +        if (*orig_field)
600 +          free (*orig_field); /* free previous string */
601 +        *orig_field = gengetopt_strdup (value);
602 +      }
603 +    }
604 +  };
605 +
606 +  return 0; /* OK */
607   }
608  
609 +
610   int
611 < cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error)
611 > cmdline_parser_internal (
612 >  int argc, char **argv, struct gengetopt_args_info *args_info,
613 >                        struct cmdline_parser_params *params, const char *additional_error)
614   {
615    int c;        /* Character of the parsed option.  */
616  
617    int error = 0;
618    struct gengetopt_args_info local_args_info;
619 +  
620 +  int override;
621 +  int initialize;
622 +  int check_required;
623 +  int check_ambiguity;
624 +  
625 +  package_name = argv[0];
626 +  
627 +  override = params->override;
628 +  initialize = params->initialize;
629 +  check_required = params->check_required;
630 +  check_ambiguity = params->check_ambiguity;
631  
632    if (initialize)
633      cmdline_parser_init (args_info);
# Line 365 | Line 636 | cmdline_parser_internal (int argc, char * const *argv,
636  
637    optarg = 0;
638    optind = 0;
639 <  opterr = 1;
639 >  opterr = params->print_errors;
640    optopt = '?';
641  
642    while (1)
643      {
644        int option_index = 0;
374      char *stop_char;
645  
646        static struct option long_options[] = {
647          { "help",       0, NULL, 'h' },
# Line 381 | Line 651 | cmdline_parser_internal (int argc, char * const *argv,
651          { "sele1",      1, NULL, 0 },
652          { "sele2",      1, NULL, 0 },
653          { "order",      1, NULL, 0 },
654 +        { "nzbins",     1, NULL, 'z' },
655 +        { "memory",     1, NULL, 'm' },
656 +        { "selecorr",   0, NULL, 's' },
657          { "rcorr",      0, NULL, 'r' },
658          { "vcorr",      0, NULL, 'v' },
659          { "dcorr",      0, NULL, 'd' },
660          { "lcorr",      0, NULL, 'l' },
661 +        { "lcorrZ",     0, NULL, 0 },
662 +        { "cohZ",       0, NULL, 0 },
663 +        { "sdcorr",     0, NULL, 'M' },
664          { "r_rcorr",    0, NULL, 0 },
665          { "thetacorr",  0, NULL, 0 },
390        { "actioncorr", 0, NULL, 0 },
666          { "drcorr",     0, NULL, 0 },
667 <        { NULL, 0, NULL, 0 }
667 >        { "helfandEcorr",       0, NULL, 0 },
668 >        { "momentum",   0, NULL, 'p' },
669 >        { "stresscorr", 0, NULL, 0 },
670 >        { 0,  0, 0, 0 }
671        };
672  
673 <      stop_char = 0;
396 <      c = getopt_long (argc, argv, "hVi:o:rvdl", long_options, &option_index);
673 >      c = getopt_long (argc, argv, "hVi:o:z:m:srvdlMp", long_options, &option_index);
674  
675        if (c == -1) break;       /* Exit from `while (1)' loop.  */
676  
# Line 410 | Line 687 | cmdline_parser_internal (int argc, char * const *argv,
687            exit (EXIT_SUCCESS);
688  
689          case 'i':       /* input dump file.  */
690 <          if (local_args_info.input_given)
691 <            {
692 <              fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
693 <              goto failure;
694 <            }
695 <          if (args_info->input_given && ! override)
696 <            continue;
697 <          local_args_info.input_given = 1;
698 <          args_info->input_given = 1;
699 <          if (args_info->input_arg)
423 <            free (args_info->input_arg); /* free previous string */
424 <          args_info->input_arg = gengetopt_strdup (optarg);
425 <          if (args_info->input_orig)
426 <            free (args_info->input_orig); /* free previous string */
427 <          args_info->input_orig = gengetopt_strdup (optarg);
690 >        
691 >        
692 >          if (update_arg( (void *)&(args_info->input_arg),
693 >               &(args_info->input_orig), &(args_info->input_given),
694 >              &(local_args_info.input_given), optarg, 0, 0, ARG_STRING,
695 >              check_ambiguity, override, 0, 0,
696 >              "input", 'i',
697 >              additional_error))
698 >            goto failure;
699 >        
700            break;
429
701          case 'o':       /* output file name.  */
702 <          if (local_args_info.output_given)
703 <            {
704 <              fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
705 <              goto failure;
706 <            }
707 <          if (args_info->output_given && ! override)
708 <            continue;
709 <          local_args_info.output_given = 1;
710 <          args_info->output_given = 1;
711 <          if (args_info->output_arg)
441 <            free (args_info->output_arg); /* free previous string */
442 <          args_info->output_arg = gengetopt_strdup (optarg);
443 <          if (args_info->output_orig)
444 <            free (args_info->output_orig); /* free previous string */
445 <          args_info->output_orig = gengetopt_strdup (optarg);
702 >        
703 >        
704 >          if (update_arg( (void *)&(args_info->output_arg),
705 >               &(args_info->output_orig), &(args_info->output_given),
706 >              &(local_args_info.output_given), optarg, 0, 0, ARG_STRING,
707 >              check_ambiguity, override, 0, 0,
708 >              "output", 'o',
709 >              additional_error))
710 >            goto failure;
711 >        
712            break;
713 <
713 >        case 'z':       /* Number of Z bins.  */
714 >        
715 >        
716 >          if (update_arg( (void *)&(args_info->nzbins_arg),
717 >               &(args_info->nzbins_orig), &(args_info->nzbins_given),
718 >              &(local_args_info.nzbins_given), optarg, 0, "100", ARG_INT,
719 >              check_ambiguity, override, 0, 0,
720 >              "nzbins", 'z',
721 >              additional_error))
722 >            goto failure;
723 >        
724 >          break;
725 >        case 'm':       /* Available memory (defaults to 2G).  */
726 >        
727 >        
728 >          if (update_arg( (void *)&(args_info->memory_arg),
729 >               &(args_info->memory_orig), &(args_info->memory_given),
730 >              &(local_args_info.memory_given), optarg, 0, "2G", ARG_STRING,
731 >              check_ambiguity, override, 0, 0,
732 >              "memory", 'm',
733 >              additional_error))
734 >            goto failure;
735 >        
736 >          break;
737 >        case 's':       /* selection correlation function.  */
738 >        
739 >          if (args_info->dynamicProps_group_counter && override)
740 >            reset_group_dynamicProps (args_info);
741 >          args_info->dynamicProps_group_counter += 1;
742 >        
743 >          if (update_arg( 0 ,
744 >               0 , &(args_info->selecorr_given),
745 >              &(local_args_info.selecorr_given), optarg, 0, 0, ARG_NO,
746 >              check_ambiguity, override, 0, 0,
747 >              "selecorr", 's',
748 >              additional_error))
749 >            goto failure;
750 >        
751 >          break;
752          case 'r':       /* rmsd.  */
753 <          if (local_args_info.rcorr_given)
450 <            {
451 <              fprintf (stderr, "%s: `--rcorr' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
452 <              goto failure;
453 <            }
454 <          if (args_info->rcorr_given && ! override)
455 <            continue;
456 <          local_args_info.rcorr_given = 1;
457 <          args_info->rcorr_given = 1;
753 >        
754            if (args_info->dynamicProps_group_counter && override)
755              reset_group_dynamicProps (args_info);
756            args_info->dynamicProps_group_counter += 1;
757 +        
758 +          if (update_arg( 0 ,
759 +               0 , &(args_info->rcorr_given),
760 +              &(local_args_info.rcorr_given), optarg, 0, 0, ARG_NO,
761 +              check_ambiguity, override, 0, 0,
762 +              "rcorr", 'r',
763 +              additional_error))
764 +            goto failure;
765 +        
766            break;
462
767          case 'v':       /* velocity correlation function.  */
768 <          if (local_args_info.vcorr_given)
465 <            {
466 <              fprintf (stderr, "%s: `--vcorr' (`-v') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
467 <              goto failure;
468 <            }
469 <          if (args_info->vcorr_given && ! override)
470 <            continue;
471 <          local_args_info.vcorr_given = 1;
472 <          args_info->vcorr_given = 1;
768 >        
769            if (args_info->dynamicProps_group_counter && override)
770              reset_group_dynamicProps (args_info);
771            args_info->dynamicProps_group_counter += 1;
772 +        
773 +          if (update_arg( 0 ,
774 +               0 , &(args_info->vcorr_given),
775 +              &(local_args_info.vcorr_given), optarg, 0, 0, ARG_NO,
776 +              check_ambiguity, override, 0, 0,
777 +              "vcorr", 'v',
778 +              additional_error))
779 +            goto failure;
780 +        
781            break;
477
782          case 'd':       /* dipole correlation function.  */
783 <          if (local_args_info.dcorr_given)
480 <            {
481 <              fprintf (stderr, "%s: `--dcorr' (`-d') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
482 <              goto failure;
483 <            }
484 <          if (args_info->dcorr_given && ! override)
485 <            continue;
486 <          local_args_info.dcorr_given = 1;
487 <          args_info->dcorr_given = 1;
783 >        
784            if (args_info->dynamicProps_group_counter && override)
785              reset_group_dynamicProps (args_info);
786            args_info->dynamicProps_group_counter += 1;
787 +        
788 +          if (update_arg( 0 ,
789 +               0 , &(args_info->dcorr_given),
790 +              &(local_args_info.dcorr_given), optarg, 0, 0, ARG_NO,
791 +              check_ambiguity, override, 0, 0,
792 +              "dcorr", 'd',
793 +              additional_error))
794 +            goto failure;
795 +        
796            break;
492
797          case 'l':       /* Lengendre correlation function.  */
798 <          if (local_args_info.lcorr_given)
495 <            {
496 <              fprintf (stderr, "%s: `--lcorr' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
497 <              goto failure;
498 <            }
499 <          if (args_info->lcorr_given && ! override)
500 <            continue;
501 <          local_args_info.lcorr_given = 1;
502 <          args_info->lcorr_given = 1;
798 >        
799            if (args_info->dynamicProps_group_counter && override)
800              reset_group_dynamicProps (args_info);
801            args_info->dynamicProps_group_counter += 1;
802 +        
803 +          if (update_arg( 0 ,
804 +               0 , &(args_info->lcorr_given),
805 +              &(local_args_info.lcorr_given), optarg, 0, 0, ARG_NO,
806 +              check_ambiguity, override, 0, 0,
807 +              "lcorr", 'l',
808 +              additional_error))
809 +            goto failure;
810 +        
811            break;
812 <
812 >        case 'M':       /* System dipole correlation function.  */
813 >        
814 >          if (args_info->dynamicProps_group_counter && override)
815 >            reset_group_dynamicProps (args_info);
816 >          args_info->dynamicProps_group_counter += 1;
817 >        
818 >          if (update_arg( 0 ,
819 >               0 , &(args_info->sdcorr_given),
820 >              &(local_args_info.sdcorr_given), optarg, 0, 0, ARG_NO,
821 >              check_ambiguity, override, 0, 0,
822 >              "sdcorr", 'M',
823 >              additional_error))
824 >            goto failure;
825 >        
826 >          break;
827 >        case 'p':       /* Helfand momentum for viscosity.  */
828 >        
829 >          if (args_info->dynamicProps_group_counter && override)
830 >            reset_group_dynamicProps (args_info);
831 >          args_info->dynamicProps_group_counter += 1;
832 >        
833 >          if (update_arg( 0 ,
834 >               0 , &(args_info->momentum_given),
835 >              &(local_args_info.momentum_given), optarg, 0, 0, ARG_NO,
836 >              check_ambiguity, override, 0, 0,
837 >              "momentum", 'p',
838 >              additional_error))
839 >            goto failure;
840 >        
841 >          break;
842  
843          case 0: /* Long option with no short option */
844            /* select first stuntdouble set.  */
845            if (strcmp (long_options[option_index].name, "sele1") == 0)
846            {
847 <            if (local_args_info.sele1_given)
848 <              {
849 <                fprintf (stderr, "%s: `--sele1' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
850 <                goto failure;
851 <              }
852 <            if (args_info->sele1_given && ! override)
853 <              continue;
854 <            local_args_info.sele1_given = 1;
855 <            args_info->sele1_given = 1;
856 <            if (args_info->sele1_arg)
523 <              free (args_info->sele1_arg); /* free previous string */
524 <            args_info->sele1_arg = gengetopt_strdup (optarg);
525 <            if (args_info->sele1_orig)
526 <              free (args_info->sele1_orig); /* free previous string */
527 <            args_info->sele1_orig = gengetopt_strdup (optarg);
847 >          
848 >          
849 >            if (update_arg( (void *)&(args_info->sele1_arg),
850 >                 &(args_info->sele1_orig), &(args_info->sele1_given),
851 >                &(local_args_info.sele1_given), optarg, 0, 0, ARG_STRING,
852 >                check_ambiguity, override, 0, 0,
853 >                "sele1", '-',
854 >                additional_error))
855 >              goto failure;
856 >          
857            }
858            /* select second stuntdouble set (if sele2 is not set, use script from sele1).  */
859            else if (strcmp (long_options[option_index].name, "sele2") == 0)
860            {
861 <            if (local_args_info.sele2_given)
862 <              {
863 <                fprintf (stderr, "%s: `--sele2' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
864 <                goto failure;
865 <              }
866 <            if (args_info->sele2_given && ! override)
867 <              continue;
868 <            local_args_info.sele2_given = 1;
869 <            args_info->sele2_given = 1;
870 <            if (args_info->sele2_arg)
542 <              free (args_info->sele2_arg); /* free previous string */
543 <            args_info->sele2_arg = gengetopt_strdup (optarg);
544 <            if (args_info->sele2_orig)
545 <              free (args_info->sele2_orig); /* free previous string */
546 <            args_info->sele2_orig = gengetopt_strdup (optarg);
861 >          
862 >          
863 >            if (update_arg( (void *)&(args_info->sele2_arg),
864 >                 &(args_info->sele2_orig), &(args_info->sele2_given),
865 >                &(local_args_info.sele2_given), optarg, 0, 0, ARG_STRING,
866 >                check_ambiguity, override, 0, 0,
867 >                "sele2", '-',
868 >                additional_error))
869 >              goto failure;
870 >          
871            }
872            /* Lengendre Polynomial Order.  */
873            else if (strcmp (long_options[option_index].name, "order") == 0)
874            {
875 <            if (local_args_info.order_given)
876 <              {
877 <                fprintf (stderr, "%s: `--order' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
878 <                goto failure;
879 <              }
880 <            if (args_info->order_given && ! override)
881 <              continue;
882 <            local_args_info.order_given = 1;
559 <            args_info->order_given = 1;
560 <            args_info->order_arg = strtol (optarg, &stop_char, 0);
561 <            if (!(stop_char && *stop_char == '\0')) {
562 <              fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg);
875 >          
876 >          
877 >            if (update_arg( (void *)&(args_info->order_arg),
878 >                 &(args_info->order_orig), &(args_info->order_given),
879 >                &(local_args_info.order_given), optarg, 0, 0, ARG_INT,
880 >                check_ambiguity, override, 0, 0,
881 >                "order", '-',
882 >                additional_error))
883                goto failure;
884 <            }
565 <            if (args_info->order_orig)
566 <              free (args_info->order_orig); /* free previous string */
567 <            args_info->order_orig = gengetopt_strdup (optarg);
884 >          
885            }
886 +          /* Lengendre correlation function binned by Z.  */
887 +          else if (strcmp (long_options[option_index].name, "lcorrZ") == 0)
888 +          {
889 +          
890 +            if (args_info->dynamicProps_group_counter && override)
891 +              reset_group_dynamicProps (args_info);
892 +            args_info->dynamicProps_group_counter += 1;
893 +          
894 +            if (update_arg( 0 ,
895 +                 0 , &(args_info->lcorrZ_given),
896 +                &(local_args_info.lcorrZ_given), optarg, 0, 0, ARG_NO,
897 +                check_ambiguity, override, 0, 0,
898 +                "lcorrZ", '-',
899 +                additional_error))
900 +              goto failure;
901 +          
902 +          }
903 +          /* Lengendre correlation function for OH bond vectors binned by Z.  */
904 +          else if (strcmp (long_options[option_index].name, "cohZ") == 0)
905 +          {
906 +          
907 +            if (args_info->dynamicProps_group_counter && override)
908 +              reset_group_dynamicProps (args_info);
909 +            args_info->dynamicProps_group_counter += 1;
910 +          
911 +            if (update_arg( 0 ,
912 +                 0 , &(args_info->cohZ_given),
913 +                &(local_args_info.cohZ_given), optarg, 0, 0, ARG_NO,
914 +                check_ambiguity, override, 0, 0,
915 +                "cohZ", '-',
916 +                additional_error))
917 +              goto failure;
918 +          
919 +          }
920            /* Radial rmsd.  */
921            else if (strcmp (long_options[option_index].name, "r_rcorr") == 0)
922            {
923 <            if (local_args_info.r_rcorr_given)
573 <              {
574 <                fprintf (stderr, "%s: `--r_rcorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
575 <                goto failure;
576 <              }
577 <            if (args_info->r_rcorr_given && ! override)
578 <              continue;
579 <            local_args_info.r_rcorr_given = 1;
580 <            args_info->r_rcorr_given = 1;
923 >          
924              if (args_info->dynamicProps_group_counter && override)
925                reset_group_dynamicProps (args_info);
926              args_info->dynamicProps_group_counter += 1;
927 <            break;
927 >          
928 >            if (update_arg( 0 ,
929 >                 0 , &(args_info->r_rcorr_given),
930 >                &(local_args_info.r_rcorr_given), optarg, 0, 0, ARG_NO,
931 >                check_ambiguity, override, 0, 0,
932 >                "r_rcorr", '-',
933 >                additional_error))
934 >              goto failure;
935 >          
936            }
937            /* Angular rmsd.  */
938            else if (strcmp (long_options[option_index].name, "thetacorr") == 0)
939            {
940 <            if (local_args_info.thetacorr_given)
590 <              {
591 <                fprintf (stderr, "%s: `--thetacorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
592 <                goto failure;
593 <              }
594 <            if (args_info->thetacorr_given && ! override)
595 <              continue;
596 <            local_args_info.thetacorr_given = 1;
597 <            args_info->thetacorr_given = 1;
940 >          
941              if (args_info->dynamicProps_group_counter && override)
942                reset_group_dynamicProps (args_info);
943              args_info->dynamicProps_group_counter += 1;
944 <            break;
944 >          
945 >            if (update_arg( 0 ,
946 >                 0 , &(args_info->thetacorr_given),
947 >                &(local_args_info.thetacorr_given), optarg, 0, 0, ARG_NO,
948 >                check_ambiguity, override, 0, 0,
949 >                "thetacorr", '-',
950 >                additional_error))
951 >              goto failure;
952 >          
953            }
954 <          /* Action correlation function.  */
955 <          else if (strcmp (long_options[option_index].name, "actioncorr") == 0)
954 >          /* Directional rmsd for particles with unit vectors.  */
955 >          else if (strcmp (long_options[option_index].name, "drcorr") == 0)
956            {
957 <            if (local_args_info.actioncorr_given)
607 <              {
608 <                fprintf (stderr, "%s: `--actioncorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
609 <                goto failure;
610 <              }
611 <            if (args_info->actioncorr_given && ! override)
612 <              continue;
613 <            local_args_info.actioncorr_given = 1;
614 <            args_info->actioncorr_given = 1;
957 >          
958              if (args_info->dynamicProps_group_counter && override)
959                reset_group_dynamicProps (args_info);
960              args_info->dynamicProps_group_counter += 1;
961 <            break;
961 >          
962 >            if (update_arg( 0 ,
963 >                 0 , &(args_info->drcorr_given),
964 >                &(local_args_info.drcorr_given), optarg, 0, 0, ARG_NO,
965 >                check_ambiguity, override, 0, 0,
966 >                "drcorr", '-',
967 >                additional_error))
968 >              goto failure;
969 >          
970            }
971 <          /* Directional rmsd for particles with unit vectors.  */
972 <          else if (strcmp (long_options[option_index].name, "drcorr") == 0)
971 >          /* Helfand moment for thermal conductvity.  */
972 >          else if (strcmp (long_options[option_index].name, "helfandEcorr") == 0)
973            {
974 <            if (local_args_info.drcorr_given)
624 <              {
625 <                fprintf (stderr, "%s: `--drcorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
626 <                goto failure;
627 <              }
628 <            if (args_info->drcorr_given && ! override)
629 <              continue;
630 <            local_args_info.drcorr_given = 1;
631 <            args_info->drcorr_given = 1;
974 >          
975              if (args_info->dynamicProps_group_counter && override)
976                reset_group_dynamicProps (args_info);
977              args_info->dynamicProps_group_counter += 1;
978 <            break;
978 >          
979 >            if (update_arg( 0 ,
980 >                 0 , &(args_info->helfandEcorr_given),
981 >                &(local_args_info.helfandEcorr_given), optarg, 0, 0, ARG_NO,
982 >                check_ambiguity, override, 0, 0,
983 >                "helfandEcorr", '-',
984 >                additional_error))
985 >              goto failure;
986 >          
987            }
988 +          /* Stress tensor correlation function.  */
989 +          else if (strcmp (long_options[option_index].name, "stresscorr") == 0)
990 +          {
991            
992 +            if (args_info->dynamicProps_group_counter && override)
993 +              reset_group_dynamicProps (args_info);
994 +            args_info->dynamicProps_group_counter += 1;
995 +          
996 +            if (update_arg( 0 ,
997 +                 0 , &(args_info->stresscorr_given),
998 +                &(local_args_info.stresscorr_given), optarg, 0, 0, ARG_NO,
999 +                check_ambiguity, override, 0, 0,
1000 +                "stresscorr", '-',
1001 +                additional_error))
1002 +              goto failure;
1003 +          
1004 +          }
1005 +          
1006            break;
1007          case '?':       /* Invalid option.  */
1008            /* `getopt_long' already printed an error message.  */
# Line 648 | Line 1016 | cmdline_parser_internal (int argc, char * const *argv,
1016  
1017    if (args_info->dynamicProps_group_counter > 1)
1018      {
1019 <      fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required.%s\n", argv[0], args_info->dynamicProps_group_counter, (additional_error ? additional_error : ""));
1019 >      fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required%s.\n", argv[0], args_info->dynamicProps_group_counter, (additional_error ? additional_error : ""));
1020        error = 1;
1021      }
1022    
# Line 664 | Line 1032 | cmdline_parser_internal (int argc, char * const *argv,
1032    if ( error )
1033      return (EXIT_FAILURE);
1034  
1035 +  if (optind < argc)
1036 +    {
1037 +      int i = 0 ;
1038 +      int found_prog_name = 0;
1039 +      /* whether program name, i.e., argv[0], is in the remaining args
1040 +         (this may happen with some implementations of getopt,
1041 +          but surely not with the one included by gengetopt) */
1042 +
1043 +      i = optind;
1044 +      while (i < argc)
1045 +        if (argv[i++] == argv[0]) {
1046 +          found_prog_name = 1;
1047 +          break;
1048 +        }
1049 +      i = 0;
1050 +
1051 +      args_info->inputs_num = argc - optind - found_prog_name;
1052 +      args_info->inputs =
1053 +        (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
1054 +      while (optind < argc)
1055 +        if (argv[optind++] != argv[0])
1056 +          args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ;
1057 +    }
1058 +
1059    return 0;
1060  
1061   failure:

Comparing:
trunk/src/applications/dynamicProps/DynamicPropsCmd.c (property svn:keywords), Revision 1183 by xsun, Tue Oct 2 12:05:25 2007 UTC vs.
trunk/src/applications/dynamicProps/DynamicPropsCmd.cpp (property svn:keywords), Revision 1939 by gezelter, Thu Oct 31 18:18:57 2013 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines