Forum: Forums topas RSS
"Exception Caught" error for sequential refinement
"Run_Number" limited by 10 bits?
jobe #1
Member for 2 weeks · 3 posts · Location: Aarhus, Denmark
Group memberships: Members
Show profile · Link to this post
Subject: "Exception Caught" error for sequential refinement
Hello everyone,

I'm doing sequential refinements of variable temperature PXRD data sets. I've set up my refinement according to http://topas.dur.ac.uk/topaswiki/doku.…?id=sequential_re…, where I essentially use the "num_runs" keyword to define a macro that takes a list of data files.

The problem is that I get the "Exception Caugt" error message in TOPAS at data set no. 1024. (This happens for several data sets across different experiments). I think the value of 1024 is quite suspicious as it is the maximum value that can be represented by 10 bits. I'm thinking that maybe the value of "Run_Number" is somehow restricted by this?

Have anyone had similar problems, and if I'm right, is it then possible to change the limits on "Run_Number"?


Cheers,
Jonas
AlanCoelho #2
Member since Aug 2011 · 283 posts
Group memberships: Members
Show profile · Link to this post
Run_Number is a double precision number, not 10 bits.

The exception caught could be anything such as no min/max limits on lattice parameters for example.

If the exception-caught always happen at Run_Number 1024 then that INP file is causing the crash. Post a stripped down version of that INP file and I will have a closer look. Or, e-mail to me the simplified INP file with the data file in question.

cheers
alan
jobe #3
Member for 2 weeks · 3 posts · Location: Aarhus, Denmark
Group memberships: Members
Show profile · Link to this post
Hello Alan,
 
I've stripped down the INP file as much as possible:

'------------------------------------------------------------------------------------------------------------------------
'GENERAL REFINEMENT INFORMATION
iters 100
chi2_convergence_criteria 0.00001                                                
do_errors
no_LIMIT_warnings
continue_after_convergence     'Used to try and find the global minimum. ´
conserve_memory                     'Makes it run slightly faster in GUI mode, can be commented out.

r_wp  10.0765324 r_exp  2.03919031 r_p  5.18542518 r_wp_dash  13.1924485 r_p_dash  7.42458153 r_exp_dash  2.669759 weighted_Durbin_Watson  0.024812141 gof  4.94143797

macro jiggle {0.20}
macro wiggle { val_on_continue = Val + Rand(-jiggle*Val, jiggle*Val) }


'-------------------------------------------------------------------------------------------------------------------------
'SETTING UP THE SEQUENTIAL REFINEMENT
'Link: http://topas.dur.ac.uk/topaswiki/doku.…?id=sequential_re…

