funkalicious 0.1

getChainPotential_args.c File Reference

#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gio/gio.h>
#include <glib-2.0/glib.h>
#include "config.h"
#include "getChainPotential_args.h"
Include dependency graph for getChainPotential_args.c:

Go to the source code of this file.

Defines

#define GET_CHAIN_POTENTIAL_ARGS_DOMAIN   1024
#define DEFAULT_OUTPUT_FILENAME   "potential.grid"

Functions

void program_print_version (FILE *f)
void libdotcode_print_version (FILE *f)
void libpostproc_print_version (FILE *f)
void print_version_info ()
void yyparse ()
int yylex ()
double * new_double_from_string (const char *s, GError **err)
int * new_int_from_string (const char *s, GError **err)
struct argsprocess_args (int argc, char **argv, GError **err)

Variables

struct args args
const char * version_info

Define Documentation

#define DEFAULT_OUTPUT_FILENAME   "potential.grid"

Definition at line 37 of file getChainPotential_args.c.

Referenced by process_args().

#define GET_CHAIN_POTENTIAL_ARGS_DOMAIN   1024

Function Documentation

void libdotcode_print_version ( FILE *  f)
void libpostproc_print_version ( FILE *  f)
double* new_double_from_string ( const char *  s,
GError **  err 
)

Definition at line 86 of file getChainPotential_args.c.

References GET_CHAIN_POTENTIAL_ARGS_DOMAIN.

                                                            {
  double* d = (double*)malloc(sizeof(double));
  if(d == NULL) {
    *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 1, "getChainPotential_args.c::new_double_from_string: Error occurred converting string (%s) to double: out of memory/malloc failed", s);
    return NULL;
  }
  char *end;
  errno = 0;
  *d = strtod(s, &end);
  if(((end == s) && (*d == 0)) || (errno != 0)) {
    *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 2, "getChainPotential_args.c::new_double_from_string: Error occurred converting string (%s) to double: %s", s, strerror(errno));
    free(d);
    return NULL;
  }
  return d;
}
int* new_int_from_string ( const char *  s,
GError **  err 
)

Definition at line 103 of file getChainPotential_args.c.

References GET_CHAIN_POTENTIAL_ARGS_DOMAIN.

                                                      {
  int* d = (int*)malloc(sizeof(int));
  if(d == NULL) {
    *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 1, "getChainPotential_args.c::new_int_from_string: Error occurred converting string (%s) to int: out of memory/malloc failed", s);
    return NULL;
  }
  char *end;
  errno = 0;
  *d = strtod(s, &end);
  if(((end == s) && (*d == 0)) || (errno != 0)) {
    *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 2, "getChainPotential_args.c::new_int_from_string: Error occurred converting string (%s) to int: %s", s, strerror(errno));
    free(d);
    return NULL;
  }
  return d;
}
void print_version_info ( )

Definition at line 43 of file getChainPotential_args.c.

References libdotcode_print_version(), libpostproc_print_version(), PACKAGE_NAME, program_print_version(), SIZEOF_DOUBLE, SIZEOF_INT, and VERSION.

                          {
  program_print_version(stdout);
  libdotcode_print_version(stdout);
  libpostproc_print_version(stdout);
  printf("autotools info:\n\tProject: %s\n\tVersion: %s\n", PACKAGE_NAME, VERSION);
  printf("Platform information:\n\tSize of int=%d double=%d\n\tEndianness: %s\n", SIZEOF_INT, SIZEOF_DOUBLE,
#ifdef WORDS_BIGENDIAN
   "big"
#else
   "little"
#endif
   );
}

Here is the call graph for this function:

struct args* process_args ( int  argc,
char **  argv,
GError **  err 
) [read]

Processes the arguments to process_args

Parameters:
argcargc from main
argvargv from main
Returns:
NULL if there was an error. Pointer to the args struct if success.

Definition at line 120 of file getChainPotential_args.c.

