Changeset 3657667 in sasview for sansmodels


Ignore:
Timestamp:
Jan 12, 2013 12:45:21 PM (12 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:
5917637
Parents:
3540156
Message:

Added arbitrary orientation for pdb atomic data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/c_gen/sld2i.cpp

    rb1174ec r3657667  
    5353 */ 
    5454void GenI :: genicom(int npoints, double *qx, double *qy, double *I_out){ 
     55        //npoints is given negative for angular averaging  
    5556        // Assumes that q doesn't have qz component and sld_n is all real 
    5657        double q = 0.0; 
     58        int is_avg = 0; 
    5759        //double Pi = 4.0*atan(1.0); 
    5860        polar_sld b_sld; 
     
    6971 
    7072        double count = 0.0; 
     73        //check if this computation is for averaging 
     74        if (n_pix < 0 ){ 
     75                is_avg = 1; 
     76                n_pix = fabs(n_pix); 
     77        } 
    7178        //Assume that pixel volumes are given in vol_pix in A^3 unit 
    7279        //int x_size = 0; //in Ang 
     
    93100                                                                 mx_val[j], my_val[j], mz_val[j], 
    94101                                                                 inspin, outspin, stheta); 
    95                                 qr = (qx[i]*x_val[j] + qy[i]*y_val[j]); 
    96                                 iqr = cassign(0.0, qr); 
    97                                 ephase = cplx_exp(iqr); 
     102                                if (is_avg < 1){ 
     103                                        //anisotropic 
     104                                        qr = (qx[i]*x_val[j] + qy[i]*y_val[j]); 
     105                                        iqr = cassign(0.0, qr); 
     106                                        ephase = cplx_exp(iqr); 
     107                                        } 
     108                                else{ 
     109                                        //isotropic 
     110                                        qr = sqrt(x_val[j]*x_val[j]+y_val[j]*y_val[j]+z_val[j]*z_val[j]); 
     111                                        qr *= q; 
     112                                        if (qr == 0.0){ 
     113                                                ephase = cassign(0.0, 1.0); 
     114                                                } 
     115                                        else{ 
     116                                                qr = sin(qr) / qr; 
     117                                                ephase = cassign(qr, 0.0); 
     118                                                } 
     119                                        } 
    98120                                //up_up 
    99121                                if (inspin > 0.0 && outspin > 0.0){ 
Note: See TracChangeset for help on using the changeset viewer.