Changeset 3435 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Jun 14, 2018 3:31:10 PM (5 years ago)
Author:
vondreele
Message:

make new routine GetSpGrpfromUser? & use it inGeneral & Transform fo space group input
modify getHKLpeak to check for magnetic space group extinctions - passes hkl that is allowed by either.
modify G2pwdGUI to retain SGData in Unit Cell data (in ssopts dict)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r3429 r3435  
    326326        def OnSpaceGroup(event):
    327327            event.Skip()
    328             Flds = SGTxt.GetValue().split()
    329             Flds[0] = Flds[0].upper()
    330             #get rid of extra spaces between fields first
    331             for fld in Flds: fld = fld.strip()
    332             SpcGp = ' '.join(Flds)
     328            SpcGp = GetSpGrpfromUser(self.panel,self.newSpGrp)
    333329            if SpcGp == self.newSpGrp: #didn't change it!
    334330                return
     
    432428        sgSizer = wx.BoxSizer(wx.HORIZONTAL)
    433429        sgSizer.Add(wx.StaticText(self.panel,label='  Space group: '),0,WACV)
    434         SGTxt = wx.TextCtrl(self.panel,value=self.newSpGrp,style=wx.TE_PROCESS_ENTER)
    435         SGTxt.Bind(wx.EVT_TEXT_ENTER,OnSpaceGroup)
    436         SGTxt.Bind(wx.EVT_KILL_FOCUS,OnSpaceGroup)
     430        SGTxt = wx.Button(self.panel,wx.ID_ANY,self.newSpGrp,size=(100,-1))
     431        SGTxt.Bind(wx.EVT_BUTTON,OnSpaceGroup)
    437432        sgSizer.Add(SGTxt,0,WACV)
    438433        mainSizer.Add(sgSizer,0,WACV)
     
    943938################################################################################
    944939################################################################################
     940def GetSpGrpfromUser(parent,SpGrp):
     941    helptext = '''\t\t\tGSAS-II space group information
     942               
     943Space groups are entered here as given in Volume I or Volume A of the
     944International Tables using the short Hermann-Mauguin symbol,except that spaces
     945are placed between axial fields (e.g. "P 4/m m m", "F D 3 M" or "p -3 1 m").
     946NB: the cubic "bar" in "F d -3 m" is unnecessary, and upper/lower case is not required.
     947
     948Where a centrosymmetric tetragonal or cubic space group has alternate origin settings,
     949Origin choice 2 (with the center of symmetry at the origin, which gives an -x,-y,-z
     950symmetry operator) is always used. Refer to the relevant pages in IT I or A to find
     951the offset in atom positions between the two choices.
     952
     953For rhombohedral space groups, (R xxx) the hexagonal setting is assumed. Append a
     954final R to the name (R xxx R) to indicate that a rhombohedral cell should be
     955used (not recommended when alpha >> 120 or << 60, due to correlation.)
     956
     957For standard settings of space groups, space group numbers (1-230) can alternately
     958be entered.
     959
     960GSAS-II will accept non-standard settings of space groups. For example, space
     961group "P -1" can be set to include face centering, using symbol "F -1" and "P 1 1 21/a"
     962as a nonstandard version of "P 21/c".
     963
     964Review the symmetry operators generated by GSAS-II to confirm that you have
     965entered the right symbol for your structure.
     966'''
     967    dlg = G2G.SingleStringDialog(parent,'Get Space Group',
     968        '  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.',
     969        value=SpGrp,help=helptext)
     970    if not dlg.Show():
     971        dlg.Destroy()
     972        return
     973    else:
     974        try:
     975            # has a space group number been input?
     976            spcnum = int(dlg.GetValue())
     977            if 1 <= spcnum <= 230:
     978                SpcGp = G2spc.spgbyNum[spcnum]
     979            else:
     980                msg = 'Space Group Error'
     981                wx.MessageBox('Invalid space group number',caption=msg,style=wx.ICON_EXCLAMATION)
     982                return
     983        except:
     984            #get rid of extra spaces between fields first
     985            Flds = dlg.GetValue().split()
     986            for fld in Flds: fld = fld.strip()
     987            SpcGp = ' '.join(Flds)
     988        finally:
     989            dlg.Destroy()
     990    return SpcGp
    945991   
    946992   
     
    13351381                    G2G.SGMessageBox(General,msg,text,table).Show()
    13361382                    return
    1337                 helptext = '''\t\t\tGSAS-II space group information
    1338                
    1339 Space groups are entered here as given in Volume I or Volume A of the
    1340 International Tables using the short Hermann-Mauguin symbol,except that spaces
    1341 are placed between axial fields (e.g. "P 4/m m m", "F D 3 M" or "p -3 1 m").
    1342 NB: the cubic "bar" in "F d -3 m" is unnecessary, and upper/lower case is not required.
    1343 
    1344 Where a centrosymmetric tetragonal or cubic space group has alternate origin settings,
    1345 Origin choice 2 (with the center of symmetry at the origin, which gives an -x,-y,-z
    1346 symmetry operator) is always used. Refer to the relevant pages in IT I or A to find
    1347 the offset in atom positions between the two choices.
    1348 
    1349 For rhombohedral space groups, (R xxx) the hexagonal setting is assumed. Append a
    1350 final R to the name (R xxx R) to indicate that a rhombohedral cell should be
    1351 used (not recommended when alpha >> 120 or << 60, due to correlation.)
    1352 
    1353 For standard settings of space groups, space group numbers (1-230) can alternately
    1354 be entered.
    1355 
    1356 GSAS-II will accept non-standard settings of space groups. For example, space
    1357 group "P -1" can be set to include face centering, using symbol "F -1" and "P 1 1 21/a"
    1358 as a nonstandard version of "P 21/c".
    1359 
    1360 Review the symmetry operators generated by GSAS-II to confirm that you have
    1361 entered the right symbol for your structure.
    1362 '''
    1363                 dlg = G2G.SingleStringDialog(General,'Get Space Group',
    1364                     '  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.',
    1365                     value=SpGrp,help=helptext)
    1366                 if not dlg.Show():
    1367                     dlg.Destroy()
    1368                     return
    1369                 else:
    1370                     try:
    1371                         # has a space group number been input?
    1372                         spcnum = int(dlg.GetValue())
    1373                         if 1 <= spcnum <= 230:
    1374                             SpcGp = G2spc.spgbyNum[spcnum]
    1375                         else:
    1376                             msg = 'Space Group Error'
    1377                             wx.MessageBox('Invalid space group number',caption=msg,style=wx.ICON_EXCLAMATION)
    1378                             return
    1379                     except:
    1380                         #get rid of extra spaces between fields first
    1381                         Flds = dlg.GetValue().split()
    1382                         for fld in Flds: fld = fld.strip()
    1383                         SpcGp = ' '.join(Flds)
    1384                     finally:
    1385                         dlg.Destroy()
    13861383                # try a lookup on the user-supplied name
     1384                SpcGp = GetSpGrpfromUser(General,SpGrp)
    13871385                SpGrpNorm = G2spc.StandardizeSpcName(SpcGp)
    13881386                if SpGrpNorm:
Note: See TracChangeset for help on using the changeset viewer.