Changeset abb6e4f in sasmodels
- Timestamp:
- Dec 20, 2016 5:05:48 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:
- 56b0435
- Parents:
- fa4a994
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/lamellar_hg_stack_caille.c
ra807206 rabb6e4f 3 3 */ 4 4 5 double Iq(double qval, 6 double length_tail, 7 double length_head, 8 double Nlayers, 9 double dd, 10 double Cp, 11 double tail_sld, 12 double head_sld, 13 double solvent_sld); 14 15 double Iq(double qval, 16 double length_tail, 17 double length_head, 18 double Nlayers, 19 double dd, 20 double Cp, 21 double tail_sld, 22 double head_sld, 23 double solvent_sld) 5 static double 6 Iq(double qval, 7 double length_tail, 8 double length_head, 9 double fp_Nlayers, 10 double dd, 11 double Cp, 12 double tail_sld, 13 double head_sld, 14 double solvent_sld) 24 15 { 25 double NN; //local variables of coefficient wave16 int Nlayers = (int)(fp_Nlayers+0.5); //cast to an integer for the loop 26 17 double inten,Pq,Sq,alpha,temp,t2; 27 18 //double dQ, dQDefault, t1, t3; 28 int ii,NNint;29 19 // from wikipedia 0.577215664901532860606512090082402431042159335 30 20 const double Euler = 0.577215664901533; // Euler's constant, increased sig figs for new models Feb 2015 … … 32 22 //dQ = dQDefault; // REMOVED UNUSED dQ calculations for new models Feb 2015 33 23 34 NN = trunc(Nlayers); //be sure that NN is an integer 35 36 Pq = (head_sld-solvent_sld)*(sin(qval*(length_head+length_tail))-sin(qval*length_tail)) + 37 (tail_sld-solvent_sld)*sin(qval*length_tail); 24 Pq = (head_sld-solvent_sld)*(sin(qval*(length_head+length_tail))-sin(qval*length_tail)) 25 + (tail_sld-solvent_sld)*sin(qval*length_tail); 38 26 Pq *= Pq; 39 27 Pq *= 4.0/(qval*qval); 40 28 41 NNint = (int)NN; //cast to an integer for the loop42 ii=0;43 29 Sq = 0.0; 44 for(ii=1;ii<=(NNint-1);ii+=1) { 45 46 //fii = (double)ii; //do I really need to do this? - unused variable, removed 18Feb2015 47 30 for(int ii=1; ii<=Nlayers-1; ii++) { 48 31 temp = 0.0; 49 32 alpha = Cp/4.0/M_PI/M_PI*(log(M_PI*ii) + Euler); … … 52 35 //t3 = dQ*dQ*dd*dd*ii*ii; 53 36 54 temp = 1.0- ii/NN;37 temp = 1.0-(double)ii/(double)Nlayers; 55 38 //temp *= cos(dd*qval*ii/(1.0+t1)); 56 39 temp *= cos(dd*qval*ii); … … 71 54 72 55 inten *= 1.0e-04; // 1/A to 1/cm 73 return (inten);56 return inten; 74 57 } 75 58
Note: See TracChangeset
for help on using the changeset viewer.