Ignore:
Timestamp:
Aug 21, 2009 10:34:33 AM (15 years ago)
Author:
Jae Cho <jhjcho@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
14c3887
Parents:
bda194e3
Message:

some corrections and removed polydispersity from inside of function and set dQ =0

Location:
sansmodels/src/sans/models/c_extensions
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_extensions/ellipsoid.h

    r1ed3834 rc1c29b6  
    2828 //             </text> 
    2929 //[FIXED]= <text> axis_phi.width; axis_theta.width;radius_a.width; 
    30  //radius_b.width; length.width; r_minor.width 
    31  //, r_ratio.width</text> 
     30 //radius_b.width; length.width; r_minor.width; 
     31 //r_ratio.width</text> 
    3232 //[ORIENTATION_PARAMS]=  axis_phi.width; axis_theta.width;axis_phi; axis_theta 
    3333 
  • sansmodels/src/sans/models/c_extensions/lamellar.c

    r0cfeff4 rc1c29b6  
    66#include "lamellar.h" 
    77#include <math.h> 
    8 #include "libCylinder.h" 
     8//#include "libCylinder.h" 
    99#include <stdio.h> 
    1010#include <stdlib.h> 
  • sansmodels/src/sans/models/c_extensions/lamellar.h

    r975ec8e rc1c29b6  
    3636} LamellarParameters; 
    3737 
    38  
    39  
     38/// kernel 
     39double lamellar_kernel(double dp[], double q); 
    4040/// 1D scattering function 
    4141double lamellar_analytical_1D(LamellarParameters *pars, double q); 
  • sansmodels/src/sans/models/c_extensions/lamellarPS.c

    rb4679de rc1c29b6  
    1010#include <stdlib.h> 
    1111 
     12/*LamellarPS_kernel() was moved from libigor to get rid of polydipersity in del(thickness) that we provide from control panel. 
     13/*      LamellarPSX  :  calculates the form factor of a lamellar structure - with S(q) effects included 
     14------- 
     15------- resolution effects ARE NOT included, but only a CONSTANT default value, not the real q-dependent resolution!! 
     16 
     17        */ 
     18double 
     19LamellarPS_kernel(double dp[], double q) 
     20{ 
     21        double scale,dd,del,contr,NN,Cp,bkg;            //local variables of coefficient wave 
     22        double inten, qval,Pq,Sq,alpha,temp,t1,t2,t3,dQ; 
     23        double Pi,Euler,dQDefault,fii; 
     24        int ii,NNint; 
     25        Euler = 0.5772156649;           // Euler's constant 
     26        dQDefault = 0.0;//0.0025;               //[=] 1/A, q-resolution, default value 
     27        dQ = dQDefault; 
     28 
     29        Pi = 4.0*atan(1.0); 
     30        qval = q; 
     31 
     32        scale = dp[0]; 
     33        dd = dp[1]; 
     34        del = dp[2]; 
     35        contr = dp[3]; 
     36        NN = trunc(dp[4]);              //be sure that NN is an integer 
     37        Cp = dp[5]; 
     38        bkg = dp[6]; 
     39 
     40        Pq = 2.0*contr*contr/qval/qval*(1.0-cos(qval*del)); 
     41 
     42        NNint = (int)NN;                //cast to an integer for the loop 
     43        ii=0; 
     44        Sq = 0.0; 
     45        for(ii=1;ii<(NNint-1);ii+=1) { 
     46 
     47                fii = (double)ii;               //do I really need to do this? 
     48 
     49                temp = 0.0; 
     50                alpha = Cp/4.0/Pi/Pi*(log(Pi*ii) + Euler); 
     51                t1 = 2.0*dQ*dQ*dd*dd*alpha; 
     52                t2 = 2.0*qval*qval*dd*dd*alpha; 
     53                t3 = dQ*dQ*dd*dd*ii*ii; 
     54 
     55                temp = 1.0-ii/NN; 
     56                temp *= cos(dd*qval*ii/(1.0+t1)); 
     57                temp *= exp(-1.0*(t2 + t3)/(2.0*(1.0+t1)) ); 
     58                temp /= sqrt(1.0+t1); 
     59 
     60                Sq += temp; 
     61        } 
     62 
     63        Sq *= 2.0; 
     64        Sq += 1.0; 
     65 
     66        inten = 2.0*Pi*scale*Pq*Sq/(dd*qval*qval); 
     67 
     68        inten *= 1.0e8;         // 1/A to 1/cm 
     69 
     70    return(inten+bkg); 
     71} 
    1272 
    1373/** 
     
    1878 */ 
    1979double lamellarPS_analytical_1D(LamellarPSParameters *pars, double q) { 
    20         double dp[8]; 
     80        double dp[7]; 
    2181 
    2282        // Fill paramater array 
     
    2484        dp[1] = pars->spacing; 
    2585        dp[2] = pars->delta; 
    26         dp[3] = pars->sigma; 
    27         dp[4] = pars->contrast; 
    28         dp[5] = pars->n_plates; 
    29         dp[6] = pars->caille; 
    30         dp[7] = pars->background; 
     86        dp[3] = pars->contrast; 
     87        dp[4] = pars->n_plates; 
     88        dp[5] = pars->caille; 
     89        dp[6] = pars->background; 
    3190 
    3291        // Call library function to evaluate model 
    33         return LamellarPS(dp, q); 
     92        return LamellarPS_kernel(dp, q); 
    3493} 
    3594/** 
  • sansmodels/src/sans/models/c_extensions/lamellarPS.h

    r96b59384 rc1c29b6  
    77/** Structure definition for concentrated lamellar form factor parameters 
    88 * [PYTHONCLASS] = LamellarPSModel 
    9  * [DISP_PARAMS] = spacing 
     9 * [DISP_PARAMS] = delta, spacing 
    1010   [DESCRIPTION] = <text>[Concentrated Lamellar Form Factor] Calculates the scattered 
    1111           intensity from a lyotropic lamellar phase. 
     
    2121                *Parameters: spacing = repeat spacing, 
    2222                delta = bilayer thickness, 
    23                 sigma = variation in bilayer thickness 
    2423                contrast = SLD_solvent - SLD_bilayer 
    2524                n_plate = # of Lamellar plates 
     
    2827                scale = scale factor 
    2928</text> 
    30    [FIXED]= spacing.width 
     29   [FIXED]= <text>delta.width; spacing.width</text> 
    3130   [ORIENTATION_PARAMS]= 
    3231 
     
    4241    //  [DEFAULT]=delta=30 [A] 
    4342    double delta; 
    44         /// polydispersity of the bilayer thickness  [A] 
    45     //  [DEFAULT]=sigma=0.15 
    46     double sigma; 
    4743    /// Contrast [1/A²] 
    4844    //  [DEFAULT]=contrast=5.3e-6 [1/A²] 
     
    6056} LamellarPSParameters; 
    6157 
    62  
    63  
     58/// kernel 
     59double LamellarPS_kernel(double dp[], double q); 
    6460/// 1D scattering function 
    6561double lamellarPS_analytical_1D(LamellarPSParameters *pars, double q); 
Note: See TracChangeset for help on using the changeset viewer.