Changeset 8e36cdd in sasview for sansmodels/src/sans/models/c_extensions
- Timestamp:
- Aug 20, 2009 1:24:23 PM (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:
- 1d67243
- Parents:
- 191b369
- Location:
- sansmodels/src/sans/models/c_extensions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_extensions/parallelepiped.c
r3c102d4 r8e36cdd 23 23 dp[0] = pars->scale; 24 24 dp[1] = pars->short_a; 25 dp[2] = pars-> long_b;26 dp[3] = pars->long er_c;25 dp[2] = pars->short_b; 26 dp[3] = pars->long_c; 27 27 dp[4] = pars->contrast; 28 28 dp[5] = pars->background; … … 98 98 */ 99 99 double parallelepiped_analytical_2D_scaled(ParallelepipedParameters *pars, double q, double q_x, double q_y) { 100 double parallel_x, parallel_y, parallel_z;100 double cparallel_x, cparallel_y, cparallel_z, bparallel_x, bparallel_y, parallel_x, parallel_y, parallel_z; 101 101 double q_z; 102 102 double alpha, vol, cos_val_c, cos_val_b, cos_val_a, edgeA, edgeB, edgeC; … … 106 106 107 107 edgeA = pars->short_a; 108 edgeB = pars-> long_b;109 edgeC = pars->long er_c;108 edgeB = pars->short_b; 109 edgeC = pars->long_c; 110 110 111 111 112 112 // parallelepiped c axis orientation 113 parallel_x = sin(pars->parallel_theta) * cos(pars->parallel_phi);114 parallel_y = sin(pars->parallel_theta) * sin(pars->parallel_phi);115 parallel_z = cos(pars->parallel_theta);113 cparallel_x = sin(pars->parallel_theta) * cos(pars->parallel_phi); 114 cparallel_y = sin(pars->parallel_theta) * sin(pars->parallel_phi); 115 cparallel_z = cos(pars->parallel_theta); 116 116 117 117 // q vector … … 120 120 // Compute the angle btw vector q and the 121 121 // axis of the parallelepiped 122 cos_val_c = parallel_x*q_x + parallel_y*q_y +parallel_z*q_z;122 cos_val_c = cparallel_x*q_x + cparallel_y*q_y + cparallel_z*q_z; 123 123 alpha = acos(cos_val_c); 124 124 125 125 // parallelepiped a axis orientation 126 parallel_x = -(1-sin(pars->parallel_theta)*sin(pars->parallel_phi))*sin(pars->parallel_psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)*sin(pars->parallel_psi);127 parallel_y = (1-sin(pars->parallel_theta)*sin(pars->parallel_phi))*cos(pars->parallel_psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)*cos(pars->parallel_psi);126 parallel_x = sin(pars->parallel_psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)*sin(pars->parallel_psi); 127 parallel_y = cos(pars->parallel_psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)*cos(pars->parallel_psi); 128 128 129 //parallel_x = -(1-sin(pars->parallel_theta)*sin(pars->parallel_phi))*sin(pars->parallel_psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)*sin(pars->parallel_psi); 130 //parallel_y = (1-sin(pars->parallel_theta)*sin(pars->parallel_phi))*cos(pars->parallel_psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)*cos(pars->parallel_psi); 131 cos_val_a = (parallel_x*q_x + parallel_y*q_y); 129 cos_val_a = parallel_x*q_x + parallel_y*q_y; 132 130 133 131 134 132 135 133 // parallelepiped b axis orientation 136 parallel_x =(1-sin(pars->parallel_theta)*cos(pars->parallel_phi))*cos(pars->parallel_psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)* cos(pars->parallel_psi);137 parallel_y =(1-sin(pars->parallel_theta)*cos(pars->parallel_phi))*sin(pars->parallel_psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)* sin(pars->parallel_psi);134 bparallel_x = sqrt(1-sin(pars->parallel_theta)*cos(pars->parallel_phi))*cos(pars->parallel_psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)* cos(pars->parallel_psi); 135 bparallel_y = sqrt(1-sin(pars->parallel_theta)*cos(pars->parallel_phi))*sin(pars->parallel_psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)* sin(pars->parallel_psi); 138 136 // axis of the parallelepiped 139 cos_val_b = (parallel_x*q_x + parallel_y*q_y) ;137 cos_val_b = sin(acos(cos_val_a)) ; 140 138 141 139 … … 148 146 149 147 // Call the IGOR library function to get the kernel 150 answer = pkernel( q*edgeA, q*edgeB, q*edgeC, cos_val_a,cos_val_b,cos_val_c);148 answer = pkernel( q*edgeA, q*edgeB, q*edgeC, sin(alpha)*cos_val_a,sin(alpha)*cos_val_b,cos_val_c); 151 149 152 150 // Multiply by contrast^2 -
sansmodels/src/sans/models/c_extensions/parallelepiped.h
r2cb89e7 r8e36cdd 7 7 /** Structure definition for Parallelepiped parameters 8 8 * [PYTHONCLASS] = ParallelepipedModel 9 * [DISP_PARAMS] = short_a, long_b, longer_c,parallel_phi,parallel_psi, parallel_theta9 * [DISP_PARAMS] = short_a, short_b, long_c,parallel_phi,parallel_psi, parallel_theta 10 10 [DESCRIPTION] = <text> Form factor for a rectangular solid with uniform scattering length density. 11 11 12 12 scale:Scale factor 13 short_a: length of short side of the parallelepiped[A]14 long_b: length of long side of the parallelepiped[A]15 long er_c: length of longer sideof the parallelepiped [A]13 short_a: length of short edge [A] 14 short_b: length of another short edge [A] 15 long_c: length of long edge of the parallelepiped [A] 16 16 contrast: particle_sld - solvent_sld 17 17 background:Incoherent Background [1/cm] 18 18 </text> 19 [FIXED]= <text>short_a.width; long_b.width; longer_c.width;parallel_phi.width;parallel_psi.width; parallel_theta.width</text>19 [FIXED]= <text>short_a.width; short_b.width; long_c.width;parallel_phi.width;parallel_psi.width; parallel_theta.width</text> 20 20 [ORIENTATION_PARAMS]= <text>parallel_phi;parallel_psi; parallel_theta; parallel_phi.width;parallel_psi.width; parallel_theta.width</text> 21 21 … … 26 26 // [DEFAULT]=scale=1.0 27 27 double scale; 28 /// Length of short side of the parallelepiped [A]28 /// Length of short edge of the parallelepiped [A] 29 29 // [DEFAULT]=short_a=35 [A] 30 30 double short_a; 31 /// Length of long side edge of the parallelepiped [A]32 // [DEFAULT]= long_b=75 [A]33 double long_b;34 /// Length of long er side of the parallelepiped [A]35 // [DEFAULT]=long er_c=400 [A]36 double long er_c;31 /// Length of short edge edge of the parallelepiped [A] 32 // [DEFAULT]=short_b=75 [A] 33 double short_b; 34 /// Length of long edge of the parallelepiped [A] 35 // [DEFAULT]=long_c=400 [A] 36 double long_c; 37 37 /// Contrast [1/A²] 38 38 // [DEFAULT]=contrast=5.3e-6 [1/A²]
Note: See TracChangeset
for help on using the changeset viewer.