Changeset 4660 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Nov 23, 2020 5:37:49 PM (13 months ago)
Author:
vondreele
Message:

Add atom site fraction calculator for 2 atom shared sites

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r4659 r4660  
    42464246            print ("select one or more rows of atoms")
    42474247            G2frame.ErrorDialog('Select atom',"select one or more rows of atoms then redo")
     4248           
     4249    def OnFracSplit(event):
     4250        'Split atom frac accordintg to atom type & refined site fraction'   
     4251        cx,ct,cs,ci = getAtomPtrs(data)     
     4252        indx = getAtomSelections(Atoms,ct-1)
     4253        if indx:
     4254            atomData = data['Atoms']
     4255            colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())]
     4256            PE = G2elemGUI.PickElement(G2frame,oneOnly=True)
     4257            if PE.ShowModal() == wx.ID_OK:
     4258                Atype2 = PE.Elem.strip()
     4259                AtomInfo2 = G2elem.GetAtomInfo(Atype2)
     4260                Z2 = AtomInfo2['Z']
     4261                B2 = AtomInfo2['Isotopes']['Nat. Abund.']['SL'][0]
     4262            PE.Destroy()
     4263            for ind in indx:
     4264                Aname1 = atomData[ind][ct-1]
     4265                Atype1 = G2elem.FixValence(atomData[ind][ct])
     4266                Afrac = atomData[ind][cx+3]
     4267                AtomInfo1 = G2elem.GetAtomInfo(Atype1)
     4268                if Atype1 == Atype2:
     4269                    print('ERROR - 2nd atom type must be different from selected atom')
     4270                    continue
     4271                Z1 = AtomInfo1['Z']
     4272                B1 = AtomInfo1['Isotopes']['Nat. Abund.']['SL'][0]
     4273                frac1 = (Z1*Afrac-Z2)/(Z1-Z2)
     4274                bfrac1 = (B1*Afrac-B2)/(B1-B2)
     4275                print(' For %s: X-ray based %s site fraction = %.3f, %s site fraction = %.3f'%(Aname1,Atype1,frac1,Atype2,(1.-frac1)))
     4276                print('        neutron based %s site fraction = %.3f, %s site fraction = %.3f\n'%(Atype1,bfrac1,Atype2,(1.-bfrac1)))
    42484277                       
    42494278    def OnValidProtein(event):
     
    1263512664        G2frame.Bind(wx.EVT_MENU, OnDistAnglePrt, id=G2G.wxID_ATOMSPDISAGL)
    1263612665        G2frame.Bind(wx.EVT_MENU, OnDistAngleHist, id=G2G.wxID_ATOMSBNDANGLHIST)
     12666        G2frame.Bind(wx.EVT_MENU, OnFracSplit, id=G2G.wxID_ATOMFRACSPLIT)
    1263712667        G2frame.Bind(wx.EVT_MENU, OnDensity, id=G2G.wxID_ATOMSDENSITY)
    1263812668        G2frame.Bind(wx.EVT_MENU, OnIsoDistortCalc, id=G2G.wxID_ISODISP)
Note: See TracChangeset for help on using the changeset viewer.