27#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 *));
62void FC_FUNC_(clean_clarg, CLEAN_CLARG)() {
64 for (
i = 0;
i < argc;
i++)
71 printf(
"Usage: oct-oscillator-strength [OPTIONS] [w]\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 "
78 printf(
" This should have been generated by this same "
80 printf(
" (run mode 2).\n");
81 printf(
" 2 Reads a number of 'multipoles' files, which "
83 printf(
" present in the working directory, and be "
85 printf(
" 'multipoles.1', 'multipoles.2', ..., and "
86 "generate an 'ot'\n");
87 printf(
" file with the k-th order response of a given "
89 printf(
" The order k is decided by the '-k' option. The "
91 printf(
" is decided by the '-O' option.\n");
92 printf(
" 3 Peforms an analysis of the second-order "
94 printf(
" operator O, present in the working directory, "
96 printf(
" previously generated with run mode 2. It also "
98 printf(
" file with a list of frequecies around which "
100 printf(
" for resonances is performed.\n");
101 printf(
" 4 Reads an 'ot' file, and generates an 'omega' "
103 printf(
" either the sine or cosine Fourier transform of "
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 "
110 " then the operator will be the (l,m) multipole.\n");
111 printf(
" o If <operator> is x, y, or z, then the response "
113 printf(
" to be analyzed will be the dipole in the given "
115 printf(
" o If the -O option is not given in the command "
117 printf(
" the observation operator O will be the same as "
119 printf(
" perturbation operator that defines the initial "
121 printf(
" -f <file> This is the file where the frequencies needed in "
123 printf(
" 3 are stored.\n");
124 printf(
" -d <gamma> gamma is the damping factor used in the SOS "
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");
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 "
135 printf(
" time interval [0, <time>]. If this argument is "
137 printf(
" it makes use of all the time-window present in "
139 printf(
" multipoles files.\n");
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) {
154 c = getopt(argc, argv,
"hm:s:k:O:r:n:t:d:f:");
168 *searchinterval = (double)atof(optarg);
172 c = sscanf(optarg,
"(%d,%d)",
l, m);
188 printf(
"Problem reading the -O option value.\n\n");
195 *order = (int)atoi(optarg);
199 *nresonances = (int)atoi(optarg);
203 *nfrequencies = (int)atoi(optarg);
207 *time = (double)atof(optarg);
211 strcpy(ffile, optarg);
215 *damping = (double)atof(optarg);
224 while (optind < argc)
225 *omega = (double)atof(argv[optind++]);
232 printf(
"Usage: oct-harmonic-spectrum [OPTIONS] \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");
239 " -p, --pol=pol Specifies the direction of the light polarization.\n");
240 printf(
" The oct-harmonic-spectrum utility program needs to "
242 printf(
" the direction along which the emission radiation "
244 printf(
" considered to be polarized. It may be linearly "
246 printf(
" or circularly polarized. The valid options are:\n");
247 printf(
" 'x' : Linearly polarized field in the x "
249 printf(
" 'y' : Linearly polarized field in the x "
251 printf(
" 'z' : Linearly polarized field in the x "
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 "
258 printf(
" The default is 'x'\n");
259 printf(
" -a, --ar Calculates the angle-resolved harmonic-spectrum "
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 "
265 printf(
" second derivative of the dipole moment "
266 "numerically, the \n");
267 printf(
" the time derivative of the current, or by making "
269 printf(
" the dipole acceleration.\n");
270 printf(
" ' The options are:\n");
271 printf(
" '1' : use the dipole, take second derivative "
273 printf(
" '2' : use the acceleration file.\n");
274 printf(
" '3' : use the total current file.\n");
275 printf(
" The default is '1'\n");
280 double *y,
double *z,
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}};
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);
298 c = getopt(argc, argv,
"hvw:p:m:x:y:z:a");
309 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
313 *w0 = (double)atof(optarg);
321 *m = (int)atoi(optarg);
329 *x = (double)atof(optarg);
333 *y = (double)atof(optarg);
337 *z = (double)atof(optarg);
346 printf(
"Usage: oct-help [options] \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 "
353 printf(
" -p, --print=VARNAME Prints description of variable 'VARNAME'.\n");
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'},
371 int option_index = 0;
372#if defined(HAVE_GETOPT_LONG)
373 c =
getopt_long(argc, argv,
"hvls:p:", long_options, &option_index);
375 c = getopt(argc, argv,
"hvls:p:");
388 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
392 strcpy(
mode,
"list");
396 strcpy(
mode,
"search");
397 strcpy(name, optarg);
401 strcpy(
mode,
"print");
402 strcpy(name, optarg);
414 printf(
"Usage: octopus [options] \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");
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'},
433 int option_index = 0;
434#if defined(HAVE_GETOPT_LONG)
435 c =
getopt_long(argc, argv,
"hvc", long_options, &option_index);
437 c = getopt(argc, argv,
"hvc");
446 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
450 printf(
"%s\n", config_str_c);
463 printf(
"Usage: oct-casida_spectrum [options] \n");
465 printf(
"Options:\n");
466 printf(
" -h, --help Prints this help and exits.\n");
467 printf(
" -v, --version Prints octopus version.\n");
471void FC_FUNC_(getopt_casida_spectrum, GETOPT_CASIDA_SPECTRUM)() {
473#if defined(HAVE_GETOPT_LONG)
474 static struct option long_options[] = {{
"help", no_argument, 0,
'h'},
475 {
"version", no_argument, 0,
'v'},
480 int option_index = 0;
481#if defined(HAVE_GETOPT_LONG)
482 c =
getopt_long(argc, argv,
"hv", long_options, &option_index);
484 c = getopt(argc, argv,
"hv");
493 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
505 printf(
"Usage: oct-center-geom [options] \n");
507 printf(
"Options:\n");
508 printf(
" -h, --help Prints this help and exits.\n");
509 printf(
" -v, --version Prints octopus version.\n");
513void FC_FUNC_(getopt_center_geom, GETOPT_CENTER_GEOM)() {
515#if defined(HAVE_GETOPT_LONG)
516 static struct option long_options[] = {{
"help", no_argument, 0,
'h'},
517 {
"version", no_argument, 0,
'v'},
522 int option_index = 0;
523#if defined(HAVE_GETOPT_LONG)
524 c =
getopt_long(argc, argv,
"hv", long_options, &option_index);
526 c = getopt(argc, argv,
"hv");
535 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
547 printf(
"Usage: oct-dielectric-function [options] \n");
549 printf(
"Options:\n");
550 printf(
" -h, --help Prints this help and exits.\n");
551 printf(
" -v, --version Prints octopus version.\n");
555void FC_FUNC_(getopt_dielectric_function, GETOPT_DIELECTRIC_FUNCTION)() {
557#if defined(HAVE_GETOPT_LONG)
558 static struct option long_options[] = {{
"help", no_argument, 0,
'h'},
559 {
"version", no_argument, 0,
'v'},
564 int option_index = 0;
565#if defined(HAVE_GETOPT_LONG)
566 c =
getopt_long(argc, argv,
"hv", long_options, &option_index);
568 c = getopt(argc, argv,
"hv");
577 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
589 printf(
"Usage: oct-propagation_spectrum [options] \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");
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'},
613 int option_index = 0;
614#if defined(HAVE_GETOPT_LONG)
615 c =
getopt_long(argc, argv,
"hvr:", long_options, &option_index);
617 c = getopt(argc, argv,
"hvr:");
626 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
629 strcpy(fname, optarg);
641 printf(
"Usage: oct-xyz-anim [options] \n");
643 printf(
"Options:\n");
644 printf(
" -h, --help Prints this help and exits.\n");
645 printf(
" -v, --version Prints octopus version.\n");
649void FC_FUNC_(getopt_xyz_anim, GETOPT_XYZ_ANIM)() {
651#if defined(HAVE_GETOPT_LONG)
652 static struct option long_options[] = {{
"help", no_argument, 0,
'h'},
653 {
"version", no_argument, 0,
'v'},
658 int option_index = 0;
659#if defined(HAVE_GETOPT_LONG)
660 c =
getopt_long(argc, argv,
"hv", long_options, &option_index);
662 c = getopt(argc, argv,
"hv");
671 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
683 printf(
"Usage: oct-photoelectron_spectrum [OPTIONS] \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 "
690 printf(
" (without spaces). Default is the laser "
692 printf(
" -u, --pvec=x,y,z The plane cut vector in comma-separated "
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 "
700 printf(
" --espan=Emin:Emax "
702 printf(
" -e, --de The resolution in energy.\n");
703 printf(
" -T, Maximum and minimum theta in colon-separated "
705 printf(
" --thspan=thetamin:thetamax "
707 printf(
" -t, --dth The resolution in theta.\n");
708 printf(
" -P, Maximum and minimum phi in colon separated "
710 printf(
" --phspan=phimin:phimax "
712 printf(
" -p, --dph The resolution in phi.\n");
713 printf(
" -I, --integr=var The spectrum is integrated over the specified "
715 printf(
" example \"-I phi\" integrates over phi. \n");
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) {
727 char delims[] =
",:";
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'},
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,
752 c = getopt(argc, argv,
"hve:E:P:p:T:t:V:C:u:I:");
763 printf(
"octopus %s (git commit %s)\n", PACKAGE_VERSION, GIT_COMMIT);
768 if ((strcmp(optarg,
"phi") == 0)) {
770 }
else if ((strcmp(optarg,
"theta") == 0)) {
772 }
else if ((strcmp(optarg,
"r") == 0)) {
774 }
else if ((strcmp(optarg,
"kx") == 0)) {
776 }
else if ((strcmp(optarg,
"ky") == 0)) {
778 }
else if ((strcmp(optarg,
"kz") == 0)) {
781 printf(
"Unrecognized integration variable %s.\n", optarg);
787 *estep = atof(optarg);
791 tok = strtok(optarg, delims);
792 espan[0] = atof(tok);
793 tok = strtok(NULL, delims);
794 espan[1] = atof(tok);
799 *thstep = atof(optarg);
803 tok = strtok(optarg, delims);
804 thspan[0] = atof(tok);
805 tok = strtok(NULL, delims);
806 thspan[1] = atof(tok);
811 *phstep = atof(optarg);
815 tok = strtok(optarg, delims);
816 phspan[0] = atof(tok);
817 tok = strtok(NULL, delims);
818 phspan[1] = atof(tok);
823 tok = strtok(optarg, delims);
825 tok = strtok(NULL, delims);
827 tok = strtok(NULL, delims);
833 tok = strtok(optarg, delims);
835 tok = strtok(NULL, delims);
837 tok = strtok(NULL, delims);
843 tok = strtok(optarg, delims);
845 tok = strtok(NULL, delims);
847 tok = strtok(NULL, delims);
void getopt_harmonic_spectrum(double *w0, int *m, int *ar, double *x, double *y, double *z, char *pol)
void FC_FUNC_(clean_clarg, CLEAN_CLARG)()
void getopt_propagation_spectrum(char *fname)
void set_clarg(int *i, char *c)
void getopt_octopus(char *config_str_c)
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.