Changeset 3337


Ignore:
Timestamp:
Apr 6, 2018 9:09:33 AM (4 years ago)
Author:
vondreele
Message:

fixes to MagStructureFactor2use ValidatedTxYctrl? for unit cell input in Unit Cells - useful for trial doubling/halving a cell axis, etc.. Also more robust.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwdGUI.py

    r3264 r3337  
    28472847            controls[6] = controls[7] = controls[8] = value
    28482848            controls[9] = controls[10] = controls[11] = 90.0
    2849             Obj.SetValue("%.5f"%(controls[6]))
     2849            Obj.SetValue(controls[6])
    28502850        elif controls[5] in ['R3-H','P6/mmm','I4/mmm','P4/mmm']:
    28512851            if ObjId == 0:
    28522852                controls[6] = controls[7] = value
    2853                 Obj.SetValue("%.5f"%(controls[6]))
     2853                Obj.SetValue(controls[6])
    28542854            else:
    28552855                controls[8] = value
    2856                 Obj.SetValue("%.5f"%(controls[8]))
     2856                Obj.SetValue(controls[8])
    28572857            controls[9] = controls[10] = controls[11] = 90.0
    28582858            if controls[5] in ['R3-H','P6/mmm']:
     
    28602860        elif controls[5] in ['Fmmm','Immm','Cmmm','Pmmm']:
    28612861            controls[6+ObjId] = value
    2862             Obj.SetValue("%.5f"%(controls[6+ObjId]))
     2862            Obj.SetValue(controls[6+ObjId])
    28632863            controls[9] = controls[10] = controls[11] = 90.0
    28642864        elif controls[5] in ['C2/m','P2/m']:
     
    28662866            if ObjId != 3:
    28672867                controls[6+ObjId] = value
    2868                 Obj.SetValue("%.5f"%(controls[6+ObjId]))
     2868                Obj.SetValue(controls[6+ObjId])
    28692869            else:
    28702870                controls[10] = value
    2871                 Obj.SetValue("%.3f"%(controls[10]))
     2871                Obj.SetValue(controls[10])
    28722872        else:
    28732873            controls[6+ObjId] = value
    28742874            if ObjId < 3:
    2875                 Obj.SetValue("%.5f"%(controls[6+ObjId]))
     2875                Obj.SetValue(controls[6+ObjId])
    28762876            else:
    2877                 Obj.SetValue("%.3f"%(controls[6+ObjId]))
     2877                Obj.SetValue(controls[6+ObjId])
    28782878        controls[12] = G2lat.calc_V(G2lat.cell2A(controls[6:12]))
    28792879        volVal.SetValue("%.3f"%(controls[12]))
     
    29102910            dlg.Destroy()
    29112911       
    2912     def OnCellChange(event):
    2913         event.Skip()
    2914         Obj = event.GetEventObject()
    2915         ObjId = cellList.index(Obj.GetId())
    2916         try:
    2917             value = max(1.0,float(Obj.GetValue()))
    2918         except ValueError:
    2919             if ObjId//2 < 3:               #bad cell edge - reset
    2920                 value = controls[6+ObjId//2]
    2921             else:                       #bad angle
    2922                 value = 90.
    2923         SetCellValue(Obj,ObjId//2,value)
    2924         OnHklShow(event)
     2912    def OnCellChange(invalid,value,tc):
     2913        if invalid:
     2914            return
     2915        OnHklShow(None)
    29252916        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    29262917       
     
    29312922        cell = controls[6:12]
    29322923        A = G2lat.cell2A(cell)
    2933 #        ibrav = bravaisSymb.index(controls[5])
    29342924        spc = controls[13]
    29352925        SGData = G2spc.SpcGroup(spc)[1]
     
    29452935        else:
    29462936            if len(peaks[0]):
    2947 #                dmin = peaks[0][-1][7]
    29482937                G2frame.HKL = G2pwd.getHKLpeak(dmin,SGData,A,Inst)
    29492938                peaks = [G2indx.IndexPeaks(peaks[0],G2frame.HKL)[1],peaks[1]]   #keep esds from peak fit
     
    32113200        'Tetragonal-I','Tetragonal-P','Orthorhombic-F','Orthorhombic-I','Orthorhombic-C',
    32123201        'Orthorhombic-P','Monoclinic-C','Monoclinic-P','Triclinic']
    3213     cellGUIlist = [[[0,1,2],4,zip([" Unit cell: a = "," Vol = "],["%.5f","%.3f"],[True,False],[0,0])],
    3214     [[3,4,5,6],6,zip([" Unit cell: a = "," c = "," Vol = "],["%.5f","%.5f","%.3f"],[True,True,False],[0,2,0])],
    3215     [[7,8,9,10],8,zip([" Unit cell: a = "," b = "," c = "," Vol = "],["%.5f","%.5f","%.5f","%.3f"],
     3202    cellGUIlist = [[[0,1,2],4,zip([" Unit cell: a = "," Vol = "],[(10,5),"%.3f"],[True,False],[0,0])],
     3203    [[3,4,5,6],6,zip([" Unit cell: a = "," c = "," Vol = "],[(10,5),(10,5),"%.3f"],[True,True,False],[0,2,0])],
     3204    [[7,8,9,10],8,zip([" Unit cell: a = "," b = "," c = "," Vol = "],[(10,5),(10,5),(10,5),"%.3f"],
    32163205        [True,True,True,False],[0,1,2,0])],
    32173206    [[11,12],10,zip([" Unit cell: a = "," b = "," c = "," beta = "," Vol = "],
    3218         ["%.5f","%.5f","%.5f","%.3f","%.3f"],[True,True,True,True,False],[0,1,2,4,0])],
     3207        [(10,5),(10,5),(10,5),(10,3),"%.3f"],[True,True,True,True,False],[0,1,2,4,0])],
    32193208    [[13,],8,zip([" Unit cell: a = "," b = "," c = "," Vol = "," alpha = "," beta = "," gamma = "],
    3220         ["%.5f","%.5f","%.5f","%.3f","%.3f","%.3f","%.3f"],
     3209        [(10,5),(10,5),(10,5),"%.3f",(10,3),(10,3),(10,3)],
    32213210        [True,True,True,False,True,True,True],[0,1,2,0,3,4,5])]]
    32223211   
     
    33133302        littleSizer.Add(wx.StaticText(G2frame.dataWindow,label=txt),0,WACV)
    33143303        if ifEdit:          #a,b,c,etc.
    3315 #        azmthOff = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data,'azmthOff',nDig=(10,2),typeHint=float,OnLeave=OnAzmthOff)
    3316             cellVal = wx.TextCtrl(G2frame.dataWindow,value=(fmt%(controls[6+Id])),style=wx.TE_PROCESS_ENTER)
    3317             cellVal.Bind(wx.EVT_TEXT_ENTER,OnCellChange)       
    3318             cellVal.Bind(wx.EVT_KILL_FOCUS,OnCellChange)
     3304            cellVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,controls,6+Id,nDig=fmt,OnLeave=OnCellChange)
    33193305            valSizer = wx.BoxSizer(wx.HORIZONTAL)
    33203306            valSizer.Add(cellVal,0,WACV)
  • trunk/GSASIIstrMath.py

    r3320 r3337  
    792792    SGT = np.array([ops[1] for ops in SGData['SGOps']])
    793793    Ncen = len(SGData['SGCen'])
    794     Nops = len(SGMT)*Ncen*(1+SGData['SGInv'])
     794    Nops = len(SGMT)*Ncen
     795    if not SGData['SGFixed']:
     796        Nops *= (1+SGData['SGInv'])
    795797    MFtables = calcControls['MFtables']
    796798    Amat,Bmat = G2lat.Gmat2AB(G)
     
    858860        MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T   #Nref,Natm
    859861        TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Fdata*Mdata*MF/(2*Nops)     #Nref,Natm
    860         if SGData['SGInv'] and not SGData['SGFixed']:
    861             mphase = np.hstack((phase,-phase))
     862        if SGData['SGInv']:
     863            if not SGData['SGFixed']:
     864                mphase = np.hstack((phase,-phase))  #OK
     865            else:
     866                mphase = phase
    862867        else:
    863             mphase = phase
     868            mphase = phase                    #
    864869        mphase = np.array([mphase+twopi*np.inner(cen,H.T)[:,nxs,nxs] for cen in SGData['SGCen']])
    865870        mphase = np.concatenate(mphase,axis=1)              #Nref,full Nop,Natm
Note: See TracChangeset for help on using the changeset viewer.