References args, args::center_wf_list, wavefunction::charge, DEFAULT_OUTPUT_FILENAME, e, args::expand_density_boxes, args::extra_neighbor, wavefunction::file, GET_CHAIN_POTENTIAL_ARGS_DOMAIN, args::invert_odd, args::N_neighbors, args::neighbor_offset, new_int_from_string(), args::outfile, args::pixel_strategy, args::povray, print_version(), print_version_info(), args::save_ascii_values, args::save_inhomog_iterations, args::sepchar, wavefunction::storage, args::sweep_x, args::sweep_y, args::sweep_z, args::use_inhomogeneous_dielectric, args::wf_list, args::xslices, args::yslices, and args::zslices.

                                                               {
  fprintf(stderr, "Will I segfault too? %d %s\n", argc, argv[0]);
  gchar **file_names = NULL;
  gboolean print_version = FALSE;
  gchar** xslices = NULL;
  gchar** yslices = NULL;
  gchar** zslices = NULL;
  gboolean sweeps_exp_percent = FALSE;
  gboolean sweeps_log_percent = FALSE;
  char* invert_odd_coords = NULL;
  char* outfile = NULL;
  gboolean save_ascii_comma = FALSE;
  /*Static so that it doesn't disappear when we leave scope! This is the
   *array that will be used in the arg struct if expand_box[0] is non-zero.
   *The two negative numbers are flags for future code to let us know that
   *the other two numbers haven't been modified.
   */
  static int expand_box[3] = {-1, -1, -1};
  gchar* offsets=NULL;
  gchar* s_expand_box = NULL;
  GOptionEntry options[] = {
    { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &file_names,},
    { "version", 'v', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &print_version, "Print version information about this program", NULL },
    { "ascii-dump", 'a', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &(args.save_ascii_values), "Dump the entire array to a tab-separated file", NULL },
    { "povray", 'p', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &(args.povray), "Dump the entire array to a povray-rendered scene", NULL },
    { "ascii-dump-comma", 'c', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &(save_ascii_comma), "When dumping the entire array to a file, use commas instead of tabs to separate values.", NULL },
    { "expand-box", 'E', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_FILENAME, &(s_expand_box), "Before calculating the potential, extend the box out in all directionsby this many grid sites.", NULL },
    { "invert-odd", 'i', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_FILENAME, &invert_odd_coords, "3 characters representing the coordinates to invert on every odd site (one of each coordinate, in any order, no separators; used to make a chain of up-down-up-down-up potentials).", NULL },
    { "outfile", 'o', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_FILENAME, &outfile, "File into which to put the resulting potential.", NULL},
    { "xneighbors", 'x', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_INT, &(args.N_neighbors[0]), "Number of nearest neighbors along x", NULL},
    { "yneighbors", 'y', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_INT, &(args.N_neighbors[1]), "Number of nearest neighbors along y", NULL},
    { "zneighbors", 'z', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_INT, &(args.N_neighbors[2]), "Number of nearest neighbors along z", NULL},
    { "offset-distance", 'd', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING, &offsets, "Offset between neighbors in each direction, in gridsites. Is specified as x,y,z, e.g. 5,10,15 will have each each item in the chain setparted by x distance of 5, y of 10, and z of 15 gridsites.", NULL},
    { "xslice", 'X', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING_ARRAY, &(xslices), "x coordinate (in grid sites) along which to output a 2D slice of the total density and the resulting potential", NULL},
    { "yslice", 'Y', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING_ARRAY, &(yslices), "y coordinate (in grid sites) along which to output a 2D slice of the total density and the resulting potential", NULL},
    { "zslice", 'Z', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING_ARRAY, &(zslices), "z coordinate (in grid sites) along which to output a 2D slice of the total density and the resulting potential", NULL},
    { "sweepx", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &args.sweep_x, "Output a sequence of PBMs to the sweep_x subdirectory showing a sweep along the x axis across the entire structure", NULL },
    { "sweepy", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &args.sweep_y, "Output a sequence of PBMs to the sweep_y subdirectory showing a sweep along the y axis across the entire structure", NULL },
    { "sweepz", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &args.sweep_z, "Output a sequence of PBMs to the sweep_z subdirectory showing a sweep along the z axis across the entire structure", NULL },
    { "sweep_exp", 'e', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &sweeps_exp_percent, "Set pixel values in the sweep images to the \"normalized exp\" of the percentage of the maximum value, instead of just the percentage =pixel_max_value*(1.0-exp(percent))/(1.0-e).", NULL},
    { "sweep_log", 'l', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &sweeps_log_percent, "Set pixel values in the sweep images to the \"normalized log\" of the percentage of the maximum value, instead of just the percentage =pixel_max_value*log(percent+1)/log(2).", NULL},
    { "inhomogeneous", 'H', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &args.use_inhomogeneous_dielectric, "Dielectric is inhomogeneous; use recursive multigrid calculation to find the potential (otherwise, will only divide rho by epsilon at each point)", NULL },
    { "save_inhomog_iterations", 's', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &args.save_inhomog_iterations, "Save a sweep along z of the potential and del_phi term at each iteration of the inhomogeneous solver and a dump.", NULL},
    {NULL}
  };
  GOptionContext *ctx;
  ctx = g_option_context_new("- create a dotcode potential for the specified grid of nearest neighbors");
  g_option_context_add_main_entries(ctx, options, "Options");

  g_option_context_parse(ctx, &argc, &argv, NULL);

  if(save_ascii_comma) args.sepchar = ',';

  /*Add an extra neighbor to each non-zero direction.*/
  for(int i=0; i<3; i++) if(args.N_neighbors[i]) args.extra_neighbor[i]=1;

  if(offsets != NULL) {
    gchar** specs=g_strsplit(offsets, ",", 3);
    for(int i=0; i<3; i++) {
      if(specs[i] == NULL) {
  *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 75, "getChainPotential_args.c: too few numbers in the neighbor offset list (got %d; should be exactly 3)\n", i);
  return NULL;
      }
      GError *e = NULL;
      int* val = new_int_from_string(specs[i], &e);
      if((val == NULL) || (e != NULL)) {
  if(e != NULL) {
    g_propagate_prefixed_error(err, e, "getChainPotential_args.c: Unable to convert specified offset (%s) (whole list was (%s)) or unable to allcoate an int!\n", specs[i], offsets);
  }else{
    *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 76, "getChainPotential_args.c: Unable to convert specified offset (%s) (whole list was (%s)) or unable to allcoate an int!\n", specs[i], offsets);
  }
  return NULL;
      }
      args.neighbor_offset[i] = *val;
      free(val);
    }
    g_strfreev(specs);
  }

  if(invert_odd_coords != NULL) {
    for(int i=0; i<3; i++) {
      if(invert_odd_coords[i] == '\0') break;
      switch(invert_odd_coords[i]){
      case 'X':
      case 'x':
  args.invert_odd |= 1;
      break;
      case 'Y':
      case 'y':
  args.invert_odd |= 2;
      break;
      case 'Z':
      case 'z':
  args.invert_odd |= 4;
      break;
      default:
  *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 15, "getChainPotential_args.c: character %c in invert-odd coordinate string (%s) is not x, y, or z!", invert_odd_coords[i], invert_odd_coords);
  return NULL;
      }
    }
  }

  args.xslices = NULL;
  int *d;
  GError *e = NULL;
  if(xslices != NULL) {
    for(int i=0; xslices[i] != NULL; i++) {
      if((d=new_int_from_string(xslices[i], &e)) != NULL) {
  args.xslices = g_list_append(args.xslices, d);
      }else{
  *err = e;
  return NULL;
      }
    }
  }
  args.yslices = NULL;
  e = NULL;
  if(yslices != NULL) {
    for(int i=0; yslices[i] != NULL; i++) {
      if((d=new_int_from_string(yslices[i], &e)) != NULL) {
  args.yslices = g_list_append(args.yslices, d);
      }else{
  *err = e;
  return NULL;
      }
    }
  }
  args.zslices = NULL;
  e = NULL;
  if(zslices != NULL) {
    for(int i=0; zslices[i] != NULL; i++) {
      if((d=new_int_from_string(zslices[i], &e)) != NULL) {
  args.zslices = g_list_append(args.zslices, d);
      }else{
  *err = e;
  return NULL;
      }
    }
  }
  if(sweeps_log_percent) {
    if(sweeps_exp_percent) {
      *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 24, "getChainPotential_args.c: you may give EITHER the normalized log OR exp strategy, not both!\n");
      return NULL;
    }else{
      args.pixel_strategy=1;
    }
  }else if(sweeps_exp_percent) {
    args.pixel_strategy=2;
  }

  if(s_expand_box != NULL) {
    fprintf(stderr, "Got s_expand_box=%s\n", s_expand_box);
    gchar** sb = g_strsplit(s_expand_box, ",", 0);
    int i;
    for(i=0; sb[i] != NULL; i++) {
      if(i>2) break;
      expand_box[i] = atoi(sb[i]);
      fprintf(stderr, "sb[%d]=%s->%d\n", i, sb[i], expand_box[i]);
    }
    g_strfreev(sb);
    if(i>3) {
      *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 24, "getChainPotential_args.c: ERROR: got more than 3 values for the expansion box (%s)\n", s_expand_box);
      return NULL;
    }
    /*Once the input has been processed, we check the values*/
    if((expand_box[0] == 0) && (expand_box[1] == 0) && (expand_box[2] == 0)) {
      /*Scenario three: all set to zero. Do nothing.*/
    } else if((expand_box[0] == 0) && (expand_box[1] == -1) && (expand_box[2] == -1)) {
      /*Scenario four: all set to zero by setting only the first. Do nothing.*/
    } else if((expand_box[0] >= 0) && (expand_box[1] == -1) && (expand_box[2] == -1)) {
      /*scenario one: just one coordinate set; expand in all directions.*/
      expand_box[1] = expand_box[0];
      expand_box[2] = expand_box[0];
      args.expand_density_boxes = expand_box;
    } else if((expand_box[0] >= 0) && (expand_box[1] >= 0) && (expand_box[2] >= 0)) {
      /*scenario two: User set all 3 values, so we need to save it to the struct*/
      args.expand_density_boxes = expand_box;
    } else {
      /*One or more invalid numbers.*/
      *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 14, "getChainPotential_args.c: ERROR: a specified calculation box expansion size was negative! (%d,%d,%d)", expand_box[0], expand_box[1], expand_box[2]);
      return NULL;
    }
    fprintf(stderr, "expand_box=%d,%d,%d expand_density_boxes=%p\n", expand_box[0], expand_box[1], expand_box[2], (void*)args.expand_density_boxes);
  }

  //gchar* htext = g_option_context_get_help(ctx, FALSE, NULL);
  g_option_context_free(ctx);

  args.wf_list = NULL;
  struct wavefunction *wf =NULL;
  gboolean center;
  if(file_names != NULL) {
    for(int i = 0; file_names[i] != NULL; i++) {
      if((wf = (struct wavefunction*)malloc(sizeof(struct wavefunction))) == NULL) {
  *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 3, "getChainPotential_args.c::new_double_from_string: Failed to allocate a struct wavefunction! Get more memory perhaps? (malloc returned NULL)");
  return NULL;
      }
      if(file_names[i][0] == '-') {
  wf->charge = -1.0;
      }else if(file_names[i][0] == '+') {
  wf->charge = 1.0;
      }else{
  *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 3, "getChainPotential_args.c::new_double_from_string: first character of the wavefunction argument was not a plus (+) or minus (-); we got \"%c\"; specification of \"%s\"! What is the sign of the charge here?", file_names[i][0], file_names[i]);
  free(wf);
  return NULL;
      }
      if(file_names[i][1] == '/') {
  center = FALSE;
      }else if(file_names[i][1] == '@') {
  center = TRUE;
      }else{
  *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 3, "getChainPotential_args.c::new_double_from_string: second character of the wavefunction argument was not a slash (/); we got \"%c\"; specification of \"%s\"! What is the sign of the charge here?", file_names[i][1], file_names[i]);
  free(wf);
  return NULL;
      }
      wf->storage =NULL;
      wf->file = g_file_new_for_commandline_arg(&file_names[i][2]);
      if(center) {
  fprintf(stderr, "center: %s\n", file_names[i]);
  args.center_wf_list = g_list_append(args.center_wf_list, wf);
      }else{
  fprintf(stderr, "not center: %s\n", file_names[i]);
  args.wf_list = g_list_append(args.wf_list, wf);
      }
    }
  }

  if(print_version){
    print_version_info();
    *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 7, "\n");
    return NULL;
  }

  if((args.wf_list == NULL) && (args.center_wf_list == NULL)) {
    *err = g_error_new(GET_CHAIN_POTENTIAL_ARGS_DOMAIN, 3, "getChainPotential_args.c::you MUST give at least one wave function to process!\n");
    return NULL;
  }

  if(outfile == NULL) {
    args.outfile = g_file_new_for_path(DEFAULT_OUTPUT_FILENAME);
  }else{
    args.outfile = g_file_new_for_commandline_arg(outfile);
  }

  return &args;
}

