Changeset 3258


Ignore:
Timestamp:
Feb 4, 2018 12:34:11 AM (5 years ago)
Author:
toby
Message:

Apply Dij values to lattice constants

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3256 r3258  
    51665166        self.DataEdit.Append(G2G.wxID_HKLFADD,'Add single crystal histograms','Select new single crystal histograms to be used for this phase')
    51675167        self.DataEdit.Append(G2G.wxID_DATADELETE,'Remove histograms','Remove histograms from use for this phase')
     5168        G2G.Define_wxId('wxID_DATADIJ')
     5169        self.DataEdit.Append(G2G.wxID_DATADIJ,'Apply Strain to Lattice Constants',
     5170                             'Shift cell by Dij of selected histogram')
    51685171        self.PostfillDataMenu()
    51695172           
     
    64656468        Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree()
    64666469        for phase in Phases:
    6467             print('Updating {} from histogram {}'.format(phase,histNames[sel]))
     6470            print('Updating {} from Seq. Ref. row {}'.format(phase,histNames[sel]))
    64686471            Phase = Phases[phase]
    64696472            General = Phase['General']
     
    64736476            pId = Phase['pId']
    64746477            pfx = str(pId)+'::'
    6475             if cell[0]:
    6476                 A,sigA = G2stIO.cellFill(pfx,SGData,parmDict,{})
    6477                 cell[1:7] = G2lat.A2cell(A)
    6478                 cell[7] = G2lat.calc_V(A)
     6478            # there should not be any changes to the cell because those terms are not refined
     6479            A,sigA = G2stIO.cellFill(pfx,SGData,parmDict,{})
     6480            cell[1:7] = G2lat.A2cell(A)
     6481            cell[7] = G2lat.calc_V(A)
    64796482            textureData = General['SH Texture']   
    64806483            if textureData['Order']:
     
    70287031    #G2frame.dataDisplay.Refresh() # shows colored text on mac
    70297032    G2frame.dataWindow.SetDataSize()
    7030    
     7033
    70317034################################################################################
    70327035#####  Main PWDR panel
  • trunk/GSASIIphsGUI.py

    r3257 r3258  
    66926692                dlg.Destroy()
    66936693        wx.CallAfter(G2ddG.UpdateDData,G2frame,DData,data)
    6694                
     6694       
     6695    def OnDataApplyStrain(event):
     6696        SGData = data['General']['SGData']       
     6697        DijVals = data['Histograms'][G2frame.hist]['HStrain'][0][:]
     6698        # apply the Dij values to the reciprocal cell
     6699        newA = []
     6700        Dijdict = dict(zip(G2spc.HStrainNames(SGData),DijVals))
     6701        for Aij,lbl in zip(G2lat.cell2A(data['General']['Cell'][1:7]),
     6702                            ['D11','D22','D33','D12','D13','D23']):
     6703            newA.append(Aij + Dijdict.get(lbl,0.0))
     6704        # convert back to direct cell
     6705        data['General']['Cell'][1:7] = G2lat.A2cell(newA)
     6706        data['General']['Cell'][7] = G2lat.calc_V(newA)
     6707        # subtract the selected histograms Dij values from all for this phase
     6708        for hist in data['Histograms']:
     6709            for i,val in enumerate(DijVals):
     6710                data['Histograms'][hist]['HStrain'][0][i] -= val
     6711        # for hist in sorted(data['Histograms']): # list effective lattice constants applying Dij values
     6712        #     DijVals = data['Histograms'][hist]['HStrain'][0]
     6713        #     newA = []
     6714        #     Dijdict = dict(zip(G2spc.HStrainNames(SGData),DijVals))
     6715        #     for Aij,lbl in zip(G2lat.cell2A(data['General']['Cell'][1:7]),
     6716        #                     ['D11','D22','D33','D12','D13','D23']):
     6717        #         newA.append(Aij + Dijdict.get(lbl,0.0))
     6718        #     print(hist, G2lat.A2cell(newA)[:3], G2lat.calc_V(newA))
     6719        wx.CallAfter(G2ddG.UpdateDData,G2frame,DData,data)
     6720
    66956721################################################################################
    66966722##### Rigid bodies
     
    89208946        G2frame.Bind(wx.EVT_MENU, OnHklfAdd, id=G2G.wxID_HKLFADD)
    89218947        G2frame.Bind(wx.EVT_MENU, OnDataDelete, id=G2G.wxID_DATADELETE)
     8948        G2frame.Bind(wx.EVT_MENU, OnDataApplyStrain, id=G2G.wxID_DATADIJ)
    89228949        # Atoms
    89238950        FillSelectPageMenu(TabSelectionIdDict, G2frame.dataWindow.AtomsMenu)
Note: See TracChangeset for help on using the changeset viewer.