Changeset 1530
- Timestamp:
- Oct 21, 2014 8:20:34 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r1529 r1530 129 129 generalData['AtomPtrs'] = [6,4,10,12] 130 130 if generalData['Type'] in ['modulated','magnetic',] and 'Super' not in generalData: 131 generalData['SuperSg'] = '(abg)'132 131 generalData['Super'] = 1 133 132 generalData['SuperVec'] = [[[0,0,.1],False,4],[[0,0,.1],False,4],[[0.,0.,.1],False,4]] … … 203 202 # UpdateGeneral execution continues below 204 203 205 def NameSizer(): 204 def NameSizer(): 205 206 def SetDefaultSSsymbol(): 207 if generalData['SGData']['SGLaue'] in '-1': 208 return '(abg)' 209 elif generalData['SGData']['SGLaue'] in ['2/m']: 210 if generalData['SGData']['SGUniq'] == 'a': 211 return '(a00)' 212 elif generalData['SGData']['SGUniq'] == 'b': 213 return '(0b0)' 214 elif generalData['SGData']['SGUniq'] == 'c': 215 return '(00g)' 216 else: 217 return '(00g)' 218 206 219 def OnPhaseName(event): 207 220 oldName = generalData['Name'] … … 215 228 if not len(generalData['AtomTypes']): #can change only if no atoms! 216 229 generalData['Type'] = TypeTxt.GetValue() 230 if generalData['Type'] in ['modulated',]: 231 generalData['SuperSg'] = SetDefaultSSsymbol() 217 232 wx.CallAfter(UpdateGeneral) 218 233 else: … … 234 249 msg = 'Space Group Error' 235 250 Style = wx.ICON_EXCLAMATION 251 Text = '\n'.join(text) 252 wx.MessageBox(Text,caption=msg,style=Style) 236 253 else: 237 254 text,table = G2spc.SGPrint(SGData) 238 255 generalData['SGData'] = SGData 239 256 msg = 'Space Group Information' 240 Style = wx.ICON_INFORMATION 241 G2gd.SGMessageBox(General,msg,text,table).Show() 257 G2gd.SGMessageBox(General,msg,text,table).Show() 258 if generalData['Type'] in ['modulated',]: 259 generalData['SuperSg'] = SetDefaultSSsymbol() 242 260 wx.CallAfter(UpdateGeneral) 243 261 … … 513 531 SSymbol = superGp.GetValue() 514 532 E,SSGData = G2spc.SSpcGroup(generalData['SGData'],SSymbol) 515 if E: 533 if SSGData: 534 Vec = generalData['SuperVec'][0][0] #(3+1) only 535 generalData['SuperVec'][0][0] = G2spc.SSGModCheck(Vec,SSGData) 536 text,table = G2spc.SSGPrint(generalData['SGData'],SSGData) 537 generalData['SSGData'] = SSGData 538 generalData['SuperSg'] = SSymbol 539 msg = 'Superspace Group Information' 540 G2gd.SGMessageBox(General,msg,text,table).Show() 541 else: 516 542 text = [E+'\nSuperspace Group set to previous'] 517 543 superGp.SetValue(generalData['SuperSg']) 518 544 msg = 'Superspace Group Error' 519 545 Style = wx.ICON_EXCLAMATION 520 else: 521 Vec = generalData['SuperVec'][0][0] #(3+1) only 522 Vec = G2spc.SSGModCheck(Vec,SSGData) 523 generalData['SuperVec'][0][0] = Vec 524 text,table = G2spc.SSGPrint(generalData['SGData'],SSGData) 525 generalData['SSGData'] = SSGData 526 generalData['SuperSg'] = SSymbol 527 msg = 'Superspace Group Information' 528 Style = wx.ICON_INFORMATION 529 G2gd.SGMessageBox(General,msg,text,table).Show() 546 Text = '\n'.join(text) 547 wx.MessageBox(Text,caption=msg,style=Style) 530 548 wx.CallAfter(UpdateGeneral) 531 549 -
trunk/GSASIIspc.py
r1529 r1530 298 298 SGText.append(' The lattice is '+CentStr+' '+'primitive '+SGData['SGSys'].lower()) 299 299 SGText.append(' The Laue symmetry is '+SGData['SGLaue']) 300 SGText.append(' The lattice point group is '+SGData['SGPtGrp']) 300 if 'SGPtGrp' in SGData: #patch 301 SGText.append(' The lattice point group is '+SGData['SGPtGrp']) 301 302 SGText.append(' Multiplicity of a general site is '+str(Mult)) 302 303 if SGData['SGUniq'] in ['a','b','c']: … … 305 306 SGText.append(' The inversion center is located at 0,0,0') 306 307 if SGData['SGPolax']: 307 SGText.append(' The location of the origin is arbitrary in '+SGData['SGPolax']+'\n') 308 SGText.append(' The location of the origin is arbitrary in '+SGData['SGPolax']) 309 SGText.append(' ') 308 310 if SGData['SGLatt'] == 'P': 309 311 SGText.append(' The equivalent positions are:\n') … … 312 314 SGText.append(' ('+Latt2text(SGData['SGLatt'])+')+\n') 313 315 SGTable = [] 314 for i, [M,T]in enumerate(SGData['SGOps']):315 SGTable.append('(%2d) %s'%(i+1,MT2text( M,T)))316 for i,Opr in enumerate(SGData['SGOps']): 317 SGTable.append('(%2d) %s'%(i+1,MT2text(Opr))) 316 318 return SGText,SGTable 317 319 … … 359 361 Tprime[i] += -1 360 362 offset[i] += -1 361 OPtxt = MT2text(mult*M,Tprime) 363 Opr = [mult*M,Tprime] 364 OPtxt = MT2text(Opr) 362 365 SGTextList.append(OPtxt.replace(' ','')) 363 366 offsetList.append(tuple(offset)) … … 366 369 return SGTextList,offsetList,symOpList,G2oprList 367 370 368 def MT2text( M,T):371 def MT2text(Opr): 369 372 "From space group matrix/translation operator returns text version" 370 373 XYZ = ('-Z','-Y','-X','X-Y','ERR','Y-X','X','Y','Z') 371 374 TRA = (' ','ERR','1/6','1/4','1/3','ERR','1/2','ERR','2/3','3/4','5/6','ERR') 372 375 Fld = '' 376 M,T = Opr 373 377 for j in range(3): 374 378 IJ = int(round(2*M[j][0]+3*M[j][1]+4*M[j][2]+4))%12 … … 544 548 SSGOps = SSGData['SSGOps'] 545 549 SSGKl = SGData['SSGKl'] 550 print 'genQ',genQ 551 print 'SSGKl',SSGKl 546 552 iFrac = {} 547 553 for i,frac in enumerate(SSGData['modSymb']): 548 554 if frac in ['1/2','1/3','1/4','1/6','1']: 549 555 iFrac[i] = frac 550 # set identity & 1,-1 556 # set identity & 1,-1; triclinic 551 557 SSGOps[0][0][3,3] = 1. 552 558 # monoclinic 553 559 if SGData['SGPtGrp'] in ['2','m']: #OK 554 560 SSGOps[1][0][3,3] = SSGKl[0] 561 SSGOps[1][1][3] = genQ[0] 555 562 for i in iFrac: 556 563 if SGData['SGPtGrp'] == '2': … … 558 565 else: 559 566 SSGOps[1][0][3,i] = -1 567 if genQ: 568 SSGOps[1][0][3,i] *= -1 560 569 elif SGData['SGPtGrp'] == '2/m': #OK 561 570 SSGOps[1][0][3,3] = SSGKl[1] … … 568 577 SSGOps[3][0][3,3] = SSGKl[2] 569 578 # tetragonal 570 elif SGData['SGPtGrp'] in ['4','-4',]: 579 elif SGData['SGPtGrp'] == '4': #OK 580 SSGOps[1][0][3,3] = SSGKl[0] 581 SSGOps[1][1][3] = genQ[0] 582 if '1/2' in SSGData['modSymb']: 583 SSGOps[1][0][3,1] = -1 584 elif SGData['SGPtGrp'] == '-4': #OK 571 585 SSGOps[1][0][3,3] = SSGKl[0] 572 586 if '1/2' in SSGData['modSymb']: 573 if SGData['SGPtGrp'] == '-4': 574 SSGOps[1][0][3,1] = 1 575 else: 576 SSGOps[1][0][3,1] = -1 587 SSGOps[1][0][3,1] = 1 577 588 elif SGData['SGPtGrp'] in ['4/m',]: 578 SSGOps[1][0][3,3] = SSGKl[1] 589 SSGOps[1][0][3,3] = -SSGKl[1] 590 SSGOps[1][1][3] = genQ[0] 579 591 if '1/2' in SSGData['modSymb']: 580 SSGOps[1][0][3,3] *= -1581 592 SSGOps[1][0][3,1] = -1 582 593 elif SGData['SGPtGrp'] in ['422','4mm','-42m','-4m2',]: … … 587 598 SSGOps[1][0][3,3] *= -1 588 599 SSGOps[1][0][3,1] = -1 600 SSGOps[2][0][3,3] = SSGKl[1] 601 SSGOps[3][0][3,3] = SSGKl[2] 602 SSGOps[4][0][3,3] = SSGKl[3] 589 603 # trigonal 590 elif SGData['SGPtGrp'] in ['3','-3',]:604 elif SGData['SGPtGrp'] == '3': 591 605 SSGOps[1][0][3,3] = SSGKl[0] 592 if '1/2' in SSGData['modSymb']: 593 if SGData['SGPtGrp'] == '-6': 594 SSGOps[1][0][3,1] = 1 595 else: 596 SSGOps[1][0][3,1] = -1 606 SSGOps[1][1][3] = genQ[0] 607 elif SGData['SGPtGrp'] == '-3': 608 SSGOps[1][0][3,3] = -SSGKl[0] 597 609 elif SGData['SGPtGrp'] in ['32','3m','-3m',]: 598 610 SSGOps[1][0][3,3] = SSGKl[1] 599 611 elif SGData['SGPtGrp'] in ['312','321','3m1','31m','-3m1','-31m',]: 600 pass612 SSGOps[1][0][3,3] = SSGKl[0] 601 613 # hexagonal 602 elif SGData['SGPtGrp'] in ['6','-6',]:614 elif SGData['SGPtGrp'] == '6': #OK 603 615 SSGOps[1][0][3,3] = SSGKl[0] 604 elif SGData['SGPtGrp'] in ['6/m',]: 605 SSGOps[1][0][3,3] = SSGKl[1] 616 SSGOps[1][1][3] = genQ[0] 617 elif SGData['SGPtGrp'] == '-6': #OK 618 SSGOps[1][0][3,3] = SSGKl[0] 619 elif SGData['SGPtGrp'] in ['6/m',]: #OK 620 SSGOps[1][0][3,3] = -SSGKl[1] 621 SSGOps[1][1][3] = genQ[0] 622 SSGOps[2][1][3] = genQ[1] 606 623 elif SGData['SGPtGrp'] in ['622','6mm','-62m','-62',]: 607 pass 624 SSGOps[1][0][3,3] = SSGKl[0] 625 SSGOps[2][0][3,3] = -SSGKl[1] 626 SSGOps[3][0][3,3] = -SSGKl[2] 608 627 elif SGData['SGPtGrp'] in ['6/mmm',]: 609 pass 610 628 SSGOps[1][0][3,3] = SSGKl[0] 629 if genQ[0]: 630 SSGOps[1][0][3,3] = -SSGKl[0] 631 SSGOps[1][1][3] = genQ[0] 632 SSGOps[3][0][3,3] = -SSGKl[1] 633 if genQ[1]: 634 SSGOps[3][0][3,3] = SSGKl[1] 635 SSGOps[3][1][3] = genQ[1] 636 SSGOps[10][0][3,3] = SSGKl[2] 637 if genQ[2]: 638 SSGOps[10][0][3,3] = -SSGKl[2] 639 SSGOps[10][1][3] = genQ[2] 640 SSGOps[11][0][3,3] = SSGKl[3] 641 if genQ[3]: 642 SSGOps[11][0][3,3] = -SSGKl[3] 643 SSGOps[11][1][3] = genQ[3] 611 644 if SGData['SGInv']: 612 645 SSGfull = SSGOps[:] … … 624 657 for k in range(nOps): 625 658 OpD = SSGOps[k] 626 if np.allclose(OpC[0],OpD[0]) and np.allclose(OpC[1],OpD[1]):659 if SSMT2text(OpC) == SSMT2text(OpD): 627 660 continue 628 661 elif np.allclose(OpC[0][:3,:3],OpD[0][:3,:3]): 629 if np.allclose(OpD[0][3],np.zeros(4)): 662 if np.any([np.allclose(OpC[0][3][:3],cen) for cen in SGData['SGCen']]): 663 # if np.allclose(OpC[0][3],np.zeros(4)): 664 continue 665 elif np.allclose(OpD[0][3],np.zeros(4)): 630 666 SSGOps[k] = OpC 631 667 else: 668 print 'OpC',SSMT2text(OpC),'OpD',SSMT2text(OpD) 632 669 return False,None 633 670 return True,SSGOps 634 671 635 def getTau(genQ): 636 print 'genQ',genQ 637 return genQ 672 def getTau(): 673 if not genQ: 674 return [0,0,0,0] 675 newQ = genQ 676 if SGData['SGPtGrp'] in ['2/m']: #OK 677 newQ = [0.5,] 678 return newQ 638 679 639 680 LaueModList = ['abg', 'ab0', 'ab1/2', 'a0g', 'a1/2g','0bg', '1/2bg', … … 656 697 if ''.join(gensym) not in GenSymList: 657 698 return 'unknown generator symbol '+''.join(gensym),None 658 LaueModId = LaueModList.index(''.join(modsym)) 699 try: 700 LaueModId = LaueModList.index(''.join(modsym)) 701 except ValueError: 702 return 'Unknown modulation symbol '+''.join(modsym),None 659 703 if not checkModSym(): 660 704 return 'Modulation '+''.join(modsym)+' not consistent with space group '+SGData['SpGrp'],None … … 665 709 if len(gensym) and len(gensym) != len(SGData['SSGKl']): 666 710 return 'Wrong number of items in generator symbol '+''.join(gensym),None 667 genQ = getTau( genQ)711 genQ = getTau() 668 712 SSGData = {'SSpGrp':SGData['SpGrp']+SSymbol,'modQ':modQ,'modSymb':modsym} 669 713 SSCen = np.ones((len(SGData['SGCen']),4))*0.5 … … 695 739 SGTable - list of strings for each of the operations 696 740 ''' 697 Mult = len(SSGData['SSGCen'])*len(SSGData['SSGOps']) *(int(SGData['SGInv'])+1)741 Mult = len(SSGData['SSGCen'])*len(SSGData['SSGOps']) 698 742 SSGText = [] 699 743 SSGText.append(' Superspace Group: '+SSGData['SSpGrp']) … … 707 751 SSGText.append(' The Laue symmetry is '+SGData['SGLaue']) 708 752 SSGText.append(' The superlattice point group is '+SGData['SGPtGrp']+','+''.join([str(i) for i in SGData['SSGKl']])) 709 SSGText.append(' The number of super 753 SSGText.append(' The number of superspace group generators is '+str(len(SGData['SSGKl']))) 710 754 SSGText.append(' Multiplicity of a general site is '+str(Mult)) 711 755 if SGData['SGUniq'] in ['a','b','c']: … … 715 759 if SGData['SGPolax']: 716 760 SSGText.append(' The location of the origin is arbitrary in '+SGData['SGPolax']) 761 SSGText.append(' ') 717 762 if len(SSGData['SSGCen']) > 1: 718 763 SSGText.append(' The equivalent positions are:') 719 SSGText.append(' \n('+SSLatt2text(SSGData['SSGCen'])+')+\n')764 SSGText.append(' ('+SSLatt2text(SSGData['SSGCen'])+')+\n') 720 765 else: 721 766 SSGText.append(' The equivalent positions are:\n') 722 767 SSGTable = [] 723 for i, [M,T]in enumerate(SSGData['SSGOps']):724 SSGTable.append('(%2d) %s'%(i+1,SSMT2text( M,T)))768 for i,Opr in enumerate(SSGData['SSGOps']): 769 SSGTable.append('(%2d) %s'%(i+1,SSMT2text(Opr))) 725 770 return SSGText,SSGTable 726 771 … … 734 779 return [Q if mod not in ['a','b','g'] and vec != Q else vec for [vec,mod,Q] in zip(Vec,modSymb,modQ)] 735 780 736 def SSMT2text( M,T):781 def SSMT2text(Opr): 737 782 "From superspace group matrix/translation operator returns text version" 738 XYZS = (' X','Y','Z','S')783 XYZS = ('x','y','z','t') #Stokes, Campbell & van Smaalen notation 739 784 TRA = (' ','ERR','1/6','1/4','1/3','ERR','1/2','ERR','2/3','3/4','5/6','ERR') 740 785 Fld = '' 786 M,T = Opr 741 787 for j in range(4): 742 788 IJ = ''
Note: See TracChangeset
for help on using the changeset viewer.