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