Changeset 85bb870 in sasview for sansmodels/src/sans
- 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
- Location:
- sansmodels/src/sans/models
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/SphereExpShellModel.py
r339ce67 r85bb870 164 164 165 165 A = self.params['A_shell%s'% str(n)] 166 if A <1.0e-16: 166 from math import fabs 167 if fabs(A) <1.0e-16: 167 168 # Right side of each shells 168 169 r0 += self.params['thick_shell%s'% str(n)] -
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 -
sansmodels/src/sans/models/c_extensions/fcc.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, cos_val_a3, cos_val_a2, cos_val_a1; 64 64 double a1_dot_q, a2_dot_q,a3_dot_q; 65 65 double answer; … … 80 80 81 81 latticeScale = 4.0*(4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa*sqrt(2.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 /// instead of against q coordinate (PRB 36(46), 3(6), 1754(3854))85 /// instead of against q coordinate in PRB 36(46), 3(6), 1754(3854) 85 86 // b3 axis orientation 86 87 b3_x = sin(pars->theta) * cos(pars->phi);//negative sign here??? 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 alpha = acos(cos_val_b3); 89 92 // b1 axis orientation 90 93 b1_x = sin(pars->psi); 91 94 b1_y = cos(pars->psi); 95 cos_val_b1 = (b1_x*q_x + b1_y*q_y); 92 96 // 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); 98 a3_y = 0.5*(b2_y + b1_y); 99 a3_z = 0.0; 100 // a1 axis orientation 101 a1_x = 0.5*(b3_x + b2_x); 102 a1_y = 0.5*(b3_y + b2_y); 103 // a2 axis orientation 104 a2_x = 0.5*(b3_x + b1_x); 105 a2_y = 0.5*(b3_y + b1_y); 106 107 // q vector 108 q_z = 0.0; // for SANS; assuming qz is negligible 97 cos_val_b2 = sin(acos(cos_val_b1)); 98 // alpha correction 99 cos_val_b2 *= sin(alpha); 100 cos_val_b1 *= sin(alpha); 109 101 110 102 // 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; 103 a3_dot_q = 0.5*aa*q*(cos_val_b2+cos_val_b1); 114 104 115 105 // 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); 106 a1_dot_q = 0.5*aa*q*(cos_val_b2+cos_val_b3); 118 107 119 108 // 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); 109 a2_dot_q = 0.5*aa*q*(cos_val_b3+cos_val_b1); 122 110 123 111 // 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");112 if (fabs(cos_val_b3)>1.0) { 113 printf("fcc_ana_2D: Unexpected error: cos(alpha)>1\n"); 126 114 return 0; 127 115 } -
sansmodels/src/sans/models/c_models/barbell.cpp
r339ce67 r85bb870 198 198 } 199 199 if (weights_theta.size()>1) { 200 _ptvalue *= sin(weights_theta[l].value);200 _ptvalue *= fabs(sin(weights_theta[l].value)); 201 201 } 202 202 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/bcc.cpp
rd5b6a9d r85bb870 166 166 } 167 167 if (weights_theta.size()>1) { 168 _ptvalue *= sin(weights_theta[j].value);168 _ptvalue *= fabs(sin(weights_theta[j].value)); 169 169 } 170 170 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/capcyl.cpp
r339ce67 r85bb870 198 198 } 199 199 if (weights_theta.size()>1) { 200 _ptvalue *= sin(weights_theta[l].value);200 _ptvalue *= fabs(sin(weights_theta[l].value)); 201 201 } 202 202 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/coreshellcylinder.cpp
rc451be9 r85bb870 199 199 200 200 if (weights_theta.size()>1) { 201 _ptvalue *= sin(weights_theta[k].value);201 _ptvalue *= fabs(sin(weights_theta[k].value)); 202 202 } 203 203 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/csparallelepiped.cpp
r18f2ca1 r85bb870 224 224 225 225 if (weights_parallel_theta.size()>1) { 226 _ptvalue *= sin(weights_parallel_theta[l].value);226 _ptvalue *= fabs(sin(weights_parallel_theta[l].value)); 227 227 } 228 228 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/cylinder.cpp
rf10063e r85bb870 167 167 *pow(weights_rad[i].value,2)*weights_len[j].value; 168 168 if (weights_theta.size()>1) { 169 _ptvalue *= sin(weights_theta[k].value);169 _ptvalue *= fabs(sin(weights_theta[k].value)); 170 170 } 171 171 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/ellipsoid.cpp
rf10063e r85bb870 170 170 * pow(weights_rad_b[j].value,2) * weights_rad_a[i].value; 171 171 if (weights_theta.size()>1) { 172 _ptvalue *= sin(weights_theta[k].value);172 _ptvalue *= fabs(sin(weights_theta[k].value)); 173 173 } 174 174 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/ellipticalcylinder.cpp
rf10063e r85bb870 207 207 * weights_rat[m].value; 208 208 if (weights_theta.size()>1) { 209 _ptvalue *= sin(weights_theta[k].value);209 _ptvalue *= fabs(sin(weights_theta[k].value)); 210 210 } 211 211 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/fcc.cpp
rd5b6a9d r85bb870 165 165 } 166 166 if (weights_theta.size()>1) { 167 _ptvalue *= sin(weights_theta[j].value);167 _ptvalue *= fabs(sin(weights_theta[j].value)); 168 168 } 169 169 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/hollowcylinder.cpp
r2339249f r85bb870 195 195 * weights_length[j].value; 196 196 if (weights_theta.size()>1) { 197 _ptvalue *= sin(weights_theta[k].value);197 _ptvalue *= fabs(sin(weights_theta[k].value)); 198 198 } 199 199 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/parallelepiped.cpp
rf10063e r85bb870 208 208 209 209 if (weights_parallel_theta.size()>1) { 210 _ptvalue *= sin(weights_parallel_theta[l].value);210 _ptvalue *= fabs(sin(weights_parallel_theta[l].value)); 211 211 } 212 212 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/sc.cpp
r94a3f8f r85bb870 165 165 } 166 166 if (weights_theta.size()>1) { 167 _ptvalue *= sin(weights_theta[j].value);167 _ptvalue *= fabs(sin(weights_theta[j].value)); 168 168 } 169 169 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/spheroid.cpp
rf10063e r85bb870 241 241 * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value; 242 242 if (weights_theta.size()>1) { 243 _ptvalue *= sin(weights_theta[m].value);243 _ptvalue *= fabs(sin(weights_theta[m].value)); 244 244 } 245 245 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/stackeddisks.cpp
rc451be9 r85bb870 198 198 *pow(weights_radius[j].value,2)*(weights_core_thick[i].value+2*weights_layer_thick[k].value); 199 199 if (weights_theta.size()>1) { 200 _ptvalue *= sin(weights_theta[l].value);200 _ptvalue *= fabs(sin(weights_theta[l].value)); 201 201 } 202 202 sum += _ptvalue; -
sansmodels/src/sans/models/c_models/triaxialellipsoid.cpp
r13eb1c4 r85bb870 199 199 * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value; 200 200 if (weights_theta.size()>1) { 201 _ptvalue *= sin(weights_theta[k].value);201 _ptvalue *= fabs(sin(weights_theta[k].value)); 202 202 } 203 203 sum += _ptvalue;
Note: See TracChangeset
for help on using the changeset viewer.