Changeset 3338


Ignore:
Timestamp:
Apr 6, 2018 3:35:44 PM (4 years ago)
Author:
vondreele
Message:

fix SpnFlp? issues for mcif imports - had messed up mag structure factors
make correct Mag moments for crystal axes aligned components - both structure factors & derivatives
checked with very oblique sarcopside.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwdGUI.py

    r3337 r3338  
    10791079        pwddata = G2frame.GPXtree.GetItemPyData(PatternId)[1]
    10801080        auxPlot = G2pwd.MakeRDF(RDFcontrols,background,inst,pwddata)
    1081 #        GSASIIpath.IPyBreak()
    10821081        superMinusOne = unichr(0xaf)+unichr(0xb9)
    10831082        for plot in auxPlot:
     
    11971196            debyeTable = G2G.Table(data[1]['debyeTerms'],rowLabels=rowLabels,colLabels=colLabels,types=Types)
    11981197            debyeGrid = G2G.GSGrid(parent=G2frame.dataWindow)
    1199 #            debyeGrid.SetScrollRate(0,0)
    12001198            debyeGrid.SetTable(debyeTable, True)
    12011199            debyeGrid.Bind(wx.EVT_KEY_DOWN, KeyEditPeakGrid)
     
    12591257            peaksTable = G2G.Table(data[1]['peaksList'],rowLabels=rowLabels,colLabels=colLabels,types=Types)
    12601258            peaksGrid = G2G.GSGrid(parent=G2frame.dataWindow)
    1261 #            peaksGrid.SetScrollRate(0,0)
    12621259            peaksGrid.SetTable(peaksTable, True)
    12631260            peaksGrid.Bind(wx.EVT_KEY_DOWN, KeyEditPeakGrid)
     
    16461643            if 'Bank' not in instData:
    16471644                instData['Bank'] = [1,1,0]
    1648 #            GSASIIpath.IPyBreak()
    16491645            if len(data) == len(instData) and instType == instData['Type'][0]:   #don't mix data types or lam & lam1/lam2 parms!
    16501646                for item in instData:
     
    26782674    G2frame.indxPeaks.Bind(wg.EVT_GRID_CELL_LEFT_CLICK, RefreshIndexPeaksGrid)
    26792675    G2frame.indxPeaks.Bind(wx.EVT_KEY_DOWN, KeyEditPickGrid)                 
    2680 #    G2frame.indxPeaks.SetScrollRate(0,0)
    26812676    G2frame.indxPeaks.AutoSizeColumns(False)
    26822677    if len(XY):
     
    33933388        gridDisplay.Bind(wg.EVT_GRID_CELL_LEFT_CLICK,RefreshUnitCellsGrid)
    33943389        gridDisplay.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK,OnSortCells)
    3395 #        gridDisplay.SetScrollRate(0,0)
    33963390        gridDisplay.SetRowLabelSize(0)
    33973391        gridDisplay.AutoSizeColumns(False)
  • trunk/GSASIIspc.py

    r3336 r3338  
    10941094        Nsyms += Nsym
    10951095        sgOps += sgOp
    1096         OprNames += oprName   
    1097     SpnFlp = np.ones(Nsym,dtype=np.int)
    1098     GenFlg = SGData.get('GenFlg',[0])
    1099     Ngen = len(SGData['SGGen'])
    1100 #    print ('GenFlg:',SGData['GenFlg'])
    1101 #    print ('GenSym:',SGData['GenSym'])
    1102     Nfl = len(GenFlg)
    1103     for ieqv in range(Nsym):
    1104         for iunq in range(Nfl):
    1105             if SGData['SGGen'][ieqv%Ngen] & GenFlg[iunq]:
    1106                 SpnFlp[ieqv] *= FlpSpn[iunq]
    1107 #        print ('\nMagSpGrp:',SGData['MagSpGrp'],Ncv)
    1108 #        print ('FlpSpn:',Nfl,FlpSpn)
     1096        OprNames += oprName
     1097    if SGData['SGFixed']:
     1098        SpnFlp = SGData['SpnFlp']
     1099    else:
     1100        SpnFlp = np.ones(Nsym,dtype=np.int)
     1101        GenFlg = SGData.get('GenFlg',[0])
     1102        Ngen = len(SGData['SGGen'])
     1103    #    print ('GenFlg:',SGData['GenFlg'])
     1104    #    print ('GenSym:',SGData['GenSym'])
     1105        Nfl = len(GenFlg)
     1106        for ieqv in range(Nsym):
     1107            for iunq in range(Nfl):
     1108                if SGData['SGGen'][ieqv%Ngen] & GenFlg[iunq]:
     1109                    SpnFlp[ieqv] *= FlpSpn[iunq]
     1110    #        print ('\nMagSpGrp:',SGData['MagSpGrp'],Ncv)
     1111    #        print ('FlpSpn:',Nfl,FlpSpn)
     1112        for incv in range(Ncv):
     1113            if incv:
     1114                try:
     1115                    SpnFlp = np.concatenate((SpnFlp,SpnFlp[:Nsym]*FlpSpn[Nfl+incv-1]))
     1116                except IndexError:
     1117                    FlpSpn = [1,]+FlpSpn
     1118                    SpnFlp = np.concatenate((SpnFlp,SpnFlp[:Nsym]*FlpSpn[Nfl+incv-1]))                   
    11091119    detM = [nl.det(M) for M in sgOp]
    1110     for incv in range(Ncv):
    1111         if incv:
    1112             try:
    1113                 SpnFlp = np.concatenate((SpnFlp,SpnFlp[:Nsym]*FlpSpn[Nfl+incv-1]))
    1114             except IndexError:
    1115                 FlpSpn = [1,]+FlpSpn
    1116                 SpnFlp = np.concatenate((SpnFlp,SpnFlp[:Nsym]*FlpSpn[Nfl+incv-1]))                   
    1117 #    if ' 1bar ' in SGData['GenSym'][0] and FlpSpn[0] < 0:
    1118 #        detM[1] = 1.
    1119     MagMom = SpnFlp*np.array(Ncv*detM)
     1120    MagMom = SpnFlp*np.array(Ncv*detM)      #duplicate for no. centerings
    11201121    SGData['MagMom'] = MagMom
    11211122#        print ('SgOps:',OprNames)
  • trunk/GSASIIstrMath.py

    r3337 r3338  
    788788#    phfx = pfx.split(':')[0]+hfx
    789789    ast = np.sqrt(np.diag(G))
     790    GS = G/np.outer(ast,ast)
    790791    Mast = twopisq*np.multiply.outer(ast,ast)
    791792    SGMT = np.array([ops[0].T for ops in SGData['SGOps']])
     
    810811    if not Xdata.size:          #no atoms in phase!
    811812        return
    812     Mag = np.sqrt(np.sum(Gdata**2,axis=0))      #magnitude of moments for uniq atoms
     813    Mag = np.sqrt(np.inner(Gdata.T,np.inner(Gdata.T,GS)))
    813814    Gdata = np.where(Mag>0.,Gdata/Mag,0.)       #normalze mag. moments
    814     Gdata = np.inner(Bmat,Gdata.T)              #convert to crystal space
    815815    Gdata = np.inner(Gdata.T,SGMT).T            #apply sym. ops.
    816816    if SGData['SGInv'] and not SGData['SGFixed']:
     
    818818    Gdata = np.hstack([Gdata for icen in range(Ncen)])        #dup over cell centering
    819819    Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata   #flip vectors according to spin flip * det(opM)
    820     Gdata = np.inner(Amat,Gdata.T)              #convert back to cart. space MXYZ, Natoms, NOps*Inv*Ncen
    821     Gdata = np.swapaxes(Gdata,1,2)              # put Natoms last
    822     Mag = np.tile(Mag[:,nxs],len(SGMT)*Ncen).T
     820    Mag = np.tile(Mag[:,nxs],len(SGMT)*Ncen).T.reshape((len(SGMT),-1))
    823821    if SGData['SGInv'] and not SGData['SGFixed']:
    824822        Mag = np.repeat(Mag,2,axis=0)                  #Mag same shape as Gdata
     
    10761074    #TODO: fix mag math - moments parallel to crystal axes
    10771075    ast = np.sqrt(np.diag(G))
     1076    GS = G/np.outer(ast,ast)
    10781077    Mast = twopisq*np.multiply.outer(ast,ast)
    10791078    SGMT = np.array([ops[0].T for ops in SGData['SGOps']])
     
    10911090        return {}
    10921091    mSize = len(Mdata)
    1093     Mag = np.sqrt(np.sum(Gdata**2,axis=0))      #magnitude of moments for uniq atoms
    1094 #    Gdata = np.where(Mag>0.,Gdata/Mag,0.)       #normalze mag. moments
     1092    Mag = np.sqrt(np.inner(Gdata.T,np.inner(Gdata.T,GS))).flatten()
    10951093    dGdM = np.repeat(Gdata[:,nxs,:],Nops,axis=1)
    1096 #    Gdata = np.inner(Bmat,Gdata.T)              #convert to crystal space
    10971094    Gdata = np.inner(Gdata.T,SGMT).T            #apply sym. ops.
    10981095    if SGData['SGInv'] and not SGData['SGFixed']:
     
    11001097    Gdata = np.hstack([Gdata for icen in range(Ncen)])        #dup over cell centering
    11011098    Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata   #flip vectors according to spin flip
    1102 #    Gdata = np.inner(Amat,Gdata.T)              #convert back to cart. space MXYZ, Natoms, NOps
    1103 #    Gdata = np.swapaxes(Gdata,1,2)              # put Natoms last - Mxyz,Nops,Natms
    11041099    Mag = np.tile(Mag[:,nxs],Nops).T  #make Mag same length as Gdata
    11051100    dGdm = (1.-Gdata**2)                        #1/Mag removed - canceled out in dqmx=sum(dqdm*dGdm)
  • trunk/imports/G2phase_CIF.py

    r3335 r3338  
    311311                self.MPhase['General']['SGData'] = SGData
    312312                self.MPhase['General']['SGData']['SpnFlp'] = censpn
     313                G2spc.GenMagOps(SGData)         #set magMom
    313314                self.MPhase['General']['SGData']['MagSpGrp'] = MSpGrp
    314315                MagPtGp = blk.get('_space_group.magn_point_group')
Note: See TracChangeset for help on using the changeset viewer.