Changeset 0d6e865 in sasmodels for sasmodels/models/barbell.c


Ignore:
Timestamp:
Oct 11, 2016 1:42:00 PM (8 years ago)
Author:
dirk
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
1fdb555
Parents:
19e7ca7
Message:

Rewriting selected models in spherical coordinates. This fixes ticket #492 for these models.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/barbell.c

    r2222134 r0d6e865  
    9595    // Compute angle alpha between q and the cylinder axis 
    9696    double sn, cn; // slots to hold sincos function output 
    97     SINCOS(theta*M_PI_180, sn, cn); 
    98     const double q = sqrt(qx*qx+qy*qy); 
    99     const double cos_val = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q); 
     97    SINCOS(phi*M_PI_180, sn, cn); 
     98    const double q = sqrt(qx*qx + qy*qy); 
     99    const double cos_val = (q==0. ? 1.0 : (cn*qx + sn*qy)*sin(theta*M_PI_180)/q); 
    100100    const double alpha = acos(cos_val); // rod angle relative to q 
    101101 
Note: See TracChangeset for help on using the changeset viewer.