Changeset 3418 for trunk/GSASIIpwdGUI.py


Ignore:
Timestamp:
Jun 2, 2018 7:42:33 AM (5 years ago)
Author:
vondreele
Message:

move SGMagSpinBox from G2phsGUI to G2ctrlGUI
add selection of spin choices in Unit Cells List for testing magnetic space groups with neutron data only - test TBD
fix bug in ApplyBNSlatt for non BNS centered lattice choice

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwdGUI.py

    r3395 r3418  
    30923092        A = G2lat.cell2A(cell)
    30933093        ibrav = bravaisSymb.index(controls[5])
     3094        controls[13] = SPGlist[ibrav][0]       
    30943095        SGData = G2spc.SpcGroup(controls[13])[1]
    30953096        if 'C' in Inst['Type'][0] or 'PKS' in Inst['Type'][0]:
     
    32643265            dlg.Destroy()
    32653266           
     3267    def OnSpinOp(event):
     3268        Obj = event.GetEventObject()
     3269        isym = Indx[Obj.GetId()]+1
     3270        spCode = {'red':-1,'black':1}                   
     3271        SGData['SGSpin'][isym] = spCode[Obj.GetValue()]
     3272        G2spc.CheckSpin(isym,SGData)
     3273        GenSym,GenFlg,BNSsym = G2spc.GetGenSym(SGData)
     3274        SGData['GenSym'] = GenSym
     3275        SGData['GenFlg'] = GenFlg
     3276        OprNames,SpnFlp = G2spc.GenMagOps(SGData)
     3277        SGData['SpnFlp'] = SpnFlp
     3278        SGData['MagSpGrp'] = G2spc.MagSGSym(SGData)
     3279       
     3280    def OnBNSlatt(event):
     3281        Obj = event.GetEventObject()
     3282        SGData.update(G2spc.SpcGroup(SGData['SpGrp'])[1])
     3283        BNSlatt = Obj.GetValue()
     3284        if '_' in BNSlatt:
     3285            SGData['BNSlattsym'] = [BNSlatt,BNSsym[BNSlatt]]
     3286        else:
     3287            SGData['BNSlattsym'] = [SGData['SGLatt'],[0.,0.,0.]]
     3288        SGData['SGSpin'] = [1,]*len(SGData['SGSpin'])
     3289        GenSym,GenFlg = G2spc.GetGenSym(SGData)[:2]
     3290        SGData['GenSym'] = GenSym
     3291        SGData['GenFlg'] = GenFlg
     3292        SGData['MagSpGrp'] = G2spc.MagSGSym(SGData)
     3293        G2spc.ApplyBNSlatt(SGData,SGData['BNSlattsym'])
     3294        OprNames,SpnFlp = G2spc.GenMagOps(SGData)
     3295        SGData['SpnFlp'] = SpnFlp
     3296           
     3297    def OnShowSpins(event):
     3298        SGData['MagSpGrp'] = G2spc.MagSGSym(SGData)
     3299        msg = 'Magnetic space group information'
     3300        text,table = G2spc.SGPrint(SGData,AddInv=True)
     3301        text[0] = ' Magnetic Space Group: '+SGData['MagSpGrp']
     3302        text[3] = ' The magnetic lattice point group is '+SGData['MagPtGp']
     3303        G2G.SGMagSpinBox(G2frame.dataWindow,msg,text,table,SGData['SGCen'],OprNames,
     3304            SGData['SpnFlp'],False).Show()
     3305       
    32663306    G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.IndexMenu)
    32673307    G2frame.Bind(wx.EVT_MENU, OnIndexPeaks, id=G2G.wxID_INDEXPEAKS)
     
    32783318    if len(controls) < 14:              #add space group used in indexing
    32793319        controls.append(spaceGroups[bravaisSymb.index(controls[5])])
     3320    SGData = G2spc.SpcGroup(controls[13])[1]
    32803321    G2frame.GPXtree.SetItemPyData(UnitCellsId,data)            #update with volume
    32813322    bravaisNames = ['Cubic-F','Cubic-I','Cubic-P','Trigonal-R','Trigonal/Hexagonal-P',
     
    33683409    SSopt.Bind(wx.EVT_CHECKBOX,OnSSopt)
    33693410    littleSizer.Add(SSopt,0,WACV)
    3370     hklShow = wx.Button(G2frame.dataWindow,label="Show hkl positions")
    3371     hklShow.Bind(wx.EVT_BUTTON,OnHklShow)
    3372     littleSizer.Add(hklShow,0,WACV)
     3411    if 'X' in Inst['Type'][0]:
     3412        hklShow = wx.Button(G2frame.dataWindow,label="Show hkl positions")
     3413        hklShow.Bind(wx.EVT_BUTTON,OnHklShow)
     3414        littleSizer.Add(hklShow,0,WACV)
    33733415    mainSizer.Add(littleSizer,0)
    3374    
    33753416    mainSizer.Add((5,5),0)
     3417    if 'N' in Inst['Type'][0]:
     3418        Indx = {}
     3419        GenSym,GenFlg,BNSsym = G2spc.GetGenSym(SGData)
     3420        SGData['GenSym'] = GenSym
     3421        SGData['SGGray'] = False
     3422        neutSizer = wx.BoxSizer(wx.HORIZONTAL)
     3423        neutSizer.Add(wx.StaticText(G2frame.dataWindow,label=' BNS lattice: '),0,WACV)
     3424        BNS = wx.ComboBox(G2frame.dataWindow,value=SGData['BNSlattsym'][0],
     3425            choices=[SGData['SGLatt'],]+list(BNSsym.keys()),style=wx.CB_READONLY|wx.CB_DROPDOWN)
     3426        BNS.Bind(wx.EVT_COMBOBOX,OnBNSlatt)
     3427        neutSizer.Add(BNS,0,WACV)
     3428        spinColor = ['black','red']
     3429        spCode = {-1:'red',1:'black'}
     3430        for isym,sym in enumerate(GenSym[1:]):
     3431            neutSizer.Add(wx.StaticText(G2frame.dataWindow,label=' %s: '%(sym.strip())),0,WACV)               
     3432            spinOp = wx.ComboBox(G2frame.dataWindow,value=spCode[SGData['SGSpin'][isym+1]],choices=spinColor,
     3433                style=wx.CB_READONLY|wx.CB_DROPDOWN)               
     3434            Indx[spinOp.GetId()] = isym
     3435            spinOp.Bind(wx.EVT_COMBOBOX,OnSpinOp)
     3436            neutSizer.Add(spinOp,0,WACV)
     3437        OprNames,SpnFlp = G2spc.GenMagOps(SGData)
     3438        SGData['SpnFlp'] = SpnFlp
     3439        showSpins = wx.Button(G2frame.dataWindow,label=' Show spins?')
     3440        showSpins.Bind(wx.EVT_BUTTON,OnShowSpins)
     3441        neutSizer.Add(showSpins,0,WACV)
     3442        hklShow = wx.Button(G2frame.dataWindow,label="Show hkl positions")
     3443        hklShow.Bind(wx.EVT_BUTTON,OnHklShow)
     3444        neutSizer.Add(hklShow,0,WACV)
     3445        mainSizer.Add(neutSizer,0)
     3446        mainSizer.Add((5,5),0)
    33763447    ibrav = SetLattice(controls)
    33773448    for cellGUI in cellGUIlist:
Note: See TracChangeset for help on using the changeset viewer.