Changeset 1598


Ignore:
Timestamp:
Dec 8, 2014 12:36:58 PM (9 years ago)
Author:
vondreele
Message:

insure super lattice reflection set is unique reflections only
fix PawleyUpDate? for SS reflections
add plot of recip. unit cell box in 3D reflection drawing
fix SS plot math in 3Dplots

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r1597 r1598  
    870870    SSdH = dict(zip(range(-maxH,maxH+1),SSdH))
    871871    for h,k,l,d in HKL:
    872         ext = G2spc.GenHKLf([h,k,l],SGData)[0]
     872        ext = G2spc.GenHKLf([h,k,l],SGData)[0]  #h,k,l must be integral values here
    873873        if not ext and d >= dmin:
    874874            HKLs.append([h,k,l,0,d])
     
    880880                if d >= dmin:
    881881                    HKLM = np.array([h,k,l,dH])
    882                     if G2spc.checkSSextc(HKLM,SSGData):
     882                    if G2spc.checkSSLaue([h,k,l,dH],SGData,SSGData) and G2spc.checkSSextc(HKLM,SSGData):
    883883                        HKLs.append([h,k,l,dH,d])   
    884884    return HKLs
  • trunk/GSASIImath.py

    r1595 r1598  
    17201720    A = G2lat.cell2A(cell[:6])
    17211721    Vol = cell[6]
     1722    im = 0
     1723    if generalData['Type'] in ['modulated','magnetic',]:
     1724        im = 1
    17221725    Hmax = np.asarray(G2lat.getHKLmax(dmin,SGData,A),dtype='i')+1
    17231726    adjHKLmax(SGData,Hmax)
     
    17251728    time0 = time.time()
    17261729    for iref,ref in enumerate(reflDict['RefList']):
    1727         dsp = ref[4]
     1730        dsp = ref[4+im]
     1731        if im and ref[3]:   #skip super lattice reflections
     1732            continue
    17281733        if dsp >= dmin:
    17291734            ff = 0.1*Vol    #est. no. atoms for ~10A**3/atom
     
    17311736                SQ = 0.25/dsp**2
    17321737                ff *= G2el.ScatFac(FFtable,SQ)[0]
    1733             if ref[8] > 0.:         #use only +ve Fobs**2
    1734                 E = np.sqrt(ref[8])/ff
     1738            if ref[8+im] > 0.:         #use only +ve Fobs**2
     1739                E = np.sqrt(ref[8+im])/ff
    17351740            else:
    17361741                E = 0.
  • trunk/GSASIIphsGUI.py

    r1596 r1598  
    51445144        refData = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,  \
    51455145            PatternId,'Reflection Lists'))[PhaseName]['RefList']
     5146        im = 0
     5147        if data['General']['Type'] in ['modulated','magnetic',]:
     5148            im = 1
    51465149        Inv = data['General']['SGData']['SGInv']
    51475150        mult = 0.5
     
    51525155            for iref,ref in enumerate(Refs):
    51535156                try:
    5154                     if ref[6] < 0.:
    5155                         ref[6] *= -mult
    5156                         refData[iref][8] *= -mult
    5157                         refData[iref][9] *= -mult
    5158                         ref[5] = False
    5159                         ref[7] = 1.0
     5157                    if ref[6+im] < 0.:
     5158                        ref[6+im] *= -mult
     5159                        refData[iref][8+im] *= -mult
     5160                        refData[iref][9+im] *= -mult
     5161                        ref[5+im] = False
     5162                        ref[7+im] = 1.0
    51605163                except IndexError:
    51615164                    print 'skipped',ref
  • trunk/GSASIIplot.py

    r1596 r1598  
    526526    '''
    527527
     528    global ifBox
     529    ifBox = False
    528530    def OnKeyBox(event):
    529531        mode = cb.GetValue()
     
    557559       
    558560    def OnKey(event):           #on key UP!!
     561        global ifBox
    559562        Choice = {'F':'Fo','S':'Fosq','U':'Unit','D':'dFsq','W':'dFsq/sig'}
    560563        try:
     
    576579            drawingData['Quaternion'] = Q
    577580            Q = drawingData['Quaternion']
     581        elif key in 'B':
     582            ifBox = not ifBox
    578583        elif key == '+':
    579584            Data['Scale'] *= 1.25
     
    597602    Super = Data['Super']
    598603    SuperVec = []
    599     for i in range(Super):
    600         SuperVec.append(Data['SuperVec'][i][0])
    601         SuperVec = np.array(SuperVec)
     604    if Super:
     605        SuperVec = np.array(Data['SuperVec'][0])
    602606    defaultViewPt = copy.copy(drawingData['viewPoint'])
    603607    Amat,Bmat = G2lat.cell2AB(cell)         #Amat - crystal to cartesian, Bmat - inverse
     
    616620    uBox = np.array([[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]])
    617621    uEdges = np.array([
    618         [uBox[0],uBox[1]],[uBox[0],uBox[3]],[uBox[0],uBox[4]],[uBox[1],uBox[2]]])
    619     uColors = [Rd,Gr,Bl]
    620    
     622        [uBox[0],uBox[1]],[uBox[0],uBox[3]],[uBox[0],uBox[4]],[uBox[1],uBox[2]],
     623        [uBox[2],uBox[3]],[uBox[1],uBox[5]],[uBox[2],uBox[6]],[uBox[3],uBox[7]],
     624        [uBox[4],uBox[5]],[uBox[5],uBox[6]],[uBox[6],uBox[7]],[uBox[7],uBox[4]]])
     625    uColors = [Rd,Gr,Bl, Wt,Wt,Wt, Wt,Wt,Wt, Wt,Wt,Wt]
    621626    def FillHKLRC():
    622627        R = np.zeros(len(hklRef))
     
    630635            else:
    631636                Fosq,sig,Fcsq = refl[8+Super],1.0,refl[9+Super]
    632             HKL.append(H+np.sum(SuperVec*refl[3:3+Super],axis=0))
     637            if Super:
     638                HKL.append(H+SuperVec*refl[3])
     639            else:
     640                HKL.append(H)
    633641            if Data['Type'] == 'Unit':
    634642                R[i] = 0.1
     
    779787        glLightfv(GL_LIGHT0,GL_DIFFUSE,[1,1,1,1])
    780788       
     789    def RenderBox(x,y,z):
     790        xyz = np.array([x,y,z])
     791        glEnable(GL_COLOR_MATERIAL)
     792        glLineWidth(1)
     793        glPushMatrix()
     794        glTranslate(x,y,z)
     795        glColor4ubv([0,0,0,0])
     796        glBegin(GL_LINES)
     797        for line,color in zip(uEdges,uColors):
     798            glColor3ubv(color)
     799            glVertex3fv(line[0])
     800            glVertex3fv(line[1])
     801        glEnd()
     802        glPopMatrix()
     803        glColor4ubv([0,0,0,0])
     804        glDisable(GL_COLOR_MATERIAL)
     805       
    781806    def RenderUnitVectors(x,y,z):
    782807        xyz = np.array([x,y,z])
     
    786811        glTranslate(x,y,z)
    787812        glBegin(GL_LINES)
    788         for line,color in zip(uEdges,uColors):
     813        for line,color in zip(uEdges,uColors)[:3]:
    789814            glColor3ubv(color)
    790815            glVertex3fv(-line[1])
     
    850875        glTranslate(-Tx,-Ty,-Tz)
    851876        x,y,z = drawingData['viewPoint'][0]
    852         RenderUnitVectors(x,y,z)
     877        if ifBox:
     878            RenderBox(x,y,z)
     879        else:
     880            RenderUnitVectors(x,y,z)
    853881        RenderUnitVectors(0,0,0)
    854882        RenderDots(HKL,RC)
     
    871899    Page.SetFocus()
    872900    Page.Choice = None
    873     choice = [' save as/key:','jpeg','tiff','bmp','c: recenter to default','+: increase scale',
     901    choice = [' save as/key:','jpeg','tiff','bmp','c: recenter to default','b: toggle box ','+: increase scale',
    874902    '-: decrease scale','f: Fobs','s: Fobs**2','u: unit','d: Fo-Fc','w: DF/sig','i: toggle intensity scaling']
    875903    cb = wx.ComboBox(G2frame.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY,choices=choice)
  • trunk/GSASIIspc.py

    r1587 r1598  
    11231123    Uses old GSAS Fortran routine genhkl.for
    11241124
    1125     :param HKL:  [h,k,l]
     1125    :param HKL:  [h,k,l] must be integral values for genhkl.for to work
    11261126    :param SGData: space group data obtained from SpcGroup
    11271127    :returns: iabsnt,mulp,Uniq,phi
     
    11301130     *   mulp = reflection multiplicity including Friedel pairs
    11311131     *   Uniq = numpy array of equivalent hkl in descending order of h,k,l
     1132     *   phi = phase offset for each equivalent h,k,l
    11321133
    11331134    '''
     
    11451146   
    11461147    return iabsnt,mulp,Uniq,phi
     1148   
     1149def checkSSLaue(HKL,SGData,SSGData):
     1150    #Laue check here - Toss HKL if outside unique Laue part
     1151    h,k,l,m = HKL
     1152    if SGData['SGLaue'] == '2/m':
     1153        if SGData['SGUniq'] == 'a':
     1154            if 'a' in SSGData['modSymb'] and h == 0 and m < 0:
     1155                return False
     1156            elif 'b' in SSGData['modSymb'] and k == 0 and l ==0 and m < 0:
     1157                return False
     1158            else:
     1159                return True
     1160        elif SGData['SGUniq'] == 'b':
     1161            if 'b' in SSGData['modSymb'] and k == 0 and m < 0:
     1162                return False
     1163            elif 'a' in SSGData['modSymb'] and h == 0 and l ==0 and m < 0:
     1164                return False
     1165            else:
     1166                return True
     1167        elif SGData['SGUniq'] == 'c':
     1168            if 'g' in SSGData['modSymb'] and l == 0 and m < 0:
     1169                return False
     1170            elif 'a' in SSGData['modSymb'] and h == 0 and k ==0 and m < 0:
     1171                return False
     1172            else:
     1173                return True
     1174    elif SGData['SGLaue'] == 'mmm':
     1175        if 'a' in SSGData['modSymb']:
     1176            if h == 0 and m < 0:
     1177                return False
     1178            else:
     1179                return True
     1180        elif 'b' in SSGData['modSymb']:
     1181            if k == 0 and m < 0:
     1182                return False
     1183            else:
     1184                return True
     1185        elif 'g' in SSGData['modSymb']:
     1186            if l == 0 and m < 0:
     1187                return False
     1188            else:
     1189                return True
     1190    else:   #tetragonal, trigonal, hexagonal (& triclinic?)
     1191        if l == 0 and m < 0:
     1192            return False
     1193        else:
     1194            return True
     1195       
    11471196   
    11481197def checkSSextc(HKL,SSGData):
  • trunk/imports/G2phase.py

    r1513 r1598  
    433433                Type = 'modulated'
    434434                vec = S.split()[1:]
    435                 SuperVec[nqi] = [[float(vec[i]) for i in range(3)],False,4]
     435                SuperVec = [[float(vec[i]) for i in range(3)],False,4]
    436436                nqi += 1
    437437            elif 'atom' in S[:4]:
Note: See TracChangeset for help on using the changeset viewer.