Changeset 1572


Ignore:
Timestamp:
Nov 17, 2014 4:37:02 PM (7 years ago)
Author:
vondreele
Message:

complete SS indexing, apply hklm extinction rules
cleanup indexing, cell refine, load cell, make new phase, calibration, etc.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r1528 r1572  
    11541154    print 'index peak list saved'
    11551155   
    1156 def SetNewPhase(Name='New Phase',SGData=None,cell=None):
     1156def SetNewPhase(Name='New Phase',SGData=None,cell=None,Super=None):
    11571157    '''Create a new phase dict with default values for various parameters
    11581158
     
    11951195        'RBModels':{},
    11961196        }
     1197    if Super.get('Use',False):
     1198        phaseData['General'].update({'Type':'modulated','Super':1,'SuperSg':Super['ssSymb']})
     1199        phaseData['General']['SSGData'] = G2spc.SSpcGroup(SGData,Super['ssSymb'])
     1200        phaseData['General']['SuperVec'] = [[Super['ModVec'],False,Super['maxH']],
     1201            [[0,0,.1],False,4],[[0.,0.,.1],False,4]]
     1202
    11971203    return phaseData
    11981204       
  • trunk/GSASIIindex.py

    r1571 r1572  
    230230    import bisect
    231231    N = len(HKL)
    232     if N == 0: return False
     232    if N == 0: return False,peaks
    233233    hklds = list(np.array(HKL).T[-2])+[1000.0,0.0,]
    234234    hklds.sort()                                        # ascending sort - upper bound at end
     
    265265                peak[3] = True
    266266    if hklmax[0]*hklmax[1]*hklmax[2] > 0:
    267         return True
    268     else:
    269         return False
     267        return True,peaks
     268    else:
     269        return False,peaks  #nothing indexed!
    270270       
    271271def Values2A(ibrav,values):
     
    443443    tries = 0
    444444    HKL = G2lat.GenHBravais(dmin,ibrav,A)
    445     while len(HKL) > 2 and IndexPeaks(peaks,HKL):
     445    while len(HKL) > 2 and IndexPeaks(peaks,HKL)[0]:
    446446        Pwr = pwr - (tries % 2)
    447447        HKL = []
     
    494494        HKL = G2lat.GenHBravais(dmin,ibrav,A[:])
    495495        if len(HKL) > mHKL[ibrav]:
    496             IndexPeaks(peaks,HKL)
     496            peaks = IndexPeaks(peaks,HKL)[1]
    497497            Asave.append([calc_M20(peaks,HKL),A[:]])
    498498    tries = 0
     
    506506        HKL = G2lat.GenHBravais(dmin,ibrav,Abeg)
    507507       
    508         if IndexPeaks(peaks,HKL) and len(HKL) > mHKL[ibrav]:
     508        if IndexPeaks(peaks,HKL)[0] and len(HKL) > mHKL[ibrav]:
    509509            Lhkl,M20,X20,Aref = refinePeaks(peaks,ibrav,Abeg)
    510510            Asave.append([calc_M20(peaks,HKL),Aref[:]])
     
    514514                    Lhkl,M20,X20,Aref = refinePeaks(peaks,ibrav,Abeg)
    515515                    HKL = G2lat.GenHBravais(dmin,ibrav,Aref)
    516                     IndexPeaks(peaks,HKL)
     516                    peaks = IndexPeaks(peaks,HKL)[1]
    517517                    Asave.append([calc_M20(peaks,HKL),Aref[:]])
    518518            elif ibrav == 11:                      #C-centered monoclinic
     
    520520                Lhkl,M20,X20,Aref = refinePeaks(peaks,ibrav,Abeg)
    521521                HKL = G2lat.GenHBravais(dmin,ibrav,Aref)
    522                 IndexPeaks(peaks,HKL)
     522                peaks = IndexPeaks(peaks,HKL)[1]
    523523                Asave.append([calc_M20(peaks,HKL),Aref[:]])
    524524        else:
     
    625625                                        A = monoCellReduce(ibrav,A[:])
    626626                                    HKL = G2lat.GenHBravais(dmin,ibrav,A)
    627                                     IndexPeaks(peaks,HKL)
     627                                    peaks = IndexPeaks(peaks,HKL)[1]
    628628                                    a,b,c,alp,bet,gam = G2lat.A2cell(A)
    629629                                    V = G2lat.calc_V(A)
  • trunk/GSASIIpwd.py

    r1571 r1572  
    808808def getHKLMpeak(dmin,SGData,SSGData,Vec,maxH,A):
    809809    'needs a doc string'
    810     HKL = G2lat.GenHLaue(dmin,SGData,A)       
    811810    HKLs = []
    812811    vec = np.array(Vec)
     812    vstar = np.sqrt(G2lat.calc_rDsq(vec,A))     #find extra needed for -n SS reflections
     813    dvec = 1./(maxH*vstar+1./dmin)
     814    HKL = G2lat.GenHLaue(dvec,SGData,A)       
    813815    SSdH = [vec*h for h in range(-maxH,maxH+1)]
    814816    SSdH = dict(zip(range(-maxH,maxH+1),SSdH))
    815817    for h,k,l,d in HKL:
    816818        ext = G2spc.GenHKLf([h,k,l],SGData)[0]
    817         if not ext:
     819        if not ext and d >= dmin:
    818820            HKLs.append([h,k,l,0,d,-1])
    819821        for dH in SSdH:
     
    823825                d = 1/np.sqrt(G2lat.calc_rDsq(H,A))
    824826                if d >= dmin:
    825                     HKLs.append([h,k,l,dH,d,-1])
     827                    HKLM = np.array([h,k,l,dH])
     828                    if G2spc.checkSSextc(HKLM,SSGData[1]):
     829                        HKLs.append([h,k,l,dH,d,-1])
    826830    return HKLs
    827831
  • trunk/GSASIIpwdGUI.py

    r1571 r1572  
    20992099            dmin = cells[3]
    21002100            G2frame.HKL = []
     2101#        if ssopt.get('Use',False):
     2102#            SSGData = G2spc.SSpcGroup(SGData,ssopt['ssSymb'])
     2103#            Vec = ssopt['ModVec']
     2104#            maxH = ssopt['maxH']
     2105#            G2frame.HKL = G2pwd.getHKLMpeak(dmin,SGData,SSGData,Vec,maxH,A)
    21012106            for i,cell in enumerate(cellist):
    21022107                if cell[-1]:        #selected cell from table - no SS
     
    21042109                    A = G2lat.cell2A(cell[3:9])
    21052110                    G2frame.HKL = G2lat.GenHBravais(dmin,ibrav,A)
    2106                     G2indx.IndexPeaks(data[0],G2frame.HKL)
     2111                    peaks = G2indx.IndexPeaks(data[0],G2frame.HKL)[1]
    21072112                    for hkl in G2frame.HKL:
    21082113                        hkl.append(G2lat.Dsp2pos(Inst,hkl[3]))
     
    21122117    Types = [wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,1',]+2*[wg.GRID_VALUE_BOOL,]+ \
    21132118        3*[wg.GRID_VALUE_LONG,]+2*[wg.GRID_VALUE_FLOAT+':10,5',]
    2114     if len(data[0][0]) > 9:
     2119    if len(data[0]) and len(data[0][0]) > 9:
    21152120        colLabels = ['position','intensity','use','indexed','h','k','l','m','d-obs','d-calc']
    21162121        Types = [wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,1',]+2*[wg.GRID_VALUE_BOOL,]+ \
     
    22432248        ObjId = Obj.GetId()
    22442249        Id,valObj = Indx[ObjId]
    2245         move = Obj.GetValue()*0.002
     2250        move = Obj.GetValue()*0.0005
    22462251        Obj.SetValue(0)
    22472252        value = min(1.0,max(.0,float(valObj.GetValue())+move))
     
    23282333        PatternId = G2frame.PatternId
    23292334        PickId = G2frame.PickId   
    2330         peaks = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Index Peak List'))[0]
     2335        peaks = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Index Peak List'))
    23312336        limits = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Limits'))[1]
    23322337        controls,bravais,cells,dmin,ssopt = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Unit Cells List'))
     
    23472352        else:
    23482353            G2frame.HKL = G2pwd.getHKLpeak(dmin,SGData,A)
    2349         G2indx.IndexPeaks(peaks,G2frame.HKL)
    2350         for peak in peaks: print peak
     2354        peaks = [G2indx.IndexPeaks(peaks[0],G2frame.HKL)[1],peaks[1]]   #keep esds from peak fit
     2355        G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Index Peak List'),peaks)
    23512356        for hkl in G2frame.HKL:
    23522357            hkl.append(G2lat.Dsp2pos(Inst,hkl[-2])+controls[1])
     
    23842389        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)       
    23852390               
    2386     def RefineCell(event):
     2391    def RefineCell(event):  #want this to do modulation vector as well
    23872392        def cellPrint(ibrav,A):
    23882393            cell = G2lat.A2cell(A)
     
    24142419        dmin = G2indx.getDmin(peaks[0])-0.005
    24152420        G2frame.HKL = G2pwd.getHKLpeak(dmin,SGData,A)
    2416         G2indx.IndexPeaks(peaks[0],G2frame.HKL)
     2421        peaks = [G2indx.IndexPeaks(peaks[0],G2frame.HKL)[1],peaks[1]]   #put peak fit esds back in peaks
    24172422        if 'C' in Inst['Type'][0]:
    24182423            Lhkl,M20,X20,Aref,Zero = G2indx.refinePeaksZ(peaks[0],wave,ibrav,A,controls[1],controls[0])
    2419         else:   #'T'OF
     2424        else:   #'T'OF - doesn't seem to work
    24202425            Lhkl,M20,X20,Aref,Zero = G2indx.refinePeaksT(peaks[0],difC,ibrav,A,controls[1],controls[0])           
    24212426        controls[1] = Zero
     
    25312536                E,SGData = G2spc.SpcGroup(controls[13])
    25322537                G2frame.PatternTree.SetItemPyData(sub, \
    2533                     G2IO.SetNewPhase(Name=PhaseName,SGData=SGData,cell=cell[1:]))
     2538                    G2IO.SetNewPhase(Name=PhaseName,SGData=SGData,cell=cell[1:],Super=ssopt))
    25342539                Status.SetStatusText('Change space group from '+str(controls[13])+' if needed')
    25352540        finally:
  • trunk/GSASIIspc.py

    r1571 r1572  
    11451145   
    11461146    return iabsnt,mulp,Uniq,phi
     1147   
     1148def checkSSextc(HKL,SSGData):
     1149    Ops = SSGData['SSGOps']
     1150    OpM = np.array([op[0] for op in Ops])
     1151    OpT = np.array([op[1] for op in Ops])
     1152    HKLS = np.array([HKL,-HKL])
     1153    DHKL = np.reshape(np.inner(HKLS,OpM)-HKL,(-1,4))
     1154    PHKL = np.reshape(np.inner(HKLS,OpT),(-1,))
     1155    for dhkl,phkl in zip(DHKL,PHKL)[1:]:
     1156        if dhkl.any():
     1157            continue
     1158        else:
     1159            if phkl:
     1160                return False
     1161    return True
    11471162                                 
    11481163def GetOprPtrName(key):
     
    19751990    'P 21 n m':[],
    19761991#32       
    1977     'P b a 2':[],
    1978     'P 2 c b':[],
    1979     'P c 2 a':[],
     1992    'P b a 2':['(00g)','(00g)s0s','(00g)0ss','(00g)ss0','(1/21/2g)qq0',
     1993        '(a00)','(a01/2)','(0b0)','(0b1/2)',],
     1994    'P 2 c b':['(a00)','(a00)ss0','(a00)s0s','(a00)0ss','(a1/21/2)0qq',
     1995        '(0b0)','(1/2b0)','(00g)','(1/20g)',],
     1996    'P c 2 a':['(0b0)','(0b0)ss0','(0b0)0ss','(0b0)s0s','(1/2b1/2)q0q',
     1997        '(00g)','01/2g)','(a00)','(a1/20)',],
    19801998#33       
    19811999    'P n a 21':[],
     
    19862004    'P 21 c n':[],
    19872005#34       
    1988     'P n n 2':[],
    1989     'P 2 n n':[],
    1990     'P n 2 n':[],
     2006    'P n n 2':['(00g)','(00g)s0s','(00g)0ss','(1/21/2g)qq0',
     2007        '(a00)','(a1/21/2)0q0','(a1/21/2)00q','(0b0)','(1/2b1/2)q00','(1/2b1/2)00q',],
     2008    'P 2 n n':['(a00)','(a00)ss0','(a00)s0s','(a1/21/2)0qq',
     2009        '(0b0)','(1/2b1/2)q00','(1/2b1/2)00q','(00g)','(1/21/2b)0q0','(1/21/2g)q00',],
     2010    'P n 2 n':['(0b0)','(0b0)ss0','(0b0)0ss','(1/2b1/2)q0q',
     2011        '(00g)','(1/21/2g)0q0','(1/21/2g)q00','(a00)','(a1/21/2)00q','(b1/21/2)0q0',],
    19912012#35       
    19922013    'C m m 2':[],
     
    20812102        '(a00)','(a00)00s','(a00)0s0','(a00)0ss','(a01/2)','(a01/2)0s0',],
    20822103#50 o@i qq0,0qq,q0q ->000
    2083     'P b a n':[],
    2084     'P n c b':[],
    2085     'P c n a':[],
     2104    'P b a n':['(00g)','(00g)s00','(00g)0s0','(00g)ss0','(1/21/2g)',
     2105        '(a00)','(a00)0s0','(a01/2)','(0b0)','(0b0)s00','(0b1/2)',],
     2106    'P n c b':['(a00)','(a00)0s0','(a00)00s','(a00)0ss','(a1/21/2)',
     2107        '(0b0)','(0b0)00s','(1/2b0)','(00g)','(00g)0s0','(1/20g)',],
     2108    'P c n a':['(0b0)','(0b0)s00','(0b0)00s','(0b0)s0s','(1/2b1/2)',
     2109        '(00g)','(00g)s00','(01/2a)','(a00)','(a00)00s','(a1/20)',],
    20862110#51       
    20872111    'P m m a':[],
     
    20912115    'P m m b':[],
    20922116    'P c m m':[],
    2093 #52       
    2094     'P n n a':[],
    2095     'P b n n':[],
    2096     'P n c n':[],
    2097     'P n a n':[],
    2098     'P n n b':[],
    2099     'P c n n':[],
     2117#52   o@i qq0,0qq,q0q ->000     
     2118    'P n n a':['(00g)','(00g)s00','(00g)0s0','(a00)','(a00)00s',
     2119        '(0b0)','(0b0)00s','(a1/21/2)','(1/2b1/2)',],
     2120    'P b n n':['(a00)','(a00)0s0','(a00)00s','(0b0)','(0b0)s00',
     2121        '(00g)','(00g)s00','(1/2b1/2)','(1/21/2g)',],
     2122    'P n c n':['(0b0)','(0b0)s00','(0b0)00s','(00g)','(00g)0s0',
     2123        '(a00)','(a00)0s0','(1/21/2g)','(a1/21/2)',],
     2124    'P n a n':['(0b0)','(0b0)s00','(0b0)00s','(00g)','(00g)0s0',
     2125        '(a00)','(a00)0s0','(1/21/2g)','(a1/21/2)',],
     2126    'P n n b':['(00g)','(00g)s00','(00g)0s0','(a00)','(a00)00s',
     2127        '(0b0)','(0b0)00s','(a1/21/2)','(1/2b1/2)',],
     2128    'P c n n':['(a00)','(a00)0s0','(a00)00s','(0b0)','(0b0)s00',
     2129        '(00g)','(00g)s00','(1/2b1/2)','(1/21/2g)',],
    21002130#53       
    21012131    'P m n a':[],
Note: See TracChangeset for help on using the changeset viewer.