Changeset 1533
 Timestamp:
 Oct 22, 2014 4:33:10 PM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIspc.py
r1531 r1533 510 510 if SGData['SGPtGrp'] in ['2','m']: #OK 511 511 if mod in ['a00','0b0','00g']: 512 re turn[i*1 for i in SGData['SSGKl']]512 result = [i*1 for i in SGData['SSGKl']] 513 513 else: 514 return SGData['SSGKl'] 514 result = SGData['SSGKl'][:] 515 if '/' in mod: 516 return [i*1 for i in result] 517 else: 518 return result 515 519 elif SGData['SGPtGrp'] == '2/m': #OK 516 520 if mod in ['a00','0b0','00g']: 517 re turnSGData['SSGKl'][:]521 result = SGData['SSGKl'][:] 518 522 else: 519 return [i*1 for i in SGData['SSGKl']] 523 result = [i*1 for i in SGData['SSGKl']] 524 if '/' in mod: 525 return [i*1 for i in result] 526 else: 527 return result 520 528 else: #orthorhombic 521 529 if SGData['SGPtGrp'] == '222': … … 545 553 return [1 if i in ['a','b','g'] else 1 for i in mod] 546 554 555 def extendSSGOps(SSGOps): 556 nOps = len(SSGOps) 557 for i in range(nOps): 558 if np.allclose(SSGOps[i][0][3],np.zeros(4)): 559 continue 560 for j in range(nOps): 561 if np.allclose(SSGOps[j][0][3],np.zeros(4)): 562 continue 563 OpC = list(SGProd(SSGOps[j],SSGOps[i])) 564 OpC[1] %= 1. 565 for k in range(nOps): 566 OpD = SSGOps[k] 567 if SSMT2text(OpC) == SSMT2text(OpD): 568 continue 569 elif np.allclose(OpC[0][:3,:3],OpD[0][:3,:3]): 570 if np.allclose(OpD[0][3],np.zeros(4)): 571 SSGOps[k] = OpC 572 elif np.any([np.allclose(OpC[0][3][:3],cen) for cen in SGData['SGCen']]): #? 573 continue 574 else: 575 OpCtxt = SSMT2text(OpC).replace(' ','') 576 OpDtxt = SSMT2text(OpD).replace(' ','') 577 print 'OpC',OpCtxt,'OpD',OpDtxt 578 return False,OpCtxt+' conflict with '+OpDtxt 579 return True,SSGOps 580 581 547 582 def genSSGOps(): 548 SSGOps = SSGData['SSGOps'] 583 SSGOps = SSGData['SSGOps'][:] 549 584 iFrac = {} 550 585 for i,frac in enumerate(SSGData['modSymb']): 551 586 if frac in ['1/2','1/3','1/4','1/6','1']: 552 587 iFrac[i] = frac 553 print S Symbol588 print SGData['SpGrp']+SSymbol 554 589 print 'SSGKl',SSGKl,'genQ',genQ,'iFrac',iFrac 555 590 # set identity & 1,1; triclinic … … 557 592 # expand if centrosymmetric 558 593 if SGData['SGInv']: 559 SSGOps = SSGOps[:] + [[1*M,V] for M,V in SSGOps]594 SSGOps += [[1*M,V] for M,V in SSGOps[:]] 560 595 # monoclinic 561 596 if SGData['SGPtGrp'] in ['2','m']: #OK … … 563 598 SSGOps[1][1][3] = genQ[0] 564 599 for i in iFrac: 565 if SGData['SGPtGrp'] == '2': 566 SSGOps[1][0][3,i] = 1 567 else: 568 SSGOps[1][0][3,i] = 1 569 if genQ: 570 SSGOps[1][0][3,i] *= 1 571 elif SGData['SGPtGrp'] == '2/m': #OK 572 SSGOps[1][0][3,3] = SSGKl[0] 573 SSGOps[3][0][3,3] = SSGKl[1] 600 SSGOps[1][0][3,i] = SSGKl[0] 601 elif SGData['SGPtGrp'] == '2/m': 602 for i,j in enumerate([1,3]): 603 SSGOps[j][0][3,3] = SSGKl[i] 604 if genQ[i]: 605 SSGOps[j][1][3] = genQ[i] 606 for k in iFrac: 607 SSGOps[j][0][3,k] = SSGKl[i] 608 E,SSGOps = extendSSGOps(SSGOps) 609 print E,SSMT2text(SSGOps[1]).replace(' ',''),SSMT2text(SSGOps[3]).replace(' ','') 610 611 # orthorhombic 612 elif SGData['SGPtGrp'] in ['222','mm2','m2m','2mm','mmm']: 613 for i in [0,1,2]: 614 SSGOps[i+1][0][3,3] = SSGKl[i] 615 SSGOps[i+1][1][3] = genQ[i] 574 616 for i in iFrac: 575 617 SSGOps[1][0][3,i] = 1 576 # orthorhombic 577 elif SGData['SGPtGrp'] in ['222','mm2','m2m','2mm','mmm']: 578 SSGOps[1][0][3,3] = SSGKl[0] 579 SSGOps[2][0][3,3] = SSGKl[1] 580 SSGOps[3][0][3,3] = SSGKl[2] 618 print SSMT2text(SSGOps[1]).replace(' ',''),SSMT2text(SSGOps[2]).replace(' ',''), \ 619 SSMT2text(SSGOps[3]).replace(' ','') 581 620 # tetragonal 582 621 elif SGData['SGPtGrp'] == '4': #OK … … 596 635 SSGOps[1][0][3,1] = 1 597 636 elif SGData['SGPtGrp'] in ['422','4mm','42m','4m2',]: 598 SSGOps[1][0][3,3] = SSGKl[1] 637 for i,j in enumerate([1,4,5]): 638 SSGOps[j][0][3,3] = SSGKl[i] 639 if genQ[i]: 640 SSGOps[j][1][3] = genQ[i] 641 E,SSGOps = extendSSGOps(SSGOps) 599 642 elif SGData['SGPtGrp'] in ['4/mmm',]: 600 643 SSGOps[1][0][3,3] = SSGKl[1] … … 625 668 SSGOps[1][1][3] = genQ[0] 626 669 SSGOps[2][1][3] = genQ[1] 627 elif SGData['SGPtGrp'] in ['622','6mm','62m','62',]: 628 SSGOps[1][0][3,3] = SSGKl[0] 629 SSGOps[2][0][3,3] = SSGKl[1] 630 SSGOps[3][0][3,3] = SSGKl[2] 631 elif SGData['SGPtGrp'] in ['6/mmm',]: 632 SSGOps[1][0][3,3] = SSGKl[0] 633 if genQ[0]: 634 SSGOps[1][0][3,3] = SSGKl[0] 635 SSGOps[1][1][3] = genQ[0] 636 SSGOps[3][0][3,3] = SSGKl[1] 637 if genQ[1]: 638 SSGOps[3][0][3,3] = SSGKl[1] 639 SSGOps[3][1][3] = genQ[1] 640 SSGOps[10][0][3,3] = SSGKl[2] 641 if genQ[2]: 642 SSGOps[10][0][3,3] = SSGKl[2] 643 SSGOps[10][1][3] = genQ[2] 644 SSGOps[11][0][3,3] = SSGKl[3] 645 if genQ[3]: 646 SSGOps[11][0][3,3] = SSGKl[3] 647 SSGOps[11][1][3] = genQ[3] 670 elif SGData['SGPtGrp'] in ['622','6mm','62m','6m2',]: #OK 671 for i,j in enumerate([1,10,11]): 672 SSGOps[j][0][3,3] = SSGKl[i] 673 if genQ[i]: 674 SSGOps[j][1][3] = genQ[i] 675 E,SSGOps = extendSSGOps(SSGOps) 676 elif SGData['SGPtGrp'] in ['6/mmm',]: #not OK 677 for i,j in enumerate([1,15,19,11]): 678 SSGOps[j][0][3,3] = SSGKl[i] 679 if genQ[i]: 680 SSGOps[j][1][3] = genQ[i] 681 E,SSGOps = extendSSGOps(SSGOps) 648 682 if SGData['SGPtGrp'] in ['1','1']: #triclinic  done 649 683 return True,SSGOps 650 nOps = len(SSGOps) 651 for i in range(nOps): 652 for j in range(nOps): 653 OpC = list(SGProd(SSGOps[j],SSGOps[i])) 654 OpC[1] %= 1. 655 for k in range(nOps): 656 OpD = SSGOps[k] 657 if SSMT2text(OpC) == SSMT2text(OpD): 658 continue 659 elif np.allclose(OpC[0][:3,:3],OpD[0][:3,:3]): 660 if np.allclose(OpD[0][3],np.zeros(4)): 661 SSGOps[k] = OpC 662 elif np.any([np.allclose(OpC[0][3][:3],cen) for cen in SGData['SGCen']]): #? 663 continue 664 else: 665 OpCtxt = SSMT2text(OpC).strip() 666 OpDtxt = SSMT2text(OpD).strip() 667 print 'OpC',OpCtxt,'OpD',OpDtxt 668 return False,OpCtxt+' conflict with '+OpDtxt 669 return True,SSGOps 684 E,SSGOps = extendSSGOps(SSGOps) 685 return E,SSGOps 686 687 def specialGen(gensym): 688 sym = ''.join(gensym) 689 if SGData['SGPtGrp'] in ['62m',] and sym == '00s': 690 gensym = '0ss' 691 return gensym 670 692 671 def getTau(): 672 if not genQ: 673 return [0,0,0,0] 674 newQ = genQ 675 if SGData['SGPtGrp'] in ['2/m']: #OK 676 newQ = [0.5,] 677 return newQ 693 def checkGen(gensym): 694 sym = ''.join(gensym) 695 # monoclinic  all done 696 if str(SSGKl) == '[1]' and sym == 's': 697 return False 698 elif str(SSGKl) == '[1, 1]' and sym == 's0': 699 return False 700 elif str(SSGKl) == '[1, 1]' and sym == '0s': 701 return False 702 #orthorhombic  all 703 elif SGData['SGPtGrp'] in ['222',] and sym not in ['','s00','0s0','00s']: 704 return False 705 elif SGData['SGPtGrp'] in ['2mm','m2m','mm2','mmm'] and sym not in GenSymList[4:15]: 706 return False 707 #tetragonal  all done 708 elif SGData['SGPtGrp'] in ['4',] and sym not in ['','s','q']: 709 return False 710 elif SGData['SGPtGrp'] in ['4',] and sym not in ['',]: 711 return False 712 elif SGData['SGPtGrp'] in ['4/m',] and sym not in ['','s0','q0']: 713 return False 714 elif SGData['SGPtGrp'] in ['422',] and sym not in ['','q00','s00']: 715 return False 716 elif SGData['SGPtGrp'] in ['4mm',] and sym not in ['','ss0','s0s','0ss','qq0','qqs']: 717 return False 718 elif SGData['SGPtGrp'] in ['4m2',] and sym not in ['','00s','00q']: 719 return False 720 elif SGData['SGPtGrp'] in ['42m',] and sym not in ['','0s0','0q0']: 721 return False 722 elif SGData['SGPtGrp'] in ['4/mmm',] and sym not in ['','s00s','s0s0','00ss','q0q0','q0qs']: 723 return False 724 #trigonal/rhombohedral  all done 725 elif SGData['SGPtGrp'] in ['3',] and sym not in ['','t']: 726 return False 727 elif SGData['SGPtGrp'] in ['3',] and sym not in ['',]: 728 return False 729 elif SGData['SGPtGrp'] in ['32',] and sym not in ['','t0']: 730 return False 731 elif SGData['SGPtGrp'] in ['321',] and sym not in ['','t00']: 732 return False 733 elif SGData['SGPtGrp'] in ['312',] and sym not in ['',]: 734 return False 735 elif SGData['SGPtGrp'] in ['3m','3m'] and sym not in ['','0s']: 736 return False 737 elif SGData['SGPtGrp'] in ['3m1','3m1'] and sym not in ['','0s0']: 738 return False 739 elif SGData['SGPtGrp'] in ['31m','31m'] and sym not in ['','00s']: 740 return False 741 #hexagonal  all done 742 elif SGData['SGPtGrp'] in ['6',] and sym not in ['','s','h','t']: 743 return False 744 elif SGData['SGPtGrp'] in ['6',] and sym not in ['',]: 745 return False 746 elif SGData['SGPtGrp'] in ['6/m',] and sym not in ['','s0']: 747 return False 748 elif SGData['SGPtGrp'] in ['622',] and sym not in ['','h00','t00','s00']: 749 return False 750 elif SGData['SGPtGrp'] in ['6mm',] and sym not in ['','ss0','s0s','0ss']: 751 return False 752 elif SGData['SGPtGrp'] in ['6m2',] and sym not in ['','0s0']: 753 return False 754 elif SGData['SGPtGrp'] in ['62m',] and sym not in ['','0ss']: 755 return False 756 elif SGData['SGPtGrp'] in ['6/mmm',] and sym not in ['','s00s','s0s0','00ss']: 757 return False 758 return True 678 759 679 760 LaueModList = ['abg', 'ab0', 'ab1/2', 'a0g', 'a1/2g','0bg', '1/2bg', … … 706 787 if SGData['SGLaue'] in ['2/m','mmm']: 707 788 SSGKl = fixMonoOrtho() 708 genQ = [Fracs[mod] for mod in gensym]709 789 if len(gensym) and len(gensym) != len(SSGKl): 710 790 return 'Wrong number of items in generator symbol '+''.join(gensym),None 711 genQ = getTau() 791 gensym = specialGen(gensym) 792 if not checkGen(gensym): 793 return 'Generator '+''.join(gensym)+' not consistent with space group '+SGData['SpGrp'],None 794 genQ = [Fracs[mod] for mod in gensym] 795 if not genQ: 796 genQ = [0,0,0,0] 712 797 SSGData = {'SSpGrp':SGData['SpGrp']+SSymbol,'modQ':modQ,'modSymb':modsym} 713 798 SSCen = np.ones((len(SGData['SGCen']),4))*0.5 … … 796 881 IK = int(round(T[j]*12))%12 797 882 if IK: 883 if not IJ: 884 break 798 885 if IJ[0] == '': 799 886 Fld += (TRA[IK]+IJ).rjust(8)
Note: See TracChangeset
for help on using the changeset viewer.