Octopus
getopt_f.c
Go to the documentation of this file.
1/*
2 Copyright (C) 2002 M. Marques, A. Castro, A. Rubio, G. Bertsch
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18
19*/
20
21#include <config.h>
22#include <build_info.h>
23#include <stdio.h>
24#include <stdlib.h>
25#include <getopt.h>
26#include <string.h>
27
28#if __has_include(<unistd.h>)
29#include <unistd.h>
30#endif
31#include <assert.h>
32
33// Below we check whether _POSIX_VERSION is defined to decide whether we can use
34// getopt_long. This is not entirely correct, becaues getopt_long is a GNU
35// extension which is not mandated by POSIX. However, most relevant major
36// UNIX-like operating systems that define _POSIX_VERSION also have getopt_long
37// in their standard C library. The list below is incomplete.
38//
39// Support is present in: Support is absent in:
40//
41// - Linux with both glibc and musl - HP-UX
42// - macOS - AIX
43// - FreeBSD, NetBSD, OpenBSD
44// - Solaris
45#if defined(_POSIX_VERSION) && !defined(__hpux) && !defined(_AIX)
46#define HAVE_GETOPT_LONG 1
47#endif
48
49/* GENERAL FUNCTIONS AND VARIABLES */
50
51char **argv;
52int argc;
53
54void FC_FUNC_(set_number_clarg, SET_NUMBER_CLARG)(int *nargc) {
55 argc = *nargc + 1;
56 argv = (char **)malloc(argc * sizeof(char *));
57}
58
59void set_clarg(int *i, char* c) {
60 argv[*i] = strdup(c);
61}
62
63void FC_FUNC_(clean_clarg, CLEAN_CLARG)() {
64 int i;
65 for (i = 0; i < argc; i++)
66 free(argv[i]);
67 free(argv);
68 argv = NULL;
69}
70
71int clarg_is_set() { return argv != NULL; }
72
73/* FUNCTIONS TO BE USED BY THE PROGRAM oct-oscillator-strength */
75 printf("Usage: oct-oscillator-strength [OPTIONS] [w]\n");
76 printf("\n");
77 printf("Options:\n");
78 printf(" -h Prints this help and exits.\n");
79 printf(" -m <mode> Select the run mode:\n");
80 printf(" 1 (default) analyzes the signal present in an "
81 "'ot' file.\n");
82 printf(" This should have been generated by this same "
83 "utility\n");
84 printf(" (run mode 2).\n");
85 printf(" 2 Reads a number of 'multipoles' files, which "
86 "should be\n");
87 printf(" present in the working directory, and be "
88 "called\n");
89 printf(" 'multipoles.1', 'multipoles.2', ..., and "
90 "generate an 'ot'\n");
91 printf(" file with the k-th order response of a given "
92 "operator O.\n");
93 printf(" The order k is decided by the '-k' option. The "
94 "operator\n");
95 printf(" is decided by the '-O' option.\n");
96 printf(" 3 Peforms an analysis of the second-order "
97 "response of an\n");
98 printf(" operator O, present in the working directory, "
99 "and\n");
100 printf(" previously generated with run mode 2. It also "
101 "reads a\n");
102 printf(" file with a list of frequecies around which "
103 "the search\n");
104 printf(" for resonances is performed.\n");
105 printf(" 4 Reads an 'ot' file, and generates an 'omega' "
106 "file with\n");
107 printf(" either the sine or cosine Fourier transform of "
108 "the\n");
109 printf(" signal present in 'ot'.\n");
110 printf(" -O <operator> Selects the operator to be analyzed:\n");
111 printf(" o If <operator> is a pair of integers in the "
112 "form '(l,m)'\n");
113 printf(
114 " then the operator will be the (l,m) multipole.\n");
115 printf(" o If <operator> is x, y, or z, then the response "
116 "operator\n");
117 printf(" to be analyzed will be the dipole in the given "
118 "direction.\n");
119 printf(" o If the -O option is not given in the command "
120 "line, then\n");
121 printf(" the observation operator O will be the same as "
122 "the\n");
123 printf(" perturbation operator that defines the initial "
124 "kick.\n");
125 printf(" -f <file> This is the file where the frequencies needed in "
126 "run mode\n");
127 printf(" 3 are stored.\n");
128 printf(" -d <gamma> gamma is the damping factor used in the SOS "
129 "formulae that\n");
130 printf(" produce (hyper)-polarizabilities.\n");
131 printf(" -s <dw> Limits of the search interval: [w-dw,w+dw]\n");
132 printf(" -r <r> Number of resonances to search for.\n");
133 printf(
134 " -n <N> Number of frequencies in which the search interval\n");
135 printf(" is discretized (default 1000)\n");
136 printf(" -k <k> Process, or generate, the k-th order response.\n");
137 printf(" -t <time> The signal analysis will be done by integrating in "
138 "the \n");
139 printf(" time interval [0, <time>]. If this argument is "
140 "absent,\n");
141 printf(" it makes use of all the time-window present in "
142 "the\n");
143 printf(" multipoles files.\n");
144 exit(-1);
145}
146
147void FC_FUNC_(getopt_oscillator_strength, GETOPT_OSCILLATOR_STRENGTH)(
148 int *mode, double *omega, double *searchinterval, int *order,
149 int *nresonances, int *nfrequencies, double *time, int *l, int *m,
150 double *damping, char * ffile) {
151 int c;
152
153 /* This line would be present if we wanted to make the omega a
154 mandatory argument. But for the moment I think it should not be mandatory.
155 if(argc==1) oscillator_strength_help(); */
156
157 while (1) {
158 c = getopt(argc, argv, "hm:s:k:O:r:n:t:d:f:");
159 if (c == -1)
160 break;
161 switch (c) {
162
163 case 'h':
165 break;
166
167 case 'm':
168 *mode = (int)atoi(optarg);
169 break;
170
171 case 's':
172 *searchinterval = (double)atof(optarg);
173 break;
174
175 case 'O':
176 c = sscanf(optarg, "(%d,%d)", l, m);
177 if (c != 2) {
178 switch (optarg[0]) {
179 case 'x':
180 *l = 0;
181 *m = 1;
182 break;
183 case 'y':
184 *l = 0;
185 *m = 2;
186 break;
187 case 'z':
188 *l = 0;
189 *m = 3;
190 break;
191 default:
192 printf("Problem reading the -O option value.\n\n");
194 }
195 }
196 break;
197
198 case 'k':
199 *order = (int)atoi(optarg);
200 break;
201
202 case 'r':
203 *nresonances = (int)atoi(optarg);
204 break;
205
206 case 'n':
207 *nfrequencies = (int)atoi(optarg);
208 break;
209
210 case 't':
211 *time = (double)atof(optarg);
212 break;
213
214 case 'f':
215 strcpy(ffile, optarg);
216 break;
217
218 case 'd':
219 *damping = (double)atof(optarg);
220 break;
221
222 case '?':
224 break;
225 }
226 }
227 if (optind < argc) {
228 while (optind < argc)
229 *omega = (double)atof(argv[optind++]);
230 }
231}
232/***************************************************************/
233
234/* FUNCTIONS TO BE USED BY THE PROGRAM oct-harmonic-spectrum */
236 printf("Usage: oct-harmonic-spectrum [OPTIONS] \n");
237 printf("\n");
238 printf("Options:\n");
239 printf(" -h, --help Prints this help and exits.\n");
240 printf(" -v, --version Prints octopus version.\n");
241 printf(" -w, --freq=freq Specifies the fundamental frequency.\n");
242 printf(
243 " -p, --pol=pol Specifies the direction of the light polarization.\n");
244 printf(" The oct-harmonic-spectrum utility program needs to "
245 "know\n");
246 printf(" the direction along which the emission radiation "
247 "is\n");
248 printf(" considered to be polarized. It may be linearly "
249 "polarized\n");
250 printf(" or circularly polarized. The valid options are:\n");
251 printf(" 'x' : Linearly polarized field in the x "
252 "direction.\n");
253 printf(" 'y' : Linearly polarized field in the x "
254 "direction.\n");
255 printf(" 'z' : Linearly polarized field in the x "
256 "direction.\n");
257 printf(" '+' : Circularly polarized field, "
258 "counterclockwise.\n");
259 printf(" '-' : Circularly polarized field, clockwise.\n");
260 printf(" 'v' : Along a direction specified by -x X -y Y "
261 "-z Z.\n");
262 printf(" The default is 'x'\n");
263 printf(" -a, --ar Calculates the angle-resolved harmonic-spectrum "
264 "along a\n");
265 printf(
266 " direction (X,Y,Z) specified by by -x X -y Y -z Z.\n");
267 printf(" -m, --mode=mode Whether the harmonic spectrum is computed by "
268 "taking the\n");
269 printf(" second derivative of the dipole moment "
270 "numerically, the \n");
271 printf(" the time derivative of the current, or by making "
272 "use of \n:");
273 printf(" the dipole acceleration.\n");
274 printf(" ' The options are:\n");
275 printf(" '1' : use the dipole, take second derivative "
276 "numerically.\n");
277 printf(" '2' : use the acceleration file.\n");
278 printf(" '3' : use the total current file.\n");
279 printf(" The default is '1'\n");
280 exit(-1);
281}
282
283void getopt_harmonic_spectrum(double *w0, int *m, int *ar, double *x,
284 double *y, double *z,
285 char * pol) {
286 int c;
287
288#if defined(HAVE_GETOPT_LONG)
289 static struct option long_options[] = {
290 {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'},
291 {"freq", required_argument, 0, 'w'}, {"pol", required_argument, 0, 'p'},
292 {"mode", required_argument, 0, 'm'}, {"ar", required_argument, 0, 'a'},
293 {"x", required_argument, 0, 'x'}, {"y", required_argument, 0, 'y'},
294 {"z", required_argument, 0, 'z'}, {0, 0, 0, 0}};
295#endif
296
297 while (1) {
298 int option_index = 0;
299#if defined(HAVE_GETOPT_LONG)
300 c = getopt_long(argc, argv, "hvw:p:m:x:y:z:a", long_options, &option_index);
301#else
302 c = getopt(argc, argv, "hvw:p:m:x:y:z:a");
303#endif
304 if (c == -1)
305 break;
306 switch (c) {
307
308 case 'h':
310 break;
311
312 case 'v':
313 printf("octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
314 exit(0);
315
316 case 'w':
317 *w0 = (double)atof(optarg);
318 break;
319
320 case 'p':
321 strcpy(pol, optarg);
322 break;
323
324 case 'm':
325 *m = (int)atoi(optarg);
326 break;
327
328 case 'a':
329 *ar = 1;
330 break;
331
332 case 'x':
333 *x = (double)atof(optarg);
334 break;
335
336 case 'y':
337 *y = (double)atof(optarg);
338 break;
339
340 case 'z':
341 *z = (double)atof(optarg);
342 break;
343 }
344 }
345}
346/***************************************************************/
347
348/* FUNCTIONS TO BE USED BY THE PROGRAM oct-help */
349void help_help() {
350 printf("Usage: oct-help [options] \n");
351 printf("\n");
352 printf("Options:\n");
353 printf(" -h, --help Prints this help and exits.\n");
354 printf(" -v, --version Prints octopus version.\n");
355 printf(" -s, --search=STRING Search variables whose names contain string "
356 "'STRING'.\n");
357 printf(" -p, --print=VARNAME Prints description of variable 'VARNAME'.\n");
358 exit(-1);
359}
360
361void FC_FUNC_(getopt_help, GETOPT_HELP)(char * mode,
362 char * name) {
363 int c;
364
365#if defined(HAVE_GETOPT_LONG)
366 static struct option long_options[] = {{"help", no_argument, 0, 'h'},
367 {"version", no_argument, 0, 'v'},
368 {"list", no_argument, 0, 'l'},
369 {"search", required_argument, 0, 's'},
370 {"print", required_argument, 0, 'p'},
371 {0, 0, 0, 0}};
372#endif
373
374 while (1) {
375 int option_index = 0;
376#if defined(HAVE_GETOPT_LONG)
377 c = getopt_long(argc, argv, "hvls:p:", long_options, &option_index);
378#else
379 c = getopt(argc, argv, "hvls:p:");
380#endif
381 if (argc == 1)
382 help_help();
383 if (c == -1)
384 break;
385 switch (c) {
386
387 case 'h':
388 help_help();
389 break;
390
391 case 'v':
392 printf("octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
393 exit(0);
394
395 case 'l':
396 strcpy(mode, "list");
397 return;
398
399 case 's':
400 strcpy(mode, "search");
401 strcpy(name, optarg);
402 return;
403
404 case 'p':
405 strcpy(mode, "print");
406 strcpy(name, optarg);
407 return;
408 }
409 }
410 if (optind < argc)
411 help_help();
412}
413
414/***************************************************************/
415
416/* FUNCTIONS TO BE USED BY THE PROGRAM octopus */
417void octopus_help() {
418 printf("Usage: octopus [options] \n");
419 printf("\n");
420 printf("Options:\n");
421 printf(" -h, --help Prints this help and exits.\n");
422 printf(" -v, --version Prints octopus version.\n");
423 printf(" -c, --config Prints compilation configuration options.\n");
424 exit(-1);
425}
426
427void getopt_octopus(char * config_str_c) {
428 int c;
429#if defined(HAVE_GETOPT_LONG)
430 static struct option long_options[] = {{"help", no_argument, 0, 'h'},
431 {"version", no_argument, 0, 'v'},
432 {"config", no_argument, 0, 'c'},
433 {0, 0, 0, 0}};
434#endif
435
436 while (1) {
437 int option_index = 0;
438#if defined(HAVE_GETOPT_LONG)
439 c = getopt_long(argc, argv, "hvc", long_options, &option_index);
440#else
441 c = getopt(argc, argv, "hvc");
442#endif
443 if (c == -1)
444 break;
445 switch (c) {
446 case 'h':
447 octopus_help();
448 break;
449 case 'v':
450 printf("octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
451 exit(0);
452 break;
453 case 'c':
454 printf("%s\n", config_str_c);
455 exit(0);
456 break;
457 }
458 }
459 if (optind < argc)
460 octopus_help();
461}
462
463/***************************************************************/
464
465/* FUNCTIONS TO BE USED BY THE PROGRAM oct-casida_spectrum */
467 printf("Usage: oct-casida_spectrum [options] \n");
468 printf("\n");
469 printf("Options:\n");
470 printf(" -h, --help Prints this help and exits.\n");
471 printf(" -v, --version Prints octopus version.\n");
472 exit(-1);
473}
474
475void FC_FUNC_(getopt_casida_spectrum, GETOPT_CASIDA_SPECTRUM)() {
476 int c;
477#if defined(HAVE_GETOPT_LONG)
478 static struct option long_options[] = {{"help", no_argument, 0, 'h'},
479 {"version", no_argument, 0, 'v'},
480 {0, 0, 0, 0}};
481#endif
482
483 while (1) {
484 int option_index = 0;
485#if defined(HAVE_GETOPT_LONG)
486 c = getopt_long(argc, argv, "hv", long_options, &option_index);
487#else
488 c = getopt(argc, argv, "hv");
489#endif
490 if (c == -1)
491 break;
492 switch (c) {
493 case 'h':
495 break;
496 case 'v':
497 printf("octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
498 exit(0);
499 }
500 }
501 if (optind < argc)
503}
504
505/***************************************************************/
506
507/* FUNCTIONS TO BE USED BY THE PROGRAM oct-center-geom */
508void center_geom_help() {
509 printf("Usage: oct-center-geom [options] \n");
510 printf("\n");
511 printf("Options:\n");
512 printf(" -h, --help Prints this help and exits.\n");
513 printf(" -v, --version Prints octopus version.\n");
514 exit(-1);
515}
516
517void FC_FUNC_(getopt_center_geom, GETOPT_CENTER_GEOM)() {
518 int c;
519#if defined(HAVE_GETOPT_LONG)
520 static struct option long_options[] = {{"help", no_argument, 0, 'h'},
521 {"version", no_argument, 0, 'v'},
522 {0, 0, 0, 0}};
523#endif
524
525 while (1) {
526 int option_index = 0;
527#if defined(HAVE_GETOPT_LONG)
528 c = getopt_long(argc, argv, "hv", long_options, &option_index);
529#else
530 c = getopt(argc, argv, "hv");
531#endif
532 if (c == -1)
533 break;
534 switch (c) {
535 case 'h':
537 break;
538 case 'v':
539 printf("octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
540 exit(0);
541 }
542 }
543 if (optind < argc)
545}
546
547/***************************************************************/
548
549/* FUNCTIONS TO BE USED BY THE PROGRAM oct-center-geom */
551 printf("Usage: oct-dielectric-function [options] \n");
552 printf("\n");
553 printf("Options:\n");
554 printf(" -h, --help Prints this help and exits.\n");
555 printf(" -v, --version Prints octopus version.\n");
556 exit(-1);
557}
558
559void FC_FUNC_(getopt_dielectric_function, GETOPT_DIELECTRIC_FUNCTION)() {
560 int c;
561#if defined(HAVE_GETOPT_LONG)
562 static struct option long_options[] = {{"help", no_argument, 0, 'h'},
563 {"version", no_argument, 0, 'v'},
564 {0, 0, 0, 0}};
565#endif
566
567 while (1) {
568 int option_index = 0;
569#if defined(HAVE_GETOPT_LONG)
570 c = getopt_long(argc, argv, "hv", long_options, &option_index);
571#else
572 c = getopt(argc, argv, "hv");
573#endif
574 if (c == -1)
575 break;
576 switch (c) {
577 case 'h':
579 break;
580 case 'v':
581 printf("octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
582 exit(0);
583 }
584 }
585 if (optind < argc)
587}
588
589/***************************************************************/
590
591/* FUNCTIONS TO BE USED BY THE PROGRAM oct-propagation_spectrum */
593 printf("Usage: oct-propagation_spectrum [options] \n");
594 printf("\n");
595 printf("Options:\n");
596 printf(" -h, --help Prints this help and exits.\n");
597 printf(" -v, --version Prints octopus version.\n");
598 printf(" -r, --reference REF REF should be the name of the 'reference' "
599 "multipoles file,.\n");
600 printf(" whenever you want to do a time-dependent "
601 "response function.\n");
602 printf(" calculation.\n");
603 exit(-1);
604}
605
606void getopt_propagation_spectrum(char * fname) {
607 int c;
608#if defined(HAVE_GETOPT_LONG)
609 static struct option long_options[] = {
610 {"help", no_argument, 0, 'h'},
611 {"version", no_argument, 0, 'v'},
612 {"reference", required_argument, 0, 'r'},
613 {0, 0, 0, 0}};
614#endif
615
616 while (1) {
617 int option_index = 0;
618#if defined(HAVE_GETOPT_LONG)
619 c = getopt_long(argc, argv, "hvr:", long_options, &option_index);
620#else
621 c = getopt(argc, argv, "hvr:");
622#endif
623 if (c == -1)
624 break;
625 switch (c) {
626 case 'h':
628 break;
629 case 'v':
630 printf("octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
631 exit(0);
632 case 'r':
633 strcpy(fname, optarg);
634 break;
635 }
636 }
637 if (optind < argc)
639}
640
641/***************************************************************/
642
643/* FUNCTIONS TO BE USED BY THE PROGRAM oct-xyz-anim */
644void xyz_anim_help() {
645 printf("Usage: oct-xyz-anim [options] \n");
646 printf("\n");
647 printf("Options:\n");
648 printf(" -h, --help Prints this help and exits.\n");
649 printf(" -v, --version Prints octopus version.\n");
650 exit(-1);
651}
652
653void FC_FUNC_(getopt_xyz_anim, GETOPT_XYZ_ANIM)() {
654 int c;
655#if defined(HAVE_GETOPT_LONG)
656 static struct option long_options[] = {{"help", no_argument, 0, 'h'},
657 {"version", no_argument, 0, 'v'},
658 {0, 0, 0, 0}};
659#endif
660
661 while (1) {
662 int option_index = 0;
663#if defined(HAVE_GETOPT_LONG)
664 c = getopt_long(argc, argv, "hv", long_options, &option_index);
665#else
666 c = getopt(argc, argv, "hv");
667#endif
668 if (c == -1)
669 break;
670 switch (c) {
671 case 'h':
673 break;
674 case 'v':
675 printf("octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
676 exit(0);
677 }
678 }
679 if (optind < argc)
681}
682
683/***************************************************************/
684
685/* FUNCTIONS TO BE USED BY THE PROGRAM oct-photoelectron_spectrum */
687 printf("Usage: oct-photoelectron_spectrum [OPTIONS] \n");
688 printf("\n");
689 printf("Options:\n");
690 printf(" -h, --help Prints this help and exits.\n");
691 printf(" -v, --version Prints octopus version.\n");
692 printf(" -V, --vec=x,y,z The polar zenith direction in comma-separated "
693 "format \n");
694 printf(" (without spaces). Default is the laser "
695 "polarization. \n");
696 printf(" -u, --pvec=x,y,z The plane cut vector in comma-separated "
697 "format.\n");
698 printf(" Default is 0,0,1 (px-py plane). \n");
699 printf(" -C, --center=x,y,z Center of the coordinates in p-space in "
700 "comma-separated format \n");
701 printf(" Default: 0,0,0. \n");
702 printf(" -E, Maximum and minimum energy in colon-separated "
703 "values. \n");
704 printf(" --espan=Emin:Emax "
705 " \n");
706 printf(" -e, --de The resolution in energy.\n");
707 printf(" -T, Maximum and minimum theta in colon-separated "
708 "format. \n");
709 printf(" --thspan=thetamin:thetamax "
710 " \n");
711 printf(" -t, --dth The resolution in theta.\n");
712 printf(" -P, Maximum and minimum phi in colon separated "
713 "format. \n");
714 printf(" --phspan=phimin:phimax "
715 " \n");
716 printf(" -p, --dph The resolution in phi.\n");
717 printf(" -I, --integr=var The spectrum is integrated over the specified "
718 "variable. For \n");
719 printf(" example \"-I phi\" integrates over phi. \n");
720
721 exit(-1);
722}
723
724void FC_FUNC_(getopt_photoelectron_spectrum,
725 GETOPT_PHOTOELECTRON_SPECTRUM)(double *estep, double *espan,
726 double *thstep, double *thspan,
727 double *phstep, double *phspan,
728 double *pol, double *center,
729 double *pvec, int *integrate) {
730 int c;
731 char delims[] = ",:";
732 char *tok = NULL;
733
734#if defined(HAVE_GETOPT_LONG)
735 static struct option long_options[] = {{"help", no_argument, 0, 'h'},
736 {"version", no_argument, 0, 'v'},
737 {"integr", required_argument, 0, 'I'},
738 {"de", required_argument, 0, 'e'},
739 {"espan", required_argument, 0, 'E'},
740 {"dth", required_argument, 0, 't'},
741 {"thspan", required_argument, 0, 'T'},
742 {"dph", required_argument, 0, 'p'},
743 {"phspan", required_argument, 0, 'P'},
744 {"vec", required_argument, 0, 'V'},
745 {"pvec", required_argument, 0, 'v'},
746 {"center", required_argument, 0, 'C'},
747 {0, 0, 0, 0}};
748#endif
749
750 while (1) {
751 int option_index = 0;
752#if defined(HAVE_GETOPT_LONG)
753 c = getopt_long(argc, argv, "hve:E:P:p:T:t:V:C:u:I:", long_options,
754 &option_index);
755#else
756 c = getopt(argc, argv, "hve:E:P:p:T:t:V:C:u:I:");
757#endif
758 if (c == -1)
759 break;
760 switch (c) {
761
762 case 'h':
764 break;
765
766 case 'v':
767 printf("octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
768 exit(0);
769 break;
770
771 case 'I':
772 if ((strcmp(optarg, "phi") == 0)) {
773 *integrate = 1;
774 } else if ((strcmp(optarg, "theta") == 0)) {
775 *integrate = 2;
776 } else if ((strcmp(optarg, "r") == 0)) {
777 *integrate = 3;
778 } else if ((strcmp(optarg, "kx") == 0)) {
779 *integrate = 4;
780 } else if ((strcmp(optarg, "ky") == 0)) {
781 *integrate = 5;
782 } else if ((strcmp(optarg, "kz") == 0)) {
783 *integrate = 6;
784 } else {
785 printf("Unrecognized integration variable %s.\n", optarg);
786 *integrate = -1;
787 }
788 break;
789
790 case 'e':
791 *estep = atof(optarg);
792 break;
793
794 case 'E':
795 tok = strtok(optarg, delims);
796 espan[0] = atof(tok);
797 tok = strtok(NULL, delims);
798 espan[1] = atof(tok);
799
800 break;
801
802 case 't':
803 *thstep = atof(optarg);
804 break;
805
806 case 'T':
807 tok = strtok(optarg, delims);
808 thspan[0] = atof(tok);
809 tok = strtok(NULL, delims);
810 thspan[1] = atof(tok);
811
812 break;
813
814 case 'p':
815 *phstep = atof(optarg);
816 break;
817
818 case 'P':
819 tok = strtok(optarg, delims);
820 phspan[0] = atof(tok);
821 tok = strtok(NULL, delims);
822 phspan[1] = atof(tok);
823
824 break;
825
826 case 'V':
827 tok = strtok(optarg, delims);
828 pol[0] = atof(tok);
829 tok = strtok(NULL, delims);
830 pol[1] = atof(tok);
831 tok = strtok(NULL, delims);
832 pol[2] = atof(tok);
833
834 break;
835
836 case 'u':
837 tok = strtok(optarg, delims);
838 pvec[0] = atof(tok);
839 tok = strtok(NULL, delims);
840 pvec[1] = atof(tok);
841 tok = strtok(NULL, delims);
842 pvec[2] = atof(tok);
843
844 break;
845
846 case 'C':
847 tok = strtok(optarg, delims);
848 center[0] = atof(tok);
849 tok = strtok(NULL, delims);
850 center[1] = atof(tok);
851 tok = strtok(NULL, delims);
852 center[2] = atof(tok);
853
854 break;
855 }
856 }
857}
void getopt_harmonic_spectrum(double *w0, int *m, int *ar, double *x, double *y, double *z, char *pol)
Definition: getopt_f.c:8196
void FC_FUNC_(clean_clarg, CLEAN_CLARG)()
Definition: getopt_f.c:7968
void getopt_propagation_spectrum(char *fname)
Definition: getopt_f.c:8611
int clarg_is_set()
Definition: getopt_f.c:7980
void octopus_help()
Definition: getopt_f.c:8386
void set_clarg(int *i, char *c)
Definition: getopt_f.c:7964
void getopt_octopus(char *config_str_c)
Definition: getopt_f.c:8396
void casida_spectrum_help()
Definition: getopt_f.c:8447
void center_geom_help()
Definition: getopt_f.c:8497
void dielectric_function_help()
Definition: getopt_f.c:8547
void oscillator_strength_help()
Definition: getopt_f.c:7987
void help_help()
Definition: getopt_f.c:8298
void propagation_spectrum_help()
Definition: getopt_f.c:8597
void harmonic_spectrum_help()
Definition: getopt_f.c:8148
void photoelectron_spectrum_help()
Definition: getopt_f.c:8711
void xyz_anim_help()
Definition: getopt_f.c:8661
int getopt_long(int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __attribute__((__nothrow__
if write to the Free Software Franklin Fifth USA !The assertions are ignored if the code is compiled in not debug mode(NDEBUG ! is defined). Otherwise it is merely a logical assertion that
pure real(real64) function center(this)
Center of the filter interval.
ptrdiff_t l
ptrdiff_t i
const double w0