\File{param.c},{10:58},{Jan  5 1998}
\L{\LB{\C{}\/* \$Source: \/mit\/bert\/Cvsroot\/Thesis\/src\/exact\/param.c,v \$}}
\L{\LB{ *}}
\L{\LB{ * dealing with command\-line arguments for both twodim and return}}
\L{\LB{ *\/\CE{}}}
\L{\LB{}}
\L{\LB{\K{\#include} \<stdio.h\>}}
\L{\LB{\K{\#include} \<stdlib.h\>}}
\L{\LB{\K{\#include} \<string.h\>}}
\L{\LB{\K{\#include} \S{}\"complex.h\"\SE{}}}
\L{\LB{\K{\#include} \S{}\"param.h\"\SE{}}}
\L{\LB{\K{\#include} \S{}\"oppack.h\"\SE{}}}
\L{\LB{\K{\#include} \S{}\"util.h\"\SE{}}}
\L{\LB{}}
\L{\LB{\K{static} \K{char} rcsid[] = \S{}\"\$Id: param.c,v 1.7 1998\/01\/05 15:58:58 bert Exp \$\"\SE{};}}
\L{\LB{}}
\L{\LB{\C{}\/*** make sure that one of the subtypes has been selected ***\/\CE{}}}
\L{\LB{}}
\L{\LB{\K{\#if} !\K{defined}(RETURN) \&\& !\K{defined}(TWODIM)}}
\L{\LB{\#error  You must \K{define} one of RETURN and TWODIM to select which parameters.}}
\L{\LB{ error: You must \K{define} one of RETURN and TWODIM to select which parameters.}}
\L{\LB{\K{\#endif} \C{}\/* not RETURN nor TWODIM *\/\CE{}}}
\L{\LB{}}
\L{\LB{\C{}\/*** global variables ***\/\CE{}}}
\L{\LB{}}
\L{\LB{\C{}\/* propagator parameters *\/\CE{}}}
\L{\LB{\K{unsigned}    start\_iter =   0;    \C{}\/* initial iterations to perform *\/\CE{}}}
\L{\LB{\K{unsigned}    total\_iter = 100;    \C{}\/* total iterations to perform *\/\CE{}}}
\L{\LB{\K{int}         intermediate = 1;    \C{}\/* save packet or calculate r.p. this often *\/\CE{}}}
\L{\LB{}}
\L{\LB{\K{real}        hbar =        0.05;  \C{}\/* value of hbar for simulation *\/\CE{}}}
\L{\LB{\K{real}        mass =        1.;    \C{}\/* particle mass *\/\CE{}}}
\L{\LB{\K{real}        vcoef =       1.;    \C{}\/* a constant to multiply the potential by *\/\CE{}}}
\L{\LB{\K{real}        mu;                  \C{}\/* a coefficient used in some potentials *\/\CE{}}}
\L{\LB{\K{static} \K{char} mu\_is\_set =   0;     \C{}\/* true iff mu has a valid value *\/\CE{}}}
\L{\LB{}}
\L{\LB{translation translate = \{0.,0.\}; \C{}\/* translate origin by this much (oppack.h) *\/\CE{}}}
\L{\LB{}}
\L{\LB{\K{unsigned}    size =        64;    \C{}\/* size of data array in each dimension *\/\CE{}}}
\L{\LB{\K{real}        delta =       0.1;   \C{}\/* spacing of the x,y coordinate grid *\/\CE{}}}
\L{\LB{\K{real}        dt =          0.01;  \C{}\/* time step for propagation *\/\CE{}}}
\L{\LB{}}
\L{\LB{\K{real}        eps =        \-1;     \C{}\/* width of the wave packet (\-1 = unset) *\/\CE{}}}
\L{\LB{}}
\L{\LB{\C{}\/* the generating function for the potential*\/\CE{}}}
\L{\LB{xy\_function V = NULL;}}
\L{\LB{prop\_generate generate\_Vprop = NULL;}}
\L{\LB{prop\_generate generate\_Kprop = NULL;}}
\L{\LB{}}
\L{\LB{\C{}\/* debugging and control stuff *\/\CE{}}}
\L{\LB{\K{int}         debug =     0;      \C{}\/* true if debugging output is in effect *\/\CE{}}}
\L{\LB{}}
\L{\LB{\C{}\/* defaults for mu for various potentials *\/\CE{}}}
\L{\LB{\K{static} \K{real} mu\_delfi =    0.5443310539518174;  \C{}\/* (2\/3)\^(3\/2) *\/\CE{}}}
\L{\LB{\K{static} \K{real} mu\_nelson  =  0.1;}}
\L{\LB{\K{static} \K{real} mu\_harmonic = 1.;}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{\C{}\/*** global variables used in RETURN only ***\/\CE{}}}
\L{\LB{\K{\#ifdef} RETURN}}
\L{\LB{}}
\L{\LB{\C{}\/* initial condition space search restrictions *\/\CE{}}}
\L{\LB{\K{real}        E =         0.8;    \C{}\/* energy level for return probabilities *\/\CE{}}}
\L{\LB{\K{real}        xstep =    \-1;      \C{}\/* X step for initial\-condition grid *\/\CE{}}}
\L{\LB{\K{real}        lowX =      0.0;    \C{}\/* minimum X for initial\-condition grid *\/\CE{}}}
\L{\LB{\K{real}        highX =     1.5;    \C{}\/* maximum X for initial\-condition grid *\/\CE{}}}
\L{\LB{\K{real}        ystep =    \-1;      \C{}\/* Y step for initial\-condition grid *\/\CE{}}}
\L{\LB{\K{real}        lowY =     \-1.0;    \C{}\/* minimum Y for initial\-condition grid *\/\CE{}}}
\L{\LB{\K{real}        highY =     1.0;    \C{}\/* maximum Y for initial\-condition grid *\/\CE{}}}
\L{\LB{\K{int}         angle\_step = 10;    \C{}\/* step for the angle, in degrees *\/\CE{}}}
\L{\LB{\K{int}         angle\_off =  0;     \C{}\/* offset of angle, in degrees *\/\CE{}}}
\L{\LB{}}
\L{\LB{\C{}\/* debugging and control stuff *\/\CE{}}}
\L{\LB{\K{char}        nocalc =    0;      \C{}\/* true means only count initial conditions *\/\CE{}}}
\L{\LB{\K{char}        plot\_pts =  0;      \C{}\/* true means make a plot of valid\/invalid *\/\CE{}}}
\L{\LB{}}
\L{\LB{\K{\#endif} \C{}\/* RETURN *\/\CE{}}}
\L{\LB{}}
\L{\LB{\C{}\/*** global variables used in TWODIM only ***\/\CE{}}}
\L{\LB{\K{\#ifdef} TWODIM}}
\L{\LB{}}
\L{\LB{\C{}\/* initial conditions *\/\CE{}}}
\L{\LB{\K{real}        rx =        0.;     \C{}\/* initial X coordinate for packet center *\/\CE{}}}
\L{\LB{\K{real}        ry =        0.;     \C{}\/* initial Y coordinate for packet center *\/\CE{}}}
\L{\LB{\K{real}        kx =        0.;     \C{}\/* initial X wave number for packet center *\/\CE{}}}
\L{\LB{\K{real}        ky =        0.;     \C{}\/* initial Y wave number for packet center *\/\CE{}}}
\L{\LB{\K{real}        px =        0.;     \C{}\/* initial X momentum for packet center *\/\CE{}}}
\L{\LB{\K{real}        py =        0.;     \C{}\/* initial Y momentum for packet center *\/\CE{}}}
\L{\LB{}}
\L{\LB{\K{\#endif} \C{}\/* TWODIM *\/\CE{}}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{\C{}\/*** command\-line flags ***\/\CE{}}}
\L{\LB{}}
\L{\LB{\C{}\/* options used by both TWODIM and RETURN *\/\CE{}}}
\L{\LB{\K{\#define} COMMON\_OPTIONS      \S{}\"I:i:@:n:s:t:e:v:m:h:0:NocSdH?\"\SE{}}}
\L{\LB{}}
\L{\LB{\K{\#ifdef} RETURN}}
\L{\LB{\K{\#} \K{define} EXTRA\_OPTIONS      \S{}\"GCE:x:y:a:A:q:w:\"\SE{}}}
\L{\LB{\K{\#endif} \C{}\/* RETURN *\/\CE{}}}
\L{\LB{\K{\#ifdef} TWODIM}}
\L{\LB{\K{\#} \K{define} EXTRA\_OPTIONS      \S{}\"r:p:\"\SE{}}}
\L{\LB{\K{\#endif} \C{}\/* TWODIM *\/\CE{}}}
\L{\LB{}}
\L{\LB{\K{\#define} CMD\_LINE\_OPTIONS    (COMMON\_OPTIONS  EXTRA\_OPTIONS)}}
\L{\LB{}}
\L{\LB{\C{}\/*** global variables for getopt() ***\/\CE{}}}
\L{\LB{\K{extern} \K{char} *optarg;}}
\L{\LB{\K{extern} \K{int} optind;}}
\L{\LB{}}
\L{\LB{\C{}\/*** functions that do the work ***\/\CE{}}}
\L{\LB{}}
\L{\LB{\C{}\/* Helper to set two real variables from the same command\-line argument.}}
\L{\LB{ * The argument in str should be of the format \"num,num\".}}
\L{\LB{ * The two numbers will be written to *first and *second, respectively.}}
\L{\LB{ *\/\CE{}}}
\L{\LB{\K{static} \K{void} arg\_pair\_real(\K{char} *str, \K{real} *first, \K{real} *second)}}
\L{\LB{\{}}
\L{\LB{  \K{char} *end;}}
\L{\LB{}}
\L{\LB{  \C{}\/* get first value, complain if bad *\/\CE{}}}
\L{\LB{  *first = strtod(str, \&end);}}
\L{\LB{  \K{if} ((end == NULL) \|\| (end == str))}}
\L{\LB{    usage(progname, \S{}\"First of a pair of floating\-point numbers is invalid.\"\SE{});}}
\L{\LB{  \K{if} (*end != \S{}\',\'\SE{})}}
\L{\LB{    usage(progname, \S{}\"Missing or invalid separator for a pair of numbers.\"\SE{});}}
\L{\LB{}}
\L{\LB{  str = end + 1;}}
\L{\LB{}}
\L{\LB{  \C{}\/* get second value, complain if bad *\/\CE{}}}
\L{\LB{  *second = strtod(str, \&end);}}
\L{\LB{  \K{if} ((end == NULL) \|\| (end == str))}}
\L{\LB{    usage(progname, \S{}\"Second of a pair of floating\-point numbers is invalid.\"\SE{});}}
\L{\LB{  \K{if} (*end != \S{}\'\!0\'\SE{})}}
\L{\LB{    usage(progname, \S{}\"Invalid characters follow a pair of numbers.\"\SE{});}}
\L{\LB{}}
\L{\LB{  \K{return};}}
\L{\LB{\}}}
\L{\LB{}}
\L{\LB{\C{}\/* Describe program usage for whichever of the two programs we\'re}}
\L{\LB{ * running, then exit.  (Called when there\'s error in the options, or}}
\L{\LB{ * when the user selects \-? or \-H.)}}
\L{\LB{ *\/\CE{}}}
\L{\LB{\K{void} usage(\K{char} *name, \K{char} *problem)}}
\L{\LB{\{}}
\L{\LB{  \K{if} (problem)}}
\L{\LB{    fprintf(stderr, \S{}\"\%s\!n\"\SE{}, problem);}}
\L{\LB{}}
\L{\LB{  fprintf}}
\L{\LB{    (stderr, }}
\L{\LB{     \S{}\"\!nusage: \%s [arguments]\!n\"\SE{}}}
\L{\LB{}}
\L{\LB{     \S{}\"options:\!n\"\SE{}}}
\L{\LB{\K{\#ifdef} RETURN}}
\L{\LB{     \S{}\"   \-I \#iter          number of iterations before return probabilities\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-i \#iter          number of iterations with return probabilities\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-@ \#iter          calculate overlap each \#iter steps\!n\"\SE{}}}
\L{\LB{\K{\#endif} \C{}\/* RETURN *\/\CE{}}}
\L{\LB{\K{\#ifdef} TWODIM}}
\L{\LB{     \S{}\"   \-I \#iter          number of iterations before saving packets\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-i \#iter          number of iterations while saving packets\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-@ \#iter          save the packet each \#iter steps\!n\"\SE{}}}
\L{\LB{\K{\#endif} \C{}\/* TWODIM *\/\CE{}}}
\L{\LB{}}
\L{\LB{     \S{}\"   \-n mesh\_size      number of points in each direction of the grid\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-s delta\_r        size of the discrete space step\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-t delta\_t        size of the discrete time slice\!n\"\SE{}}}
\L{\LB{}}
\L{\LB{\K{\#ifdef} TWODIM}}
\L{\LB{     \S{}\"   \-r r0x,r0y        initial packet position\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-p p0x,p0y        initial packet momentum [\_not\_ wave number]\!n\"\SE{}}}
\L{\LB{\K{\#endif} \C{}\/* TWODIM *\/\CE{}}}
\L{\LB{}}
\L{\LB{     \S{}\"   \-e width          initial width of the packet\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-v propV\_coef     coefficient for the potential\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-0 orig\_x,orig\_y  translate origin by this much\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-m mu             \'mu\' coefficient for some potentials\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-h hbar           value of h\-bar\!n\"\SE{}}}
\L{\LB{}}
\L{\LB{\K{\#ifdef} RETURN}}
\L{\LB{     \S{}\"choice of parameters for return\-probability calculations:\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-E energy         classical energy of the packet\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-a angle\_step     step for the angle\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-A angle\_offset   start the angles somewhere other than 0\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-q xstep          step for packet X coordinate\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-w ystep          step for packet Y coordinate\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-x xmin,xmax      limits for packet X coordinate\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-y ymin,ymax      limits for packet Y coordinate\!n\"\SE{}}}
\L{\LB{\K{\#endif} \C{}\/* RETURN *\/\CE{}}}
\L{\LB{}}
\L{\LB{     \S{}\"choice of potential:\!n\"\SE{}}}
\L{\LB{     \S{}\"   (default)         Delfi potential\!n\"\SE{}}}
\L{\LB{     \S{}\"      ( V = (x\^2 + y\^2)\^2\/4 + mu x\^3 (y \- 1)\"\SE{}}}
\L{\LB{             \S{}\"\- y (x\^2 + y\^2) + (x\^2 + 3 y\^2)\/2 )\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-N                Nelson potential          \"\SE{}}}
\L{\LB{                                           \S{}\"( V = mu x\^2\/2 + (y \- x\^2\/2)\^2 )\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-o                harmonic oscillator potential            \"\SE{}}}
\L{\LB{                                                          \S{}\"( V = k\/2 \|r\|\^2 )\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-c                constant potential, free particle                \"\SE{}}}
\L{\LB{                                                                  \S{}\"( V = k )\!n\"\SE{}}}
\L{\LB{}}
\L{\LB{     \S{}\"choice of discrete kinetic energy operator:\!n\"\SE{}}}
\L{\LB{     \S{}\"   (default)         p\^2 based, parabolic KE function\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-S                second\-derivative based, sin\^2\-shaped KE function\!n\"\SE{}}}
\L{\LB{}}
\L{\LB{     \S{}\"debugging options:\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-d                debugging output (print parameters etc.)\!n\"\SE{}}}
\L{\LB{\K{\#ifdef} RETURN}}
\L{\LB{     \S{}\"   \-C                only count valid points (don\'t calculate)\!n\"\SE{}}}
\L{\LB{     \S{}\"   \-G                display character graph of valid points (don\'t calculate)\!n\"\SE{}}}
\L{\LB{\K{\#endif} \C{}\/* RETURN *\/\CE{}}}
\L{\LB{     \S{}\"   \-H                print out this help message\!n\"\SE{}, name);}}
\L{\LB{  exit (2);}}
\L{\LB{\}}}
\L{\LB{}}
\L{\LB{\C{}\/* Print out current parameters to the specified file descriptor.}}
\L{\LB{ *\/\CE{}}}
\L{\LB{\K{static} \K{void} print\_param(FILE *out)}}
\L{\LB{\{}}
\L{\LB{  \K{if} (out == NULL)}}
\L{\LB{    \K{return};}}
\L{\LB{}}
\L{\LB{  fprintf(out, \S{}\"size   = \%11u\!n\"\SE{}, size);}}
\L{\LB{  fprintf(out, \S{}\"delta  = \%11.8g\!n\"\SE{}, delta);}}
\L{\LB{  fprintf(out, \S{}\"dt     = \%11.8g\!n\"\SE{}, dt);}}
\L{\LB{\K{\#ifdef} TWODIM}}
\L{\LB{  fprintf(out, \S{}\"r0     = (\%10.8g,\%10.8g)\!n\"\SE{}, rx, ry);}}
\L{\LB{  fprintf(out, \S{}\"p0     = (\%10.8g,\%10.8g)\!n\"\SE{}, px, py);}}
\L{\LB{\K{\#endif} \C{}\/* TWODIM *\/\CE{}}}
\L{\LB{  fprintf(out, \S{}\"eps    = \%11.8g [\%10.8g*delta]\!n\"\SE{}, eps, eps\/delta);}}
\L{\LB{  fprintf(out, \S{}\"mu     = \%11.8g\!n\"\SE{}, mu);}}
\L{\LB{  fprintf(out, \S{}\"Vcoef  = \%11.8g\!n\"\SE{}, vcoef);}}
\L{\LB{  fprintf(out, \S{}\"origin = (\%10.8g,\%10.8g)\!n\"\SE{}, translate.x, translate.y);}}
\L{\LB{\K{\#ifdef} RETURN}}
\L{\LB{  fprintf(out, \S{}\"E      = \%11.8g\!n\"\SE{}, E);}}
\L{\LB{  fprintf(out, \S{}\"angles = \%11d : \%10d : \%10d\!n\"\SE{},}}
\L{\LB{}\Tab{8}{  angle\_off, angle\_step, 180 + angle\_off \- angle\_step);}}
\L{\LB{  fprintf(out, \S{}\"packX  = \%11.8g : \%10.8g : \%10.8g\!n\"\SE{}, lowX, xstep, highX);}}
\L{\LB{  fprintf(out, \S{}\"packY  = \%11.8g : \%10.8g : \%10.8g\!n\"\SE{}, lowY, ystep, highY);}}
\L{\LB{\K{\#endif} \C{}\/* RETURN *\/\CE{}}}
\L{\LB{  fprintf(out, \S{}\"hbar   = \%11.8g\!n\"\SE{}, hbar);}}
\L{\LB{  fprintf(out, \S{}\"mass   = \%11.8g\!n\!n\"\SE{}, mass);}}
\L{\LB{  fprintf(out, \S{}\"T      = \%g ... \%g\!n\!n\"\SE{}, start\_iter*dt, total\_iter*dt);}}
\L{\LB{\}}}
\L{\LB{}}
\L{\LB{\C{}\/* Function that actually reads and parses the command\-line arguments.}}
\L{\LB{ *\/\CE{}}}
\L{\LB{\K{void} read\_arguments(\K{int} argc, \K{char} **argv)}}
\L{\LB{\{}}
\L{\LB{  FILE *ff;}\Tab{24}{\C{}\/* file to write parameters into *\/\CE{}}}
\L{\LB{  \K{int} chr;}\Tab{24}{\C{}\/* option character from getopt() *\/\CE{}}}
\L{\LB{}}
\L{\LB{  \C{}\/* set progname to the name of the current executable, remove full path *\/\CE{}}}
\L{\LB{}}
\L{\LB{  progname = strrchr(argv[0], \S{}\'\/\'\SE{});}}
\L{\LB{  \K{if} (progname != NULL) \{}}
\L{\LB{    progname++;}}
\L{\LB{    argv[0] = progname;}}
\L{\LB{  \} \K{else} \{}}
\L{\LB{    progname = argv[0];}}
\L{\LB{  \}}}
\L{\LB{}}
\L{\LB{  \C{}\/* check arguments *\/\CE{}}}
\L{\LB{}}
\L{\LB{  \K{while} ((chr = getopt(argc, argv, CMD\_LINE\_OPTIONS)) != EOF)}}
\L{\LB{    \K{switch} (chr) \{}}
\L{\LB{    \K{case} \S{}\'I\'\SE{}:  start\_iter = atol(optarg);                            \K{break};}}
\L{\LB{    \K{case} \S{}\'i\'\SE{}:  total\_iter = atol(optarg);                            \K{break};}}
\L{\LB{    \K{case} \S{}\'@\'\SE{}:  intermediate = atol(optarg);                          \K{break};}}
\L{\LB{    \K{case} \S{}\'n\'\SE{}:  size = atol(optarg);                                  \K{break};}}
\L{\LB{    \K{case} \S{}\'s\'\SE{}:  delta = atof(optarg);                                 \K{break};}}
\L{\LB{    \K{case} \S{}\'t\'\SE{}:  dt = atof(optarg);                                    \K{break};}}
\L{\LB{\K{\#ifdef} TWODIM}}
\L{\LB{    \K{case} \S{}\'r\'\SE{}:  arg\_pair\_real(optarg, \&rx, \&ry);                      \K{break};}}
\L{\LB{    \K{case} \S{}\'p\'\SE{}:  arg\_pair\_real(optarg, \&px, \&py);                      \K{break};}}
\L{\LB{\K{\#endif} \C{}\/* TWODIM *\/\CE{}}}
\L{\LB{    \K{case} \S{}\'e\'\SE{}:  eps = atof(optarg);                                   \K{break};}}
\L{\LB{    \K{case} \S{}\'v\'\SE{}:  vcoef = atof(optarg);                                 \K{break};}}
\L{\LB{    \K{case} \S{}\'0\'\SE{}:  arg\_pair\_real(optarg, \&translate.x, \&translate.y);    \K{break};}}
\L{\LB{    \K{case} \S{}\'m\'\SE{}:  mu = atof(optarg); mu\_is\_set = 1;                     \K{break};}}
\L{\LB{    \K{case} \S{}\'h\'\SE{}:  hbar = atof(optarg);                                  \K{break};}}
\L{\LB{\K{\#ifdef} RETURN}}
\L{\LB{    \K{case} \S{}\'E\'\SE{}:  E = atof(optarg);                                     \K{break};}}
\L{\LB{    \K{case} \S{}\'a\'\SE{}:  angle\_step = atol(optarg);                            \K{break};}}
\L{\LB{    \K{case} \S{}\'A\'\SE{}:  angle\_off = atol(optarg);                             \K{break};}}
\L{\LB{    \K{case} \S{}\'q\'\SE{}:  xstep = atof(optarg);                                 \K{break};}}
\L{\LB{    \K{case} \S{}\'w\'\SE{}:  ystep = atof(optarg);                                 \K{break};}}
\L{\LB{    \K{case} \S{}\'x\'\SE{}:  arg\_pair\_real(optarg, \&lowX, \&highX);                 \K{break};}}
\L{\LB{    \K{case} \S{}\'y\'\SE{}:  arg\_pair\_real(optarg, \&lowY, \&highY);                 \K{break};}}
\L{\LB{\K{\#endif} \C{}\/* RETURN *\/\CE{}}}
\L{\LB{    \K{case} \S{}\'N\'\SE{}:}}
\L{\LB{      V = V\_nelson;}}
\L{\LB{      generate\_Vprop = generate\_Vprop\_nelson;}}
\L{\LB{      \K{if} (! mu\_is\_set)}}
\L{\LB{}\Tab{8}{mu = mu\_nelson;}}
\L{\LB{      \K{break};}}
\L{\LB{    \K{case} \S{}\'o\'\SE{}:}}
\L{\LB{      V = V\_harmonic;}}
\L{\LB{      generate\_Vprop = generate\_Vprop\_harmonic;}}
\L{\LB{      \K{if} (! mu\_is\_set)}}
\L{\LB{}\Tab{8}{mu = mu\_harmonic;}}
\L{\LB{      \K{break};}}
\L{\LB{    \K{case} \S{}\'c\'\SE{}:}}
\L{\LB{      V = V\_constant;}}
\L{\LB{      generate\_Vprop = generate\_Vprop\_constant;}}
\L{\LB{      \K{break};}}
\L{\LB{    \K{case} \S{}\'S\'\SE{}:}}
\L{\LB{      generate\_Kprop = generate\_Kprop\_sin2;}}
\L{\LB{      \K{break};}}
\L{\LB{\K{\#ifdef} RETURN}}
\L{\LB{    \K{case} \S{}\'C\'\SE{}:  nocalc++;                                             \K{break};}}
\L{\LB{    \K{case} \S{}\'G\'\SE{}:  nocalc++; plot\_pts++;                                 \K{break};}}
\L{\LB{\K{\#endif} \C{}\/* RETURN *\/\CE{}}}
\L{\LB{    \K{case} \S{}\'d\'\SE{}:  debug++;                                              \K{break};}}
\L{\LB{}}
\L{\LB{    \C{}\/* if we get \'?\', that means either \'\-?\' or a broken argument *\/\CE{}}}
\L{\LB{    \K{case} \S{}\'H\'\SE{}:}}
\L{\LB{    \K{case} \S{}\'?\'\SE{}:  usage(progname, NULL);                                \K{break};}}
\L{\LB{    \K{default}:   printf(\S{}\"OPTION NOT HANDLED PROPERLY: \'\-\%c\'\!n\"\SE{}, chr);  abort();}}
\L{\LB{    \}}}
\L{\LB{}}
\L{\LB{  \C{}\/* any remaining arguments are bogus; complain. *\/\CE{}}}
\L{\LB{  \K{if} (optind\<argc)}}
\L{\LB{    usage(progname, \S{}\"Invalid extra arguments.\"\SE{});}}
\L{\LB{}}
\L{\LB{  \C{}\/** set defaults that depend on other values **\/\CE{}}}
\L{\LB{}}
\L{\LB{  \C{}\/* if unspecified, choose that packet width which is FFT\-invariant *\/\CE{}}}
\L{\LB{  \K{if} (eps \< 0) \{}}
\L{\LB{    eps = delta * sqrt(size \/ M\_PI)\/2.;}}
\L{\LB{  \}}}
\L{\LB{}}
\L{\LB{  \C{}\/* set propagator defaults, if applicable *\/\CE{}}}
\L{\LB{  \K{if} (V == NULL) \{}}
\L{\LB{    V = V\_delfi;}}
\L{\LB{  \}}}
\L{\LB{  \K{if} (generate\_Vprop == NULL) \{}}
\L{\LB{    generate\_Vprop = generate\_Vprop\_delfi;}}
\L{\LB{    \K{if} (! mu\_is\_set)}}
\L{\LB{      mu = mu\_delfi;}}
\L{\LB{  \}}}
\L{\LB{  \K{if} (generate\_Kprop == NULL) \{}}
\L{\LB{    generate\_Kprop = generate\_Kprop\_p2;}}
\L{\LB{  \}}}
\L{\LB{}}
\L{\LB{\K{\#ifdef} RETURN}}
\L{\LB{  \C{}\/* default x and y steps for initial conditions to delta (ie grid spacing) *\/\CE{}}}
\L{\LB{  \K{if} (xstep \<= 0.)  xstep=delta;}}
\L{\LB{  \K{if} (ystep \<= 0.)  ystep=delta;}}
\L{\LB{\K{\#endif} \C{}\/* RETURN *\/\CE{}}}
\L{\LB{}}
\L{\LB{  \C{}\/** write out (and possibly display) values that are set **\/\CE{}}}
\L{\LB{}}
\L{\LB{  ff = fopen(SCRATCH \S{}\"parameters\"\SE{}, \S{}\"w\"\SE{});}}
\L{\LB{  print\_param(ff);}}
\L{\LB{  fclose(ff);}}
\L{\LB{}}
\L{\LB{  \K{if} (debug)}}
\L{\LB{    print\_param(stdout);}}
\L{\LB{}}
\L{\LB{\K{\#ifdef} TWODIM}}
\L{\LB{  rx \-= translate.x;  ry \-= translate.y;}}
\L{\LB{  kx = px \/ hbar;     ky = py \/ hbar;}}
\L{\LB{\K{\#endif} \C{}\/* TWODIM *\/\CE{}}}
\L{\LB{\}}}
