Changeset 3435
- Timestamp:
- Jun 14, 2018 3:31:10 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r3429 r3435 326 326 def OnSpaceGroup(event): 327 327 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) 333 329 if SpcGp == self.newSpGrp: #didn't change it! 334 330 return … … 432 428 sgSizer = wx.BoxSizer(wx.HORIZONTAL) 433 429 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) 437 432 sgSizer.Add(SGTxt,0,WACV) 438 433 mainSizer.Add(sgSizer,0,WACV) … … 943 938 ################################################################################ 944 939 ################################################################################ 940 def GetSpGrpfromUser(parent,SpGrp): 941 helptext = '''\t\t\tGSAS-II space group information 942 943 Space groups are entered here as given in Volume I or Volume A of the 944 International Tables using the short Hermann-Mauguin symbol,except that spaces 945 are placed between axial fields (e.g. "P 4/m m m", "F D 3 M" or "p -3 1 m"). 946 NB: the cubic "bar" in "F d -3 m" is unnecessary, and upper/lower case is not required. 947 948 Where a centrosymmetric tetragonal or cubic space group has alternate origin settings, 949 Origin choice 2 (with the center of symmetry at the origin, which gives an -x,-y,-z 950 symmetry operator) is always used. Refer to the relevant pages in IT I or A to find 951 the offset in atom positions between the two choices. 952 953 For rhombohedral space groups, (R xxx) the hexagonal setting is assumed. Append a 954 final R to the name (R xxx R) to indicate that a rhombohedral cell should be 955 used (not recommended when alpha >> 120 or << 60, due to correlation.) 956 957 For standard settings of space groups, space group numbers (1-230) can alternately 958 be entered. 959 960 GSAS-II will accept non-standard settings of space groups. For example, space 961 group "P -1" can be set to include face centering, using symbol "F -1" and "P 1 1 21/a" 962 as a nonstandard version of "P 21/c". 963 964 Review the symmetry operators generated by GSAS-II to confirm that you have 965 entered 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 945 991 946 992 … … 1335 1381 G2G.SGMessageBox(General,msg,text,table).Show() 1336 1382 return 1337 helptext = '''\t\t\tGSAS-II space group information1338 1339 Space groups are entered here as given in Volume I or Volume A of the1340 International Tables using the short Hermann-Mauguin symbol,except that spaces1341 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,-z1346 symmetry operator) is always used. Refer to the relevant pages in IT I or A to find1347 the offset in atom positions between the two choices.1348 1349 For rhombohedral space groups, (R xxx) the hexagonal setting is assumed. Append a1350 final R to the name (R xxx R) to indicate that a rhombohedral cell should be1351 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 alternately1354 be entered.1355 1356 GSAS-II will accept non-standard settings of space groups. For example, space1357 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 have1361 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 return1369 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 return1379 except:1380 #get rid of extra spaces between fields first1381 Flds = dlg.GetValue().split()1382 for fld in Flds: fld = fld.strip()1383 SpcGp = ' '.join(Flds)1384 finally:1385 dlg.Destroy()1386 1383 # try a lookup on the user-supplied name 1384 SpcGp = GetSpGrpfromUser(General,SpGrp) 1387 1385 SpGrpNorm = G2spc.StandardizeSpcName(SpcGp) 1388 1386 if SpGrpNorm: -
trunk/GSASIIpwd.py
r3231 r3435 1023 1023 1024 1024 def getHKLpeak(dmin,SGData,A,Inst=None): 1025 'needs a doc string' 1025 ''' 1026 Generates allowed by symmetry reflections with d >= dmin 1027 NB: GenHKLf & checkMagextc return True for extinct reflections 1028 1029 :param dmin: minimum d-spacing 1030 :param SGData: space group data obtained from SpcGroup 1031 :param A: lattice parameter terms A1-A6 1032 :param Inst: instrument parameter info 1033 :returns: HKLs: list hkl, etc for allowed reflections 1034 1035 ''' 1026 1036 HKL = G2lat.GenHLaue(dmin,SGData,A) 1027 1037 HKLs = [] 1028 1038 for h,k,l,d in HKL: 1029 1039 ext = G2spc.GenHKLf([h,k,l],SGData)[0] 1040 if ext and 'MagSpGrp' in SGData: 1041 ext = G2spc.checkMagextc([h,k,l],SGData) 1030 1042 if not ext: 1031 1043 if Inst == None: -
trunk/GSASIIpwdGUI.py
r3420 r3435 2880 2880 def OnSpcSel(event): 2881 2881 controls[13] = spcSel.GetString(spcSel.GetSelection()) 2882 ssopt['SGData'] = G2spc.SpcGroup(controls[13])[1] 2882 2883 G2frame.dataWindow.RefineCell.Enable(True) 2883 2884 OnHklShow(event) … … 2965 2966 A = G2lat.cell2A(cell) 2966 2967 spc = controls[13] 2967 SGData = G2spc.SpcGroup(spc)[1]2968 SGData = ssopt.get('SGData',G2spc.SpcGroup(spc)[1]) 2968 2969 Symb = SGData['SpGrp'] 2969 2970 if ssopt.get('Use',False): … … 3265 3266 dlg.Destroy() 3266 3267 3268 def OnMagSel(event): 3269 Obj = event.GetEventObject() 3270 if Obj.GetValue(): 3271 SGData['SGSpin'] = [1,]*len(SGData['SGSpin']) 3272 GenSym,GenFlg,BNSsym = G2spc.GetGenSym(SGData) 3273 SGData['GenSym'] = GenSym 3274 SGData['GenFlg'] = GenFlg 3275 OprNames,SpnFlp = G2spc.GenMagOps(SGData) 3276 SGData['SpnFlp'] = SpnFlp 3277 SGData['MagSpGrp'] = G2spc.MagSGSym(SGData) 3278 else: 3279 del SGData['MagSpGrp'] 3280 OnHklShow(None) 3281 ssopt['SGData'] = SGData 3282 wx.CallAfter(UpdateUnitCellsGrid,G2frame,data) 3283 3267 3284 def OnSpinOp(event): 3268 3285 Obj = event.GetEventObject() … … 3320 3337 if len(controls) < 14: #add space group used in indexing 3321 3338 controls.append(spaceGroups[bravaisSymb.index(controls[5])]) 3322 SGData = G2spc.SpcGroup(controls[13])[1]3339 SGData = ssopt.get('SGData',G2spc.SpcGroup(controls[13])[1]) 3323 3340 G2frame.GPXtree.SetItemPyData(UnitCellsId,data) #update with volume 3324 3341 bravaisNames = ['Cubic-F','Cubic-I','Cubic-P','Trigonal-R','Trigonal/Hexagonal-P', … … 3415 3432 hklShow.Bind(wx.EVT_BUTTON,OnHklShow) 3416 3433 littleSizer.Add(hklShow,0,WACV) 3434 elif 'N' in Inst['Type'][0]: 3435 MagSel = wx.CheckBox(G2frame.dataWindow,label="Magnetic?") 3436 MagSel.SetValue('MagSpGrp' in SGData) 3437 MagSel.Bind(wx.EVT_CHECKBOX,OnMagSel) 3438 littleSizer.Add(MagSel,0,WACV) 3417 3439 mainSizer.Add(littleSizer,0) 3418 3440 mainSizer.Add((5,5),0) 3419 3441 if 'N' in Inst['Type'][0]: 3420 Indx = {}3421 GenSym,GenFlg,BNSsym = G2spc.GetGenSym(SGData)3422 SGData['GenSym'] = GenSym3423 SGData['SGGray'] = False3424 3442 neutSizer = wx.BoxSizer(wx.HORIZONTAL) 3425 neutSizer.Add(wx.StaticText(G2frame.dataWindow,label=' BNS lattice: '),0,WACV) 3426 BNS = wx.ComboBox(G2frame.dataWindow,value=SGData['BNSlattsym'][0], 3427 choices=[SGData['SGLatt'],]+list(BNSsym.keys()),style=wx.CB_READONLY|wx.CB_DROPDOWN) 3428 BNS.Bind(wx.EVT_COMBOBOX,OnBNSlatt) 3429 neutSizer.Add(BNS,0,WACV) 3430 spinColor = ['black','red'] 3431 spCode = {-1:'red',1:'black'} 3432 for isym,sym in enumerate(GenSym[1:]): 3433 neutSizer.Add(wx.StaticText(G2frame.dataWindow,label=' %s: '%(sym.strip())),0,WACV) 3434 spinOp = wx.ComboBox(G2frame.dataWindow,value=spCode[SGData['SGSpin'][isym+1]],choices=spinColor, 3435 style=wx.CB_READONLY|wx.CB_DROPDOWN) 3436 Indx[spinOp.GetId()] = isym 3437 spinOp.Bind(wx.EVT_COMBOBOX,OnSpinOp) 3438 neutSizer.Add(spinOp,0,WACV) 3439 OprNames,SpnFlp = G2spc.GenMagOps(SGData) 3440 SGData['SpnFlp'] = SpnFlp 3441 showSpins = wx.Button(G2frame.dataWindow,label=' Show spins?') 3442 showSpins.Bind(wx.EVT_BUTTON,OnShowSpins) 3443 neutSizer.Add(showSpins,0,WACV) 3443 if 'MagSpGrp' in SGData: 3444 Indx = {} 3445 GenSym,GenFlg,BNSsym = G2spc.GetGenSym(SGData) 3446 SGData['GenSym'] = GenSym 3447 SGData['SGGray'] = False 3448 neutSizer.Add(wx.StaticText(G2frame.dataWindow,label=' BNS lattice: '),0,WACV) 3449 BNS = wx.ComboBox(G2frame.dataWindow,value=SGData['BNSlattsym'][0], 3450 choices=[SGData['SGLatt'],]+list(BNSsym.keys()),style=wx.CB_READONLY|wx.CB_DROPDOWN) 3451 BNS.Bind(wx.EVT_COMBOBOX,OnBNSlatt) 3452 neutSizer.Add(BNS,0,WACV) 3453 spinColor = ['black','red'] 3454 spCode = {-1:'red',1:'black'} 3455 for isym,sym in enumerate(GenSym[1:]): 3456 neutSizer.Add(wx.StaticText(G2frame.dataWindow,label=' %s: '%(sym.strip())),0,WACV) 3457 spinOp = wx.ComboBox(G2frame.dataWindow,value=spCode[SGData['SGSpin'][isym+1]],choices=spinColor, 3458 style=wx.CB_READONLY|wx.CB_DROPDOWN) 3459 Indx[spinOp.GetId()] = isym 3460 spinOp.Bind(wx.EVT_COMBOBOX,OnSpinOp) 3461 neutSizer.Add(spinOp,0,WACV) 3462 OprNames,SpnFlp = G2spc.GenMagOps(SGData) 3463 SGData['SpnFlp'] = SpnFlp 3464 showSpins = wx.Button(G2frame.dataWindow,label=' Show spins?') 3465 showSpins.Bind(wx.EVT_BUTTON,OnShowSpins) 3466 neutSizer.Add(showSpins,0,WACV) 3444 3467 hklShow = wx.Button(G2frame.dataWindow,label="Show hkl positions") 3445 3468 hklShow.Bind(wx.EVT_BUTTON,OnHklShow) -
trunk/GSASIIspc.py
r3434 r3435 1960 1960 def checkHKLextc(HKL,SGData): 1961 1961 ''' 1962 Checks if reflection extinct 1962 Checks if reflection extinct - does not check centering 1963 1963 1964 1964 :param HKL: [h,k,l] 1965 1965 :param SGData: space group data obtained from SpcGroup 1966 :returns: False if extinct; True if allowed1966 :returns: True if extinct; False if allowed 1967 1967 1968 1968 ''' … … 1978 1978 else: 1979 1979 if phkl%1.: 1980 return False1981 return True1980 return True 1981 return False 1982 1982 1983 1983 def checkMagextc(HKL,SGData): 1984 1984 ''' 1985 Checks if reflection magnetically extinct; 1985 Checks if reflection magnetically extinct; does fullcheck (centering, too) 1986 1986 uses algorthm from Gallego, et al., J. Appl. Cryst. 45, 1236-1247 (2012) 1987 1987 1988 1988 :param HKL: [h,k,l] 1989 1989 :param SGData: space group data obtained from SpcGroup; must have magnetic symmetry SpnFlp data 1990 :returns: False if magnetically extinct; True if allowed1990 :returns: True if magnetically extinct; False if allowed (to match GenHKLf) 1991 1991 1992 1992 ''' … … 1995 1995 OpM = np.array([op[0] for op in Ops]) 1996 1996 OpT = np.array([op[1] for op in Ops]) 1997 if SGData['SGInv'] :1997 if SGData['SGInv'] and not SGData['SGFixed']: 1998 1998 OpM = np.vstack((OpM,-OpM)) 1999 1999 OpT = np.vstack((OpT,-OpT))%1. … … 2017 2017 Psum += pterm 2018 2018 if nsum/nA > 1.: #only need to look at nA=1 frok eq(8) 2019 return False 2020 if np.allclose(Psum,np.zeros(3)): 2019 2021 return True 2020 if np.allclose(Psum,np.zeros(3)):2021 return False2022 2022 else: 2023 2023 if np.inner(HKL,Psum): 2024 return False2025 return True2024 return True 2025 return False 2026 2026 2027 2027 def checkSSextc(HKL,SSGData):
Note: See TracChangeset
for help on using the changeset viewer.