Ignore:
Timestamp:
Oct 20, 2010 3:49:53 PM (14 years ago)
Author:
Jae Cho <jhjcho@…>
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
Message:

minor correcions of orientational order,etc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_extensions/fcc.c

    r18f2ca1 r85bb870  
    6161        double b3_x, b3_y, b3_z, b2_x, b2_y, b1_x, b1_y; 
    6262        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; 
    6464        double a1_dot_q, a2_dot_q,a3_dot_q; 
    6565        double answer; 
     
    8080 
    8181        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 
    8384        /// 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) 
    8586    // b3 axis orientation 
    8687    b3_x = sin(pars->theta) * cos(pars->phi);//negative sign here??? 
    8788    b3_y = sin(pars->theta) * sin(pars->phi); 
    8889    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); 
    8992    // b1 axis orientation 
    9093    b1_x = sin(pars->psi); 
    9194    b1_y = cos(pars->psi); 
     95        cos_val_b1 = (b1_x*q_x + b1_y*q_y); 
    9296    // 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); 
    109101 
    110102    // 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); 
    114104 
    115105    // 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); 
    118107 
    119108    // 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); 
    122110 
    123111    // 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"); 
    126114        return 0; 
    127115    } 
Note: See TracChangeset for help on using the changeset viewer.