Changeset 142


Ignore:
Timestamp:
Aug 2, 2010 4:12:33 PM (13 years ago)
Author:
vondreel
Message:

major refactor of phase editing, EXP & PDB import
replace "general" list with dictionary,
make Uij obey site symmetry for user access

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r135 r142  
    810810        SGData = {'SpGrp':'P 1'}
    811811        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
    814815       
    815816    def OnDeletePhase(self,event):
     
    10071008                dlg.Destroy()
    10081009            if Phase:
    1009                 PhaseName = Phase['General'][0]
     1010                PhaseName = Phase['General']['Name']
    10101011                if not G2gd.GetPatternTreeItemId(self,self.root,'Phases'):
    10111012                    sub = self.PatternTree.AppendItem(parent=self.root,text='Phases')
     
    10281029                dlg.Destroy()
    10291030            if Phase:
    1030                 PhaseName = Phase['General'][0]
     1031                PhaseName = Phase['General']['Name']
    10311032                if not G2gd.GetPatternTreeItemId(self,self.root,'Phases'):
    10321033                    sub = self.PatternTree.AppendItem(parent=self.root,text='Phases')
  • trunk/GSASIIIO.py

    r113 r142  
    928928                Atoms.append(Atom)
    929929    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]}
    932931    Phase['Atoms'] = Atoms
    933932    return Phase
     
    996995    else:
    997996        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]}
    1000998    Phase['Atoms'] = Atoms
    1001999   
  • trunk/GSASIIgrid.py

    r136 r142  
    1010import GSASIIphsGUI as G2phG
    1111
    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)]
    1414
    1515[ wxID_IMCALIBRATE, wxID_IMINTEGRATE, wxID_IMCLEARCALIB, wxID_SAVEINTG,
     
    3939       
    4040    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')
    4242
    4343    def _init_coll_IndPeaksMenu(self,parent):
     
    6363        parent.Append(id=wxID_ATOMSEDITINSERT, kind=wx.ITEM_NORMAL,text='Insert empty atom',
    6464            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')
    6567           
    6668    def _init_coll_IndPeaks_Items(self,parent):
  • trunk/GSASIIphsGUI.py

    r94 r142  
    1212import GSASIIplot as G2plt
    1313import GSASIIgrid as G2gd
     14import numpy as np
     15import numpy.linalg as nl
    1416
    1517VERY_LIGHT_GREY = wx.Colour(235,235,235)
     18WHITE = wx.Colour(255,255,255)
    1619
    1720# trig functions in degrees
     
    3134    def FillGeneralGrid():
    3235        def SetLatticeParametersStyle(SGData,table):
     36            clist = [1,2,3,4,5,6]
    3337            if SGData['SGLaue'] in ['m3','m3m']:
    3438                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)
    3739                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]
    4141            elif SGData['SGLaue'] in ['3R','3mR']:
    4242                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)
    4543                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]
    4845            elif SGData['SGLaue'] in ['3','3m1','31m','6/m','6/mmm']:
    4946                table[4][2] = table[4][1]
    50                 General.SetCellStyle(4,2,"light grey",True)
    5147                table[4][4] = table[4][5] = 90.
    5248                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]
    5650            elif SGData['SGLaue'] in ['4/m','4/mmm']:
    5751                table[4][2] = table[4][1]
    58                 General.SetCellStyle(4,2,"light grey",True)
    5952                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]
    6354            elif SGData['SGLaue'] in ['mmm']:
    6455                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]
    6857            elif SGData['SGLaue'] in ['2/m']:
    6958                if SGData['SGUniq'] == 'a':
    7059                    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]
    7361                if SGData['SGUniq'] == 'b':
    7462                    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]
    7764                if SGData['SGUniq'] == 'c':
    7865                    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)               
    8169           
    8270        def RefreshGeneralGrid(event):
    8371               
    8472            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]
    8876            SpcGp = table[2][0]
    8977            SGErr,SGData = G2spc.SpcGroup(SpcGp)
     
    9179                if SGErr:
    9280                    text = [G2spc.SGErrors(SGErr)+'\nSpace Group set to previous']
    93                     table[2][0] = generalData[2]['SpGrp']
     81                    table[2][0] = generalData['SGData']['SpGrp']
    9482                    msg = 'Space Group Error'
    9583                    Style = wx.ICON_EXCLAMATION
    9684                else:
    9785                    text = G2spc.SGPrint(SGData)
    98                     generalData[2] = SGData
     86                    generalData[SGData] = SGData
    9987                    msg = 'Space Group Information'
    10088                    Style = wx.ICON_INFORMATION
     
    10391                    Text += line+'\n'
    10492                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]))
    10694            for c in range(1,7):
    10795                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]))
    11098            SetLatticeParametersStyle(SGData,table)
    111             generalData[4][1] = float(General.GetCellValue(5,1))
     99            generalData['Scale'][1] = float(General.GetCellValue(5,1))
    112100            General.ForceRefresh()
    113101                       
     
    116104        generalData = data['General']
    117105        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'] = []
    123111        colType = 1
    124112        colSS = 7
    125113        self.dataFrame.setSizePosLeft([600,350])
    126         if generalData[1] =='macromolecular':
     114        if generalData['Type'] =='macromolecular':
    127115            colType = 4
    128116            colSS = 10
    129117        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]
    132120            else:
    133121                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]
    140127        colLabels = []
    141         colLabels += ['' for i in range(max(8,len(generalData[5])))]
     128        colLabels += ['' for i in range(max(8,len(generalData['AtomTypes'])))]
    142129        table = []
    143         table.append([generalData[0],'','','','','','','',''])      #phase name
    144         table.append([generalData[1],'','','','','','','',''])      #phase type
    145         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'])
    146133        table.append([SGData['SpGrp'],'','','','','','','',''])     #space group symbol
    147134        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
    151137        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'
    161141        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'])))]
    166157        generalTable = G2gd.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types)
    167158        General.SetTable(generalTable, True)
     
    170161        General.SetColSize(0,100)
    171162        General.SetColLabelSize(0)
    172         for c in range(max(8,len(generalData[5]))):
     163        for c in range(max(8,len(generalData['AtomTypes']))):
    173164            if c > 0:
    174165                General.SetReadOnly(0,c,isReadOnly=True)
     
    204195       
    205196        def RefreshAtomGrid(event):
     197           
     198            def chkUij(Uij,CSI):
     199                return Uij
     200               
    206201            r,c =  event.GetRow(),event.GetCol()
    207202            if r < 0:                          #on col label!
     
    227222                self.SelectedRow = r
    228223            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]
    236226                if None in XYZ:
    237227                    XYZ = [0,0,0]
    238228                SScol = colLabels.index('site sym')
    239229                Mulcol = colLabels.index('mult')
    240                 E,SGData = G2spc.SpcGroup(generalData[2]['SpGrp'])
     230                E,SGData = G2spc.SpcGroup(generalData['SGData']['SpGrp'])
    241231                Sytsym,Mult = G2spc.SytSym(XYZ,SGData)
    242232                atomData[r][SScol] = Sytsym
    243233                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]               
    245275                   
    246276        def AtomTypeSelect(event):
     
    258288        atomData = data['Atoms']
    259289        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
    264294            wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_FLOAT+':10,4']
    265295        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':
    267297            colLabels += ['Mx','My','Mz']
    268298            Types[2] = wg.GRID_VALUE_CHOICE+": ,X,XU,U,M,MX,MXU,MU,F,FX,FXU,FU,FM,FMX,FMU,"
    269299            Types += [
    270300                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':
    272302            colLabels = ['res no','residue','chain'] + colLabels
    273303            Types = [wg.GRID_VALUE_NUMBER,
     
    295325                for i in range(2,8):
    296326                    Atoms.SetCellRenderer(row,colIA+i,wg.GridCellStringRenderer())
    297                     Atoms.SetReadOnly(row,colIA+i,isReadOnly=True)
    298327                    Atoms.SetCellValue(row,colIA+i,'')
     328                    Atoms.SetCellStyle(row,colIA+i,VERY_LIGHT_GREY,True)
    299329            elif Atoms.GetCellValue(row,colIA) == 'A':
     330                CSI = G2spc.GetCSuinel(atomData[row][colLabels.index('site sym')])
    300331                Atoms.SetCellRenderer(row,colIA+1,wg.GridCellStringRenderer())
    301                 Atoms.SetReadOnly(row,colIA+1,isReadOnly=True)
     332                Atoms.SetCellStyle(row,colIA+1,VERY_LIGHT_GREY,True)
    302333                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                           
    304340    def AtomAdd(event):
    305341        atomData = data['Atoms']
    306342        generalData = data['General']
    307343        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()           
    312353        event.StopPropagation()
    313         FillAtomsGrid()
    314354           
    315355    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()           
    323371        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()
    325382       
    326383    def UpdateDrawing():
     
    328385       
    329386    def FillPawleyReflectionsGrid():
     387        generalData = data['General']
    330388       
    331389        print 'Pawley reflections'
     
    338396            self.dataFrame.Bind(wx.EVT_MENU, AtomAdd, id=G2gd.wxID_ATOMSEDITADD)
    339397            self.dataFrame.Bind(wx.EVT_MENU, AtomInsert, id=G2gd.wxID_ATOMSEDITINSERT)
     398            self.dataFrame.Bind(wx.EVT_MENU, AtomDelete, id=G2gd.wxID_ATOMSEDITDELETE)
    340399            FillAtomsGrid()           
    341400        else:
     
    355414     
    356415    GeneralData = data['General']
    357     if GeneralData[3] == 'Pawley':
     416    if GeneralData['Type'] == 'Pawley':
    358417        PawleyRefl = G2gd.GSGrid(parent=self.dataDisplay)
    359418        self.dataDisplay.AddPage(PawleyRefl,'Pawley reflections')
    360         FillPawleyReflectionsGrid()
    361419    else:
    362420        Atoms = G2gd.GSGrid(parent=self.dataDisplay)
    363         FillAtomsGrid()
    364421        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')
    368424   
    369425    self.dataDisplay.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, OnPageChanged)
  • trunk/GSASIIspc.py

    r102 r142  
    409409   
    410410def GetCSuinel(siteSym):
     411    # returns Uij terms, multipliers, GUI flags & Uiso2Uij multipliers
    411412    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  0
    413         [[1,1,2,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0]],    #  A  A  C  0  0  0
    414         [[1,2,1,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0]],    #  A  B  A  0  0  0
    415         [[1,2,2,0,0,0],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0]],    #  A  B  B  0  0  0
    416         [[1,1,1,2,2,2],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]],    #  A  A  A  D  D  D
    417         [[1,1,1,2,2,2],[ 1.0, 1.0, 1.0, 1.0,-1.0,-1.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]],    #  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]],    #  A  A  A  D  D -D
    420         [[1,1,2,1,0,0],[ 1.0, 1.0, 1.0, 0.5, 0.0, 0.0]],    #  A  A  C A/2 0  0
    421         [[1,2,3,0,0,],[ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0]],    #  A  B  C  0  0  0
    422         [[1,1,2,3,0,],[ 1.0, 1.0, 1.0, 1.0, 0.0, 0.0]],    #  A  A  C  D  0  0
    423         [[1,2,1,0,3,],[ 1.0, 1.0, 1.0, 0.0, 1.0, 0.0]],    #  A  B  A  0  E  0
    424         [[1,2,2,0,0,],[ 1.0, 1.0, 1.0, 0.0, 0.0, 1.0]],    #  A  B  B  0  0  F
    425         [[1,2,3,2,0,],[ 1.0, 1.0, 1.0, 0.5, 0.0, 0.0]],    #  A  B  C B/2 0  0
    426         [[1,2,3,1,0,],[ 1.0, 1.0, 1.0, 0.5, 0.0, 0.0]],    #  A  B  C A/2 0  0
    427         [[1,2,3,4,0,],[ 1.0, 1.0, 1.0, 1.0, 0.0, 0.0]],    #  A  B  C  D  0  0
    428         [[1,2,3,0,4,],[ 1.0, 1.0, 1.0, 0.0, 1.0, 0.0]],    #  A  B  C  0  E  0
    429         [[1,2,3,0,0,],[ 1.0, 1.0, 1.0, 0.0, 0.0, 1.0]],    #  A  B  C  0  0  F
    430         [[1,1,2,3,4,],[ 1.0, 1.0, 1.0, 1.0, 1.0,-1.0]],    #  A  A  C  D  E -E
    431         [[1,1,2,3,4,],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]],    #  A  A  C  D  E  E
    432         [[1,2,1,3,4,],[ 1.0, 1.0, 1.0, 1.0, 1.0,-1.0]],    #  A  B  A  D  E -D
    433         [[1,2,1,3,4,],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]],    #  A  B  A  D  E  D
    434         [[1,2,2,3,3,],[ 1.0, 1.0, 1.0, 1.0,-1.0, 1.0]],    #  A  B  B  D -D  F
    435         [[1,2,2,3,3,],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]],    #  A  B  B  D  D  F
    436         [[1,2,3,2,4,],[ 1.0, 1.0, 1.0, 0.5, 0.5, 1.0]],    #  A  B  C B/2 F/2 F
    437         [[1,2,3,1,0,],[ 1.0, 1.0, 1.0, 0.5, 0.0, 1.0]],    #  A  B  C A/2  0  F
    438         [[1,2,3,2,4,],[ 1.0, 1.0, 1.0, 0.5, 1.0, 0.0]],    #  A  B  C B/2  E  0
    439         [[1,2,3,1,4,],[ 1.0, 1.0, 1.0, 0.5, 1.0, 0.5]],    #  A  B  C A/2  E E/2
    440         [[1,2,3,4,5,],[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]],    #  A  B  C  D  E   F
     413        [[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
    441442        ]
    442443    indx = GetNXUPQsym(siteSym)
Note: See TracChangeset for help on using the changeset viewer.