28#if __has_include(<unistd.h>)
44#if defined(_POSIX_VERSION) && !defined(__hpux) && !defined(_AIX)
45#define HAVE_GETOPT_LONG 1
53void FC_FUNC_(set_number_clarg, SET_NUMBER_CLARG)(
int *nargc) {
55 argv = (
char **)malloc(argc *
sizeof(
char *));
58void FC_FUNC_(set_clarg, SET_CLARG)(
int *
i, STR_F_TYPE arg STR_ARG1) {
64void FC_FUNC_(clean_clarg, CLEAN_CLARG)() {
66 for (
i = 0;
i < argc;
i++)
73 printf(
"Usage: oct-oscillator-strength [OPTIONS] [w]\n");
76 printf(
" -h Prints this help and exits.\n");
77 printf(
" -m <mode> Select the run mode:\n");
78 printf(
" 1 (default) analyzes the signal present in an "
80 printf(
" This should have been generated by this same "
82 printf(
" (run mode 2).\n");
83 printf(
" 2 Reads a number of 'multipoles' files, which "
85 printf(
" present in the working directory, and be "
87 printf(
" 'multipoles.1', 'multipoles.2', ..., and "
88 "generate an 'ot'\n");
89 printf(
" file with the k-th order response of a given "
91 printf(
" The order k is decided by the '-k' option. The "
93 printf(
" is decided by the '-O' option.\n");
94 printf(
" 3 Peforms an analysis of the second-order "
96 printf(
" operator O, present in the working directory, "
98 printf(
" previously generated with run mode 2. It also "
100 printf(
" file with a list of frequecies around which "
102 printf(
" for resonances is performed.\n");
103 printf(
" 4 Reads an 'ot' file, and generates an 'omega' "
105 printf(
" either the sine or cosine Fourier transform of "
107 printf(
" signal present in 'ot'.\n");
108 printf(
" -O <operator> Selects the operator to be analyzed:\n");
109 printf(
" o If <operator> is a pair of integers in the "
112 " then the operator will be the (l,m) multipole.\n");
113 printf(
" o If <operator> is x, y, or z, then the response "
115 printf(
" to be analyzed will be the dipole in the given "
117 printf(
" o If the -O option is not given in the command "
119 printf(
" the observation operator O will be the same as "
121 printf(
" perturbation operator that defines the initial "
123 printf(
" -f <file> This is the file where the frequencies needed in "
125 printf(
" 3 are stored.\n");
126 printf(
" -d <gamma> gamma is the damping factor used in the SOS "
128 printf(
" produce (hyper)-polarizabilities.\n");
129 printf(
" -s <dw> Limits of the search interval: [w-dw,w+dw]\n");
130 printf(
" -r <r> Number of resonances to search for.\n");
132 " -n <N> Number of frequencies in which the search interval\n");
133 printf(
" is discretized (default 1000)\n");
134 printf(
" -k <k> Process, or generate, the k-th order response.\n");
135 printf(
" -t <time> The signal analysis will be done by integrating in "
137 printf(
" time interval [0, <time>]. If this argument is "
139 printf(
" it makes use of all the time-window present in "
141 printf(
" multipoles files.\n");
145void FC_FUNC_(getopt_oscillator_strength, GETOPT_OSCILLATOR_STRENGTH)(
146 int *
mode,
double *omega,
double *searchinterval,
int *order,
147 int *nresonances,
int *nfrequencies,
double *time,
int *
l,
int *m,
148 double *damping, STR_F_TYPE ffile STR_ARG1) {
156 c = getopt(argc, argv,
"hm:s:k:O:r:n:t:d:f:");
166 *
mode = (int)atoi(optarg);
170 *searchinterval = (double)atof(optarg);
174 c = sscanf(optarg,
"(%d,%d)",
l, m);
190 printf(
"Problem reading the -O option value.\n\n");
197 *order = (int)atoi(optarg);
201 *nresonances = (int)atoi(optarg);
205 *nfrequencies = (int)atoi(optarg);
209 *time = (double)atof(optarg);
213 TO_F_STR1(optarg, ffile);
217 *damping = (double)atof(optarg);
226 while (optind < argc)
227 *omega = (double)atof(argv[optind++]);
234 printf(
"Usage: oct-harmonic-spectrum [OPTIONS] \n");
236 printf(
"Options:\n");
237 printf(
" -h, --help Prints this help and exits.\n");
238 printf(
" -v, --version Prints octopus version.\n");
239 printf(
" -w, --freq=freq Specifies the fundamental frequency.\n");
241 " -p, --pol=pol Specifies the direction of the light polarization.\n");
242 printf(
" The oct-harmonic-spectrum utility program needs to "
244 printf(
" the direction along which the emission radiation "
246 printf(
" considered to be polarized. It may be linearly "
248 printf(
" or circularly polarized. The valid options are:\n");
249 printf(
" 'x' : Linearly polarized field in the x "
251 printf(
" 'y' : Linearly polarized field in the x "
253 printf(
" 'z' : Linearly polarized field in the x "
255 printf(
" '+' : Circularly polarized field, "
256 "counterclockwise.\n");
257 printf(
" '-' : Circularly polarized field, clockwise.\n");
258 printf(
" 'v' : Along a direction specified by -x X -y Y "
260 printf(
" The default is 'x'\n");
261 printf(
" -a, --ar Calculates the angle-resolved harmonic-spectrum "
264 " direction (X,Y,Z) specified by by -x X -y Y -z Z.\n");
265 printf(
" -m, --mode=mode Whether the harmonic spectrum is computed by "
267 printf(
" second derivative of the dipole moment "
268 "numerically, the \n");
269 printf(
" the time derivative of the current, or by making "
271 printf(
" the dipole acceleration.\n");
272 printf(
" ' The options are:\n");
273 printf(
" '1' : use the dipole, take second derivative "
275 printf(
" '2' : use the acceleration file.\n");
276 printf(
" '3' : use the total current file.\n");
277 printf(
" The default is '1'\n");
281void FC_FUNC_(getopt_harmonic_spectrum,
282 GETOPT_HARMONIC_SPECTRUM)(
double *w0,
int *m,
int *ar,
double *x,
283 double *y,
double *z,
284 STR_F_TYPE pol STR_ARG1) {
287#if defined(HAVE_GETOPT_LONG)
288 static struct option long_options[] = {
289 {
"help", no_argument, 0,
'h'}, {
"version", no_argument, 0,
'v'},
290 {
"freq", required_argument, 0,
'w'}, {
"pol", required_argument, 0,
'p'},
291 {
"mode", required_argument, 0,
'm'}, {
"ar", required_argument, 0,
'a'},
292 {
"x", required_argument, 0,
'x'}, {
"y", required_argument, 0,
'y'},
293 {
"z", required_argument, 0,
'z'}, {0, 0, 0, 0}};
297 int option_index = 0;
298#if defined(HAVE_GETOPT_LONG)
299 c =
getopt_long(argc, argv,
"hvw:p:m:x:y:z:a", long_options, &option_index);
301 c = getopt(argc, argv,
"hvw:p:m:x:y:z:a");
312 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
316 *w0 = (double)atof(optarg);
320 TO_F_STR1(optarg, pol);
324 *m = (int)atoi(optarg);
332 *x = (double)atof(optarg);
336 *y = (double)atof(optarg);
340 *z = (double)atof(optarg);
349 printf(
"Usage: oct-help [options] \n");
351 printf(
"Options:\n");
352 printf(
" -h, --help Prints this help and exits.\n");
353 printf(
" -v, --version Prints octopus version.\n");
354 printf(
" -s, --search=STRING Search variables whose names contain string "
356 printf(
" -p, --print=VARNAME Prints description of variable 'VARNAME'.\n");
360void FC_FUNC_(getopt_help, GETOPT_HELP)(STR_F_TYPE
mode,
361 STR_F_TYPE name STR_ARG2) {
364#if defined(HAVE_GETOPT_LONG)
365 static struct option long_options[] = {{
"help", no_argument, 0,
'h'},
366 {
"version", no_argument, 0,
'v'},
367 {
"list", no_argument, 0,
'l'},
368 {
"search", required_argument, 0,
's'},
369 {
"print", required_argument, 0,
'p'},
374 int option_index = 0;
375#if defined(HAVE_GETOPT_LONG)
376 c =
getopt_long(argc, argv,
"hvls:p:", long_options, &option_index);
378 c = getopt(argc, argv,
"hvls:p:");
391 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
395 TO_F_STR1(
"list",
mode);
399 TO_F_STR1(
"search",
mode);
400 TO_F_STR2(optarg, name);
404 TO_F_STR1(
"print",
mode);
405 TO_F_STR2(optarg, name);
417 printf(
"Usage: octopus [options] \n");
419 printf(
"Options:\n");
420 printf(
" -h, --help Prints this help and exits.\n");
421 printf(
" -v, --version Prints octopus version.\n");
422 printf(
" -c, --config Prints compilation configuration options.\n");
426void FC_FUNC_(getopt_octopus, GETOPT_OCTOPUS)(STR_F_TYPE config_str STR_ARG1) {
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'},
437 int option_index = 0;
438#if defined(HAVE_GETOPT_LONG)
439 c =
getopt_long(argc, argv,
"hvc", long_options, &option_index);
441 c = getopt(argc, argv,
"hvc");
450 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
454 TO_C_STR1(config_str, config_str_c);
455 printf(
"%s\n", config_str_c);
469 printf(
"Usage: oct-casida_spectrum [options] \n");
471 printf(
"Options:\n");
472 printf(
" -h, --help Prints this help and exits.\n");
473 printf(
" -v, --version Prints octopus version.\n");
477void FC_FUNC_(getopt_casida_spectrum, GETOPT_CASIDA_SPECTRUM)() {
479#if defined(HAVE_GETOPT_LONG)
480 static struct option long_options[] = {{
"help", no_argument, 0,
'h'},
481 {
"version", no_argument, 0,
'v'},
486 int option_index = 0;
487#if defined(HAVE_GETOPT_LONG)
488 c =
getopt_long(argc, argv,
"hv", long_options, &option_index);
490 c = getopt(argc, argv,
"hv");
499 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
511 printf(
"Usage: oct-center-geom [options] \n");
513 printf(
"Options:\n");
514 printf(
" -h, --help Prints this help and exits.\n");
515 printf(
" -v, --version Prints octopus version.\n");
519void FC_FUNC_(getopt_center_geom, GETOPT_CENTER_GEOM)() {
521#if defined(HAVE_GETOPT_LONG)
522 static struct option long_options[] = {{
"help", no_argument, 0,
'h'},
523 {
"version", no_argument, 0,
'v'},
528 int option_index = 0;
529#if defined(HAVE_GETOPT_LONG)
530 c =
getopt_long(argc, argv,
"hv", long_options, &option_index);
532 c = getopt(argc, argv,
"hv");
541 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
553 printf(
"Usage: oct-dielectric-function [options] \n");
555 printf(
"Options:\n");
556 printf(
" -h, --help Prints this help and exits.\n");
557 printf(
" -v, --version Prints octopus version.\n");
561void FC_FUNC_(getopt_dielectric_function, GETOPT_DIELECTRIC_FUNCTION)() {
563#if defined(HAVE_GETOPT_LONG)
564 static struct option long_options[] = {{
"help", no_argument, 0,
'h'},
565 {
"version", no_argument, 0,
'v'},
570 int option_index = 0;
571#if defined(HAVE_GETOPT_LONG)
572 c =
getopt_long(argc, argv,
"hv", long_options, &option_index);
574 c = getopt(argc, argv,
"hv");
583 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
595 printf(
"Usage: oct-propagation_spectrum [options] \n");
597 printf(
"Options:\n");
598 printf(
" -h, --help Prints this help and exits.\n");
599 printf(
" -v, --version Prints octopus version.\n");
600 printf(
" -r, --reference REF REF should be the name of the 'reference' "
601 "multipoles file,.\n");
602 printf(
" whenever you want to do a time-dependent "
603 "response function.\n");
604 printf(
" calculation.\n");
608void FC_FUNC_(getopt_propagation_spectrum,
609 GETOPT_PROPAGATION_SPECTRUM)(STR_F_TYPE fname STR_ARG1) {
611#if defined(HAVE_GETOPT_LONG)
612 static struct option long_options[] = {
613 {
"help", no_argument, 0,
'h'},
614 {
"version", no_argument, 0,
'v'},
615 {
"reference", required_argument, 0,
'r'},
620 int option_index = 0;
621#if defined(HAVE_GETOPT_LONG)
622 c =
getopt_long(argc, argv,
"hvr:", long_options, &option_index);
624 c = getopt(argc, argv,
"hvr:");
633 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
636 TO_F_STR1(optarg, fname);
648 printf(
"Usage: oct-xyz-anim [options] \n");
650 printf(
"Options:\n");
651 printf(
" -h, --help Prints this help and exits.\n");
652 printf(
" -v, --version Prints octopus version.\n");
656void FC_FUNC_(getopt_xyz_anim, GETOPT_XYZ_ANIM)() {
658#if defined(HAVE_GETOPT_LONG)
659 static struct option long_options[] = {{
"help", no_argument, 0,
'h'},
660 {
"version", no_argument, 0,
'v'},
665 int option_index = 0;
666#if defined(HAVE_GETOPT_LONG)
667 c =
getopt_long(argc, argv,
"hv", long_options, &option_index);
669 c = getopt(argc, argv,
"hv");
678 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
690 printf(
"Usage: oct-photoelectron_spectrum [OPTIONS] \n");
692 printf(
"Options:\n");
693 printf(
" -h, --help Prints this help and exits.\n");
694 printf(
" -v, --version Prints octopus version.\n");
695 printf(
" -V, --vec=x,y,z The polar zenith direction in comma-separated "
697 printf(
" (without spaces). Default is the laser "
699 printf(
" -u, --pvec=x,y,z The plane cut vector in comma-separated "
701 printf(
" Default is 0,0,1 (px-py plane). \n");
702 printf(
" -C, --center=x,y,z Center of the coordinates in p-space in "
703 "comma-separated format \n");
704 printf(
" Default: 0,0,0. \n");
705 printf(
" -E, Maximum and minimum energy in colon-separated "
707 printf(
" --espan=Emin:Emax "
709 printf(
" -e, --de The resolution in energy.\n");
710 printf(
" -T, Maximum and minimum theta in colon-separated "
712 printf(
" --thspan=thetamin:thetamax "
714 printf(
" -t, --dth The resolution in theta.\n");
715 printf(
" -P, Maximum and minimum phi in colon separated "
717 printf(
" --phspan=phimin:phimax "
719 printf(
" -p, --dph The resolution in phi.\n");
720 printf(
" -I, --integr=var The spectrum is integrated over the specified "
722 printf(
" example \"-I phi\" integrates over phi. \n");
727void FC_FUNC_(getopt_photoelectron_spectrum,
728 GETOPT_PHOTOELECTRON_SPECTRUM)(
double *estep,
double *espan,
729 double *thstep,
double *thspan,
730 double *phstep,
double *phspan,
731 double *pol,
double *
center,
732 double *pvec,
int *integrate) {
734 char delims[] =
",:";
737#if defined(HAVE_GETOPT_LONG)
738 static struct option long_options[] = {{
"help", no_argument, 0,
'h'},
739 {
"version", no_argument, 0,
'v'},
740 {
"integr", required_argument, 0,
'I'},
741 {
"de", required_argument, 0,
'e'},
742 {
"espan", required_argument, 0,
'E'},
743 {
"dth", required_argument, 0,
't'},
744 {
"thspan", required_argument, 0,
'T'},
745 {
"dph", required_argument, 0,
'p'},
746 {
"phspan", required_argument, 0,
'P'},
747 {
"vec", required_argument, 0,
'V'},
748 {
"pvec", required_argument, 0,
'v'},
749 {
"center", required_argument, 0,
'C'},
754 int option_index = 0;
755#if defined(HAVE_GETOPT_LONG)
756 c =
getopt_long(argc, argv,
"hve:E:P:p:T:t:V:C:u:I:", long_options,
759 c = getopt(argc, argv,
"hve:E:P:p:T:t:V:C:u:I:");
770 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
775 if ((strcmp(optarg,
"phi") == 0)) {
777 }
else if ((strcmp(optarg,
"theta") == 0)) {
779 }
else if ((strcmp(optarg,
"r") == 0)) {
781 }
else if ((strcmp(optarg,
"kx") == 0)) {
783 }
else if ((strcmp(optarg,
"ky") == 0)) {
785 }
else if ((strcmp(optarg,
"kz") == 0)) {
788 printf(
"Unrecognized integration variable %s.\n", optarg);
794 *estep = atof(optarg);
798 tok = strtok(optarg, delims);
799 espan[0] = atof(tok);
800 tok = strtok(NULL, delims);
801 espan[1] = atof(tok);
806 *thstep = atof(optarg);
810 tok = strtok(optarg, delims);
811 thspan[0] = atof(tok);
812 tok = strtok(NULL, delims);
813 thspan[1] = atof(tok);
818 *phstep = atof(optarg);
822 tok = strtok(optarg, delims);
823 phspan[0] = atof(tok);
824 tok = strtok(NULL, delims);
825 phspan[1] = atof(tok);
830 tok = strtok(optarg, delims);
832 tok = strtok(NULL, delims);
834 tok = strtok(NULL, delims);
840 tok = strtok(optarg, delims);
842 tok = strtok(NULL, delims);
844 tok = strtok(NULL, delims);
850 tok = strtok(optarg, delims);
852 tok = strtok(NULL, delims);
854 tok = strtok(NULL, delims);
void casida_spectrum_help()
void dielectric_function_help()
void oscillator_strength_help()
void propagation_spectrum_help()
void harmonic_spectrum_help()
void photoelectron_spectrum_help()
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.