Changeset 1599


Ignore:
Timestamp:
Dec 8, 2014 3:58:55 PM (8 years ago)
Author:
vondreele
Message:

rationalize SS, RB & normal atom data; atId is after U23 followed by RB & SS stuff
revise Jana2K imports to have just 3+1 SS only & build atoms as above

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r1598 r1599  
    131131        if generalData['Type'] in ['modulated','magnetic',] and 'Super' not in generalData:
    132132            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]
    134134            generalData['SSGData'] = {}
    135135# end of patches
     
    993993                if Atoms.GetColLabelValue(c) == 'refine':
    994994                    Type = generalData['Type']
    995                     if Type in ['nuclear','macromolecular']:
     995                    if Type in ['nuclear','macromolecular','modulated']:
    996996                        choice = ['F - site fraction','X - coordinates','U - thermal parameters']
    997997                    elif Type in ['magnetic',]:
     
    10771077                    ss = colLabels.index('site sym')
    10781078                    for r in range(Atoms.GetNumberRows()):
    1079                         ID = atomData[r][-1]
     1079                        ID = atomData[r][ui+6]
    10801080                        if parms != atomData[r][c] and Atoms.GetColLabelValue(c) == 'I/A':
    10811081                            if parms == 'A':                #'I' --> 'A'
     
    11021102                        if not Atoms.IsReadOnly(r,c):
    11031103                            if Atoms.GetColLabelValue(c) == 'refine':
    1104                                 rbExcl = rbAtmDict.get(atomData[r][-1],'')
     1104                                rbExcl = rbAtmDict.get(atomData[r][ui+6],'')
    11051105                                if rbExcl:
    11061106                                    for excl in rbExcl:
     
    11211121            r,c =  event.GetRow(),event.GetCol()
    11221122            if r >= 0 and c >= 0:
    1123                 ID = atomData[r][-1]
     1123                ci = colLabels.index('I/A')
     1124                ID = atomData[r][ci+8]
    11241125                if Atoms.GetColLabelValue(c) in ['x','y','z']:
    11251126                    ci = colLabels.index('x')
     
    11751176                            atomData[r][i+colLabels.index('U11')] = value*CSI[1][i]
    11761177                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],''),'')
    11781180                if 'Atoms' in data['Drawing']:
    11791181                    DrawAtomsReplaceByID(data['Drawing'],atomData[r],ID)
     
    11971199                value = Atoms.GetCellValue(r,c)
    11981200                atomData[r][c] = value
    1199                 ID = atomData[r][-1]
     1201                ci = colLabels.index('I/A')
     1202                ID = atomData[r][ci+8]
    12001203                if 'Atoms' in data['Drawing']:
    12011204                    DrawAtomsReplaceByID(data['Drawing'],atomData[r],ID)
     
    12131216                    Atoms.ClearSelection()
    12141217            elif c < 0:                   #only row clicks
     1218                ci = colLabels.index('I/A')
    12151219                if event.ControlDown() and not event.ShiftDown():                   
    12161220                    if r in Atoms.GetSelectedRows():
     
    12271231                        Atoms.SelectRow(row,True)
    12281232                elif event.AltDown() or (event.ShiftDown() and event.ControlDown()):
    1229                     if atomData[r][-1] in rbAtmDict:
     1233                    if atomData[r][ci+8] in rbAtmDict:
    12301234                        G2frame.ErrorDialog('Atom move error','Atoms in rigid bodies can not be moved')
    12311235                        Atoms.frm = -1
     
    12901294                Atoms.SetColSize(i,50)           
    12911295            for row in range(Atoms.GetNumberRows()):
    1292                 atId = atomData[row][-1]
     1296                atId = atomData[row][colIA+8]
    12931297                rbExcl = rbAtmDict.get(atId,'')
    12941298                Atoms.SetReadOnly(row,colSS,True)                         #site sym
     
    13041308                    Atoms.SetCellTextColour(row,colUiso,VERY_LIGHT_GREY)
    13051309                    for i in range(6):
    1306                         ci = colU11+i
    1307                         Atoms.SetCellTextColour(row,ci,BLACK)
    1308                         Atoms.SetCellStyle(row,ci,VERY_LIGHT_GREY,True)
     1310                        cj = colU11+i
     1311                        Atoms.SetCellTextColour(row,cj,BLACK)
     1312                        Atoms.SetCellStyle(row,cj,VERY_LIGHT_GREY,True)
    13091313                        if CSI[2][i] and 'U' not in rbExcl:
    1310                             Atoms.SetCellStyle(row,ci,WHITE,False)
     1314                            Atoms.SetCellStyle(row,cj,WHITE,False)
    13111315                else:
    13121316                    Atoms.SetCellStyle(row,colUiso,WHITE,False)
     
    13151319                        Atoms.SetCellStyle(row,colUiso,VERY_LIGHT_GREY,True)
    13161320                    for i in range(6):
    1317                         ci = colU11+i
    1318                         Atoms.SetCellStyle(row,ci,VERY_LIGHT_GREY,True)
    1319                         Atoms.SetCellTextColour(row,ci,VERY_LIGHT_GREY)
     1321                        cj = colU11+i
     1322                        Atoms.SetCellStyle(row,cj,VERY_LIGHT_GREY,True)
     1323                        Atoms.SetCellTextColour(row,cj,VERY_LIGHT_GREY)
    13201324                if 'X' in rbExcl:
    13211325                    for c in range(0,colX+3):
     
    14091413            atomData.append([Name,El,'',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId])
    14101414        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,[],[],[],[]])
    14121416        SetupGeneral()
    14131417        if 'Atoms' in data['Drawing']:           
     
    14341438        colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())]
    14351439        cx = colLabels.index('x')
     1440        ci = colLabels.index('I/A')
    14361441        indx = Atoms.GetSelectedRows()
    14371442        if len(indx) != 1:
    14381443            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:
    14401445            G2frame.ErrorDialog('Atom move error','Atoms in rigid bodies can not be moved')
    14411446        else:
     
    14431448            SetupGeneral()
    14441449            FillAtomsGrid(Atoms)
    1445             ID = atomData[indx[0]][-1]
     1450            ID = atomData[indx[0]][ci+8]
    14461451            DrawAtomsReplaceByID(data['Drawing'],atomData[indx[0]],ID)
    14471452            G2plt.PlotStructure(G2frame,data)
     
    14621467        generalData = data['General']
    14631468        SGData = generalData['SGData']
    1464         if generalData['Type'] == 'nuclear':
     1469        if generalData['Type'] in ['nuclear','modulated',]:
    14651470            if oldatom:
    14661471                opr = oldatom[5]
     
    15031508                atomData.insert(indx,['UNK','UNK','',x,y,z,1,Sytsym,Mult,'I',0.01,0,0,0,0,0,0,atId])
    15041509            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,[],[],[],[]])
    15061511            SetupGeneral()
    15071512
    15081513    def AtomDelete(event):
     1514        colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())]
     1515        ci = colLabels.index('I/A')
    15091516        indx = Atoms.GetSelectedRows()
    15101517        IDs = []
     
    15141521            for ind in indx:
    15151522                atom = atomData[ind]
    1516                 if atom[-1] in rbAtmDict:
     1523                if atom[ci+8] in rbAtmDict:
    15171524                    G2frame.dataFrame.SetStatusText('**** ERROR - atom is in a rigid body and can not be deleted ****')
    15181525                else:
    1519                     IDs.append(atom[-1])
     1526                    IDs.append(atom[ci+8])
    15201527                    del atomData[ind]
    15211528            if 'Atoms' in data['Drawing']:
     
    15561563            generalData = data['General']
    15571564            colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())]
     1565            ci = colLabels.index('I/A')
    15581566            choices = ['Type','Name','x','y','z','frac','I/A','Uiso']
    15591567            dlg = wx.SingleChoiceDialog(G2frame,'Select','Atom parameter',choices)
     
    15791587                        if 'Atoms' in data['Drawing']:
    15801588                            for r in indx:
    1581                                 ID = atomData[r][-1]
     1589                                ID = atomData[r][ci+8]
    15821590                                DrawAtomsReplaceByID(data['Drawing'],atomData[r],ID)
    15831591                    FillAtomsGrid(Atoms)
     
    19391947            try:
    19401948                idx = atomNames.index(atom[:ct+1])
     1949                atId = atom[cia+8]
    19411950                atomData[idx][:-1] = atom[:-1]
     1951                atomData[idx][cia+8] = atId
    19421952            except ValueError:
    19431953                print atom[:ct+1], 'not in Atom array; not updated'
     
    19531963           
    19541964            def OnWaveType(event):
    1955                 atom[-2][SS]['waveType']=waveType.GetValue()
     1965                atom[-1][SS]['waveType']=waveType.GetValue()
    19561966               
    19571967            atomSizer = wx.BoxSizer(wx.HORIZONTAL)
    19581968            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,
    19601970                style=wx.CB_READONLY|wx.CB_DROPDOWN)
    19611971            waveType.Bind(wx.EVT_COMBOBOX,OnWaveType)
     
    19681978                Obj = event.GetEventObject()
    19691979                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])
    19711981                UpdateWavesData()
    19721982               
     
    19771987                    val = float(Obj.GetValue())
    19781988                except ValueError:
    1979                     val = atomData[iatm][-2][SS][item][iwave][0][ival]
     1989                    val = atomData[iatm][-1][SS][item][iwave][0][ival]
    19801990                Obj.SetValue('%.4f'%val)
    1981                 atomData[iatm][-2][SS][item][iwave][0][ival] = val
     1991                atomData[iatm][-1][SS][item][iwave][0][ival] = val
    19821992               
    19831993            def OnRefWave(event):
    19841994                Obj = event.GetEventObject()
    19851995                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]
    19871997               
    19881998            def OnDelWave(event):
    19891999                Obj = event.GetEventObject()
    19902000                iatm,item,iwave = Indx[Obj.GetId()]
    1991                 del atomData[iatm][-2][SS][item][iwave]
     2001                del atomData[iatm][-1][SS][item][iwave]
    19922002                UpdateWavesData()               
    19932003               
     
    20542064                        if generalData['Type'] == 'modulated' and Stype == 'Smag':
    20552065                            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]))
    20572067                       
    20582068        SetPhaseWindow(G2frame.dataFrame,waveData,mainSizer)
     
    20992109            drawingData['showRigidBodies'] = True
    21002110        cx,ct,cs,ci = [0,0,0,0]
    2101         if generalData['Type'] == 'nuclear':
     2111        if generalData['Type'] in ['nuclear','modulated']:
    21022112            cx,ct,cs,ci = [2,1,6,17]         #x, type, style & index
    21032113        elif generalData['Type'] == 'macromolecular':
  • trunk/GSASIIplot.py

    r1598 r1599  
    427427    Super = Data['Super']
    428428    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])
    432431    FoMax = math.sqrt(FosqMax)
    433432    xlabel = ['k, h=','h, k=','h, l=']
     
    446445        else:
    447446            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)
    449451        HKLF.append([Fosq,sig,Fcsq])
    450452        if H[izone] == Data['Layer']:
     
    479481                    A = (Fosq-Fcsq)/(3*sig)
    480482                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
    483488            xy = (h[pzone[izone][0]],h[pzone[izone][1]])
    484489            if Type in ['|DFsq|/sig','|DFsq|>sig','|DFsq|>3sig']:
  • trunk/imports/G2phase.py

    r1598 r1599  
    427427                    dlg.Destroy()
    428428                SGlines = G2spc.SGPrint(SGData)
    429                 for l in SGlines: print l
    430429            elif 'qi' in S[:2]:
    431430                if nqi:
     
    518517            Atom = [Name,aType,'',XYZ[0],XYZ[1],XYZ[2],1.0,SytSym,Mult,IA,Uiso]
    519518            Atom += Uij
     519            Atom.append(ran.randint(0,sys.maxint))
     520            Atom.append([])
     521            Atom.append([])
    520522            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))
    522523            Atoms.append(Atom)
    523524        file2.close()
  • trunk/imports/G2sfact.py

    r1506 r1599  
    152152                break
    153153        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")           
    154156        return True #ColumnValidator(self, filepointer)
    155157
     
    167169                        h,k,l,m1,Fo,sigFo = S.split()[:6]
    168170                        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)]                       
    175171                except ValueError:  #skipping text at front
    176172                    text = S.split()
     
    185181                elif self.Super == 1:
    186182                    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])
    191183            self.errors = 'Error after reading reflections (unexpected!)'
    192184            self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
Note: See TracChangeset for help on using the changeset viewer.