Changeset 112


Ignore:
Timestamp:
08/31/11 01:40:16 (21 months ago)
Author:
mjv500
Message:

error handling updates

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/read_abinit5.c

    r109 r112  
    5353  HANDLE_FUNC_ERROR (read_abinit_header(fp, psp_data, pspcod, rchrg, fchrg)) 
    5454 
     55  /// make core charge if needed 
    5556  if (rchrg > 0.0) { 
    5657    psp_data->has_nlcc = 1; 
     
    5859  } 
    5960 
     61  /// read in  
    6062  /**< read in psp code and xc code*/ 
    6163  if(fgets(line, MAX_STRLEN, fp) == NULL) { 
     
    6365  } 
    6466  narg = sscanf (line, "%d %d %d %d %d", &pspcod, &pspxc, &(psp_data->l_max), &idum, &((psp_data->mesh)->np) ); 
    65   ///check narg is equal to 5 
     67  PSPIO_ASSERT(narg==5, PSPIO_EIO) 
    6668 
    6769  return PSPIO_SUCCESS; 
  • trunk/src/read_abinit_header.c

    r108 r112  
    6666  } 
    6767  narg = sscanf (line, "%lf %lf %d", &(psp_data->z), &(psp_data->zvalence), &idum); 
    68   ///check narg is equal to 2 
     68  PSPIO_ASSERT(narg==2, PSPIO_EIO) 
    6969  
    7070  /**< read in psp code and xc code*/ 
     
    7373  } 
    7474  narg = sscanf (line, "%d %d %d %d %d", &pspcod, &pspxc, &(psp_data->l_max), &(psp_data->l_local), &np); 
    75   ///check narg is equal to 5 
     75  PSPIO_ASSERT(narg==5, PSPIO_EIO) 
     76 
    7677 
    7778  HANDLE_FUNC_ERROR(pspio_mesh_alloc(psp_data->mesh, np)) 
     
    9394      break; 
    9495    default: 
     96      HANDLE_FUNC_ERROR(pspio_mesh_free(psp_data->mesh)) 
    9597      HANDLE_ERROR(PSPIO_EVALUE) 
    9698  } 
    9799 
    98100 
    99   HANDLE_FUNC_ERROR( ab2libxc(pspxc,psp_data) ) 
     101  ierr = ab2libxc(pspxc,psp_data); 
     102  if (ierr){ 
     103    HANDLE_FUNC_ERROR(pspio_mesh_free(psp_data->mesh)) 
     104    HANDLE_ERROR(ierr) 
     105  } 
    100106 
    101107  /// if we have a NLCC data line to read 
     
    105111  /**< read in NLCC parameters */ 
    106112    if(fgets(line, MAX_STRLEN, fp) == NULL) { 
     113      HANDLE_FUNC_ERROR(pspio_mesh_free(psp_data->mesh)) 
    107114      HANDLE_ERROR(PSPIO_EIO) 
    108115    } 
    109116    narg = sscanf (line, "%lf %lf %lf", &rchrg, &fchrg, &qchrg); 
    110     ///check narg is equal to 3 
     117    PSPIO_ASSERT(narg==3, PSPIO_EIO) 
    111118  } 
    112119 
Note: See TracChangeset for help on using the changeset viewer.