Ignore:
Timestamp:
Feb 3, 2014 3:36:30 PM (9 years ago)
Author:
srkline
Message:

Two changes to existing model functions:

1) For the 2-yukawa model: Added conditions to enforce Z1>Z2. If this condition is not met, then a valid-looking (but incorrect) S(q) may be returned. These conditions were identified and satisfied within Yun's original Matalb code but were not transferred to the Igor code or XOP. These conditions are enforced within the Igor code before sending to either the XOP or local Igor code.

2) For the Teubner-Strey model: The coefficients have been re-written in terms of the two length scales and a proper absolute scaling. The Macro to calculate the length scales now also reports the amphiphilicity factor.

3) The help file entries for both of these functions have been appropriately updated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/Teubner_v40.ipf

    r570 r931  
    77// 
    88// 06 NOV 98 SRK 
     9// 
     10// JAN 2014 - SRK 
     11// 
     12// Changed the input parameters to be the length scales rather than a2, c1, c2 
     13// which have no physical meaning. 
    914//////////////////////////////////////////////// 
    1015 
     
    1722        Make/O/D/n=(num) xwave_ts,ywave_ts 
    1823        xwave_ts =  alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) 
    19         Make/O/D coef_ts = {0.1,-30,5000,0.1} 
    20         make/o/t parameters_ts = {"scale (a2)","c1","c2","bkg"} 
     24//      Make/O/D coef_ts = {0.1,-30,5000,0.1} 
     25//      make/o/t parameters_ts = {"scale (a2)","c1","c2","bkg"} 
     26 
     27        Make/O/D coef_ts = {0.3,6e-6,30,100,0.1} 
     28        make/o/t parameters_ts = {"scale","SLD difference (A^-2)","correlation length (xi) (A)","repeat distance, d, (A)","bkg (1/cm)"} 
     29 
    2130        Edit parameters_ts,coef_ts 
    2231        Variable/G root:g_ts 
     
    4756         
    4857        // Setup parameter table for model function 
    49         Make/O/D smear_coef_ts = {0.1,-30,5000,0.1} 
    50         make/o/t smear_parameters_ts = {"scale (a2)","c1","c2","bkg"} 
     58        Make/O/D smear_coef_ts = {0.3,6e-6,30,100,0.1} 
     59        make/o/t smear_parameters_ts = {"scale","SLD difference (A^-2)","correlation length (xi) (A)","repeat distance, d, (A)","bkg (1/cm)"} 
    5160        Edit smear_parameters_ts,smear_coef_ts 
    5261         
     
    7382        Wave cw,yw,xw 
    7483 
     84        Variable a2, c1, c2 
     85        Variable d,xi,scale,delrho 
     86 
     87        scale = cw[0] 
     88        delrho = cw[1] 
     89        xi = cw[2] 
     90        d = cw[3] 
     91         
     92         
     93        a2 = (1 + (2*pi*xi/d)^2)^2 
     94        c1 = -2*xi*xi*(2*pi*xi/d)^2+2*xi*xi 
     95        c2 = xi^4        
     96         
     97        a2 /= 8*pi*xi^3*scale*delrho^2*1e8              //this makes the units work out 
     98        c1 /= 8*pi*xi^3*scale*delrho^2*1e8 
     99        c2 /= 8*pi*xi^3*scale*delrho^2*1e8 
     100         
     101//      Print a2,c1,c2 
     102 
     103        Duplicate/O cw tmp_ts_cw 
     104        tmp_ts_cw[0] = a2 
     105        tmp_ts_cw[1] = c1 
     106        tmp_ts_cw[2] = c2 
     107        tmp_ts_cw[3] = cw[4] 
     108         
    75109#if exists("TeubnerStreyModelX") 
    76         yw = TeubnerStreyModelX(cw,xw) 
     110        yw = TeubnerStreyModelX(tmp_ts_cw,xw) 
    77111#else 
    78         yw = fTeubnerStreyModel(cw,xw) 
     112        yw = fTeubnerStreyModel(tmp_ts_cw,xw) 
    79113#endif 
    80114        return(0) 
     
    109143        Endif 
    110144        // calculate the correlation length and the repeat distance 
    111         Variable a2,c1,c2,xi,dd 
    112         a2 = coef_ts[0] 
    113         c1 = coef_ts[1] 
    114         c2 = coef_ts[2] 
    115          
    116         xi = 0.5*sqrt(a2/c2) + c1/4/c2 
    117         xi = 1/sqrt(xi) 
    118          
    119         dd = 0.5*sqrt(a2/c2) - c1/4/c2 
    120         dd = 1/sqrt(dd) 
    121         dd *=2*Pi 
    122          
     145//      Variable a2,c1,c2,xi,dd,fa 
     146//      a2 = coef_ts[0] 
     147//      c1 = coef_ts[1] 
     148//      c2 = coef_ts[2] 
     149//       
     150//      xi = 0.5*sqrt(a2/c2) + c1/4/c2 
     151//      xi = 1/sqrt(xi) 
     152//       
     153//      dd = 0.5*sqrt(a2/c2) - c1/4/c2 
     154//      dd = 1/sqrt(dd) 
     155//      dd *=2*Pi 
     156//               
     157 
     158        Variable a2, c1, c2 
     159        Variable d,xi,scale,delrho,fa 
     160        xi = coef_ts[2] 
     161        d = coef_ts[3] 
     162         
     163         
     164        a2 = (1 + (2*pi*xi/d)^2)^2 
     165        c1 = -2*xi*xi*(2*pi*xi/d)^2+2*xi*xi 
     166        c2 = xi^4        
     167         
     168        fa = c1/(sqrt(4*a2*c2)) 
     169                 
    123170        Printf "The correlation length (the dispersion of d) xi = %g A\r",xi 
    124         Printf "The quasi-periodic repeat distance, d = %g A\r",dd 
     171        Printf "The quasi-periodic repeat distance, d = %g A\r",d 
     172        Printf "The amphiphilicity factor, fa = %g\r",fa 
    125173         
    126174End 
Note: See TracChangeset for help on using the changeset viewer.