Changeset 318b5bbb in sasview for sansmodels/src/c_models/fcc.cpp
- Timestamp:
- Dec 18, 2012 10:55:24 AM (12 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:
- 6550b64
- Parents:
- 0203ade
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/c_models/fcc.cpp
re08bd5b r318b5bbb 53 53 */ 54 54 static double fc_analytical_2D_scaled(FCParameters *pars, double q, double q_x, double q_y) { 55 double b3_x, b3_y, b3_z, b1_x, b1_y ;55 double b3_x, b3_y, b3_z, b1_x, b1_y, b2_x, b2_y; 56 56 double q_z; 57 double alpha,cos_val_b3, cos_val_b2, cos_val_b1;57 double cos_val_b3, cos_val_b2, cos_val_b1; 58 58 double a1_dot_q, a2_dot_q,a3_dot_q; 59 59 double answer; … … 83 83 /// instead of against q coordinate in PRB 36(46), 3(6), 1754(3854) 84 84 // b3 axis orientation 85 b3_x = sin(theta) * cos(phi);//negative sign here???86 b3_y = sin(theta) * sin(phi);87 b3_z = cos(theta);88 cos_val_b3 = b3_x*q_x + b3_y*q_y + b3_z*q_z;89 alpha = acos(cos_val_b3);85 b3_x = cos(theta) * cos(phi); 86 b3_y = sin(theta); 87 //b3_z = -cos(theta) * sin(phi); 88 cos_val_b3 = b3_x*q_x + b3_y*q_y;// + b3_z*q_z; 89 90 90 // b1 axis orientation 91 b1_x = sin(psi); 92 b1_y = cos(psi); 93 cos_val_b1 = (b1_x*q_x + b1_y*q_y); 91 b1_x = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi); 92 b1_y = sin(psi)*cos(theta); 93 cos_val_b1 = b1_x*q_x + b1_y*q_y; 94 94 95 // b2 axis orientation 95 cos_val_b2 = sin(acos(cos_val_b1)); 96 // alpha correction 97 cos_val_b2 *= sin(alpha); 98 cos_val_b1 *= sin(alpha); 99 96 b2_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi); 97 b2_y = cos(theta)*cos(psi); 98 cos_val_b2 = b2_x*q_x + b2_y*q_y; 99 100 // The following test should always pass 101 if (fabs(cos_val_b3)>1.0) { 102 //printf("bcc_ana_2D: Unexpected error: cos()>1\n"); 103 cos_val_b3 = 1.0; 104 } 105 if (fabs(cos_val_b2)>1.0) { 106 //printf("bcc_ana_2D: Unexpected error: cos()>1\n"); 107 cos_val_b2 = 1.0; 108 } 109 if (fabs(cos_val_b1)>1.0) { 110 //printf("bcc_ana_2D: Unexpected error: cos()>1\n"); 111 cos_val_b1 = 1.0; 112 } 100 113 // Compute the angle btw vector q and the a3 axis 101 114 a3_dot_q = 0.5*aa*q*(cos_val_b2+cos_val_b1); … … 107 120 a2_dot_q = 0.5*aa*q*(cos_val_b3+cos_val_b1); 108 121 109 // The following test should always pass 110 if (fabs(cos_val_b3)>1.0) { 111 printf("fcc_ana_2D: Unexpected error: cos(alpha)>1\n"); 112 return 0; 113 } 122 114 123 // Get Fkq and Fkq_2 115 124 Fkq = exp(-0.5*pow(Da/aa,2.0)*(a1_dot_q*a1_dot_q+a2_dot_q*a2_dot_q+a3_dot_q*a3_dot_q)); … … 282 291 } 283 292 if (weights_theta.size()>1) { 284 _ptvalue *= fabs( sin(weights_theta[j].value*pi/180.0));293 _ptvalue *= fabs(cos(weights_theta[j].value*pi/180.0)); 285 294 } 286 295 sum += _ptvalue;
Note: See TracChangeset
for help on using the changeset viewer.