Changeset a0168e8 in sasmodels
- Timestamp:
- Dec 20, 2016 5:16:46 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- d504bcd
- Parents:
- 56b0435
- Location:
- sasmodels/models
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/lamellar_stack_paracrystal.c
r4962519 ra0168e8 2 2 3 3 */ 4 double Iq(double qval, 5 double th, 6 double Nlayers, 7 double davg, 8 double pd, 9 double sld, 10 double solvent_sld); 11 double paraCryst_sn(double ww, double qval, double davg, long Nlayers, double an); 12 double paraCryst_an(double ww, double qval, double davg, long Nlayers); 4 double paraCryst_sn(double ww, double qval, double davg, int Nlayers, double an); 5 double paraCryst_an(double ww, double qval, double davg, int Nlayers); 13 6 14 double Iq(double qval, 15 double th, 16 double Nlayers, 17 double davg, 18 double pd, 19 double sld, 20 double solvent_sld) 7 static double 8 Iq(double qval, 9 double th, 10 double fp_Nlayers, 11 double davg, 12 double pd, 13 double sld, 14 double solvent_sld) 21 15 { 22 23 double inten,contr,xn;24 double xi,ww,Pbil,Znq,Snq,an;25 long n1,n2;16 //get the fractional part of Nlayers, to determine the "mixing" of N's 17 int n1 = (int)(fp_Nlayers); //truncate towards zero 18 int n2 = n1 + 1; 19 const double xn = (double)n2 - fp_Nlayers; //fractional contribution of n1 26 20 27 contr = sld - solvent_sld; 28 //get the fractional part of Nlayers, to determine the "mixing" of N's 29 30 n1 = (long)trunc(Nlayers); //rounds towards zero 31 n2 = n1 + 1; 32 xn = (double)n2 - Nlayers; //fractional contribution of n1 33 34 ww = exp(-qval*qval*pd*pd*davg*davg/2.0); 21 const double ww = exp(-0.5*square(qval*pd*davg)); 35 22 36 23 //calculate the n1 contribution 24 double Znq,Snq,an; 37 25 an = paraCryst_an(ww,qval,davg,n1); 38 26 Snq = paraCryst_sn(ww,qval,davg,n1,an); 39 27 40 28 Znq = xn*Snq; 41 29 … … 52 40 // Zq = (1-ww^2)/(1+ww^2-2*ww*cos(qval*davg)) 53 41 54 xi = th/2.0; //use 1/2 the bilayer thickness55 Pbil = (sin(qval*xi)/(qval*xi))*(sin(qval*xi)/(qval*xi));42 const double xi = th/2.0; //use 1/2 the bilayer thickness 43 const double Pbil = square(sinc(qval*xi)); 56 44 57 inten = 2.0*M_PI*contr*contr*Pbil*Znq/(qval*qval);58 inten *= 1.0e-04;45 const double contr = sld - solvent_sld; 46 const double inten = 2.0*M_PI*contr*contr*Pbil*Znq/(qval*qval); 59 47 //printf("q=%.7e wwm1=%g ww=%.5e an=% 12.5e Snq=% 12.5e Znq=% 12.5e Pbil=% 12.5e\n",qval,wwm1,ww,an,Snq,Znq,Pbil); 60 return (inten);48 return 1.0e-4*inten; 61 49 } 62 50 63 51 // functions for the lamellar paracrystal model 64 52 double 65 paraCryst_sn(double ww, double qval, double davg, longNlayers, double an) {53 paraCryst_sn(double ww, double qval, double davg, int Nlayers, double an) { 66 54 67 55 double Snq; … … 69 57 Snq = an/( (double)Nlayers*square(1.0+ww*ww-2.0*ww*cos(qval*davg)) ); 70 58 71 return (Snq);59 return Snq; 72 60 } 73 61 74 62 double 75 paraCryst_an(double ww, double qval, double davg, long Nlayers) { 76 63 paraCryst_an(double ww, double qval, double davg, int Nlayers) { 77 64 double an; 78 65 … … 82 69 an += 2.0*pow(ww,(Nlayers+1))*cos((double)(Nlayers+1)*qval*davg); 83 70 84 return (an);71 return an; 85 72 } 86 73 -
sasmodels/models/lamellar_stack_paracrystal.py
r7c57861 ra0168e8 113 113 parameters = [["thickness", "Ang", 33.0, [0, inf], "volume", 114 114 "sheet thickness"], 115 ["Nlayers", "", 20, [ 0, inf], "",115 ["Nlayers", "", 20, [1, inf], "", 116 116 "Number of layers"], 117 117 ["d_spacing", "Ang", 250., [0.0, inf], "",
Note: See TracChangeset
for help on using the changeset viewer.