Changeset 034e19a in sasmodels


Ignore:
Timestamp:
Mar 15, 2016 12:40:53 PM (7 years ago)
Author:
richardh
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:
3a45c2c
Parents:
4a4ae41
Message:

more tests in hardsphere, improved code in stickyhardsphere, RKH

Location:
sasmodels/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hardsphere.py

    r97e6d3c r034e19a  
    3535from numpy import inf 
    3636 
    37 name = "hardsphere_fish" 
    38 title = "Hard sphere structure factor from FISH, with Percus-Yevick closure" 
     37name = "hardsphere" 
     38title = "Hard sphere structure factor, with Percus-Yevick closure" 
    3939description = """\ 
    4040    [Hard sphere structure factor, with Percus-Yevick closure] 
  • sasmodels/models/stickyhardsphere.py

    r13ed84c r034e19a  
    122122    //C  SOLVE QUADRATIC FOR LAMBDA 
    123123    //C 
    124     qa = eta/12.0; 
    125     qb = -1.0*(stickiness + eta/etam1); 
     124    qa = eta/6.0; 
     125    qb = stickiness + eta/etam1; 
    126126    qc = (1.0 + eta/2.0)/etam1sq; 
    127     radic = qb*qb - 4.0*qa*qc; 
     127    radic = qb*qb - 2.0*qa*qc; 
    128128    if(radic<0) { 
    129129        //if(x>0.01 && x<0.015) 
     
    133133    } 
    134134    //C   KEEP THE SMALLER ROOT, THE LARGER ONE IS UNPHYSICAL 
    135     lam = (-1.0*qb-sqrt(radic))/(2.0*qa); 
    136     lam2 = (-1.0*qb+sqrt(radic))/(2.0*qa); 
     135    radic = sqrt(radic); 
     136    lam = (qb-radic)/qa; 
     137    lam2 = (qb+radic)/qa; 
    137138    if(lam2<lam) { 
    138139        lam = lam2; 
     
    186187tests = [ 
    187188        [ {'scale': 1.0, 'background' : 0.0, 'effect_radius' : 50.0, 'perturb' : 0.05, 'stickiness' : 0.2, 'volfraction' : 0.1, 
    188            'effect_radius_pd' : 0}, [0.001], [1.09718]] 
     189           'effect_radius_pd' : 0}, [0.001, 0.003], [1.09718, 1.087830]] 
    189190        ] 
    190191 
Note: See TracChangeset for help on using the changeset viewer.