Changeset 1599
- Timestamp:
- Dec 8, 2014 3:58:55 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r1598 r1599 131 131 if generalData['Type'] in ['modulated','magnetic',] and 'Super' not in generalData: 132 132 generalData['Super'] = 1 133 generalData['SuperVec'] = [[ [0,0,.1],False,4],[[0,0,.1],False,4],[[0.,0.,.1],False,4]]133 generalData['SuperVec'] = [[0,0,.1],False,4] 134 134 generalData['SSGData'] = {} 135 135 # end of patches … … 993 993 if Atoms.GetColLabelValue(c) == 'refine': 994 994 Type = generalData['Type'] 995 if Type in ['nuclear','macromolecular' ]:995 if Type in ['nuclear','macromolecular','modulated']: 996 996 choice = ['F - site fraction','X - coordinates','U - thermal parameters'] 997 997 elif Type in ['magnetic',]: … … 1077 1077 ss = colLabels.index('site sym') 1078 1078 for r in range(Atoms.GetNumberRows()): 1079 ID = atomData[r][ -1]1079 ID = atomData[r][ui+6] 1080 1080 if parms != atomData[r][c] and Atoms.GetColLabelValue(c) == 'I/A': 1081 1081 if parms == 'A': #'I' --> 'A' … … 1102 1102 if not Atoms.IsReadOnly(r,c): 1103 1103 if Atoms.GetColLabelValue(c) == 'refine': 1104 rbExcl = rbAtmDict.get(atomData[r][ -1],'')1104 rbExcl = rbAtmDict.get(atomData[r][ui+6],'') 1105 1105 if rbExcl: 1106 1106 for excl in rbExcl: … … 1121 1121 r,c = event.GetRow(),event.GetCol() 1122 1122 if r >= 0 and c >= 0: 1123 ID = atomData[r][-1] 1123 ci = colLabels.index('I/A') 1124 ID = atomData[r][ci+8] 1124 1125 if Atoms.GetColLabelValue(c) in ['x','y','z']: 1125 1126 ci = colLabels.index('x') … … 1175 1176 atomData[r][i+colLabels.index('U11')] = value*CSI[1][i] 1176 1177 elif Atoms.GetColLabelValue(c) == 'refine': 1177 atomData[r][c] = atomData[r][c].replace(rbAtmDict.get(atomData[r][-1],''),'') 1178 ci = colLabels.index('I/A') 1179 atomData[r][c] = atomData[r][c].replace(rbAtmDict.get(atomData[r][ci+8],''),'') 1178 1180 if 'Atoms' in data['Drawing']: 1179 1181 DrawAtomsReplaceByID(data['Drawing'],atomData[r],ID) … … 1197 1199 value = Atoms.GetCellValue(r,c) 1198 1200 atomData[r][c] = value 1199 ID = atomData[r][-1] 1201 ci = colLabels.index('I/A') 1202 ID = atomData[r][ci+8] 1200 1203 if 'Atoms' in data['Drawing']: 1201 1204 DrawAtomsReplaceByID(data['Drawing'],atomData[r],ID) … … 1213 1216 Atoms.ClearSelection() 1214 1217 elif c < 0: #only row clicks 1218 ci = colLabels.index('I/A') 1215 1219 if event.ControlDown() and not event.ShiftDown(): 1216 1220 if r in Atoms.GetSelectedRows(): … … 1227 1231 Atoms.SelectRow(row,True) 1228 1232 elif event.AltDown() or (event.ShiftDown() and event.ControlDown()): 1229 if atomData[r][ -1] in rbAtmDict:1233 if atomData[r][ci+8] in rbAtmDict: 1230 1234 G2frame.ErrorDialog('Atom move error','Atoms in rigid bodies can not be moved') 1231 1235 Atoms.frm = -1 … … 1290 1294 Atoms.SetColSize(i,50) 1291 1295 for row in range(Atoms.GetNumberRows()): 1292 atId = atomData[row][ -1]1296 atId = atomData[row][colIA+8] 1293 1297 rbExcl = rbAtmDict.get(atId,'') 1294 1298 Atoms.SetReadOnly(row,colSS,True) #site sym … … 1304 1308 Atoms.SetCellTextColour(row,colUiso,VERY_LIGHT_GREY) 1305 1309 for i in range(6): 1306 c i= colU11+i1307 Atoms.SetCellTextColour(row,c i,BLACK)1308 Atoms.SetCellStyle(row,c i,VERY_LIGHT_GREY,True)1310 cj = colU11+i 1311 Atoms.SetCellTextColour(row,cj,BLACK) 1312 Atoms.SetCellStyle(row,cj,VERY_LIGHT_GREY,True) 1309 1313 if CSI[2][i] and 'U' not in rbExcl: 1310 Atoms.SetCellStyle(row,c i,WHITE,False)1314 Atoms.SetCellStyle(row,cj,WHITE,False) 1311 1315 else: 1312 1316 Atoms.SetCellStyle(row,colUiso,WHITE,False) … … 1315 1319 Atoms.SetCellStyle(row,colUiso,VERY_LIGHT_GREY,True) 1316 1320 for i in range(6): 1317 c i= colU11+i1318 Atoms.SetCellStyle(row,c i,VERY_LIGHT_GREY,True)1319 Atoms.SetCellTextColour(row,c i,VERY_LIGHT_GREY)1321 cj = colU11+i 1322 Atoms.SetCellStyle(row,cj,VERY_LIGHT_GREY,True) 1323 Atoms.SetCellTextColour(row,cj,VERY_LIGHT_GREY) 1320 1324 if 'X' in rbExcl: 1321 1325 for c in range(0,colX+3): … … 1409 1413 atomData.append([Name,El,'',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId]) 1410 1414 elif generalData['Type'] in ['modulated','magnetic']: 1411 atomData.append([Name,El,'',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0, [],[],[],[],atId])1415 atomData.append([Name,El,'',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,atId,[],[],[],[]]) 1412 1416 SetupGeneral() 1413 1417 if 'Atoms' in data['Drawing']: … … 1434 1438 colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())] 1435 1439 cx = colLabels.index('x') 1440 ci = colLabels.index('I/A') 1436 1441 indx = Atoms.GetSelectedRows() 1437 1442 if len(indx) != 1: 1438 1443 G2frame.ErrorDialog('Atom move error','Only one atom can be moved') 1439 elif atomData[indx[0]][ -1] in rbAtmDict:1444 elif atomData[indx[0]][ci+8] in rbAtmDict: 1440 1445 G2frame.ErrorDialog('Atom move error','Atoms in rigid bodies can not be moved') 1441 1446 else: … … 1443 1448 SetupGeneral() 1444 1449 FillAtomsGrid(Atoms) 1445 ID = atomData[indx[0]][ -1]1450 ID = atomData[indx[0]][ci+8] 1446 1451 DrawAtomsReplaceByID(data['Drawing'],atomData[indx[0]],ID) 1447 1452 G2plt.PlotStructure(G2frame,data) … … 1462 1467 generalData = data['General'] 1463 1468 SGData = generalData['SGData'] 1464 if generalData['Type'] == 'nuclear':1469 if generalData['Type'] in ['nuclear','modulated',]: 1465 1470 if oldatom: 1466 1471 opr = oldatom[5] … … 1503 1508 atomData.insert(indx,['UNK','UNK','',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId]) 1504 1509 elif generalData['Type'] in ['modulated','magnetic']: 1505 atomData.insert(indx,['UNK','UNK','',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0, [],[],[],[],atId])1510 atomData.insert(indx,['UNK','UNK','',x,y,z,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,atId,[],[],[],[]]) 1506 1511 SetupGeneral() 1507 1512 1508 1513 def AtomDelete(event): 1514 colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())] 1515 ci = colLabels.index('I/A') 1509 1516 indx = Atoms.GetSelectedRows() 1510 1517 IDs = [] … … 1514 1521 for ind in indx: 1515 1522 atom = atomData[ind] 1516 if atom[ -1] in rbAtmDict:1523 if atom[ci+8] in rbAtmDict: 1517 1524 G2frame.dataFrame.SetStatusText('**** ERROR - atom is in a rigid body and can not be deleted ****') 1518 1525 else: 1519 IDs.append(atom[ -1])1526 IDs.append(atom[ci+8]) 1520 1527 del atomData[ind] 1521 1528 if 'Atoms' in data['Drawing']: … … 1556 1563 generalData = data['General'] 1557 1564 colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())] 1565 ci = colLabels.index('I/A') 1558 1566 choices = ['Type','Name','x','y','z','frac','I/A','Uiso'] 1559 1567 dlg = wx.SingleChoiceDialog(G2frame,'Select','Atom parameter',choices) … … 1579 1587 if 'Atoms' in data['Drawing']: 1580 1588 for r in indx: 1581 ID = atomData[r][ -1]1589 ID = atomData[r][ci+8] 1582 1590 DrawAtomsReplaceByID(data['Drawing'],atomData[r],ID) 1583 1591 FillAtomsGrid(Atoms) … … 1939 1947 try: 1940 1948 idx = atomNames.index(atom[:ct+1]) 1949 atId = atom[cia+8] 1941 1950 atomData[idx][:-1] = atom[:-1] 1951 atomData[idx][cia+8] = atId 1942 1952 except ValueError: 1943 1953 print atom[:ct+1], 'not in Atom array; not updated' … … 1953 1963 1954 1964 def OnWaveType(event): 1955 atom[- 2][SS]['waveType']=waveType.GetValue()1965 atom[-1][SS]['waveType']=waveType.GetValue() 1956 1966 1957 1967 atomSizer = wx.BoxSizer(wx.HORIZONTAL) 1958 1968 atomSizer.Add(wx.StaticText(waveData,label=' Modulation data for atom: '+atom[0]+' WaveType: '),0,WACV) 1959 waveType = wx.ComboBox(waveData,value=atom[- 2][SS]['waveType'],choices=waveTypes,1969 waveType = wx.ComboBox(waveData,value=atom[-1][SS]['waveType'],choices=waveTypes, 1960 1970 style=wx.CB_READONLY|wx.CB_DROPDOWN) 1961 1971 waveType.Bind(wx.EVT_COMBOBOX,OnWaveType) … … 1968 1978 Obj = event.GetEventObject() 1969 1979 iatm,item = Indx[Obj.GetId()] 1970 atomData[iatm][- 2][SS][item].append([[0.0 for i in range(numVals[Stype])],False])1980 atomData[iatm][-1][SS][item].append([[0.0 for i in range(numVals[Stype])],False]) 1971 1981 UpdateWavesData() 1972 1982 … … 1977 1987 val = float(Obj.GetValue()) 1978 1988 except ValueError: 1979 val = atomData[iatm][- 2][SS][item][iwave][0][ival]1989 val = atomData[iatm][-1][SS][item][iwave][0][ival] 1980 1990 Obj.SetValue('%.4f'%val) 1981 atomData[iatm][- 2][SS][item][iwave][0][ival] = val1991 atomData[iatm][-1][SS][item][iwave][0][ival] = val 1982 1992 1983 1993 def OnRefWave(event): 1984 1994 Obj = event.GetEventObject() 1985 1995 iatm,item,iwave = Indx[Obj.GetId()] 1986 atomData[iatm][- 2][SS][item][iwave][1] = not atomData[iatm][-2][SS][item][iwave][1]1996 atomData[iatm][-1][SS][item][iwave][1] = not atomData[iatm][-1][SS][item][iwave][1] 1987 1997 1988 1998 def OnDelWave(event): 1989 1999 Obj = event.GetEventObject() 1990 2000 iatm,item,iwave = Indx[Obj.GetId()] 1991 del atomData[iatm][- 2][SS][item][iwave]2001 del atomData[iatm][-1][SS][item][iwave] 1992 2002 UpdateWavesData() 1993 2003 … … 2054 2064 if generalData['Type'] == 'modulated' and Stype == 'Smag': 2055 2065 break 2056 mainSizer.Add(WaveSizer(atom[- 2][SS][Stype],Stype,typeNames[Stype],Labels[Stype]))2066 mainSizer.Add(WaveSizer(atom[-1][SS][Stype],Stype,typeNames[Stype],Labels[Stype])) 2057 2067 2058 2068 SetPhaseWindow(G2frame.dataFrame,waveData,mainSizer) … … 2099 2109 drawingData['showRigidBodies'] = True 2100 2110 cx,ct,cs,ci = [0,0,0,0] 2101 if generalData['Type'] == 'nuclear':2111 if generalData['Type'] in ['nuclear','modulated']: 2102 2112 cx,ct,cs,ci = [2,1,6,17] #x, type, style & index 2103 2113 elif generalData['Type'] == 'macromolecular': -
trunk/GSASIIplot.py
r1598 r1599 427 427 Super = Data['Super'] 428 428 SuperVec = [] 429 for i in range(Super): 430 SuperVec.append(Data['SuperVec'][i][0]) 431 SuperVec = np.array(SuperVec) 429 if Super: 430 SuperVec = np.array(Data['SuperVec'][0]) 432 431 FoMax = math.sqrt(FosqMax) 433 432 xlabel = ['k, h=','h, k=','h, l='] … … 446 445 else: 447 446 Fosq,sig,Fcsq = refl[8+Super],1.0,refl[9+Super] 448 HKL.append(H+np.sum(SuperVec*refl[3:3+Super],axis=0)) 447 if Super: 448 HKL.append(H+SuperVec*refl[3]) 449 else: 450 HKL.append(H) 449 451 HKLF.append([Fosq,sig,Fcsq]) 450 452 if H[izone] == Data['Layer']: … … 479 481 A = (Fosq-Fcsq)/(3*sig) 480 482 if abs(A) < 3.0: A = 0 481 B = 0 482 h = H+np.sum(SuperVec*refl[3:3+Super],axis=0) 483 B = 0 484 if Super: 485 h = H+SuperVec*refl[3] 486 else: 487 h = H 483 488 xy = (h[pzone[izone][0]],h[pzone[izone][1]]) 484 489 if Type in ['|DFsq|/sig','|DFsq|>sig','|DFsq|>3sig']: -
trunk/imports/G2phase.py
r1598 r1599 427 427 dlg.Destroy() 428 428 SGlines = G2spc.SGPrint(SGData) 429 for l in SGlines: print l430 429 elif 'qi' in S[:2]: 431 430 if nqi: … … 518 517 Atom = [Name,aType,'',XYZ[0],XYZ[1],XYZ[2],1.0,SytSym,Mult,IA,Uiso] 519 518 Atom += Uij 519 Atom.append(ran.randint(0,sys.maxint)) 520 Atom.append([]) 521 Atom.append([]) 520 522 Atom.append({'SS1':{'waveType':waveType,'crenelType':crenelType,'Sfrac':Sfrac,'Spos':Spos,'Sadp':Sadp,'Smag':Smag}}) #SS2 is for (3+2), etc. 521 Atom.append(ran.randint(0,sys.maxint))522 523 Atoms.append(Atom) 523 524 file2.close() -
trunk/imports/G2sfact.py
r1506 r1599 152 152 break 153 153 self.Super = numCols-9 #= 0,1,2,or 3 154 if self.Super > 1: 155 raise self.ImportException("Supersymmetry too high; GSAS-II limited to (3+1) supersymmetry") 154 156 return True #ColumnValidator(self, filepointer) 155 157 … … 167 169 h,k,l,m1,Fo,sigFo = S.split()[:6] 168 170 h,k,l,m1 = [int(h),int(k),int(l),int(m1)] 169 elif self.Super == 2:170 h,k,l,m1,m2,Fo,sigFo = S.split()[:7]171 h,k,l,m1,m2 = [int(h),int(k),int(l),int(m1),int(m2)]172 elif self.Super == 3:173 h,k,l,m1,m2,m3,Fo,sigFo = S.split()[:8]174 h,k,l,m1,m2,m3 = [int(h),int(k),int(l),int(m1),int(m2),int(m3)]175 171 except ValueError: #skipping text at front 176 172 text = S.split() … … 185 181 elif self.Super == 1: 186 182 self.RefDict['RefList'].append([h,k,l,m1,0,0,Fo,sigFo,0,Fo,0,0,0]) 187 elif self.Super == 2:188 self.RefDict['RefList'].append([h,k,l,m1,m2,0,0,Fo,sigFo,0,Fo,0,0,0])189 elif self.Super == 3:190 self.RefDict['RefList'].append([h,k,l,m1,m2,m3,0,0,Fo,sigFo,0,Fo,0,0,0])191 183 self.errors = 'Error after reading reflections (unexpected!)' 192 184 self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
Note: See TracChangeset
for help on using the changeset viewer.