Changeset 4581


Ignore:
Timestamp:
Oct 2, 2020 10:03:39 AM (14 months ago)
Author:
toby
Message:

magnetism bugs: Load Phase not reseting SGData; error msg when somehow K-SUBG getting called w/o proper phase setup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwdGUI.py

    r4578 r4581  
    35033503
    35043504    def LoadUnitCell(event):
     3505        '''Called in response to a Load Phase menu command'''
    35053506        UnitCellsId = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List')
    35063507        data = G2frame.GPXtree.GetItemPyData(UnitCellsId)
     
    35253526                wx.MessageBox('NB: Magnetic phases from mcif files are not suitable for this purpose,\n because of space group symbol - operators mismatches',
    35263527                    caption='No usable space groups',style=wx.ICON_EXCLAMATION)
    3527                 return           
    3528         pNum = G2G.ItemSelector(Phases,G2frame,'Select phase',header='Phase')
     3528                return
     3529        elif len(Phases) == 1: # don't ask questions when there is only 1 answer
     3530            pNum = 0
     3531        else:
     3532            pNum = G2G.ItemSelector(Phases,G2frame,'Select phase',header='Phase')
    35293533        if pNum is None: return
    35303534        Phase = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,pId,Phases[pNum]))
    35313535        Phase['magPhases'] = G2frame.GPXtree.GetItemText(G2frame.PatternId)    #use as reference for recovering possible phases
    35323536        Cell = Phase['General']['Cell']
    3533         SGData = Phase['General']['SGData']
     3537        SGData.update(Phase['General']['SGData'])
    35343538        if 'SGGray' not in SGData:
    35353539            SGData['SGGray'] = False
    35363540        if Phase['General']['Type'] == 'nuclear' and 'MagSpGrp' in SGData:
    3537             SGData = G2spc.SpcGroup(SGData['SpGrp'])[1]
     3541            SGData.update(G2spc.SpcGroup(SGData['SpGrp'])[1])
    35383542        G2frame.dataWindow.RunSubGroups.Enable(True)
    35393543        ssopt.update({'Use':False,'ssSymb':'(abg)','ModVec':[0.1,0.1,0.1],'maxH':1})
     
    42044208        controls,bravais,cells,dminx,ssopt,magcells = G2frame.GPXtree.GetItemPyData(pUCid)
    42054209        E,SGData = G2spc.SpcGroup(controls[13])
    4206         atoms = list(set([atom[1] for atom in controls[15]]))       
     4210        try:
     4211            atoms = list(set([atom[1] for atom in controls[15]]))
     4212        except:
     4213            wx.MessageBox('Error: Problem with phase. Use Load Phase 1st.',
     4214                    caption='k-SUBGROUPSMAG setup error: Phase loaded?',style=wx.ICON_EXCLAMATION)
     4215            return
    42074216        testAtoms = ['',]+[atom for atom in atoms if len(G2elem.GetMFtable([atom,],[2.0,]))]
    42084217        Kx = [' ','0','1/2','-1/2','1/3','-1/3','2/3','1']
Note: See TracChangeset for help on using the changeset viewer.