Changeset 85bb870 in sasview for sansmodels/src/sans/models/c_extensions/bcc.c
- Timestamp:
- Oct 20, 2010 5:49:53 PM (14 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:
- f118fe2f
- Parents:
- 4ddb7a4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_extensions/bcc.c
r18f2ca1 r85bb870 61 61 double b3_x, b3_y, b3_z, b2_x, b2_y, b1_x, b1_y; 62 62 double q_z; 63 double alpha, vol, cos_val_ a3, cos_val_a2, cos_val_a1;63 double alpha, vol, cos_val_b3, cos_val_b2, cos_val_b1; 64 64 double a1_dot_q, a2_dot_q,a3_dot_q; 65 65 double answer; … … 80 80 //the occupied volume of the lattice 81 81 latticeScale = 2.0*(4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa/sqrt(3.0/4.0),3.0); 82 82 // q vector 83 q_z = 0.0; // for SANS; assuming qz is negligible 83 84 /// Angles here are respect to detector coordinate 84 85 /// instead of against q coordinate(PRB 36(46), 3(6), 1754(3854)) … … 87 88 b3_y = sin(pars->theta) * sin(pars->phi); 88 89 b3_z = cos(pars->theta); 90 cos_val_b3 = b3_x*q_x + b3_y*q_y + b3_z*q_z; 91 92 alpha = acos(cos_val_b3); 89 93 // b1 axis orientation 90 94 b1_x = sin(pars->psi); 91 95 b1_y = cos(pars->psi); 96 cos_val_b1 = (b1_x*q_x + b1_y*q_y); 92 97 // b2 axis orientation 93 b2_x = sqrt(1.0-sin(pars->theta)*cos(pars->phi))*cos(pars->psi); 94 b2_y = sqrt(1.0-sin(pars->theta)*cos(pars->phi))*sin(pars->psi); 95 96 // a3 axis orientation 97 a3_x = 0.5*(b2_x + b1_x - b3_x); 98 a3_y = 0.5*(b2_y + b1_y - b3_y); 99 a3_z = 0.0; 100 // a1 axis orientation 101 a1_x = 0.5*(b3_x + b2_x - b1_x); 102 a1_y = 0.5*(b3_y + b2_y - b1_y); 103 // a2 axis orientation 104 a2_x = 0.5*(b3_x + b1_x - b2_x); 105 a2_y = 0.5*(b3_y + b1_y - b2_y); 106 107 // q vector 108 q_z = 0.0; // for SANS; assuming qz is negligible 98 cos_val_b2 = sin(acos(cos_val_b1)); 99 // alpha corrections 100 cos_val_b2 *= sin(alpha); 101 cos_val_b1 *= sin(alpha); 109 102 110 103 // Compute the angle btw vector q and the a3 axis 111 cos_val_a3 = a3_x*q_x + a3_y*q_y + a3_z*q_z; 112 alpha = acos(cos_val_a3); 113 a3_dot_q = aa*q*cos_val_a3; 104 a3_dot_q = 0.5*aa*q*(cos_val_b2+cos_val_b1-cos_val_b3); 114 105 115 106 // a1 axis 116 cos_val_a1 = a1_x*q_x + a1_y*q_y; 117 a1_dot_q = aa*q*cos_val_a1*sin(alpha); 107 a1_dot_q = 0.5*aa*q*(cos_val_b3+cos_val_b2-cos_val_b1); 118 108 119 109 // a2 axis 120 cos_val_a2 = sin(acos(cos_val_a1));//a2_x*q_x + a2_y*q_y; 121 a2_dot_q = aa*q*cos_val_a2*sin(alpha); //aa*q*cos_val_a2 110 a2_dot_q = 0.5*aa*q*(cos_val_b3+cos_val_b1-cos_val_b2); 122 111 123 112 // The following test should always pass 124 if (fabs(cos_val_ a3)>1.0) {125 printf(" parallel_ana_2D: Unexpected error: cos(alpha)>1\n");113 if (fabs(cos_val_b3)>1.0) { 114 printf("bcc_ana_2D: Unexpected error: cos(alpha)>1\n"); 126 115 return 0; 127 116 } … … 131 120 // Call Zq=Z1*Z2*Z3 132 121 Zq = (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a1_dot_q)+Fkq_2); 133 Zq = Zq *(1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a2_dot_q)+Fkq_2);134 Zq = Zq *(1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a3_dot_q)+Fkq_2);122 Zq *= (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a2_dot_q)+Fkq_2); 123 Zq *= (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a3_dot_q)+Fkq_2); 135 124 136 125 // Use SphereForm directly from libigor
Note: See TracChangeset
for help on using the changeset viewer.