Changeset 0706431 in sasmodels


Ignore:
Timestamp:
Feb 17, 2015 5:34:10 PM (10 years ago)
Author:
ajj
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
c95dc908
Parents:
1e11735
Message:

Fixed barbell model - now giving same result as sasview model

Location:
sasmodels/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/barbell.c

    r58f41fe r0706431  
    2121        const double be = (arg2 == 0.0 ? 0.5 :J1(arg2)/arg2); 
    2222 
    23             double Fq = cos(arg1)*(1.0-t*t)*be; 
     23            const double Fq = cos(arg1)*(1.0-t*t)*be; 
    2424 
    2525            total += Gauss76Wt[i] * Fq; 
     
    3636    // bell radius should never be less than radius when this is called 
    3737    const double hdist = sqrt(bell_radius*bell_radius - radius*radius); 
    38     const double p1 = 2*bell_radius*bell_radius*bell_radius/3.0; 
     38    const double p1 = 2.0*bell_radius*bell_radius*bell_radius/3.0; 
    3939    const double p2 = bell_radius*bell_radius*hdist; 
    4040    const double p3 = hdist*hdist*hdist/3.0; 
    4141 
    42     return M_PI*radius*radius*length + 2.0*M_PI*(p1+p2+p3); 
     42    return M_PI*radius*radius*length + 2.0*M_PI*(p1+p2-p3); 
    4343} 
    4444 
     
    5555    const double lower = 0.0; 
    5656    const double upper = M_PI_2; 
    57     const double h = sqrt(fabs(bell_radius*bell_radius-radius*radius)); 
     57    const double h = sqrt(bell_radius*bell_radius-radius*radius); 
    5858    double total = 0.0; 
    5959    for (int i = 0; i < 76; i++){ 
     
    7878    //Contrast and volume normalization 
    7979    const double s = (sld - solvent_sld); 
    80     return form*1.0e-4*s*s; 
     80    return form*1.0e-4*s*s; //form_volume(bell_radius,radius,length); 
    8181} 
    8282 
     
    102102    // # right, so we are leaving it out for now. 
    103103    const double q = sqrt(qx*qx+qy*qy); 
    104     const double cos_val = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q); 
     104    const double cos_val = cn*cos(phi*M_PI_180)*qx + sn*qy; 
    105105    const double alpha = acos(cos_val); // rod angle relative to q 
    106106    SINCOS(alpha, sn, cn); 
    107107 
    108108    const double h = sqrt(bell_radius*bell_radius - radius*radius); // negative h 
    109     const double bell_Fq = _bell_kernel(q, h, bell_radius, length, sn, cn); 
     109    const double bell_Fq = _bell_kernel(q, h, bell_radius, length, sn, cn)/sn; 
    110110 
    111111    const double besarg = q*radius*sn; 
  • sasmodels/models/barbell.py

    r1e11735 r0706431  
    145145    bell_radius = 40, radius=20, length=400, 
    146146    theta=60, phi=60, 
    147     radius_pd=.2, radius_pd_n=0, 
    148     length_pd=.2,length_pd_n=0, 
     147    radius_pd=.2, radius_pd_n=5, 
     148    length_pd=.2,length_pd_n=5, 
    149149    theta_pd=15, theta_pd_n=0, 
    150150    phi_pd=15, phi_pd_n=0, 
Note: See TracChangeset for help on using the changeset viewer.