Changeset 1601


Ignore:
Timestamp:
Dec 9, 2014 3:46:07 PM (8 years ago)
Author:
vondreele
Message:

remove some more (3+2) & (3+3) supersymmetry stuff
begin implementation of 4D Fourier maps & their display
implement super lattice for cif reflection import
fix space groups imported from cif

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1594 r1601  
    655655            Super = generalData.get('Super',0)
    656656            SuperVec = []
    657             for i in range(Super):
    658                 SuperVec.append(generalData['SuperVec'][i][0])
    659                 SuperVec = np.array(SuperVec)
     657            if Super:
     658                SuperVec = np.array(generalData['SuperVec'][0])
    660659            UseList = data['Histograms']
    661660            NShkl = len(G2spc.MustrainNames(SGData))
     
    671670                    for iref,ref in enumerate(reflData['RefList']):
    672671                        hkl = ref[:3]
    673                         H = list(hkl+np.sum(SuperVec*ref[3:3+Super],axis=0))
     672                        if Super:
     673                            H = list(hkl+SuperVec*ref[3])
     674                        else:
     675                            H = hkl
    674676                        ref[4+Super] = np.sqrt(1./G2lat.calc_rDsq2(H,G))
    675677                        iabsnt,ref[3+Super],Uniq,phi = G2spc.GenHKLf(H,SGData)
     
    799801            Super = generalData.get('Super',0)
    800802            SuperVec = []
    801             for i in range(Super):
    802                 SuperVec.append(generalData['SuperVec'][i][0])
    803                 SuperVec = np.array(SuperVec)
     803            if Super:
     804                SuperVec = np.array(generalData['SuperVec'][0])
    804805            UseList = data['Histograms']
    805806            for histoName in newHistList:
     
    811812                for iref,ref in enumerate(reflData['RefList']):
    812813                    hkl = ref[:3]
    813                     H = list(hkl+np.sum(SuperVec*ref[3:3+Super],axis=0))
     814                    if Super:
     815                        H = list(hkl+SuperVec*ref[3])
     816                    else:
     817                        H = hkl
    814818                    ref[4+Super] = np.sqrt(1./G2lat.calc_rDsq2(H,G))
    815819                    iabsnt,ref[3+Super],Uniq,phi = G2spc.GenHKLf(H,SGData)
  • trunk/GSASIIgrid.py

    r1590 r1601  
    6767    wxID_CHARGEFLIP, wxID_PEAKSUNIQUE, wxID_PEAKSDELETE, wxID_PEAKSDA,
    6868    wxID_PEAKSDISTVP, wxID_PEAKSVIEWPT, wxID_FINDEQVPEAKS,wxID_SHOWBONDS,wxID_MULTIMCSA,
    69     wxID_SINGLEMCSA
    70 ] = [wx.NewId() for item in range(15)]
     69    wxID_SINGLEMCSA, wxID_4DMAPCOMPUTE,
     70] = [wx.NewId() for item in range(16)]
    7171
    7272[ wxID_PWDRADD, wxID_HKLFADD, wxID_PWDANALYSIS, wxID_PWDCOPY, wxID_DATADELETE,
     
    36563656        self.PrefillDataMenu(self.WavesData,helpType='Wave Data', helpLbl='Imcommensurate wave data')
    36573657        self.WavesData.Append(menu=wx.Menu(title=''),title='Select tab')
     3658        self.WavesDataCompute = wx.Menu(title='')
     3659        self.WavesData.Append(menu=self.WavesDataCompute,title='Compute')
     3660        self.WavesDataCompute.Append(id=wxID_4DMAPCOMPUTE, kind=wx.ITEM_NORMAL,text='Compute 4D map',
     3661            help='Compute 4-dimensional map')
    36583662        self.PostfillDataMenu()
    36593663                 
  • trunk/GSASIImath.py

    r1598 r1601  
    15251525    mapData['rhoMax'] = max(np.max(mapData['rho']),-np.min(mapData['rho']))
    15261526    print 'Omit map time: %.4f'%(time.time()-time0),'no. elements: %d'%(Fhkl.size)
     1527    return mapData
     1528   
     1529def Fourier4DMap(data,reflDict):
     1530    '''default doc string
     1531   
     1532    :param type name: description
     1533   
     1534    :returns: type name: description
     1535   
     1536    '''
     1537    generalData = data['General']
     1538    if not generalData['4DmapData']['RefList']:
     1539        print '**** ERROR - 4D Fourier map data not defined'
     1540        return
     1541    mapData = generalData['4DmapData']
     1542    dmin = mapData['Resolution']
     1543    SGData = generalData['SGData']
     1544    SSGData = generalData['SSGData']
     1545    SSGMT = np.array([ops[0].T for ops in SSGData['SSGOps']])
     1546    SSGT = np.array([ops[1] for ops in SSGData['SSGOps']])
     1547    cell = generalData['Cell'][1:8]       
     1548    A = G2lat.cell2A(cell[:6])
     1549    maxM = generalData['SuperVec'][2]
     1550    Hmax = G2lat.getHKLmax(dmin,SGData,A)+[maxM,]
     1551    adjHKLmax(SGData,Hmax)
     1552    Hmax = np.asarray(Hmax,dtype='i')+1
     1553    Fhkl = np.zeros(shape=2*Hmax,dtype='c16')
     1554    time0 = time.time()
     1555    for iref,ref in enumerate(reflDict['RefList']):
     1556        if ref[5] >= dmin:
     1557            Fosq,Fcsq,ph = ref[9:12]
     1558            Uniq = np.inner(ref[:4],SSGMT)
     1559            Phi = np.inner(ref[:4],SSGT)
     1560            for i,hkl in enumerate(Uniq):        #uses uniq
     1561                hkl = np.asarray(hkl,dtype='i')
     1562                dp = 360.*Phi[i]                #and phi
     1563                a = cosd(ph+dp)
     1564                b = sind(ph+dp)
     1565                phasep = complex(a,b)
     1566                phasem = complex(a,-b)
     1567                if 'Fobs' in mapData['MapType']:
     1568                    F = np.where(Fosq>0.,np.sqrt(Fosq),0.)
     1569                    h,k,l,m = hkl+Hmax
     1570                    Fhkl[h,k,l,m] = F*phasep
     1571                    h,k,l,m = -hkl+Hmax
     1572                    Fhkl[h,k,l,m] = F*phasem
     1573                elif 'delt-F' in mapData['MapType']:
     1574                    dF = np.where(Fosq>0.,np.sqrt(Fosq),0.)-np.sqrt(Fcsq)
     1575                    h,k,l,m = hkl+Hmax
     1576                    Fhkl[h,k,l,m] = dF*phasep
     1577                    h,k,l,m = -hkl+Hmax
     1578                    Fhkl[h,k,l,m] = dF*phasem
     1579    rho = fft.fftn(fft.fftshift(Fhkl))/cell[6]
     1580    print 'Fourier map time: %.4f'%(time.time()-time0),'no. elements: %d'%(Fhkl.size)
     1581    mapData['rho'] = np.real(rho)
     1582    mapData['rhoMax'] = max(np.max(mapData['rho']),-np.min(mapData['rho']))
    15271583    return mapData
    15281584
  • trunk/GSASIIphsGUI.py

    r1599 r1601  
    129129            if generalData['Type'] =='macromolecular':
    130130                generalData['AtomPtrs'] = [6,4,10,12]
    131         if generalData['Type'] in ['modulated','magnetic',] and 'Super' not in generalData:
    132             generalData['Super'] = 1
    133             generalData['SuperVec'] = [[0,0,.1],False,4]
    134             generalData['SSGData'] = {}
     131        if generalData['Type'] in ['modulated','magnetic',]:
     132            if 'Super' not in generalData:
     133                generalData['Super'] = 1
     134                generalData['SuperVec'] = [[0,0,.1],False,4]
     135                generalData['SSGData'] = {}
     136            if '4DmapData' not in generalData:
     137                generalData['4DmapData'] = mapDefault
     138                generalData['4DmapData'].update({'MapType':'Fobs'})
    135139# end of patches
    136140        cx,ct,cs,cia = generalData['AtomPtrs']
     
    19651969                atom[-1][SS]['waveType']=waveType.GetValue()
    19661970               
     1971            def OnShowWave(event):
     1972                mapBtn.SetValue(False)
     1973                G2plt.ModulationPlot(G2frame,data,atom)
     1974               
    19671975            atomSizer = wx.BoxSizer(wx.HORIZONTAL)
    19681976            atomSizer.Add(wx.StaticText(waveData,label=' Modulation data for atom:    '+atom[0]+'    WaveType: '),0,WACV)           
     
    19711979            waveType.Bind(wx.EVT_COMBOBOX,OnWaveType)
    19721980            atomSizer.Add(waveType,0,WACV)
     1981            mapBtn = wx.CheckBox(waveData,label='Show contour map?')
     1982            mapBtn.Bind(wx.EVT_CHECKBOX, OnShowWave)
     1983            Indx[mapBtn.GetId()] = atom
     1984            atomSizer.Add(mapBtn,0,WACV)
    19731985            return atomSizer
    19741986           
     
    20382050            return waveSizer
    20392051           
     2052        def MapSizer():
     2053
     2054            def OnRefList(event):
     2055                Map['RefList'] = refList.GetValue()
     2056               
     2057            def OnMapType(event):
     2058                Map['MapType'] = mapType.GetValue()
     2059               
     2060            Map = generalData['4DmapData']
     2061            refList = data['Histograms'].keys()
     2062            mapSizer = wx.BoxSizer(wx.HORIZONTAL)
     2063            mapSizer.Add(wx.StaticText(waveData,label=' 4D map data: Reflection set from: '),0,WACV)
     2064            refList = wx.ComboBox(waveData,-1,value=Map['RefList'],choices=refList,
     2065                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     2066            refList.Bind(wx.EVT_COMBOBOX,OnRefList)
     2067            mapSizer.Add(refList,0,WACV)
     2068            mapTypes = ['Fobs','delt-F']
     2069            mapSizer.Add(wx.StaticText(waveData,label=' Map type: '),0,WACV)
     2070            mapType = wx.ComboBox(waveData,-1,value=Map['MapType'],choices=mapTypes,
     2071                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     2072            mapType.Bind(wx.EVT_COMBOBOX,OnMapType)
     2073            mapSizer.Add(mapType,0,WACV)
     2074            return mapSizer
     2075           
    20402076        Indx = {}
    20412077        G2frame.dataFrame.SetStatusText('')
     
    20572093        mainSizer.Add(wx.StaticText(waveData,label=' Incommensurate propagation wave data:'),0,WACV)
    20582094        if generalData['Type'] in ['modulated','magnetic']:
     2095            mainSizer.Add(MapSizer(),0,WACV)           
    20592096            for iatm,atom in enumerate(atomData):
    2060                 for SS in ['SS1',]:  #future SS2 & SS3
     2097                for SS in ['SS1',]:  #future SS2 & SS3 - I doubt it!
    20612098                    G2gd.HorizontalLine(mainSizer,waveData)
    20622099                    mainSizer.Add(AtomSizer(SS,atom))
     
    20682105        SetPhaseWindow(G2frame.dataFrame,waveData,mainSizer)
    20692106                       
     2107    def On4DMapCompute(event):
     2108        generalData = data['General']
     2109        mapData = generalData['4DmapData']
     2110        reflName = mapData['RefList']
     2111        if not reflName:
     2112            G2frame.ErrorDialog('Fourier map','No reflections defined for Fourier map')
     2113            return
     2114        phaseName = generalData['Name']
     2115        if 'PWDR' in reflName:
     2116            PatternId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root, reflName)
     2117            reflSets = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId,'Reflection Lists'))
     2118            reflData = reflSets[phaseName]
     2119        elif 'HKLF' in reflName:
     2120            PatternId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root, reflName)
     2121            reflData = G2frame.PatternTree.GetItemPyData(PatternId)[1]
     2122        mapData.update(G2mth.Fourier4DMap(data,reflData))
     2123        mapSig = np.std(mapData['rho'])
     2124        print mapData['MapType']+' computed: rhomax = %.3f rhomin = %.3f sigma = %.3f'%(np.max(mapData['rho']),np.min(mapData['rho']),mapSig)
     2125           
    20702126################################################################################
    20712127#Structure drawing GUI stuff               
     
    56325688        if data['General']['Type'] in ['modulated','magnetic']:
    56335689            FillSelectPageMenu(TabSelectionIdDict, G2frame.dataFrame.WavesData)
     5690            G2frame.dataFrame.Bind(wx.EVT_MENU, On4DMapCompute, id=G2gd.wxID_4DMAPCOMPUTE)
    56345691        # Draw Options
    56355692        FillSelectPageMenu(TabSelectionIdDict, G2frame.dataFrame.DataDrawOptions)
  • trunk/GSASIIplot.py

    r1599 r1601  
    526526################################################################################
    527527
    528 def Plot3DSngl(G2frame,newPlot=False,Data=None,hklRef=None,Title=''):
     528def Plot3DSngl(G2frame,newPlot=False,Data=None,hklRef=None,Title='no phase'):
    529529    '''3D Structure factor plotting package - displays reflections as rings proportional
    530530        to F, F**2, etc. as requested as 3D array
     
    27662766
    27672767################################################################################
     2768#####
     2769################################################################################
     2770
     2771def ModulationPlot(G2frame,data,atom):
     2772   
     2773    print 'modulation plot for',atom[0]
     2774    try:
     2775        plotNum = G2frame.G2plotNB.plotList.index('Modulation')
     2776        Page = G2frame.G2plotNB.nb.GetPage(plotNum)
     2777        Page.figure.clf()
     2778        Plot = Page.figure.gca()
     2779        if not Page.IsShown():
     2780            Page.Show()
     2781    except ValueError:
     2782        Plot = G2frame.G2plotNB.addMpl('Modulation').gca()
     2783        plotNum = G2frame.G2plotNB.plotList.index('Modulation')
     2784        Page = G2frame.G2plotNB.nb.GetPage(plotNum)
     2785#        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
     2786
     2787   
     2788################################################################################
    27682789##### PlotCovariance
    27692790################################################################################
  • trunk/imports/G2phase.py

    r1599 r1601  
    406406                    raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry")           
    407407                SpGrp = S.split()[1]
     408                SuperSg = ''
    408409                if '(' in SpGrp:    #supercell symmetry - split in 2
    409410                    SuperStr = SpGrp.split('(')
     
    411412                    SuperSg = '('+SuperStr[1]
    412413                SpGrpNorm = G2spc.StandardizeSpcName(SpGrp)
    413                 E,SGData = G2spc.SpcGroup(SpGrp)
     414                E,SGData = G2spc.SpcGroup(SpGrpNorm)
    414415                # space group processing failed, try to look up name in table
    415416                while E:
     
    533534        Phase['General']['SuperVec'] = SuperVec
    534535        Phase['General']['SuperSg'] = SuperSg
     536        if SuperSg:
     537            Phase['General']['SSGData'] = G2spc.SSpcGroup(SGData,SuperSg)[1]
    535538        Phase['General']['AtomPtrs'] = [3,1,7,9]
    536539        Phase['Atoms'] = Atoms
  • trunk/imports/G2sfact_CIF.py

    r1453 r1601  
    4141        If multiple datasets are requested, use self.repeat and buffer caching.
    4242        '''
    43         hklitems = [('_refln_index_h','_refln_index_k','_refln_index_l'),
    44                     ('_refln.index_h','_refln.index_k','_refln.index_l')]
     43        hklitems = [('_refln_index_h','_refln_index_k','_refln_index_l','_refln_index_m_1'),
     44                    ('_refln.index_h','_refln.index_k','_refln.index_l','_refln.index_m_1')]
    4545        cellitems = [
    4646            ('_cell_length_a','_cell_length_b','_cell_length_c',
     
    111111                gotFo = False
    112112                gotFo2 = False
     113                im = 0
    113114                for i in range(2):
    114115                    if hklitems[i][0] in blkkeys and hklitems[i][1] in blkkeys and hklitems[i][2] in blkkeys:
    115116                        dnIndex = i
     117                        if hklitems[i][3] in blkkeys:   #Super lattice reflections h,k,l,m
     118                            im = 1
    116119                        break
    117120                else:
     
    262265                            HKL.append('.')
    263266                    #h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,Ext
    264                     ref = HKL+[0,0,0,0,0, 0,0,0,0,0, 0]
     267                    if im:
     268                        ref = HKL+[0,0,0,0,0, 0,0,0,0,0, 0,0]
     269                    else:
     270                        ref = HKL+[0,0,0,0,0, 0,0,0,0,0, 0]
    265271                    if F2dn:
    266272                        F2 = item[itemkeys[F2dn]]
     
    298304                            pass
    299305                               
    300                     ref[8] = F2
    301                     ref[5] = F2
    302                     ref[6] = sigF2
    303                     ref[9] = F2c
    304                     ref[7] = F2c
     306                    ref[8+im] = F2
     307                    ref[5+im] = F2
     308                    ref[6+im] = sigF2
     309                    ref[9+im] = F2c
     310                    ref[7+im] = F2c
    305311                    try:
    306312                        if Phdn:
    307                             ref[10] = float(item[itemkeys[Phdn]])
     313                            ref[10+im] = float(item[itemkeys[Phdn]])
    308314                    except:
    309315                        pass
     
    321327                    Type = 'SNC'
    322328            else:
    323                 type = 'SXC'
     329                Type = 'SXC'
    324330            self.RefDict['Type'] = Type
     331            self.RefDict['Super'] = im
    325332            if blk.get('_diffrn_radiation_wavelength'):
    326333                wave = float(blk['_diffrn_radiation_wavelength'])
Note: See TracChangeset for help on using the changeset viewer.