Changeset 54bcd4a in sasmodels for sasmodels/convert.py


Ignore:
Timestamp:
Aug 4, 2016 2:48:37 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
745b7bb
Parents:
bd49c79
Message:

spherical sld: simplify code so that it works on AMD GPUs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/convert.py

    rbd49c79 r54bcd4a  
    229229                oldpars['ndensity'] *= 1e15 
    230230        elif name == 'spherical_sld': 
    231             for k in range(1, int(pars['n_shells'])+1): 
    232                 _remove_pd(oldpars, 'thick_flat'+str(k), 'thick_flat') 
    233                 _remove_pd(oldpars, 'thick_inter'+str(k), 'thick_inter') 
     231            oldpars["CONTROL"] -= 1 
     232            # remove polydispersity from shells 
     233            for k in range(1, 11): 
     234                _remove_pd(oldpars, 'thick_flat'+str(k), 'thickness') 
     235                _remove_pd(oldpars, 'thick_inter'+str(k), 'interface') 
     236            # remove extra shells 
     237            for k in range(int(pars['n_shells']), 11): 
     238                oldpars.pop('sld_flat'+str(k), 0) 
     239                oldpars.pop('thick_flat'+str(k), 0) 
     240                oldpars.pop('thick_inter'+str(k), 0) 
     241                oldpars.pop('func_inter'+str(k), 0) 
     242                oldpars.pop('nu_inter'+str(k), 0) 
    234243        elif name == 'core_multi_shell': 
    235244            # kill extra shells 
     
    265274                    oldpars.pop(k, None) 
    266275 
     276    #print("convert from",list(sorted(pars))) 
     277    #print("convert to",list(sorted(oldpars.items()))) 
    267278    return oldpars 
    268279 
     
    323334        elif name == 'spherical_sld': 
    324335            pars['n_shells'] = math.ceil(pars['n_shells']) 
    325             pars['npts_inter'] = math.ceil(pars['npts_inter']) 
    326             pars['func_inter0'] = math.trunc(pars['func_inter0']+0.5) 
    327             for k in range(1, 11): 
    328                 pars['func_inter%d'%k] = math.trunc(pars['func_inter%d'%k]+0.5) 
    329                 pars['thick_flat%d_pd_n'%k] = 0 
    330                 pars['thick_inter%d_pd_n'%k] = 0 
    331  
     336            pars['n_steps'] = math.ceil(pars['n_steps']) 
     337            for k in range(1, 12): 
     338                pars['shape%d'%k] = math.trunc(pars['shape%d'%k]+0.5) 
     339            for k in range(2, 12): 
     340                pars['thickness%d_pd_n'%k] = 0 
     341                pars['interface%d_pd_n'%k] = 0 
     342 
Note: See TracChangeset for help on using the changeset viewer.