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 1213 by xsun, Wed Jan 23 21:21:50 2008 UTC vs.
trunk/src/applications/dynamicProps/DynamicPropsCmd.cpp (file contents), Revision 2024 by gezelter, Thu Oct 16 19:13:51 2014 UTC

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

Comparing:
trunk/src/applications/dynamicProps/DynamicPropsCmd.c (property svn:keywords), Revision 1213 by xsun, Wed Jan 23 21:21:50 2008 UTC vs.
trunk/src/applications/dynamicProps/DynamicPropsCmd.cpp (property svn:keywords), Revision 2024 by gezelter, Thu Oct 16 19:13:51 2014 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines