Changeset 142
- Timestamp:
- Aug 2, 2010 4:12:33 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r135 r142 810 810 SGData = {'SpGrp':'P 1'} 811 811 self.PatternTree.SetItemPyData(sub, \ 812 {'General':[PhaseName,'nuclear',SGData,[False,10.,10.,10.,90.,90.,90,1000.], 813 [False,1.0],[],{},[],[],[]],'Atoms':[]}) 812 {'General':{'Name':'phase name','Type':'nuclear','SGData':SGData,'Cell':[False,10.,10.,10.,90.,90.,90,1000.], 813 'Scale':[False,1.0],'Pawley dmin':0.25},'Atoms':[]}) 814 814 815 815 816 def OnDeletePhase(self,event): … … 1007 1008 dlg.Destroy() 1008 1009 if Phase: 1009 PhaseName = Phase['General'][ 0]1010 PhaseName = Phase['General']['Name'] 1010 1011 if not G2gd.GetPatternTreeItemId(self,self.root,'Phases'): 1011 1012 sub = self.PatternTree.AppendItem(parent=self.root,text='Phases') … … 1028 1029 dlg.Destroy() 1029 1030 if Phase: 1030 PhaseName = Phase['General'][ 0]1031 PhaseName = Phase['General']['Name'] 1031 1032 if not G2gd.GetPatternTreeItemId(self,self.root,'Phases'): 1032 1033 sub = self.PatternTree.AppendItem(parent=self.root,text='Phases') -
trunk/GSASIIIO.py
r113 r142 928 928 Atoms.append(Atom) 929 929 Volume = G2lat.calc_V(G2lat.cell2A(abc+angles)) 930 Phase['General'] = [PhaseName,Ptype,SGData,[False,]+abc+angles+[Volume,],[False,1.0], 931 0,0,0,0,0] 930 Phase['General'] = {'Name':PhaseName,'Type':Ptype,'SGData':SGData,'Cell':[False,]+abc+angles+[Volume,],'Scale':[False,1.0]} 932 931 Phase['Atoms'] = Atoms 933 932 return Phase … … 996 995 else: 997 996 PhaseName = 'None' 998 Phase['General'] = [PhaseName,'macromolecular',SGData,[False,]+cell+[Volume,],[False,1.0], 999 0,0,0,0,0] 997 Phase['General'] = {'Name':PhaseName,'Type':'macromolecular','SGData':SGData,'Cell':[False,]+cell+[Volume,],'Scale':[False,1.0]} 1000 998 Phase['Atoms'] = Atoms 1001 999 -
trunk/GSASIIgrid.py
r136 r142 10 10 import GSASIIphsGUI as G2phG 11 11 12 [ wxID_ATOMSEDITADD, wxID_ATOMSEDITINSERT, 13 ] = [wx.NewId() for _init_coll_Atom_Items in range( 2)]12 [ wxID_ATOMSEDITADD, wxID_ATOMSEDITINSERT, wxID_ATOMSEDITDELETE, 13 ] = [wx.NewId() for _init_coll_Atom_Items in range(3)] 14 14 15 15 [ wxID_IMCALIBRATE, wxID_IMINTEGRATE, wxID_IMCLEARCALIB, wxID_SAVEINTG, … … 39 39 40 40 def _init_coll_AtomsMenu(self,parent): 41 parent.Append(menu=self.AtomEdit, title=' Add atom')41 parent.Append(menu=self.AtomEdit, title='Edit atom list') 42 42 43 43 def _init_coll_IndPeaksMenu(self,parent): … … 63 63 parent.Append(id=wxID_ATOMSEDITINSERT, kind=wx.ITEM_NORMAL,text='Insert empty atom', 64 64 help='Double left click on atom row to Insert before') 65 parent.Append(id=wxID_ATOMSEDITDELETE, kind=wx.ITEM_NORMAL,text='Delete atom', 66 help='Select atoms to delete first') 65 67 66 68 def _init_coll_IndPeaks_Items(self,parent): -
trunk/GSASIIphsGUI.py
r94 r142 12 12 import GSASIIplot as G2plt 13 13 import GSASIIgrid as G2gd 14 import numpy as np 15 import numpy.linalg as nl 14 16 15 17 VERY_LIGHT_GREY = wx.Colour(235,235,235) 18 WHITE = wx.Colour(255,255,255) 16 19 17 20 # trig functions in degrees … … 31 34 def FillGeneralGrid(): 32 35 def SetLatticeParametersStyle(SGData,table): 36 clist = [1,2,3,4,5,6] 33 37 if SGData['SGLaue'] in ['m3','m3m']: 34 38 table[4][2] = table[4][3] = table[4][1] 35 General.SetCellStyle(4,2,"light grey",True)36 General.SetCellStyle(4,3,"light grey",True)37 39 table[4][4] = table[4][5] = table[4][6] = 90. 38 General.SetCellStyle(4,4,"light grey",True) 39 General.SetCellStyle(4,5,"light grey",True) 40 General.SetCellStyle(4,6,"light grey",True) 40 clist = [2,3,4,5,6] 41 41 elif SGData['SGLaue'] in ['3R','3mR']: 42 42 table[4][2] = table[4][3] = table[4][1] 43 General.SetCellStyle(4,2,"light grey",True)44 General.SetCellStyle(4,3,"light grey",True)45 43 table[4][5] = table[4][6] = table[4][4] 46 General.SetCellStyle(4,5,"light grey",True) 47 General.SetCellStyle(4,6,"light grey",True) 44 clist = [2,3,5,6] 48 45 elif SGData['SGLaue'] in ['3','3m1','31m','6/m','6/mmm']: 49 46 table[4][2] = table[4][1] 50 General.SetCellStyle(4,2,"light grey",True)51 47 table[4][4] = table[4][5] = 90. 52 48 table[4][6] = 120. 53 General.SetCellStyle(4,4,"light grey",True) 54 General.SetCellStyle(4,5,"light grey",True) 55 General.SetCellStyle(4,6,"light grey",True) 49 clist = [2,4,5,6] 56 50 elif SGData['SGLaue'] in ['4/m','4/mmm']: 57 51 table[4][2] = table[4][1] 58 General.SetCellStyle(4,2,"light grey",True)59 52 table[4][4] = table[4][5] = table[4][6] = 90. 60 General.SetCellStyle(4,4,"light grey",True) 61 General.SetCellStyle(4,5,"light grey",True) 62 General.SetCellStyle(4,6,"light grey",True) 53 clist = [2,4,5,6] 63 54 elif SGData['SGLaue'] in ['mmm']: 64 55 table[4][4] = table[4][5] = table[4][6] = 90. 65 General.SetCellStyle(4,4,"light grey",True) 66 General.SetCellStyle(4,5,"light grey",True) 67 General.SetCellStyle(4,6,"light grey",True) 56 clist = [4,5,6] 68 57 elif SGData['SGLaue'] in ['2/m']: 69 58 if SGData['SGUniq'] == 'a': 70 59 table[4][5]= table[4][6] = 90. 71 General.SetCellStyle(4,5,"light grey",True) 72 General.SetCellStyle(4,6,"light grey",True) 60 clist = [5,6] 73 61 if SGData['SGUniq'] == 'b': 74 62 table[4][4]= table[4][6] = 90. 75 General.SetCellStyle(4,4,"light grey",True) 76 General.SetCellStyle(4,6,"light grey",True) 63 clist = [4,6] 77 64 if SGData['SGUniq'] == 'c': 78 65 table[4][4]= table[4][5] = 90. 79 General.SetCellStyle(4,4,"light grey",True) 80 General.SetCellStyle(4,5,"light grey",True) 66 clist = [4,5] 67 for c in clist: 68 General.SetCellStyle(4,c,VERY_LIGHT_GREY,True) 81 69 82 70 def RefreshGeneralGrid(event): 83 71 84 72 r,c = event.GetRow(),event.GetCol() 85 generalData[ 0] = table[0][0]86 self.PatternTree.SetItemText(item,generalData[ 0])87 generalData[ 1] = table[1][0]73 generalData['Name'] = table[0][0] 74 self.PatternTree.SetItemText(item,generalData['Name']) 75 generalData['Type'] = table[1][0] 88 76 SpcGp = table[2][0] 89 77 SGErr,SGData = G2spc.SpcGroup(SpcGp) … … 91 79 if SGErr: 92 80 text = [G2spc.SGErrors(SGErr)+'\nSpace Group set to previous'] 93 table[2][0] = generalData[ 2]['SpGrp']81 table[2][0] = generalData['SGData']['SpGrp'] 94 82 msg = 'Space Group Error' 95 83 Style = wx.ICON_EXCLAMATION 96 84 else: 97 85 text = G2spc.SGPrint(SGData) 98 generalData[ 2] = SGData86 generalData[SGData] = SGData 99 87 msg = 'Space Group Information' 100 88 Style = wx.ICON_INFORMATION … … 103 91 Text += line+'\n' 104 92 wx.MessageBox(Text,caption=msg,style=Style) 105 General.SetCellValue(4,0,str(generalData[ 3][0]))93 General.SetCellValue(4,0,str(generalData['Cell'][0])) 106 94 for c in range(1,7): 107 95 General.SetCellStyle(4,c,"white",False) 108 generalData[ 3][c] = float(General.GetCellValue(4,c))109 generalData[ 3][7] = G2lat.calc_V(G2lat.cell2A(generalData[3][1:7]))96 generalData['Cell'][c] = float(General.GetCellValue(4,c)) 97 generalData['Cell'][7] = G2lat.calc_V(G2lat.cell2A(generalData['Cell'][1:7])) 110 98 SetLatticeParametersStyle(SGData,table) 111 generalData[ 4][1] = float(General.GetCellValue(5,1))99 generalData['Scale'][1] = float(General.GetCellValue(5,1)) 112 100 General.ForceRefresh() 113 101 … … 116 104 generalData = data['General'] 117 105 atomData = data['Atoms'] 118 AtomTypes= []119 NoAtoms= {}120 BondRadii= []121 AngleRadii= []122 AtomMass= []106 generalData['AtomTypes'] = [] 107 generalData['NoAtoms'] = {} 108 generalData['BondRadii'] = [] 109 generalData['AngleRadii'] = [] 110 generalData['AtomMass'] = [] 123 111 colType = 1 124 112 colSS = 7 125 113 self.dataFrame.setSizePosLeft([600,350]) 126 if generalData[ 1] =='macromolecular':114 if generalData['Type'] =='macromolecular': 127 115 colType = 4 128 116 colSS = 10 129 117 for atom in atomData: 130 if AtomTypes.count(atom[colType]):131 NoAtoms[atom[colType]] += atom[colSS-1]*atom[colSS+1]118 if generalData['AtomTypes'].count(atom[colType]): 119 generalData['NoAtoms'][atom[colType]] += atom[colSS-1]*atom[colSS+1] 132 120 else: 133 121 Info = G2elem.GetAtomInfo(atom[colType]) 134 AtomTypes.append(Info['Symbol']) 135 BondRadii.append(Info['Drad']) 136 AngleRadii.append(Info['Arad']) 137 AtomMass.append(Info['Mass']) 138 NoAtoms[atom[colType]] = atom[colSS-1]*atom[colSS+1] 139 generalData[5:9] = [AtomTypes,NoAtoms,AtomMass,BondRadii,AngleRadii] 122 generalData['AtomTypes'].append(Info['Symbol']) 123 generalData['BondRadii'].append(Info['Drad']) 124 generalData['AngleRadii'].append(Info['Arad']) 125 generalData['AtomMass'].append(Info['Mass']) 126 generalData['NoAtoms'][atom[colType]] = atom[colSS-1]*atom[colSS+1] 140 127 colLabels = [] 141 colLabels += ['' for i in range(max(8,len(generalData[ 5])))]128 colLabels += ['' for i in range(max(8,len(generalData['AtomTypes'])))] 142 129 table = [] 143 table.append([generalData[ 0],'','','','','','','','']) #phase name144 table.append([generalData[ 1],'','','','','','','','']) #phase type145 E,SGData = G2spc.SpcGroup(generalData[ 2]['SpGrp'])130 table.append([generalData['Name'],'','','','','','','','']) #phase name 131 table.append([generalData['Type'],'','','','','','','','']) #phase type 132 E,SGData = G2spc.SpcGroup(generalData['SGData']['SpGrp']) 146 133 table.append([SGData['SpGrp'],'','','','','','','','']) #space group symbol 147 134 table.append(['refine','a ','b ','c ','alpha ','beta ','gamma','volume ']) 148 table.append(generalData[3]) #lattice parameters 149 table.append([generalData[4][0],generalData[4][1],'','','','','','']) #scale factor 150 table.append(generalData[5]+['' for i in range(max(8,len(generalData[5])))]) #element list 135 table.append(generalData['Cell']) #lattice parameters 136 table.append([generalData['Scale'][0],generalData['Scale'][1],'','','','','','']) #scale factor 151 137 line = [] 152 mass = 0. 153 for i,elem in enumerate(generalData[5]): 154 mass += generalData[6][elem]*generalData[7][i] 155 line.append(generalData[6][elem]) 156 Volume = generalData[3][7] 157 table.append(line+['' for i in range(max(8,len(generalData[5])))]) #No. per cell 158 table.append(generalData[7]+['' for i in range(max(8,len(generalData[5])))]) #At. wt. 159 if generalData[1] == 'macromolecular' and mass > 0.0: 160 table.append(['density',mass/(0.6022137*Volume),'Matthews coeff.',Volume/mass,'','','','','']) 138 if generalData['Type'] == 'Pawley': 139 table.append(max(0.25,generalData['Pawley dmin'])) 140 rowLabels[6] = 'd min' 161 141 else: 162 table.append(['density',mass/(0.6022137*Volume),'','','','','','','']) 163 table.append(generalData[8]+['' for i in range(max(8,len(generalData[5])))]) 164 table.append(generalData[9]+['' for i in range(max(8,len(generalData[5])))]) 165 Types = [wg.GRID_VALUE_STRING for i in range(max(8,len(generalData[5])))] 142 table.append(generalData['AtomTypes']+['' for i in range(max(8,len(generalData['AtomTypes'])))]) #element list 143 mass = 0. 144 for i,elem in enumerate(generalData['AtomTypes']): 145 mass += generalData['NoAtoms'][elem]*generalData['AtomMass'][i] 146 line.append(generalData['NoAtoms'][elem]) 147 Volume = generalData['Cell'][7] 148 table.append(line+['' for i in range(max(8,len(generalData['AtomTypes'])))]) #No. per cell 149 table.append(generalData['AtomMass']+['' for i in range(max(8,len(generalData['AtomTypes'])))]) #At. wt. 150 if generalData['Type'] == 'macromolecular' and mass > 0.0: 151 table.append(['density',mass/(0.6022137*Volume),'Matthews coeff.',Volume/mass,'','','','','']) 152 else: 153 table.append(['density',mass/(0.6022137*Volume),'','','','','','','']) 154 table.append(generalData['BondRadii']+['' for i in range(max(8,len(generalData['AtomTypes'])))]) 155 table.append(generalData['AngleRadii']+['' for i in range(max(8,len(generalData['AtomTypes'])))]) 156 Types = [wg.GRID_VALUE_STRING for i in range(max(8,len(generalData['AtomTypes'])))] 166 157 generalTable = G2gd.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 167 158 General.SetTable(generalTable, True) … … 170 161 General.SetColSize(0,100) 171 162 General.SetColLabelSize(0) 172 for c in range(max(8,len(generalData[ 5]))):163 for c in range(max(8,len(generalData['AtomTypes']))): 173 164 if c > 0: 174 165 General.SetReadOnly(0,c,isReadOnly=True) … … 204 195 205 196 def RefreshAtomGrid(event): 197 198 def chkUij(Uij,CSI): 199 return Uij 200 206 201 r,c = event.GetRow(),event.GetCol() 207 202 if r < 0: #on col label! … … 227 222 self.SelectedRow = r 228 223 elif Atoms.GetColLabelValue(c) in ['x','y','z']: 229 colLabel = Atoms.GetColLabelValue(c) 230 if colLabel == 'x': 231 XYZ = [atomData[r][c],atomData[r][c+1],atomData[r][c+2]] 232 elif colLabel == 'y': 233 XYZ = [atomData[r][c-1],atomData[r][c],atomData[r][c+1]] 234 elif colLabel == 'z': 235 XYZ = [atomData[r][c-2],atomData[r][c-1],atomData[r][c]] 224 ci = colLabels.index('x') 225 XYZ = atomData[r][ci:ci+3] 236 226 if None in XYZ: 237 227 XYZ = [0,0,0] 238 228 SScol = colLabels.index('site sym') 239 229 Mulcol = colLabels.index('mult') 240 E,SGData = G2spc.SpcGroup(generalData[ 2]['SpGrp'])230 E,SGData = G2spc.SpcGroup(generalData['SGData']['SpGrp']) 241 231 Sytsym,Mult = G2spc.SytSym(XYZ,SGData) 242 232 atomData[r][SScol] = Sytsym 243 233 atomData[r][Mulcol] = Mult 244 Atoms.ForceRefresh() 234 if atomData[r][colLabels.index('I/A')] == 'A': 235 ui = colLabels.index('U11') 236 CSI = G2spc.GetCSuinel(Sytsym) 237 atomData[r][ui:ui+6] = chkUij(atomData[r][ui:ui+6],Sytsym) 238 for i in range(6): 239 ci = i+ui 240 Atoms.SetCellStyle(r,ci,VERY_LIGHT_GREY,True) 241 if CSI[2][i]: 242 Atoms.SetCellStyle(r,ci,WHITE,False) 243 elif Atoms.GetColLabelValue(c) == 'I/A': 244 if atomData[r][c] == 'I': 245 Uij = atomData[r][c+2:c+8] 246 atomData[r][c+1] = (Uij[0]+Uij[1]+Uij[2])/3.0 247 atomData[r][c+2:c+8] = [0,0,0,0,0,0] 248 Atoms.SetCellRenderer(r,c+1,wg.GridCellFloatRenderer(10,4)) 249 Atoms.SetCellStyle(r,c+1,WHITE,False) 250 for i in range(6): 251 ci = i+colLabels.index('U11') 252 Atoms.SetCellRenderer(r,ci,wg.GridCellStringRenderer()) 253 Atoms.SetCellValue(r,ci,'') 254 Atoms.SetCellStyle(r,ci,VERY_LIGHT_GREY,True) 255 else: 256 Uiso = atomData[r][c+1] 257 atomData[r][c+1] = '' 258 CSI = G2spc.GetCSuinel(atomData[r][colLabels.index('site sym')]) 259 atomData[r][c+2:c+8] = Uiso*np.array(CSI[3]) 260 Atoms.SetCellRenderer(r,c+1,wg.GridCellStringRenderer()) 261 Atoms.SetCellStyle(r,c+1,VERY_LIGHT_GREY,True) 262 for i in range(6): 263 ci = i+colLabels.index('U11') 264 Atoms.SetCellRenderer(r,ci,wg.GridCellFloatRenderer(10,4)) 265 Atoms.SetCellStyle(r,ci,VERY_LIGHT_GREY,True) 266 if CSI[2][i]: 267 Atoms.SetCellStyle(r,ci,WHITE,False) 268 elif Atoms.GetColLabelValue(c) in ['U11','U22','U33','U12','U13','U23']: 269 CSI = G2spc.GetCSuinel(atomData[r][colLabels.index('site sym')]) 270 value = atomData[r][c] 271 iUij = CSI[0][c-colLabels.index('U11')] 272 for i in range(6): 273 if iUij == CSI[0][i]: 274 atomData[r][i+colLabels.index('U11')] = value*CSI[1][i] 245 275 246 276 def AtomTypeSelect(event): … … 258 288 atomData = data['Atoms'] 259 289 Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,wg.GRID_VALUE_CHOICE+": ,X,XU,U,F,FX,FXU,FU", 260 wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_FLOAT+':10,5', 261 wg.GRID_VALUE_ FLOAT+':10,4',wg.GRID_VALUE_STRING,wg.GRID_VALUE_NUMBER,wg.GRID_VALUE_CHOICE+":I,A",262 wg.GRID_VALUE_FLOAT+':10,4', 263 wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,4', 290 wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_FLOAT+':10,5',wg.GRID_VALUE_FLOAT+':10,4', #x,y,z,frac 291 wg.GRID_VALUE_STRING,wg.GRID_VALUE_NUMBER,wg.GRID_VALUE_CHOICE+":I,A", 292 wg.GRID_VALUE_FLOAT+':10,4', #Uiso 293 wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,4', #Uij 264 294 wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,4'] 265 295 colLabels = ['Name','Type','refine','x','y','z','frac','site sym','mult','I/A','Uiso','U11','U22','U33','U12','U13','U23'] 266 if generalData[ 1] == 'magnetic':296 if generalData['Type'] == 'magnetic': 267 297 colLabels += ['Mx','My','Mz'] 268 298 Types[2] = wg.GRID_VALUE_CHOICE+": ,X,XU,U,M,MX,MXU,MU,F,FX,FXU,FU,FM,FMX,FMU," 269 299 Types += [ 270 300 wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,4'] 271 elif generalData[ 1] == 'macromolecular':301 elif generalData['Type'] == 'macromolecular': 272 302 colLabels = ['res no','residue','chain'] + colLabels 273 303 Types = [wg.GRID_VALUE_NUMBER, … … 295 325 for i in range(2,8): 296 326 Atoms.SetCellRenderer(row,colIA+i,wg.GridCellStringRenderer()) 297 Atoms.SetReadOnly(row,colIA+i,isReadOnly=True)298 327 Atoms.SetCellValue(row,colIA+i,'') 328 Atoms.SetCellStyle(row,colIA+i,VERY_LIGHT_GREY,True) 299 329 elif Atoms.GetCellValue(row,colIA) == 'A': 330 CSI = G2spc.GetCSuinel(atomData[row][colLabels.index('site sym')]) 300 331 Atoms.SetCellRenderer(row,colIA+1,wg.GridCellStringRenderer()) 301 Atoms.Set ReadOnly(row,colIA+1,isReadOnly=True)332 Atoms.SetCellStyle(row,colIA+1,VERY_LIGHT_GREY,True) 302 333 Atoms.SetCellValue(row,colIA+1,'') 303 334 for i in range(6): 335 ci = colIA+i+2 336 Atoms.SetCellStyle(row,ci,VERY_LIGHT_GREY,True) 337 if CSI[2][i]: 338 Atoms.SetCellStyle(row,ci,WHITE,False) 339 304 340 def AtomAdd(event): 305 341 atomData = data['Atoms'] 306 342 generalData = data['General'] 307 343 Ncol = Atoms.GetNumberCols() 308 if generalData[1] == 'macromolecular': 309 atomData.append([0,'UNK','','UNK','UNK','',0,0,0,0,'',0,'I',0.10,0,0,0,0,0,0]) 310 elif generalData[1] == 'nuclear': 311 atomData.append(['UNK','UNK','',0,0,0,0,'',0,'I',0.01,0,0,0,0,0,0]) 344 E,SGData = G2spc.SpcGroup(generalData['SGData']['SpGrp']) 345 Sytsym,Mult = G2spc.SytSym([0,0,0],SGData) 346 if generalData['Type'] == 'macromolecular': 347 atomData.append([0,'UNK','','UNK','UNK',Sytsym,Mult,0,0,1,'',0,'I',0.10,0,0,0,0,0,0]) 348 elif generalData['Type'] == 'nuclear': 349 atomData.append(['UNK','UNK','',0,0,0,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0]) 350 elif generalData['Type'] == 'magnetic': 351 atomData.append(['UNK','UNK','',0,0,0,1,Sytsym,Mult,0,'I',0.01,0,0,0,0,0,0,0,0,0]) 352 FillAtomsGrid() 312 353 event.StopPropagation() 313 FillAtomsGrid()314 354 315 355 def AtomInsert(event): 316 atomData = data['Atoms'] 317 generalData = data['General'] 318 Ncol = Atoms.GetNumberCols() 319 if generalData[1][0] == 'macromolecular': 320 atomData.append([0,'UNK','','UNK','UNK','',0,0,0,0,'',0,'I',0.10,0,0,0,0,0,0]) 321 elif generalData[1][0] == 'nuclear': 322 atomData.append(['UNK','UNK','',0,0,0,0,'',0,'I',0.01,0,0,0,0,0,0]) 356 indx = Atoms.GetSelectedRows() 357 if indx: 358 indx = indx[0] 359 atomData = data['Atoms'] 360 generalData = data['General'] 361 Ncol = Atoms.GetNumberCols() 362 E,SGData = G2spc.SpcGroup(generalData['SGData']['SpGrp']) 363 Sytsym,Mult = G2spc.SytSym([0,0,0],SGData) 364 if generalData['Type'] == 'macromolecular': 365 atomData.insert(indx,[0,'UNK','','UNK','UNK',Sytsym,Mult,0,0,1,'',0,'I',0.10,0,0,0,0,0,0]) 366 elif generalData['Type'] == 'nuclear': 367 atomData.insert(indx,['UNK','UNK','',0,0,0,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0]) 368 elif generalData['Type'] == 'magnetic': 369 atomData.insert(indx,['UNK','UNK','',0,0,0,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,0,0,0]) 370 FillAtomsGrid() 323 371 event.StopPropagation() 324 FillAtomsGrid() 372 373 def AtomDelete(event): 374 indx = Atoms.GetSelectedRows() 375 if indx: 376 atomData = data['Atoms'] 377 indx.reverse() 378 for ind in indx: 379 del atomData[ind] 380 FillAtomsGrid() 381 event.StopPropagation() 325 382 326 383 def UpdateDrawing(): … … 328 385 329 386 def FillPawleyReflectionsGrid(): 387 generalData = data['General'] 330 388 331 389 print 'Pawley reflections' … … 338 396 self.dataFrame.Bind(wx.EVT_MENU, AtomAdd, id=G2gd.wxID_ATOMSEDITADD) 339 397 self.dataFrame.Bind(wx.EVT_MENU, AtomInsert, id=G2gd.wxID_ATOMSEDITINSERT) 398 self.dataFrame.Bind(wx.EVT_MENU, AtomDelete, id=G2gd.wxID_ATOMSEDITDELETE) 340 399 FillAtomsGrid() 341 400 else: … … 355 414 356 415 GeneralData = data['General'] 357 if GeneralData[ 3] == 'Pawley':416 if GeneralData['Type'] == 'Pawley': 358 417 PawleyRefl = G2gd.GSGrid(parent=self.dataDisplay) 359 418 self.dataDisplay.AddPage(PawleyRefl,'Pawley reflections') 360 FillPawleyReflectionsGrid()361 419 else: 362 420 Atoms = G2gd.GSGrid(parent=self.dataDisplay) 363 FillAtomsGrid()364 421 self.dataDisplay.AddPage(Atoms,'Atoms') 365 366 Drawing = wx.Window(parent=self.dataDisplay) 367 self.dataDisplay.AddPage(Drawing,'Drawing') 422 Drawing = wx.Window(parent=self.dataDisplay) 423 self.dataDisplay.AddPage(Drawing,'Drawing') 368 424 369 425 self.dataDisplay.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, OnPageChanged) -
trunk/GSASIIspc.py
r102 r142 409 409 410 410 def GetCSuinel(siteSym): 411 # returns Uij terms, multipliers, GUI flags & Uiso2Uij multipliers 411 412 CSuinel = [[], # 0th empty - indices are Fortran style 412 [[1,1,1,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0] ], # A A A 0 0 0413 [[1,1,2,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0] ], # A A C 0 0 0414 [[1,2,1,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0] ], # A B A 0 0 0415 [[1,2,2,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0] ], # A B B 0 0 0416 [[1,1,1,2,2,2],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ], # A A A D D D417 [[1,1,1,2,2,2],[ 1.0, 1.0, 1.0, 1.0,-1.0,-1.0] ], # A A A D -D -D418 [[1,1,1,2,2,2],[ 1.0, 1.0, 1.0, 1.0,-1.0, 1.0] ], # A A A D -D D419 [[1,1,1,2,2,2],[ 1.0, 1.0, 1.0, 1.0, 1.0,-1.0] ], # A A A D D -D420 [[1,1,2,1,0,0],[ 1.0, 1.0, 1.0, 0.5, 0.0, 0.0] ], # A A C A/2 0 0421 [[1,2,3,0,0, ],[ 1.0, 1.0, 1.0, 0.0, 0.0,0.0]], # A B C 0 0 0422 [[1,1,2,3,0, ],[ 1.0, 1.0, 1.0, 1.0, 0.0,0.0]], # A A C D 0 0423 [[1,2,1,0,3, ],[ 1.0, 1.0, 1.0, 0.0, 1.0,0.0]], # A B A 0 E 0424 [[1,2,2,0,0, ],[ 1.0, 1.0, 1.0, 0.0, 0.0, 1.0]], # A B B 0 0 F425 [[1,2,3,2,0, ],[ 1.0, 1.0, 1.0, 0.5, 0.0,0.0]], # A B C B/2 0 0426 [[1,2,3,1,0, ],[ 1.0, 1.0, 1.0, 0.5, 0.0,0.0]], # A B C A/2 0 0427 [[1,2,3,4,0, ],[ 1.0, 1.0, 1.0, 1.0, 0.0,0.0]], # A B C D 0 0428 [[1,2,3,0,4, ],[ 1.0, 1.0, 1.0, 0.0, 1.0,0.0]], # A B C 0 E 0429 [[1,2,3,0,0, ],[ 1.0, 1.0, 1.0, 0.0, 0.0, 1.0]], # A B C 0 0 F430 [[1,1,2,3,4, ],[ 1.0, 1.0, 1.0, 1.0, 1.0,-1.0]], # A A C D E -E431 [[1,1,2,3,4, ],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]], # A A C D E E432 [[1,2,1,3,4, ],[ 1.0, 1.0, 1.0, 1.0, 1.0,-1.0]], # A B A D E -D433 [[1,2,1,3,4, ],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]], # A B A D E D434 [[1,2,2,3,3, ],[ 1.0, 1.0, 1.0, 1.0,-1.0, 1.0]], # A B B D -D F435 [[1,2,2,3,3, ],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]], # A B B D D F436 [[1,2,3,2,4, ],[ 1.0, 1.0, 1.0, 0.5, 0.5, 1.0]], # A B C B/2 F/2 F437 [[1,2,3,1,0, ],[ 1.0, 1.0, 1.0, 0.5, 0.0, 1.0]], # A B C A/2 0 F438 [[1,2,3,2,4, ],[ 1.0, 1.0, 1.0, 0.5, 1.0,0.0]], # A B C B/2 E 0439 [[1,2,3,1,4, ],[ 1.0, 1.0, 1.0, 0.5, 1.0, 0.5]], # A B C A/2 E E/2440 [[1,2,3,4,5, ],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]], # A B C D E F413 [[1,1,1,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0],[1,0,0,0,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A A A 0 0 0 414 [[1,1,2,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0],[1,0,1,0,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A A C 0 0 0 415 [[1,2,1,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0],[1,1,0,0,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B A 0 0 0 416 [[1,2,2,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0],[1,1,0,0,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B B 0 0 0 417 [[1,1,1,2,2,2],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],[1,0,0,1,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A A A D D D 418 [[1,1,1,2,2,2],[ 1.0, 1.0, 1.0, 1.0,-1.0,-1.0],[1,0,0,1,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A A A D -D -D 419 [[1,1,1,2,2,2],[ 1.0, 1.0, 1.0, 1.0,-1.0, 1.0],[1,0,0,1,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A A A D -D D 420 [[1,1,1,2,2,2],[ 1.0, 1.0, 1.0, 1.0, 1.0,-1.0],[1,0,0,1,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A A A D D -D 421 [[1,1,2,1,0,0],[ 1.0, 1.0, 1.0, 0.5, 0.0, 0.0],[1,0,1,0,0,0],[1.0,1.0,1.0,0.5,0.0,0.0]], # A A C A/2 0 0 422 [[1,2,3,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0],[1,1,1,0,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B C 0 0 0 423 [[1,1,2,3,0,0],[ 1.0, 1.0, 1.0, 1.0, 0.0, 0.0],[1,0,1,1,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A A C D 0 0 424 [[1,2,1,0,3,0],[ 1.0, 1.0, 1.0, 0.0, 1.0, 0.0],[1,1,0,0,1,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B A 0 E 0 425 [[1,2,2,0,0,3],[ 1.0, 1.0, 1.0, 0.0, 0.0, 1.0],[1,1,0,0,0,1],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B B 0 0 F 426 [[1,2,3,2,0,0],[ 1.0, 1.0, 1.0, 0.5, 0.0, 0.0],[1,1,1,0,0,0],[1.0,1.0,1.0,0.0,0.5,0.0]], # A B C B/2 0 0 427 [[1,2,3,1,0,0],[ 1.0, 1.0, 1.0, 0.5, 0.0, 0.0],[1,1,1,0,0,0],[1.0,1.0,1.0,0.0,0.5,0.0]], # A B C A/2 0 0 428 [[1,2,3,4,0,0],[ 1.0, 1.0, 1.0, 1.0, 0.0, 0.0],[1,1,1,1,0,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B C D 0 0 429 [[1,2,3,0,4,0],[ 1.0, 1.0, 1.0, 0.0, 1.0, 0.0],[1,1,1,0,1,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B C 0 E 0 430 [[1,2,3,0,0,4],[ 1.0, 1.0, 1.0, 0.0, 0.0, 1.0],[1,1,1,0,0,1],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B C 0 0 F 431 [[1,1,2,3,4,4],[ 1.0, 1.0, 1.0, 1.0, 1.0,-1.0],[1,0,1,1,1,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A A C D E -E 432 [[1,1,2,3,4,4],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],[1,0,1,1,1,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A A C D E E 433 [[1,2,1,3,4,3],[ 1.0, 1.0, 1.0, 1.0, 1.0,-1.0],[1,1,0,1,1,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B A D E -D 434 [[1,2,1,3,4,3],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],[1,1,0,1,1,0],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B A D E D 435 [[1,2,2,3,3,4],[ 1.0, 1.0, 1.0, 1.0,-1.0, 1.0],[1,1,0,1,0,1],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B B D -D F 436 [[1,2,2,3,3,4],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],[1,1,0,1,0,1],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B B D D F 437 [[1,2,3,2,4,4],[ 1.0, 1.0, 1.0, 0.5, 0.5, 1.0],[1,1,1,0,0,1],[1.0,1.0,1.0,0.5,0.0,0.0]], # A B C B/2 F/2 F 438 [[1,2,3,1,0,4],[ 1.0, 1.0, 1.0, 0.5, 0.0, 1.0],[1,1,1,0,0,1],[1.0,1.0,1.0,0.5,0.0,0.0]], # A B C A/2 0 F 439 [[1,2,3,2,4,0],[ 1.0, 1.0, 1.0, 0.5, 1.0, 0.0],[1,1,1,0,1,0],[1.0,1.0,1.0,0.5,0.0,0.0]], # A B C B/2 E 0 440 [[1,2,3,1,4,4],[ 1.0, 1.0, 1.0, 0.5, 1.0, 0.5],[1,1,1,0,1,0],[1.0,1.0,1.0,0.5,0.0,0.0]], # A B C A/2 E E/2 441 [[1,2,3,4,5,6],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],[1,1,1,1,1,1],[1.0,1.0,1.0,0.0,0.0,0.0]], # A B C D E F 441 442 ] 442 443 indx = GetNXUPQsym(siteSym)
Note: See TracChangeset
for help on using the changeset viewer.