Changeset 2492


Ignore:
Timestamp:
Oct 15, 2016 11:20:33 AM (7 years ago)
Author:
vondreele
Message:

fix handling of Lande g factor
fix Mag structure factor calcs - now OK for all tests

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIElem.py

    r2486 r2492  
    213213        else:
    214214            AtomInfo['Isotopes'][isotope.split('_')[1]] = data
     215    AtomInfo['Lande g'] = 2.0
    215216    return AtomInfo
    216217       
  • trunk/GSASIIphsGUI.py

    r2491 r2492  
    249249        if generalData['Type'] == 'magnetic' and not 'Lande g' in generalData:
    250250            generalData['MagDmin'] = 1.0
    251             generalData['Lande g'] = len(atomData)*[None,]
     251            generalData['Lande g'] = []
    252252        generalData['Mydir'] = G2frame.dirname
    253253        badList = {}
     
    286286                if generalData['Type'] == 'magnetic':
    287287                    generalData['MagDmin'] = generalData.get('MagDmin',1.0)
    288                     try:
    289                         if atom[ct] in atmdata.MagFF and not generalData['Lande g'][iat]:
    290                             generalData['Lande g'][iat] = 2.0
    291                     except IndexError:
    292                         generalData['Lande g'].append(2.0)
     288                    if not atom[ct] in generalData['AtomTypes']:
     289                        generalData['Lande g'].append(2.0)                       
    293290        if badList:
    294291            msg = 'Warning: element symbol(s) not found:'
     
    740737            if generalData['Type'] == 'magnetic':
    741738                elemSizer.Add(wx.StaticText(General,label=' Lande g factor: '),0,WACV)
    742                 for ig,gfac in enumerate(generalData['Lande g']):
     739                for ig,elem in enumerate(generalData['AtomTypes']):
     740                    gfac = generalData['Lande g'][ig]
    743741                    if gfac == None:
    744742                        elemSizer.Add((5,0),)
  • trunk/GSASIIpwdGUI.py

    r2491 r2492  
    34763476                       
    34773477                                                 
     3478        if not len(data[phaseName]):
     3479            return          #deleted phase?
    34783480        G2frame.RefList = phaseName
    34793481        G2frame.dataFrame.SetLabel('Reflection List for '+phaseName)
     
    34923494        if G2frame.refTable[phaseName].GetTable() is None:
    34933495            PeakTable = MakeReflectionTable(phaseName)
    3494             if PeakTable == None:
    3495                 return
    34963496            G2frame.refTable[phaseName].SetTable(PeakTable, True)
    34973497            G2frame.refTable[phaseName].EnableEditing(False)
     
    35643564    G2frame.refTable = {}
    35653565    for tabnum,phase in enumerate(phases):
    3566         G2frame.refTable[phase] = G2G.GSGrid(parent=G2frame.dataDisplay)
    3567         G2frame.dataDisplay.AddPage(G2frame.refTable[phase],phase)
     3566        if len(data[phase]):
     3567            G2frame.refTable[phase] = G2G.GSGrid(parent=G2frame.dataDisplay)
     3568            G2frame.dataDisplay.AddPage(G2frame.refTable[phase],phase)
     3569        else:       #cleanup deleted phase reflection lists
     3570            del data[phase]
     3571            if len(data):
     3572                G2frame.RefList = data.keys()[0]
     3573                phaseName = G2frame.RefList
     3574            else:
     3575                G2frame.RefList = ''
     3576                phaseName = ''
    35683577#    if phaseName not in G2frame.refTable:
    35693578#        print phaseName
    35703579#        print phases
    35713580#        raise Exception("how did we get a invalid phase name?")   
    3572     ShowReflTable(phaseName)
     3581    if phaseName:
     3582        ShowReflTable(phaseName)
    35733583#    G2frame.refTable[phaseName].Fit()   #slow!!
    35743584#    size = G2frame.refTable[phaseName].GetSize()
  • trunk/GSASIIspc.py

    r2486 r2492  
    722722        return SGData['SpGrp']
    723723    magSym = SGData['SpGrp'].split()
    724     if len(SpnFlp) == 1:    #ok
     724    if SGLaue in ['-1',]:
    725725        SGData['MagPtGp'] = SGLaue
    726         if SpnFlp[-1] == -1:
     726        if SpnFlp[0] == -1:
    727727            magSym[1] += "'"
    728728            SGData['MagPtGp'] += "'"
    729         return ' '.join(magSym)
    730     if SGLaue in ['mmm',]:
     729        if magSym[0] in ['A','B','C','I'] and SGData['SpGrp'] != 'I 41/a':
     730            if SpnFlp[1] < 0:
     731                magSym[0] += '(P)'
     732    elif SGLaue in ['mmm',]:
    731733        SGData['MagPtGp'] = ''
    732734        for i in [0,1,2]:
     
    830832                        Ptsym[i] += "'"
    831833        else:
    832             for i in [0,1]:
     834            for i in range(len(GenSym)):
    833835                if SpnFlp[i] < 0:                     
    834836                    if i and magSym[0] in ['A','B','C','I'] and SGData['SpGrp'] != 'I 41/a':
     
    975977        if incv:
    976978            SpnFlp = np.concatenate((SpnFlp,SpnFlp[:Nsym]*FlpSpn[Nfl+incv-1]))
     979    if ' 1bar ' in SGData['GenSym'][0] and FlpSpn[0] < 0:
     980        detM[1] = 1.
    977981    MagMom = SpnFlp*np.array(Ncv*detM)
    978982    SGData['MagMom'] = MagMom
  • trunk/GSASIIstrMath.py

    r2491 r2492  
    694694        if SGData['SGInv']:
    695695            Gdata = np.hstack((Gdata,-Gdata))       #inversion if any
    696         Gdata = np.repeat(Gdata,Ncen,axis=1)        #dup over cell centering
    697         Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata   #flip vectors according to spin flip
     696        Gdata = np.hstack([Gdata for icen in range(Ncen)])        #dup over cell centering
     697#        GSASIIpath.IPyBreak()
     698        Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata   #flip vectors according to spin flip * det(opM)
    698699        Gdata = np.inner(Amat,Gdata.T)              #convert back to cart. space MXYZ, Natoms, NOps*Inv*Ncen
    699700        Gdata = np.swapaxes(Gdata,1,2)              # put Natoms last
    700 #        GSASIIpath.IPyBreak()
    701701        Mag = np.tile(Mag[:,nxs],len(SGMT)*Ncen).T
    702702        if SGData['SGInv']:
    703             Mag = np.repeat(Mag,2,axis=0)                  #Mag same length as Gdata
     703            Mag = np.repeat(Mag,2,axis=0)                  #Mag same shape as Gdata
    704704    if 'NC' in calcControls[hfx+'histType']:
    705705        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
     
    768768        if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']:
    769769            MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T   #Nref,Natm
    770             TMcorr = 0.5*0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*MF/(Nops*Ncen)     #Nref,Natm
     770            TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*MF/(2*Nops*Ncen)     #Nref,Natm
    771771            if SGData['SGInv']:
    772772                mphase = np.hstack((phase,-phase))
     
    774774            else:
    775775                mphase = phase
    776             mphase = np.array([mphase+twopi*np.inner(cen,H)[:,nxs,nxs] for cen in SGData['SGCen']])
     776#            mphase = np.array([mphase+twopi*np.inner(cen,H)[:,nxs,nxs] for cen in SGData['SGCen']])
     777            mphase = np.array([mphase for cen in SGData['SGCen']])
    777778            mphase = np.concatenate(mphase,axis=1)              #Nref,full Nop,Natm
    778779            sinm = np.sin(mphase)                               #ditto - match magstrfc.for
     
    781782            HM = HM/np.sqrt(np.sum(HM**2,axis=0))               #Gdata = MAGS & HM = UVEC in magstrfc.for both OK
    782783            eDotK = np.sum(HM[:,:,nxs,nxs]*Gdata[:,nxs,:,:],axis=0)
    783             Q = -HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]+Gdata[:,nxs,:,:] #xyz,Nref,Nop,Natm = BPM in magstrfc.for OK
     784            Q = HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]-Gdata[:,nxs,:,:] #xyz,Nref,Nop,Natm = BPM in magstrfc.for OK
    784785            fam = Q*TMcorr[nxs,:,nxs,:]*cosm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #ditto
    785786            fbm = Q*TMcorr[nxs,:,nxs,:]*sinm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #ditto
     
    10641065        if SGData['SGInv']:
    10651066            Gdata = np.hstack((Gdata,-Gdata))       #inversion if any
    1066         Gdata = np.repeat(Gdata,Ncen,axis=1)    #dup over cell centering
     1067        Gdata = np.repeat(Gdata,Ncen,axis=1)        #dup over cell centering
    10671068        Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata   #flip vectors according to spin flip
    10681069        Gdata = np.inner(Amat,Gdata.T)              #convert back to cart. space MXYZ, Natoms, NOps*Inv*Ncen
    10691070        Gdata = np.swapaxes(Gdata,1,2)              # put Natoms last
    10701071#        GSASIIpath.IPyBreak()
    1071         Mag = np.tile(Mag[:,nxs],len(SGMT)*Ncen).T
     1072        Mag = np.tile(Mag[:,nxs],len(SGMT)*Ncen).T  #Mag same length as Gdata
    10721073        if SGData['SGInv']:
    1073             Mag = np.repeat(Mag,2,axis=0)                  #Mag same length as Gdata
     1074            Mag = np.repeat(Mag,2,axis=0)
    10741075        dFdMx = np.zeros((nRef,mSize,3))
    10751076    FF = np.zeros(len(Tdata))
     
    11401141                mphase = phase
    11411142            mphase = np.array([mphase+twopi*np.inner(cen,H)[:,nxs,nxs] for cen in SGData['SGCen']])
     1143#            GSASIIpath.IPyBreak()
    11421144            mphase = np.concatenate(mphase,axis=1)              #Nref,Nop,Natm
    11431145            sinm = np.sin(mphase)                               #ditto - match magstrfc.for
     
    11521154            fbms = np.sum(np.sum(fbm,axis=-1),axis=-1)                          #ditto
    11531155            Hij = np.hstack((Hij,Hij))
    1154 #            GSASIIpath.IPyBreak()
    11551156        if 'T' in calcControls[hfx+'histType']:
    11561157            fa = np.array([fot*cosp,-np.reshape(Flack*FPP,sinp.shape)*sinp*Tcorr])
Note: See TracChangeset for help on using the changeset viewer.