Changeset c1c29b6 in sasview for sansmodels/src/sans/models/c_extensions
- Timestamp:
- Aug 21, 2009 10:34:33 AM (15 years ago)
- 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
- Location:
- sansmodels/src/sans/models/c_extensions
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_extensions/ellipsoid.h
r1ed3834 rc1c29b6 28 28 // </text> 29 29 //[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> 32 32 //[ORIENTATION_PARAMS]= axis_phi.width; axis_theta.width;axis_phi; axis_theta 33 33 -
sansmodels/src/sans/models/c_extensions/lamellar.c
r0cfeff4 rc1c29b6 6 6 #include "lamellar.h" 7 7 #include <math.h> 8 #include "libCylinder.h"8 //#include "libCylinder.h" 9 9 #include <stdio.h> 10 10 #include <stdlib.h> -
sansmodels/src/sans/models/c_extensions/lamellar.h
r975ec8e rc1c29b6 36 36 } LamellarParameters; 37 37 38 39 38 /// kernel 39 double lamellar_kernel(double dp[], double q); 40 40 /// 1D scattering function 41 41 double lamellar_analytical_1D(LamellarParameters *pars, double q); -
sansmodels/src/sans/models/c_extensions/lamellarPS.c
rb4679de rc1c29b6 10 10 #include <stdlib.h> 11 11 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 */ 18 double 19 LamellarPS_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 } 12 72 13 73 /** … … 18 78 */ 19 79 double lamellarPS_analytical_1D(LamellarPSParameters *pars, double q) { 20 double dp[ 8];80 double dp[7]; 21 81 22 82 // Fill paramater array … … 24 84 dp[1] = pars->spacing; 25 85 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; 31 90 32 91 // Call library function to evaluate model 33 return LamellarPS (dp, q);92 return LamellarPS_kernel(dp, q); 34 93 } 35 94 /** -
sansmodels/src/sans/models/c_extensions/lamellarPS.h
r96b59384 rc1c29b6 7 7 /** Structure definition for concentrated lamellar form factor parameters 8 8 * [PYTHONCLASS] = LamellarPSModel 9 * [DISP_PARAMS] = spacing9 * [DISP_PARAMS] = delta, spacing 10 10 [DESCRIPTION] = <text>[Concentrated Lamellar Form Factor] Calculates the scattered 11 11 intensity from a lyotropic lamellar phase. … … 21 21 *Parameters: spacing = repeat spacing, 22 22 delta = bilayer thickness, 23 sigma = variation in bilayer thickness24 23 contrast = SLD_solvent - SLD_bilayer 25 24 n_plate = # of Lamellar plates … … 28 27 scale = scale factor 29 28 </text> 30 [FIXED]= spacing.width29 [FIXED]= <text>delta.width; spacing.width</text> 31 30 [ORIENTATION_PARAMS]= 32 31 … … 42 41 // [DEFAULT]=delta=30 [A] 43 42 double delta; 44 /// polydispersity of the bilayer thickness [A]45 // [DEFAULT]=sigma=0.1546 double sigma;47 43 /// Contrast [1/A²] 48 44 // [DEFAULT]=contrast=5.3e-6 [1/A²] … … 60 56 } LamellarPSParameters; 61 57 62 63 58 /// kernel 59 double LamellarPS_kernel(double dp[], double q); 64 60 /// 1D scattering function 65 61 double lamellarPS_analytical_1D(LamellarPSParameters *pars, double q);
Note: See TracChangeset
for help on using the changeset viewer.