macro Sequential_Refinement(numruns, ident)         { Sequential_Refinement(numruns, ident, , INP_File, Run_Number) }
macro Sequential_Refinement(numruns, ident, output) { Sequential_Refinement(numruns, ident, output, INP_File, Run_Number) }
macro Sequential_Refinement(numruns, ident, output, INPFILE, RUNNUMBER) 'This one would almost never be called directly'
{
    num_runs numruns
 
    'saves a backup of the original input file'
    #if Run_Number == 0;
        system_before_save_OUT { copy INPFILE##.inp INPFILE##.backup }
    #endif  
 
    'Save each input file with the run number and some other identifier'
    system_before_save_OUT { copy INPFILE##.inp INPFILE##_##RUNNUMBER##_##ident##.inp }
 
    'copy the output of the nth file and use it as the input for the (n+1)th file'
    out_file = Concat(String(INPFILE), ".INP");
 
    'copies the backup back over the final input file at the end of the run so you can restart from where you started'
    #if Run_Number == numruns-1;
        system_after_save_OUT { copy INPFILE##.backup INPFILE##.inp }
    #endif  
 
    'output every refined parameter with the in-built TOPAS keyword'
    'This currently doesn't work for multi-file refinement
    #m_ifarg output "" #m_else
        out_prm_vals_on_convergence output
    #m_endif
}

'-------------------------------------------------------------------------------------------------------------------------
'LIST OF FILES TO BE REFINED

    #list File_Name 'Identifier
        {
        Data\BGG_MS_600cvac_-00001.xy
        Data\BGG_MS_600cvac_-00002.xy
            '...... all of the data files
        }
       
    macro data_file { File_Name(Run_Number) }
    macro ident { Run_Number }
    Sequential_Refinement(1022, Run_Number)
    macro ResFileName { RefinementResults.txt }

'-------------------------------------------------------------------------------------------------------------------------
'SETTING UP THE OUTPUT FILES
'Link: http://topas.dur.ac.uk/topaswiki/doku.…?id=sequential_re…

macro FileNameGenerator(folder, file_name_prefix, suffix, extension)
{
    folder##\##file_name_prefix##suffix##extension
}

macro FitFileName { FileNameGenerator(Results, Fit_, Run_Number, .xy) }
macro DifFileName { FileNameGenerator(Results, Dif_, Run_Number, .xy) }


macro Out_Results(ResFileName)              { Out_Results(ResFileName, file, seqno, Get(phase_name)) }
macro Out_Results(ResFileName, phasename)   { Out_Results(ResFileName, file, seqno, phasename)       }
macro Out_Results(ResFileName, file, seqno) { Out_Results(ResFileName, file, seqno, Get(phase_name)) }
macro Out_Results(ResFileName, file, seqno, phasename) {
    out ResFileName append
        Out_String("\n")   
        Out_String(data_file)
        Out_String("\t")
        Out_String(ident)
        Out_String("\t")
        load out_record out_fmt out_eqn
        {
             "%s"  = phasename;
        }
        load out_record out_fmt out_fmt_err out_eqn
}

macro O_R(& value) {
    "\t%10.9f" "\t%10.9f"
    #m_ifarg value #m_code
        = If(Prm_There(value),value,-1);
    #m_else 'it must be a numeral, an eqn, or a Get(), and therefore, should exist'
        =value;
    #m_endif
}

macro Out_Header(ResFileName) {
    out ResFileName append
        Out_String("@file\t")
        Out_String("ident\t")
        Out_String("phase")
}
 
macro O_H(head) {
    Out_String("\t")    Out_String(head)           
    Out_String("\t")    Out_String(head##_err)   
}

#define OUTPUT
'This single output macro encapsulate all of the desired outputs, allowing it '
'  to be easily turned on and off with the above #define'
' The Output macro is referred to at the end of the input file '
    macro Output {
        'Only write the header the first time the file is run'
        #if Run_Number == 0;
            Out_Header(ResFileName)
                O_H(Rwp)
                '.... header for reported parameters
        #endif
 
        'output the following parameters for each str    '
        for strs 1 to 1 {
            Out_Results(ResFileName) {
                O_R(Get (r_wp))
                '.... values for the reported parameters
            }
        }
    }
   
'-------------------------------------------------------------------------------------------------------------------------
'DATA FILE AND INSTRUMENTAL PARAMETRES

xdd data_file
   
    continue_after_convergence
    x_calculation_step = Yobs_dx_at(Xo); convolution_step 8
   
    start_X 2.0
    finish_X 6.8

    lam ymin_on_ymax 0.001 la 1.0 lo 0.1261 lh 0.1
    LP_Factor(0)
       
    Specimen_Displacement(disp,-0.00262`_0.00010)
   
    bkg bg  723.111301`_5.23849217  269.741011`_8.16461682 -9.50724438`_6.43772228 -40.1591874`_6.41377331 -34.3449549`_5.77645379 -30.53635`_5.98240559

'------------------------------------------------------------------------------------------------------------------------
'PHASE INFORMATION

    str   
        phase_name Ba8Ga16Ge30
        scale scale_bgg  5.10341209e-008`_2.87e-010
        weight_percent w_bgg  100.000`_0.000
       
        a a_bgg  10.805720`_0.000209
        b a_bgg  10.805720`_0.000209
        c a_bgg  10.805720`_0.000209
        al 90.     
        be 90.     
        ga 90.     

       
        space_group "Pm-3n"
        site Ba1    x 0             y 0           z 0                          occ Ba 1.000      beq B_Ba1  1.19854`_0.09019 wiggle;
        site Ba2    x 0.25          y 0.5000        z 0                       occ Ba 1.000      ADPs { u_11  0.01974`_0.00194 = Get(u33); u_33  0.06232`_0.00154 = 0; = 0; = 0; }
        site Ge1    x 0.25          y 0           z 0.5                      occ Ge 1.000      beq B_Ge1  1.22365`_0.04069
        site Ge2    x 0.18473       y 0.18473     z 0.18473                  occ Ge 1.000      beq B_Ge1  1.22365`_0.04069
        site Ge3    x 0             y 0.30833     z 0.11829                  occ Ge 1.000      beq B_Ge1  1.22365`_0.04069
       
        r_bragg  100
       
        TCHZ_Peak_Type(pku,-0.04707`_0.00693, pkv, 0.01000`_0.00027,!pkw, 0.00000,!pkz, 0.0000,!pky, 0.0000,pkx, 0.00492`_0.00009)

'-------------------------------------------------------------------------------------------------------------------------

#ifdef OUTPUT
    Output
    Out_X_Ycalc(FitFileName)
    Out_X_Difference(DifFileName)
#endif



Thanks for the help!

- Jonas
AlanCoelho #4
Member since Aug 2011 · 283 posts
Group memberships: Members
Show profile · Link to this post
Its not possible to determine why the INP file crashes at run number 1024 by simply looking at the INP file. Can you e-mail me the INP file with 100 data files in the list and include the file that is run number 1024.

Apart from that the above the parameter with out hard limits are the parameters in the following macros:

   TCHZ_Peak_Type
   Specimen_Displacement

and the a_bgg lattice parameter.  The parameters have "moving window limits" ie.

      If_Prm_Eqn_Rpt(u, uv, min = Max(-1, Val-.1); max = Min(2, Val+.1); del 1.0e-4)
      etc...

Does the parameter output file show any parameters going astray.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Not logged in. · Lost password · Register
This board is powered by the Unclassified NewsBoard software, 20120620-dev, © 2003-2011 by Yves Goergen
Current time: 2019-10-13, 23:57:54 (UTC +00:00)