Changeset 3300 for trunk/GSASIIspc.py
 Timestamp:
 Mar 1, 2018 2:30:45 PM (5 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIspc.py
r3297 r3300 113 113 lattSpin += [1,1,1,1] 114 114 elif SGData['SGLatt'] == 'R': 115 SGData['SGCen'] = np.array(([0,0,0],[1./3.,2./3.,2./3.],[2./3.,1./3.,1./3.])) 116 lattSpin += [1,1,] 117 118 # if SGData['SGLaue'] == '2/m' and SGData['SGLatt'] != 'P' and '/' in SGData['SpGrp']: 119 # SGData['SGSpin'].append(1) #fix bug in fortran 120 # if 'F' in SGData['SpGrp']: 121 # SGData['SGSpin'] += [1,1,1,1] 122 # elif 'R' in SGData['SpGrp']: 123 # SGData['SGSpin'] += [1,1,1] 124 # elif SGData['SpGrp'][0] in ['A','B','C','I']: 125 # SGData['SGSpin'] += [1,] 115 SGData['SGCen'] = np.array(([0,0,0],[2./3,1./3,1./3],[1./3,2./3,2./3])) 126 116 127 117 if SGData['SGInv']: … … 207 197 208 198 if SGData['SGLatt'] == 'R': 209 if SGData['SGPtGrp'] in ['3']: 199 if SGData['SGPtGrp'] in ['3',]: 200 SGData['SGSpin'] = 4*[1,] 201 elif SGData['SGPtGrp'] in ['3','32','3m']: 202 SGData['SGSpin'] = 5*[1,] 203 elif SGData['SGPtGrp'] in ['3m',]: 204 SGData['SGSpin'] = 6*[1,] 205 206 else: 207 if SGData['SGPtGrp'] in ['1','3','23',]: 210 208 SGData['SGSpin'] = lattSpin+[1,] 211 else: 209 elif SGData['SGPtGrp'] in ['1','2','m','4','4','3','312','321','3m1','31m','6','6','432','43m','m3']: 210 SGData['SGSpin'] = lattSpin+[1,1,] 211 elif SGData['SGPtGrp'] in ['2/m','4/m','422','4mm','42m','4m2','3m1','31m', 212 '6/m','622','6mm','6m2','62m','m3m']: 212 213 SGData['SGSpin'] = lattSpin+[1,1,1,] 214 else: #'222''mmm','4/mmm','6/mmm' 215 SGData['SGSpin'] = lattSpin+[1,1,1,1,] 213 216 214 215 else:216 if SGData['SGPtGrp'] in ['1','3']:217 SGData['SGSpin'] = lattSpin218 elif SGData['SGPtGrp'] in ['1','2','m','4','4','3','312','321','3m1','31m','6','6','432','43m',]:219 SGData['SGSpin'] = lattSpin+[1,]220 elif SGData['SGPtGrp'] in ['2/m','4/m','422','4mm','42m','4m2','3m1','31m',221 '6/m','622','6mm','6m2','62m',]:222 SGData['SGSpin'] = lattSpin+[1,1,]223 elif SGData['SGPtGrp'] in ['3',]:224 SGData['SGSpin'] = lattSpin+[1,1,1,1,]225 else: #'222''mmm','4/mmm','6/mmm'226 SGData['SGSpin'] = lattSpin+[1,1,1,]227 217 228 218 return SGInfo[1],SGData … … 578 568 Nsyms = len(SGData['SGOps']) 579 569 if SGData['SGInv']: Nsyms *= 2 580 UsymOp = [ ]581 OprFlg = [ ]570 UsymOp = ['1',] 571 OprFlg = [0,] 582 572 if Nsyms == 2: #Centric triclinic or acentric monoclinic 583 573 UsymOp.append(OprNames[1]) … … 701 691 if 'P' in SGData['SGLatt']: 702 692 if SGData['SGSys'] == 'triclinic': 703 BNSsym = {'P ':[0,0,0],'P(a)':[.5,0,0],'P(b)':[0,.5,0],'P(c)':[0,0,.5]}693 BNSsym = {'P(a)':[.5,0,0],'P(b)':[0,.5,0],'P(c)':[0,0,.5]} 704 694 elif SGData['SGSys'] == 'monoclinic': 705 BNSsym = {'P ':[0,0,0],'P(a)':[.5,0,0],'P(b)':[0,.5,0],'P(c)':[0,0,.5]}695 BNSsym = {'P(a)':[.5,0,0],'P(b)':[0,.5,0],'P(c)':[0,0,.5]} 706 696 if SGData['SGUniq'] == 'a': 707 697 BNSsym.update({'P(B)':[.5,0,.5],'P(C)':[.5,.5,0]}) … … 711 701 BNSsym.update({'P(A)':[0,.5,.5],'P(B)':[.5,0,.5]}) 712 702 elif SGData['SGSys'] == 'orthorhombic': 713 BNSsym = {'P ':[0,0,0],'P(a)':[.5,0,0],'P(b)':[0,.5,0],'P(c)':[0,0,.5],703 BNSsym = {'P(a)':[.5,0,0],'P(b)':[0,.5,0],'P(c)':[0,0,.5], 714 704 'P(A)':[0,.5,.5],'P(B)':[.5,0,.5],'P(C)':[.5,.5,0],'P(I)':[.5,.5,.5]} 715 705 elif SGData['SGSys'] == 'tetragonal': 716 BNSsym = {'P ':[0,0,0],'P(c)':[0,0,.5],'P(C)':[.5,.5,0],'P(I)':[.5,.5,.5]}706 BNSsym = {'P(c)':[0,0,.5],'P(C)':[.5,.5,0],'P(I)':[.5,.5,.5]} 717 707 elif SGData['SGSys'] in ['trigonal','hexagonal']: 718 BNSsym = {'P ':[0,0,0],'P(c)':[0,0,.5]}708 BNSsym = {'P(c)':[0,0,.5]} 719 709 elif SGData['SGSys'] == 'cubic': 720 BNSsym = {'P ':[0,0,0],'P(I)':[.5,.5,.5]}710 BNSsym = {'P(I)':[.5,.5,.5]} 721 711 722 712 elif 'A' in SGData['SGLatt']: 723 713 if SGData['SGSys'] == 'monoclinic': 724 BNSsym = { 'A':[0,0,0],}714 BNSsym = {} 725 715 if SGData['SGUniq'] == 'b': 726 716 BNSsym.update({'A(a)':[.5,0,0],'A(c)':[0,0,.5]}) … … 728 718 BNSsym.update({'A(a)':[.5,0,0],'A(b)':[0,.5,0]}) 729 719 elif SGData['SGSys'] == 'orthorhombic': 730 BNSsym = {'A ':[0,0,0],'A(a)':[.5,0,0],'A(b)':[0,.5,0],'A(c)':[0,0,.5],720 BNSsym = {'A(a)':[.5,0,0],'A(b)':[0,.5,0],'A(c)':[0,0,.5], 731 721 'A(B)':[.5,0,.5],'A(C)':[.5,.5,0]} 722 elif SGData['SGSys'] == 'triclinic': 723 BNSsym = {'A(a)':[.5,0,0],'A(b)':[0,.5,0],'A(c)':[0,0,.5]} 732 724 733 725 elif 'B' in SGData['SGLatt']: 734 726 if SGData['SGSys'] == 'monoclinic': 735 BNSsym = { 'B':[0,0,0],}727 BNSsym = {} 736 728 if SGData['SGUniq'] == 'a': 737 729 BNSsym.update({'B(b)':[0,.5,0],'B(c)':[0,0,.5]}) … … 739 731 BNSsym.update({'B(a)':[.5,0,0],'B(b)':[0,.5,0]}) 740 732 elif SGData['SGSys'] == 'orthorhombic': 741 BNSsym = {'B ':[0,0,0],'B(a)':[.5,0,0],'B(b)':[0,.5,0],'B(c)':[0,0,.5],733 BNSsym = {'B(a)':[.5,0,0],'B(b)':[0,.5,0],'B(c)':[0,0,.5], 742 734 'B(A)':[0,.5,.5],'B(C)':[.5,.5,0]} 735 elif SGData['SGSys'] == 'triclinic': 736 BNSsym = {'B(a)':[.5,0,0],'B(b)':[0,.5,0],'B(c)':[0,0,.5]} 743 737 744 738 elif 'C' in SGData['SGLatt']: 745 739 if SGData['SGSys'] == 'monoclinic': 746 BNSsym = { 'C':[0,0,0],}740 BNSsym = {} 747 741 if SGData['SGUniq'] == 'a': 748 742 BNSsym.update({'C(b)':[0,.5,.0],'C(c)':[0,0,.5]}) … … 750 744 BNSsym.update({'C(a)':[.5,0,0],'C(c)':[0,0,.5]}) 751 745 elif SGData['SGSys'] == 'orthorhombic': 752 BNSsym = {'C ':[0,0,0],'C(a)':[.5,0,0],'C(b)':[0,.5,0],'C(c)':[0,0,.5],746 BNSsym = {'C(a)':[.5,0,0],'C(b)':[0,.5,0],'C(c)':[0,0,.5], 753 747 'C(A)':[0,.5,.5],'C(B)':[.5,0,.5]} 748 elif SGData['SGSys'] == 'triclinic': 749 BNSsym = {'C(a)':[.5,0,0],'C(b)':[0,.5,0],'C(c)':[0,0,.5]} 754 750 755 751 elif 'I' in SGData['SGLatt']: 756 if SGData['SGSys'] in ['monoclinic','orthorhombic' ]:757 BNSsym = {'I ':[0,0,0],'I(a)':[.5,0,0],'I(b)':[0,.5,0],'I(c)':[0,0,.5]}752 if SGData['SGSys'] in ['monoclinic','orthorhombic','triclinic']: 753 BNSsym = {'I(a)':[.5,0,0],'I(b)':[0,.5,0],'I(c)':[0,0,.5]} 758 754 elif SGData['SGSys'] == 'tetragonal': 759 BNSsym = {'I ':[0,0,0],'I(c)':[0,0,.5]}755 BNSsym = {'I(c)':[0,0,.5]} 760 756 elif SGData['SGSys'] == 'cubic': 761 BNSsym = { 'I':[0,0,0]}757 BNSsym = {} 762 758 763 759 elif 'F' in SGData['SGLatt']: 764 if SGData['SGSys'] in ['monoclinic','orthorhombic','cubic' ]:765 BNSsym = {'F ':[0,0,0],'F(S)':[.5,.5,.5]}760 if SGData['SGSys'] in ['monoclinic','orthorhombic','cubic','triclinic']: 761 BNSsym = {'F(S)':[.5,.5,.5]} 766 762 767 763 elif 'R' in SGData['SGLatt']: 768 BNSsym = {'R ':[0,0,0],'R(I)':[0,0,.5]}764 BNSsym = {'R(I)':[0,0,.5]} 769 765 return UsymOp,OprFlg,BNSsym 770 766 … … 788 784 elif '(I)' in BNS: 789 785 Tmat *= 2.0 786 if 'R' in BNS: 787 SGData['SGSpin'][1] = 1 790 788 elif '(S)' in BNS: 791 789 SGData['SGSpin'][1] = 1 … … 841 839 def MagSGSym(SGData): #needs to use SGPtGrp not SGLaue! 842 840 SGLaue = SGData['SGLaue'] 841 if '1' not in SGData['GenSym']: #patch for old gpx files 842 SGData['GenSym'] = ['1',]+SGData['GenSym'] 843 SGData['SGSpin'] = [1,]+list(SGData['SGSpin']) 844 if len(SGData['SGSpin'])<len(SGData['GenSym']): 845 SGData['SGSpin'] = [1,]+list(SGData['SGSpin']) #end patch 846 GenSym = SGData['GenSym'][1:] #skip identity 843 847 SpnFlp = SGData['SGSpin'] 844 848 # print('SpnFlp',SpnFlp) 845 GenSym = SGData['GenSym']846 849 SGPtGrp = SGData['SGPtGrp'] 847 if not len(SpnFlp):850 if len(SpnFlp) == 1: 848 851 SGData['MagPtGp'] = SGPtGrp 849 852 return SGData['SpGrp'] … … 851 854 if SGLaue in ['1',]: 852 855 SGData['MagPtGp'] = SGPtGrp 853 if SpnFlp[ 0] == 1:856 if SpnFlp[1] == 1: 854 857 magSym[1] += "'" 855 858 SGData['MagPtGp'] += "'" … … 863 866 if len(GenSym) == 3: 864 867 for i in [0,1,2]: 865 if SpnFlp[i ] < 0:868 if SpnFlp[i+1] < 0: 866 869 sym[i] += "'" 867 870 Ptsym[i] += "'" 868 871 else: 869 872 for i in range(len(GenSym)): 870 if SpnFlp[i ] < 0:873 if SpnFlp[i+1] < 0: 871 874 sym[i] += "'" 872 875 Ptsym[i] += "'" … … 877 880 for i in [0,1,2]: 878 881 SGData['MagPtGp'] += SGPtGrp[i] 879 if SpnFlp[i ] < 0:882 if SpnFlp[i+1] < 0: 880 883 magSym[i+1] += "'" 881 884 SGData['MagPtGp'] += "'" … … 884 887 if len(GenSym) == 2: 885 888 for i in [0,1]: 886 if SpnFlp[i ] < 0:889 if SpnFlp[i+1] < 0: 887 890 magSym[i+2] += "'" 888 891 magPtGp[i+1] += "'" 889 if SpnFlp[ 0]*SpnFlp[1] < 0:892 if SpnFlp[1]*SpnFlp[2] < 0: 890 893 magSym[1] += "'" 891 894 magPtGp[0] += "'" … … 895 898 magPtGp = ['','m','m'] 896 899 for i in [0,1,2]: 897 if SpnFlp[i ] < 0:900 if SpnFlp[i+1] < 0: 898 901 if i: 899 902 magSym[i+1] += "'" … … 902 905 sym[1] += "'" 903 906 Ptsym[0] += "'" 904 if SpnFlp[ 1]*SpnFlp[2] < 0:907 if SpnFlp[2]*SpnFlp[3] < 0: 905 908 sym[0] += "'" 906 909 Ptsym[0] += "'" … … 912 915 if len(GenSym) == 2: 913 916 for i in [0,1]: 914 if SpnFlp[i ] < 0:917 if SpnFlp[i+1] < 0: 915 918 magSym[i+2] += "'" 916 919 magPtGp[i+1] += "'" 917 if SpnFlp[ 0]*SpnFlp[1] < 0:920 if SpnFlp[1]*SpnFlp[2] < 0: 918 921 magSym[1] += "'" 919 922 magPtGp[0] += "'" … … 924 927 magPtGp = ['','m','m'] 925 928 for i in [0,1,2]: 926 if SpnFlp[i ] < 0:929 if SpnFlp[i+1] < 0: 927 930 if i: 928 931 magSym[i+1] += "'" … … 931 934 sym[1] += "'" 932 935 Ptsym[1] += "'" 933 if SpnFlp[ 1]*SpnFlp[2] < 0:936 if SpnFlp[2]*SpnFlp[3] < 0: 934 937 sym[0] += "'" 935 938 Ptsym[0] += "'" … … 938 941 else: 939 942 for i in [0,1]: 940 if SpnFlp[i ] < 0:943 if SpnFlp[i+1] < 0: 941 944 magSym[i+2] += "'" 942 if SpnFlp[ 0]*SpnFlp[1] < 0:945 if SpnFlp[1]*SpnFlp[2] < 0: 943 946 magSym[1] += "'" 944 947 SGData['MagPtGp'] = ''.join(magPtGp) … … 952 955 id = 1 953 956 magSym[id].strip("'") 954 if SpnFlp[ 0] < 0:957 if SpnFlp[1] < 0: 955 958 magSym[id] += "'" 956 959 Ptsym[id1] += "'" … … 958 961 if 'R' in GenSym[1]: 959 962 magSym[1].strip("'") 960 if SpnFlp[ 0] < 0:963 if SpnFlp[1] < 0: 961 964 magSym[1] += "'" 962 965 Ptsym[1] += "'" … … 969 972 magSym[j].strip("'") 970 973 Ptsym[j1].strip("'") 971 if SpnFlp[ :2] == [1,1]:974 if SpnFlp[1:3] == [1,1]: 972 975 magSym[i] += "'" 973 976 Ptsym[i1] += "'" 974 elif SpnFlp[ :2] == [1,1]:977 elif SpnFlp[1:3] == [1,1]: 975 978 magSym[j] += "'" 976 979 Ptsym[j1] += "'" 977 elif SpnFlp[ :2] == [1,1]:980 elif SpnFlp[1:3] == [1,1]: 978 981 magSym[i] += "'" 979 982 Ptsym[i1] += "'" … … 987 990 magSym[j].strip("'") 988 991 Ptsym[j1].strip("'") 989 if SpnFlp[ :2] == [1,1]:992 if SpnFlp[1:3] == [1,1]: 990 993 magSym[i] += "'" 991 994 Ptsym[i1] += "'" 992 elif SpnFlp[ :2] == [1,1]:995 elif SpnFlp[1:3] == [1,1]: 993 996 magSym[j] += "'" 994 997 Ptsym[j1] += "'" 995 elif SpnFlp[ :2] == [1,1]:998 elif SpnFlp[2] == [1,1]: 996 999 magSym[i] += "'" 997 1000 Ptsym[i1] += "'" … … 1003 1006 elif SGData['SGPtGrp'] == 'm3': 1004 1007 SGData['MagPtGp'] = "m3" 1005 if SpnFlp[ 0] < 0:1008 if SpnFlp[1] < 0: 1006 1009 magSym[1] += "'" 1007 1010 magSym[2] += "'" 1008 1011 SGData['MagPtGp'] = "m'3'" 1009 if SpnFlp[ 1] < 0:1012 if SpnFlp[2] < 0: 1010 1013 if not 'm' in magSym[1]: #only Ia3 1011 1014 magSym[1].strip("'") … … 1013 1016 elif SGData['SGPtGrp'] in ['432','43m']: 1014 1017 Ptsym = SGData['SGPtGrp'].split('3') 1015 if SpnFlp[ 0] < 0:1018 if SpnFlp[1] < 0: 1016 1019 magSym[1] += "'" 1017 1020 Ptsym[0] += "'" … … 1021 1024 elif SGData['SGPtGrp'] == 'm3m': 1022 1025 Ptsym = ['m','3','m'] 1023 if SpnFlp[ :2] == [1,1]:1026 if SpnFlp[1:3] == [1,1]: 1024 1027 magSym[1] += "'" 1025 1028 Ptsym[0] += "'" 1026 1029 magSym[2] += "'" 1027 1030 Ptsym[1] += "'" 1028 elif SpnFlp[ :2] == [1,1]:1031 elif SpnFlp[1:3] == [1,1]: 1029 1032 magSym[3] += "'" 1030 1033 Ptsym[2] += "'" 1031 elif SpnFlp[ :2] == [1,1]:1034 elif SpnFlp[1:3] == [1,1]: 1032 1035 magSym[1] += "'" 1033 1036 Ptsym[0] += "'" … … 1106 1109 OprNames += OprName 1107 1110 SpnFlp = np.ones(Nsym,dtype=np.int) 1108 Nfl = len(SGData.get('GenFlg',[])) 1109 if Nfl: 1111 GenFlg = SGData.get('GenFlg',[0]) 1112 Nfl = len(GenFlg) 1113 if Nfl>1: 1110 1114 for ieqv in range(Nsym): 1111 1115 for iunq in range(Nfl): 1112 if SGData['SGGen'][ieqv] & SGData['GenFlg'][iunq]:1116 if SGData['SGGen'][ieqv] & GenFlg[iunq]: 1113 1117 SpnFlp[ieqv] *= FlpSpn[iunq] 1114 # print '\nMagSpGrp:',SGData['MagSpGrp'],Ncv 1115 # print 'GenFlg:',SGData['GenFlg'] 1116 # print 'GenSym:',SGData['GenSym'] 1117 # print 'FlpSpn:',Nfl,FlpSpn 1118 # print ('\nMagSpGrp:',SGData['MagSpGrp'],Ncv) 1119 # print ('GenFlg:',SGData['GenFlg']) 1120 # print ('GenSym:',SGData['GenSym']) 1121 # print ('FlpSpn:',Nfl,FlpSpn) 1118 1122 detM = [nl.det(M) for M in sgOp] 1119 1123 for incv in range(Ncv): 1120 1124 if incv: 1121 SpnFlp = np.concatenate((SpnFlp,SpnFlp[:Nsym]*FlpSpn[Nfl+incv1])) 1125 try: 1126 SpnFlp = np.concatenate((SpnFlp,SpnFlp[:Nsym]*FlpSpn[Nfl+incv1])) 1127 except IndexError: 1128 FlpSpn = [1,]+FlpSpn 1129 SpnFlp = np.concatenate((SpnFlp,SpnFlp[:Nsym]*FlpSpn[Nfl+incv1])) 1122 1130 if ' 1bar ' in SGData['GenSym'][0] and FlpSpn[0] < 0: 1123 1131 detM[1] = 1. 1124 1132 MagMom = SpnFlp*np.array(Ncv*detM) 1125 1133 SGData['MagMom'] = MagMom 1126 # print 'SgOps:',OprNames1127 # print 'SGGen:',SGData['SGGen']1128 # print 'SpnFlp:',SpnFlp1129 # print 'MagMom:',MagMom1134 # print ('SgOps:',OprNames) 1135 # print ('SGGen:',SGData['SGGen']) 1136 # print ('SpnFlp:',SpnFlp) 1137 # print ('MagMom:',MagMom) 1130 1138 return OprNames,SpnFlp 1131 1139 … … 2171 2179 "returns Mxyz terms, multipliers, GUI flags" 2172 2180 CSI = [[1,2,3],[1.0,1.0,1.0]] 2173 if '1' in siteSym and SpnFlp[len(SpnFlp)//2] < 0: 2174 return [[0,0,0],[0.,0.,0.]] 2181 if siteSym.strip() in ['1','m3m']: 2182 if SpnFlp[len(SpnFlp)//2] < 0: 2183 return [[0,0,0],[0.,0.,0.]] 2184 else: 2185 return [[1,1,1],[1.,1.,1.]] 2175 2186 for opr in dupDir: 2176 2187 indx = GetNXUPQsym(opr)
Note: See TracChangeset
for help on using the changeset viewer.