Changeset 2308 for trunk/GSASIIsasd.py


Ignore:
Timestamp:
Jun 5, 2016 12:57:24 PM (5 years ago)
Author:
vondreele
Message:

add sp.shell model or SASD - Thx to L.A, Avakyan
fix (again) page switching problem with Texture
Change import string for G2img files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIsasd.py

    r1743 r2308  
    7272    return (3./(QR**3))*(np.sin(QR)-(QR*np.cos(QR)))
    7373   
     74def SphericalShellFF(Q,R,args=()):
     75    ''' Compute spherical shell form factor - can use numpy arrays
     76    param float Q: Q value array (usually in A-1)
     77    param float R: sphere radius (Usually in A - must match Q-1 units)
     78    param array args: [float r]: controls the shell thickness: R_inner = min(r*R,R), R_outer = max(r*R,R)
     79    returns float: form factors as array as needed
     80        Contributed by: L.A. Avakyan, Southern Federal University, Russia
     81    '''
     82    r = args[0]
     83    if r < 0: # truncate to positive value
     84        r = 0
     85    if r < 1:  # r controls inner sphere radius
     86        return SphereFF(Q,R) - SphereFF(Q,R*r)
     87    else:      # r controls outer sphere radius
     88        return SphereFF(Q,R*r) - SphereFF(Q,R)
     89
    7490def SpheroidFF(Q,R,args):
    7591    ''' Compute form factor of cylindrically symmetric ellipsoid (spheroid)
     
    226242    '''
    227243    return (4./3.)*np.pi*R**3
     244
     245def SphericalShellVol(R,args):
     246    ''' Compute volume of spherical shell
     247    - numpy array friendly
     248    param float R: sphere radius
     249    param array args: [float r]: controls shell thickness, see SphericalShellFF description
     250    returns float: volume
     251    '''
     252    r = args[0]
     253    if r < 0:
     254        r = 0
     255    if r < 1:
     256        return SphereVol(R) - SphereVol(R*r)
     257    else:
     258        return SphereVol(R*r) - SphereVol(R)
    228259
    229260def SpheroidVol(R,args):
     
    10231054        'Unified rod':[UniRodFF,UniRodVol],'Unified rod AR':[UniRodARFF,UniRodARVol],
    10241055        'Unified disk':[UniDiskFF,UniDiskVol],'Sphere':[SphereFF,SphereVol],
    1025         'Cylinder diam':[CylinderDFF,CylinderDVol]}
     1056        'Cylinder diam':[CylinderDFF,CylinderDVol],
     1057        'Spherical shell': [SphericalShellFF, SphericalShellVol]}
    10261058    Shape = data['Size']['Shape'][0]
    10271059    SlitLen = Sample.get('SlitLen',0.0)
     
    10721104        'Unified rod':[UniRodFF,UniRodVol],'Unified rod AR':[UniRodARFF,UniRodARVol],
    10731105        'Unified disk':[UniDiskFF,UniDiskVol],'Sphere':[SphereFF,SphereVol],
    1074         'Unified tube':[UniTubeFF,UniTubeVol],'Cylinder diam':[CylinderDFF,CylinderDVol]}
     1106        'Unified tube':[UniTubeFF,UniTubeVol],'Cylinder diam':[CylinderDFF,CylinderDVol],
     1107        'Spherical shell':[SphericalShellFF,SphericalShellVol]}
    10751108           
    10761109    sfxns = {'Dilute':DiluteSF,'Hard sphere':HardSpheresSF,'Square well':SquareWellSF,
     
    10801113        'PkInt','PkPos','PkSig','PkGam',]
    10811114       
    1082     FFparmOrder = ['Aspect ratio','Length','Diameter','Thickness']
     1115    FFparmOrder = ['Aspect ratio','Length','Diameter','Thickness','Shell thickness']
    10831116   
    10841117    SFparmOrder = ['Dist','VolFr','epis','Sticky','Depth','Width']
     
    11741207                FFargs = []
    11751208                SFargs = []
    1176                 for item in [cid+'Aspect ratio',cid+'Length',cid+'Thickness',cid+'Diameter']:
     1209                for item in [cid+'Aspect ratio',cid+'Length',cid+'Thickness',cid+'Diameter',cid+'Shell thickness']:
    11771210                    if item in parmDict:
    11781211                        FFargs.append(parmDict[item])
     
    12061239                FFargs = []
    12071240                SFargs = []
    1208                 for item in [cid+'Aspect ratio',cid+'Length',cid+'Thickness',cid+'Diameter',]:
     1241                for item in [cid+'Aspect ratio',cid+'Length',cid+'Thickness',cid+'Diameter',cid+'Shell thickness']:
    12091242                    if item in parmDict:
    12101243                        FFargs.append(parmDict[item])
     
    12831316        'Unified rod':[UniRodFF,UniRodVol],'Unified rod AR':[UniRodARFF,UniRodARVol],
    12841317        'Unified disk':[UniDiskFF,UniDiskVol],'Sphere':[SphereFF,SphereVol],
    1285         'Unified tube':[UniTubeFF,UniTubeVol],'Cylinder diam':[CylinderDFF,CylinderDVol]}
     1318        'Unified tube':[UniTubeFF,UniTubeVol],'Cylinder diam':[CylinderDFF,CylinderDVol],
     1319        'Spherical shell':[SphericalShellFF,SphericalShellVol]}
    12861320    sfxns = {'Dilute':DiluteSF,'Hard sphere':HardSpheresSF,'Square well':SquareWellSF,
    12871321            'Sticky hard sphere':StickyHardSpheresSF,'InterPrecipitate':InterPrecipitateSF,}
     
    13161350                if item in controls.get('SFargs',{}):
    13171351                    SFargs.append(controls['SFargs'][item][0])
    1318             for item in ['Aspect ratio','Length','Thickness','Diameter',]:
     1352            for item in ['Aspect ratio','Length','Thickness','Diameter','Shell thickness']:
    13191353                if item in controls['FFargs']:
    13201354                    FFargs.append(controls['FFargs'][item][0])
     
    13571391                if item in controls.get('SFargs',{}):
    13581392                    SFargs.append(controls['SFargs'][item][0])
    1359             for item in ['Aspect ratio','Length','Thickness','Diameter',]:
     1393            for item in ['Aspect ratio','Length','Thickness','Diameter','Shell thickness']:
    13601394                if item in controls['FFargs']:
    13611395                    FFargs.append(controls['FFargs'][item][0])
Note: See TracChangeset for help on using the changeset viewer.