Changeset 311 for trunk/GSASIIlattice.py


Ignore:
Timestamp:
Jun 27, 2011 10:27:29 AM (10 years ago)
Author:
vondreele
Message:

finish new indexing refinement stuff
more on texture plotting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r303 r311  
    100100    returns tuple with a*,b*,c*,alpha*, beta*, gamma* (degrees)
    101101    '''
     102    oldset = np.seterr('raise')
    102103    a = np.sqrt(max(0,g[0][0]))
    103104    b = np.sqrt(max(0,g[1][1]))
     
    106107    bet = acosd(g[2][0]/(a*c))
    107108    gam = acosd(g[0][1]/(a*b))
     109    np.seterr(**oldset)
    108110    return a,b,c,alp,bet,gam
    109111
     
    750752    'L=10':[[-0.16413497,0.33078546,0.39371345],[],[]],
    751753    'L=12':[[0.26141975,0.27266871,0.03277460,0.32589402],
    752         [0.09298802,-0.23773812,0.49446631],[]],
     754        [0.09298802,-0.23773812,0.49446631,0.0],[]],
    753755    'L=14':[[-0.17557309,0.25821932,0.27709173,0.33645360],[],[]],
    754756    'L=16':[[0.24370673,0.29873515,0.06447688,0.00377,0.32574495],
    755         [0.12039646,-0.25330128,0.23950998,0.40962508],[]],
     757        [0.12039646,-0.25330128,0.23950998,0.40962508,0.0],[]],
    756758    'L=18':[[-0.16914245,0.17017340,0.34598142,0.07433932,0.32696037],
    757         [-0.06901768,0.16006562,-0.24743528,0.47110273],[]],
     759        [-0.06901768,0.16006562,-0.24743528,0.47110273,0.0],[]],
    758760    'L=20':[[0.23067026,0.31151832,0.09287682,0.01089683,0.00037564,0.32573563],
    759         [0.13615420,-0.25048007,0.12882081,0.28642879,0.34620433],[]],
     761        [0.13615420,-0.25048007,0.12882081,0.28642879,0.34620433,0.0],[]],
    760762    'L=22':[[-0.16109560,0.10244188,0.36285175,0.13377513,0.01314399,0.32585583],
    761         [-0.09620055,0.20244115,-0.22389483,0.17928946,0.42017231],[]],
     763        [-0.09620055,0.20244115,-0.22389483,0.17928946,0.42017231,0.0],[]],
    762764    'L=24':[[0.22050742,0.31770654,0.11661736,0.02049853,0.00150861,0.00003426,0.32573505],
    763         [0.13651722,-0.21386648,0.00522051,0.33939435,0.10837396,0.32914497],
    764         [0.05378596,-0.11945819,0.16272298,-0.26449730,0.44923956]],
     765        [0.13651722,-0.21386648,0.00522051,0.33939435,0.10837396,0.32914497,0.0],
     766        [0.05378596,-0.11945819,0.16272298,-0.26449730,0.44923956,0.0,0.0]],
    765767    'L=26':[[-0.15435003,0.05261630,0.35524646,0.18578869,0.03259103,0.00186197,0.32574594],
    766         [-0.11306511,0.22072681,-0.18706142,0.05439948,0.28122966,0.35634355],[]],
     768        [-0.11306511,0.22072681,-0.18706142,0.05439948,0.28122966,0.35634355,0.0],[]],
    767769    'L=28':[[0.21225019,0.32031716,0.13604702,0.03132468,0.00362703,0.00018294,0.00000294,0.32573501],
    768         [0.13219496,-0.17206256,-0.08742608,0.32671661,0.17973107,0.02567515,0.32619598],
    769         [0.07989184,-0.16735346,0.18839770,-0.20705337,0.12926808,0.42715602]],
     770        [0.13219496,-0.17206256,-0.08742608,0.32671661,0.17973107,0.02567515,0.32619598,0.0],
     771        [0.07989184,-0.16735346,0.18839770,-0.20705337,0.12926808,0.42715602,0.0,0.0]],
    770772    'L=30':[[-0.14878368,0.01524973,0.33628434,0.22632587,0.05790047,0.00609812,0.00022898,0.32573594],
    771         [-0.11721726,0.20915005,-0.11723436,-0.07815329,0.31318947,0.13655742,0.33241385],
    772         [-0.04297703,0.09317876,-0.11831248,0.17355132,-0.28164031,0.42719361]],
     773        [-0.11721726,0.20915005,-0.11723436,-0.07815329,0.31318947,0.13655742,0.33241385,0.0],
     774        [-0.04297703,0.09317876,-0.11831248,0.17355132,-0.28164031,0.42719361,0.0,0.0]],
    773775    'L=32':[[0.20533892,0.32087437,0.15187897,0.04249238,0.00670516,0.00054977,0.00002018,0.00000024,0.32573501],
    774         [0.12775091,-0.13523423,-0.14935701,0.28227378,0.23670434,0.05661270,0.00469819,0.32578978],
    775         [0.09703829,-0.19373733,0.18610682,-0.14407046,0.00220535,0.26897090,0.36633402]],
     776        [0.12775091,-0.13523423,-0.14935701,0.28227378,0.23670434,0.05661270,0.00469819,0.32578978,0.0],
     777        [0.09703829,-0.19373733,0.18610682,-0.14407046,0.00220535,0.26897090,0.36633402,0.0,0.0]],
    776778    'L=34':[[-0.14409234,-0.01343681,0.31248977,0.25557722,0.08571889,0.01351208,0.00095792,0.00002550,0.32573508],
    777         [-0.11527834,0.18472133,-0.04403280,-0.16908618,0.27227021,0.21086614,0.04041752,0.32688152],
    778         [-0.06773139,0.14120811,-0.15835721,0.18357456,-0.19364673,0.08377174,0.43116318]]
     779        [-0.11527834,0.18472133,-0.04403280,-0.16908618,0.27227021,0.21086614,0.04041752,0.32688152,0.0],
     780        [-0.06773139,0.14120811,-0.15835721,0.18357456,-0.19364673,0.08377174,0.43116318,0.0,0.0]]
    779781    }
    780782   
     
    788790    Fln = np.zeros(len(SHCoef))
    789791    for i,term in enumerate(SHCoef):
    790         if abs(SHCoef[term]) > 1e-6:
    791             l,m,n = eval(term.strip('C'))
    792             lNorm = 4.*np.pi*(2.*l+1.)
    793             if SGData['SGLaue'] in ['m3','m3m']:
    794                 L = [i*4 for i in range(l/4)]
    795                 Kcl = 0.0
    796                 for i in L:
    797                     im = i/4
    798                     pcrs = ptx.pyplmpsi(l,i,phi)
    799                     Kcl += BOH['L='+str(l)][n-1][l/2-1]*pcrs*cosd(i*beta)       
    800             else:                #all but cubic
    801                 pcrs = ptx.pyplmpsi(l,n,phi)*RSQPI
    802                 if not n:
    803                     pcrs /= SQ2
    804                 if SGData['SGLaue'] in ['mmm','4/mmm','6/mmm']:
    805                     if n%6 == 3:
    806                         Kcl = pcrs*sind(n*beta)
    807                     else:
    808                         Kcl = pcrs*cosd(n*beta)
    809                 elif SGData['SGLaue'] in ['3mR','3m1','31m']:
    810                     Kcl = pcrs*cosd(n*beta)
    811                 else:
    812                     Kcl = pcrs*(cosd(n*beta)+sind(n*beta))
    813                                    
    814             Fln[i] = SHCoef[term]*Kcl*lNorm
     792         l,m,n = eval(term.strip('C'))
     793         lNorm = 4.*np.pi/(2.*l+1.)
     794         if SGData['SGLaue'] in ['m3','m3m']:
     795             Kcl = 0.0
     796             for j in range(0,l+1,4):
     797                 im = j/4+1
     798                 pcrs = ptx.pyplmpsi(l,j,phi)
     799                 Kcl += BOH['L='+str(l)][n-1][im-1]*pcrs*cosd(j*beta)       
     800         else:                #all but cubic
     801             pcrs = ptx.pyplmpsi(l,n,phi)*RSQPI
     802             if n == 0:
     803                 pcrs /= SQ2
     804             if SGData['SGLaue'] in ['mmm','4/mmm','6/mmm']:
     805                 if n%6 == 3:
     806                     Kcl = pcrs*sind(n*beta)
     807                 else:
     808                     Kcl = pcrs*cosd(n*beta)
     809             elif SGData['SGLaue'] in ['3mR','3m1','31m']:
     810                 Kcl = pcrs*cosd(n*beta)
     811             else:
     812                 Kcl = pcrs*(cosd(n*beta)+sind(n*beta))
     813         Fln[i] = SHCoef[term]*Kcl*lNorm
    815814    ODFln = dict(zip(SHCoef.keys(),list(zip(SHCoef.values(),Fln))))
    816     return ODFln
     815    return ODFln
     816   
     817def textureIndex(SHCoef):
     818    Tindx = 1.0
     819    for term in SHCoef:
     820        l,m,n = eval(term.strip('C'))
     821        Tindx += SHCoef[term]**2/(2.0*l+1.)
     822    return Tindx
     823   
    817824   
    818825def polfcal(ODFln,SamSym,psi,gam):
     826    import pytexture as ptx
    819827    RSQPI = 0.5641895835478
    820828    SQ2 = 1.414213562373
    821     PolVal = 1.0
     829    PolVal = np.ones_like(gam)
    822830    for term in ODFln:
    823         if ODFln[term][1] > 1.e-3:
     831        if abs(ODFln[term][1]) > 1.e-3:
    824832            l,m,n = eval(term.strip('C'))
    825833            psrs = ptx.pyplmpsi(l,m,psi)
    826834            if SamSym in ['-1','2/m']:
    827                 if m:
     835                if m != 0:
    828836                    Ksl = RSQPI*psrs*(cosd(m*gam)+sind(m*gam))
    829837                else:
    830                     ksl = RSQPI*psrs/SQ2
     838                    Ksl = RSQPI*psrs/SQ2
    831839            else:
    832                 if m:
     840                if m != 0:
    833841                    Ksl = RSQPI*psrs*cosd(m*gam)
    834842                else:
    835843                    Ksl = RSQPI*psrs/SQ2
    836         PolVal += ODFln[term][1]*Ksl
     844            PolVal += ODFln[term][1]*Ksl
    837845    return PolVal
    838846   
     
    900908]),
    901909]
    902 
     910    global FLnhTestData
     911    FLnhTestData = [{
     912    'C(4,0,0)': (0.965, 0.42760447),
     913    'C(2,0,0)': (1.0122, -0.80233610),
     914    'C(2,0,2)': (0.0061, 8.37491546E-03),
     915    'C(6,0,4)': (-0.0898, 4.37985696E-02),
     916    'C(6,0,6)': (-0.1369, -9.04081762E-02),
     917    'C(6,0,0)': (0.5935, -0.18234928),
     918    'C(4,0,4)': (0.1872, 0.16358127),
     919    'C(6,0,2)': (0.6193, 0.27573633),
     920    'C(4,0,2)': (-0.1897, 0.12530720)},[1,0,0]]
    903921def test0():
    904922    if NeedTestData: TestData()
Note: See TracChangeset for help on using the changeset viewer.