Here is the call graph for this function:

void program_print_version ( FILE *  f)
int yylex ( )
int yyparse ( )

Definition at line 1091 of file getChainPotential_parser.c.

References YYSTYPE::d, YY_, YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, YYABORT, YYACCEPT, yyalloc(), yydestruct(), YYDPRINTF, YYEMPTY, YYEOF, yyerror(), YYFINAL, YYID, YYINITDEPTH, YYLAST, YYLEX, yylval, YYMAXDEPTH, yynerrs, YYNTOKENS, YYPACT_NINF, YYPOPSTACK, YYSIZE_T, yyalloc::yyss_alloc, YYSTACK_ALLOC, YYSTACK_ALLOC_MAXIMUM, YYSTACK_BYTES, YYSTACK_FREE, YYSTACK_RELOCATE, YYTABLE_NINF, YYTERROR, YYTRANSLATE, and yyalloc::yyvs_alloc.

{


    int yystate;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus;

    /* The stacks and their tools:
       `yyss': related to states.
       `yyvs': related to semantic values.

       Refer to the stacks thru separate pointers, to allow yyoverflow
       to reallocate them elsewhere.  */

    /* The state stack.  */
    yytype_int16 yyssa[YYINITDEPTH];
    yytype_int16 *yyss;
    yytype_int16 *yyssp;

    /* The semantic value stack.  */
    YYSTYPE yyvsa[YYINITDEPTH];
    YYSTYPE *yyvs;
    YYSTYPE *yyvsp;

    YYSIZE_T yystacksize;

  int yyn;
  int yyresult;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken;
  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;

#if YYERROR_VERBOSE
  /* Buffer for error messages, and its allocated size.  */
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif

#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))

  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

  yytoken = 0;
  yyss = yyssa;
  yyvs = yyvsa;
  yystacksize = YYINITDEPTH;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY; /* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */
  yyssp = yyss;
  yyvsp = yyvs;

  goto yysetstate;

/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
 yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed.  So pushing a state here evens the stacks.  */
  yyssp++;

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
  /* Give user a chance to reallocate the stack.  Use copies of
     these so that the &'s don't force the real ones into
     memory.  */
  YYSTYPE *yyvs1 = yyvs;
  yytype_int16 *yyss1 = yyss;

  /* Each stack pointer address is followed by the size of the
     data in use in that stack, in bytes.  This used to be a
     conditional around just the two extra args, but that might
     be undefined if yyoverflow is a macro.  */
  yyoverflow (YY_("memory exhausted"),
        &yyss1, yysize * sizeof (*yyssp),
        &yyvs1, yysize * sizeof (*yyvsp),
        &yystacksize);

  yyss = yyss1;
  yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyexhaustedlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
  goto yyexhaustedlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
  yystacksize = YYMAXDEPTH;

      {
  yytype_int16 *yyss1 = yyss;
  union yyalloc *yyptr =
    (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  if (! yyptr)
    goto yyexhaustedlab;
  YYSTACK_RELOCATE (yyss_alloc, yyss);
  YYSTACK_RELOCATE (yyvs_alloc, yyvs);
#  undef YYSTACK_RELOCATE
  if (yyss1 != yyssa)
    YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;

      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
      (unsigned long int) yystacksize));

      if (yyss + yystacksize - 1 <= yyssp)
  YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  if (yystate == YYFINAL)
    YYACCEPT;

  goto yybackup;

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

  /* Do appropriate processing given the current state.  Read a
     lookahead token if we need one and don't already have one.  */

  /* First try to decide what to do without reference to lookahead token.  */
  yyn = yypact[yystate];
  if (yyn == YYPACT_NINF)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
  goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  /* Shift the lookahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

  /* Discard the shifted token.  */
  yychar = YYEMPTY;

  yystate = yyn;
  *++yyvsp = yylval;

  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 2:

/* Line 1455 of yacc.c  */
#line 38 "getChainPotential_parser.y"
    {}
    break;

  case 3:

/* Line 1455 of yacc.c  */
#line 39 "getChainPotential_parser.y"
    {(yyval.d) = (yyvsp[(1) - (1)].d);}
    break;

  case 4:

/* Line 1455 of yacc.c  */
#line 40 "getChainPotential_parser.y"
    {(yyval.d) = 0;}
    break;



/* Line 1455 of yacc.c  */
#line 1362 "src/getChainPotential_parser.c"
      default: break;
    }
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;

  /* Now `shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if ! YYERROR_VERBOSE
      yyerror (YY_("syntax error"));
#else
      {
  YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
  if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
    {
      YYSIZE_T yyalloc = 2 * yysize;
      if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
        yyalloc = YYSTACK_ALLOC_MAXIMUM;
      if (yymsg != yymsgbuf)
        YYSTACK_FREE (yymsg);
      yymsg = (char *) YYSTACK_ALLOC (yyalloc);
      if (yymsg)
        yymsg_alloc = yyalloc;
      else
        {
    yymsg = yymsgbuf;
    yymsg_alloc = sizeof yymsgbuf;
        }
    }

  if (0 < yysize && yysize <= yymsg_alloc)
    {
      (void) yysyntax_error (yymsg, yystate, yychar);
      yyerror (yymsg);
    }
  else
    {
      yyerror (YY_("syntax error"));
      if (yysize != 0)
        goto yyexhaustedlab;
    }
      }
#endif
    }



  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
   error, discard it.  */

      if (yychar <= YYEOF)
  {
    /* Return failure if at end of input.  */
    if (yychar == YYEOF)
      YYABORT;
  }
      else
  {
    yydestruct ("Error: discarding",
          yytoken, &yylval);
    yychar = YYEMPTY;
  }
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:

  /* Pacify compilers like GCC when the user code never invokes
     YYERROR and the label yyerrorlab therefore never appears in user
     code.  */
  if (/*CONSTCOND*/ 0)
     goto yyerrorlab;

  /* Do not reclaim the symbols of the rule which action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;  /* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
  {
    yyn += YYTERROR;
    if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
      {
        yyn = yytable[yyn];
        if (0 < yyn)
    break;
      }
  }

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
  YYABORT;


      yydestruct ("Error: popping",
      yystos[yystate], yyvsp);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  *++yyvsp = yylval;


  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here.  |
`-------------------------------------------------*/
yyexhaustedlab:
  yyerror (YY_("memory exhausted"));
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
  if (yychar != YYEMPTY)
     yydestruct ("Cleanup: discarding lookahead",
     yytoken, &yylval);
  /* Do not reclaim the symbols of the rule which action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
      yystos[*yyssp], yyvsp);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
  if (yymsg != yymsgbuf)
    YYSTACK_FREE (yymsg);
#endif
  /* Make sure YYID is used.  */
  return YYID (yyresult);
}

Here is the call graph for this function:


Variable Documentation

struct args args
Initial value:
 {
  .wf_list = NULL,
  .center_wf_list = NULL,
  
  .N_neighbors = {0, 0, 0},
  .xslices = NULL,
  .yslices = NULL,
  .zslices = NULL,
  .sweep_x = FALSE,
  .sweep_y = FALSE,
  .sweep_z = FALSE,
  .pixel_strategy = 0,
  .outfile = NULL,
  .invert_odd = 0,
  .expand_density_boxes = NULL,
  .save_ascii_values = FALSE,
  .sepchar = '\t',
  .povray= FALSE,
  .use_inhomogeneous_dielectric = FALSE,
  .extra_neighbor = {0, 0, 0},
  .neighbor_offset = {0, 0, 0},
  .save_inhomog_iterations = FALSE
}

Definition at line 57 of file getChainPotential_args.c.

const char* version_info
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines