Changeset 2875 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Jun 25, 2017 2:52:51 PM (5 years ago)
Author:
toby
Message:

Allow space group entry by number; move SGMessageBox to GSASIIctrls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r2873 r2875  
    451451used (not recommended when alpha >> 120 or << 60, due to correlation.)
    452452
     453For standard settings of space groups, space group numbers (1-230) can alternately
     454be entered.
     455
    453456GSAS-II will accept non-standard settings of space groups. For example, space
    454457group "P -1" can be set to include face centering, using symbol "F -1" and "P 1 1 21/a"
     
    459462'''
    460463                dlg = G2G.SingleStringDialog(General,'Get Space Group',
    461                     '  Input the space group with spaces between axial fields  \n  (e.g. p 21/c, P 63/m m c, P 4/m m m',
     464                    '  Input the space group with spaces between axial fields  \n  (e.g. p 21/c, P 63/m m c, P 4/m m m) or enter a space\n  group number between 1 and 230.',
    462465                    value=generalData['SGData']['SpGrp'],help=helptext)
    463466                if not dlg.Show():
     
    465468                    return
    466469                else:
    467                     Flds = dlg.GetValue().split()
    468                     dlg.Destroy()
    469                 #get rid of extra spaces between fields first
    470                 for fld in Flds: fld = fld.strip()
    471                 SpcGp = ' '.join(Flds)
     470                    try:
     471                        # has a space group number been input?
     472                        spcnum = int(dlg.GetValue())
     473                        if 1 <= spcnum <= 230:
     474                            SpcGp = G2spc.spgbyNum[spcnum]
     475                        else:
     476                            msg = 'Space Group Error'
     477                            Style = wx.ICON_EXCLAMATION
     478                            wx.MessageBox('Invalid space group number',caption=msg,style=Style)
     479                            return
     480                    except:
     481                        #get rid of extra spaces between fields first
     482                        Flds = dlg.GetValue().split()
     483                        for fld in Flds: fld = fld.strip()
     484                        SpcGp = ' '.join(Flds)
     485                    finally:
     486                        dlg.Destroy()
    472487                # try a lookup on the user-supplied name
    473488                SpGrpNorm = G2spc.StandardizeSpcName(SpcGp)
     
    488503                    SGTxt.SetLabel(generalData['SGData']['SpGrp'])
    489504                    msg = 'Space Group Information'
    490                     G2gd.SGMessageBox(General,msg,text,table).Show()
     505                    G2G.SGMessageBox(General,msg,text,table).Show()
    491506                if generalData['Type'] == 'magnetic':
    492507                    Nops = len(SGData['SGOps'])*len(SGData['SGCen'])
     
    891906                    generalData['SuperSg'] = SSymbol
    892907                    msg = 'Superspace Group Information'
    893                     G2gd.SGMessageBox(General,msg,text,table).Show()
     908                    G2G.SGMessageBox(General,msg,text,table).Show()
    894909                else:
    895910                    text = [E+'\nSuperspace Group set to previous']
Note: See TracChangeset for help on using the changeset viewer.