Changeset 820 for trunk/GSASIIrestrGUI.py
- Timestamp:
- Jan 3, 2013 4:03:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIrestrGUI.py ¶
r819 r820 200 200 Lists[listName].append([Ids[x],Types[x],Coords[x],]) 201 201 bond = 1.54 202 dlg = G2phG.SingleFloatDialog(G2frame,'Distance','Enter restraint distance for bond',bond,[ 1.,4.],'%.4f')202 dlg = G2phG.SingleFloatDialog(G2frame,'Distance','Enter restraint distance for bond',bond,[0.01,4.],'%.4f') 203 203 if dlg.ShowModal() == wx.ID_OK: 204 204 bond = dlg.GetValue() … … 682 682 683 683 def OnUseData(event): 684 Obj = event.GetEventObject() 684 685 restData['Use'] = Obj.GetValue() 685 686 … … 782 783 table = [] 783 784 rowLabels = [] 785 bad = [] 784 786 Types = [wg.GRID_VALUE_STRING,]+3*[wg.GRID_VALUE_FLOAT+':10,3',] 785 787 if 'macro' in General['Type']: 786 788 colLabels = ['(res) A - (res) B','calc','obs','esd'] 787 789 for i,[indx,ops,obs,esd] in enumerate(bondList): 788 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 789 name = '' 790 for atom in atoms: 791 name += '('+atom[1]+atom[0].strip()+atom[2]+') '+atom[3]+' - ' 792 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 793 calc = G2mth.getRestDist(XYZ,Amat) 794 table.append([name[:-3],calc,obs,esd]) 795 rowLabels.append(str(i)) 790 try: 791 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 792 name = '' 793 for atom in atoms: 794 name += '('+atom[1]+atom[0].strip()+atom[2]+') '+atom[3]+' - ' 795 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 796 calc = G2mth.getRestDist(XYZ,Amat) 797 table.append([name[:-3],calc,obs,esd]) 798 rowLabels.append(str(i)) 799 except KeyError: 800 print '**** WARNING - missing atom - restraint deleted ****' 801 bad.append(i) 796 802 else: 797 803 colLabels = ['A+SymOp - B+SymOp','calc','obs','esd'] 798 try:799 for i,[indx,ops,obs,esd] in enumerate(bondList):804 for i,[indx,ops,obs,esd] in enumerate(bondList): 805 try: 800 806 names = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,ct-1) 801 807 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) … … 804 810 table.append([names[0]+'+('+ops[0]+') - '+names[1]+'+('+ops[1]+')',calc,obs,esd]) 805 811 rowLabels.append(str(i)) 806 except ValueError: #patch - old restraints! 807 bondList = [] 812 except KeyError: 813 print '**** WARNING - missing atom - restraint deleted ****' 814 bad.append(i) 815 if len(bad): 816 bad.reverse() 817 for ibad in bad: 818 del bondList[ibad] 808 819 bondTable = G2gd.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 809 820 Bonds = G2gd.GSGrid(BondRestr) … … 880 891 table = [] 881 892 rowLabels = [] 893 bad = [] 882 894 Types = [wg.GRID_VALUE_STRING,]+3*[wg.GRID_VALUE_FLOAT+':10,2',] 883 895 if 'macro' in General['Type']: 884 896 colLabels = ['(res) A - (res) B - (res) C','calc','obs','esd'] 885 897 for i,[indx,ops,obs,esd] in enumerate(angleList): 886 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 887 name = '' 888 for atom in atoms: 889 name += '('+atom[1]+atom[0].strip()+atom[2]+') '+atom[3]+' - ' 890 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 891 calc = G2mth.getRestAngle(XYZ,Amat) 892 table.append([name[:-3],calc,obs,esd]) 893 rowLabels.append(str(i)) 898 try: 899 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 900 name = '' 901 for atom in atoms: 902 name += '('+atom[1]+atom[0].strip()+atom[2]+') '+atom[3]+' - ' 903 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 904 calc = G2mth.getRestAngle(XYZ,Amat) 905 table.append([name[:-3],calc,obs,esd]) 906 rowLabels.append(str(i)) 907 except KeyError: 908 print '**** WARNING - missing atom - restraint deleted ****' 909 bad.append(i) 894 910 else: 895 911 colLabels = ['A+SymOp - B+SymOp - C+SymOp','calc','obs','esd'] 896 912 for i,[indx,ops,obs,esd] in enumerate(angleList): 897 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,ct-1) 898 name = atoms[0]+'+('+ops[0]+') - '+atoms[1]+'+('+ops[1]+') - '+atoms[2]+ \ 899 '+('+ops[2]+')' 900 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 901 XYZ = G2mth.getSyXYZ(XYZ,ops,SGData) 902 calc = G2mth.getRestAngle(XYZ,Amat) 903 table.append([name,calc,obs,esd]) 904 rowLabels.append(str(i)) 913 try: 914 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,ct-1) 915 name = atoms[0]+'+('+ops[0]+') - '+atoms[1]+'+('+ops[1]+') - '+atoms[2]+ \ 916 '+('+ops[2]+')' 917 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 918 XYZ = G2mth.getSyXYZ(XYZ,ops,SGData) 919 calc = G2mth.getRestAngle(XYZ,Amat) 920 table.append([name,calc,obs,esd]) 921 rowLabels.append(str(i)) 922 except KeyError: 923 print '**** WARNING - missing atom - restraint deleted ****' 924 bad.append(i) 925 if len(bad): 926 bad.reverse() 927 for ibad in bad: 928 del angleList[ibad] 905 929 angleTable = G2gd.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 906 930 Angles = G2gd.GSGrid(AngleRestr) … … 968 992 table = [] 969 993 rowLabels = [] 994 bad = [] 970 995 Types = [wg.GRID_VALUE_STRING,]+3*[wg.GRID_VALUE_FLOAT+':10,2',] 971 996 if 'macro' in General['Type']: 972 997 colLabels = ['(res) atom','calc','obs','esd'] 973 998 for i,[indx,ops,obs,esd] in enumerate(planeList): 974 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 975 name = '' 976 for a,atom in enumerate(atoms): 977 name += '('+atom[1]+atom[0].strip()+atom[2]+') '+atom[3]+' - ' 978 if (a+1)%3 == 0: 979 name += '\n' 980 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 981 calc = G2mth.getRestPlane(XYZ,Amat) 982 table.append([name[:-3],calc,obs,esd]) 983 rowLabels.append(str(i)) 999 try: 1000 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 1001 name = '' 1002 for a,atom in enumerate(atoms): 1003 name += '('+atom[1]+atom[0].strip()+atom[2]+') '+atom[3]+' - ' 1004 if (a+1)%3 == 0: 1005 name += '\n' 1006 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 1007 calc = G2mth.getRestPlane(XYZ,Amat) 1008 table.append([name[:-3],calc,obs,esd]) 1009 rowLabels.append(str(i)) 1010 except KeyError: 1011 print '**** WARNING - missing atom - restraint deleted ****' 1012 bad.append(i) 984 1013 else: 985 1014 colLabels = ['atom+SymOp','calc','obs','esd'] 986 1015 for i,[indx,ops,obs,esd] in enumerate(planeList): 987 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,ct-1) 988 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 989 XYZ = G2mth.getSyXYZ(XYZ,ops,SGData) 990 calc = G2mth.getRestPlane(XYZ,Amat) 991 name = '' 992 for a,atom in enumerate(atoms): 993 name += atom+'+ ('+ops[a]+'),' 994 if (a+1)%3 == 0: 995 name += '\n' 996 table.append([name[:-1],calc,obs,esd]) 997 rowLabels.append(str(i)) 1016 try: 1017 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,ct-1) 1018 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 1019 XYZ = G2mth.getSyXYZ(XYZ,ops,SGData) 1020 calc = G2mth.getRestPlane(XYZ,Amat) 1021 name = '' 1022 for a,atom in enumerate(atoms): 1023 name += atom+'+ ('+ops[a]+'),' 1024 if (a+1)%3 == 0: 1025 name += '\n' 1026 table.append([name[:-1],calc,obs,esd]) 1027 rowLabels.append(str(i)) 1028 except KeyError: 1029 print '**** WARNING - missing atom - restraint deleted ****' 1030 bad.append(i) 1031 if len(bad): 1032 bad.reverse() 1033 for ibad in bad: 1034 del planeList[ibad] 998 1035 planeTable = G2gd.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 999 1036 Planes = G2gd.GSGrid(PlaneRestr) … … 1071 1108 table = [] 1072 1109 rowLabels = [] 1110 bad = [] 1073 1111 Types = [wg.GRID_VALUE_STRING,]+3*[wg.GRID_VALUE_FLOAT+':10,2',] 1074 1112 if 'macro' in General['Type']: 1075 1113 colLabels = ['(res) O (res) A (res) B (res) C','calc','obs','esd'] 1076 1114 for i,[indx,ops,obs,esd] in enumerate(volumeList): 1077 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 1078 name = '' 1079 for atom in atoms: 1080 name += '('+atom[1]+atom[0].strip()+atom[2]+') '+atom[3]+' ' 1081 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 1082 calc = G2mth.getRestChiral(XYZ,Amat) 1083 table.append([name,calc,obs,esd]) 1084 rowLabels.append(str(i)) 1115 try: 1116 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 1117 name = '' 1118 for atom in atoms: 1119 name += '('+atom[1]+atom[0].strip()+atom[2]+') '+atom[3]+' ' 1120 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 1121 calc = G2mth.getRestChiral(XYZ,Amat) 1122 table.append([name,calc,obs,esd]) 1123 rowLabels.append(str(i)) 1124 except KeyError: 1125 print '**** WARNING - missing atom - restraint deleted ****' 1126 bad.append(i) 1085 1127 else: 1086 1128 colLabels = ['O+SymOp A+SymOp B+SymOp C+SymOp)','calc','obs','esd'] 1087 1129 for i,[indx,ops,obs,esd] in enumerate(volumeList): 1088 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,ct-1) 1089 name = atoms[0]+'+('+ops[0]+') '+atoms[1]+'+('+ops[1]+') '+atoms[2]+ \ 1090 '+('+ops[2]+') '+atoms[3]+'+('+ops[3]+')' 1091 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 1092 XYZ = G2mth.getSyXYZ(XYZ,ops,SGData) 1093 calc = G2mth.getRestChiral(XYZ,Amat) 1094 table.append([name,calc,obs,esd]) 1095 rowLabels.append(str(i)) 1130 try: 1131 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,ct-1) 1132 name = atoms[0]+'+('+ops[0]+') '+atoms[1]+'+('+ops[1]+') '+atoms[2]+ \ 1133 '+('+ops[2]+') '+atoms[3]+'+('+ops[3]+')' 1134 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 1135 XYZ = G2mth.getSyXYZ(XYZ,ops,SGData) 1136 calc = G2mth.getRestChiral(XYZ,Amat) 1137 table.append([name,calc,obs,esd]) 1138 rowLabels.append(str(i)) 1139 except KeyError: 1140 print '**** WARNING - missing atom - restraint deleted ****' 1141 bad.append(i) 1142 if len(bad): 1143 bad.reverse() 1144 for ibad in bad: 1145 del volumeList[ibad] 1096 1146 volumeTable = G2gd.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1097 1147 Volumes = G2gd.GSGrid(ChiralRestr) … … 1156 1206 table = [] 1157 1207 rowLabels = [] 1208 bad = [] 1158 1209 Types = 2*[wg.GRID_VALUE_STRING,]+4*[wg.GRID_VALUE_FLOAT+':10,2',] 1159 1210 if 'macro' in General['Type']: 1160 1211 colLabels = ['(res) A B C D','coef name','torsion','obs E','restr','esd'] 1161 1212 for i,[indx,ops,cofName,esd] in enumerate(torsionList): 1162 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 1163 name = '('+atoms[2][1]+atoms[2][0].strip()+atoms[2][2]+')' 1164 for atom in atoms: 1165 name += ' '+atom[3] 1166 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 1167 tor = G2mth.getRestTorsion(XYZ,Amat) 1168 restr,calc = G2mth.calcTorsionEnergy(tor,coeffDict[cofName]) 1169 table.append([name,cofName,tor,calc,restr,esd]) 1170 rowLabels.append(str(i)) 1213 try: 1214 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 1215 name = '('+atoms[2][1]+atoms[2][0].strip()+atoms[2][2]+')' 1216 for atom in atoms: 1217 name += ' '+atom[3] 1218 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 1219 tor = G2mth.getRestTorsion(XYZ,Amat) 1220 restr,calc = G2mth.calcTorsionEnergy(tor,coeffDict[cofName]) 1221 table.append([name,cofName,tor,calc,restr,esd]) 1222 rowLabels.append(str(i)) 1223 except KeyError: 1224 print '**** WARNING - missing atom - restraint deleted ****' 1225 bad.append(i) 1226 if len(bad): 1227 bad.reverse() 1228 for ibad in bad: 1229 del torsionList[ibad] 1171 1230 torsionTable = G2gd.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1172 1231 Torsions = G2gd.GSGrid(TorsionRestr) … … 1249 1308 table = [] 1250 1309 rowLabels = [] 1310 bad = [] 1251 1311 Types = 2*[wg.GRID_VALUE_STRING,]+5*[wg.GRID_VALUE_FLOAT+':10,2',] 1252 1312 if 'macro' in General['Type']: 1253 1313 colLabels = ['(res) A B C D E','coef name','phi','psi','obs E','restr','esd'] 1254 1314 for i,[indx,ops,cofName,esd] in enumerate(ramaList): 1255 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 1256 name = '('+atoms[3][1]+atoms[3][0].strip()+atoms[3][2]+')' 1257 for atom in atoms: 1258 name += ' '+atom[3] 1259 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 1260 phi,psi = G2mth.getRestRama(XYZ,Amat) 1261 restr,calc = G2mth.calcRamaEnergy(phi,psi,coeffDict[cofName]) 1262 table.append([name,cofName,phi,psi,calc,restr,esd]) 1263 rowLabels.append(str(i)) 1315 try: 1316 atoms = G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,0,4) 1317 name = '('+atoms[3][1]+atoms[3][0].strip()+atoms[3][2]+')' 1318 for atom in atoms: 1319 name += ' '+atom[3] 1320 XYZ = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cx,3)) 1321 phi,psi = G2mth.getRestRama(XYZ,Amat) 1322 restr,calc = G2mth.calcRamaEnergy(phi,psi,coeffDict[cofName]) 1323 table.append([name,cofName,phi,psi,calc,restr,esd]) 1324 rowLabels.append(str(i)) 1325 except KeyError: 1326 print '**** WARNING - missing atom - restraint deleted ****' 1327 bad.append(i) 1328 if len(bad): 1329 bad.reverse() 1330 for ibad in bad: 1331 del ramaList[ibad] 1264 1332 ramaTable = G2gd.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1265 1333 Ramas = G2gd.GSGrid(RamaRestr)
Note: See TracChangeset
for help on using the changeset viewer.