Changeset 4535


Ignore:
Timestamp:
Jul 31, 2020 9:04:06 AM (3 years ago)
Author:
vondreele
Message:

fix X-label for pink powder patterns
revert incomm. mag. str. factor calcs to previous best one - still not correct tho.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r4533 r4535  
    14581458    TA = np.sum(mst[nxs,:,:]*(XYZ-SGT[:,:3][nxs,:,:]),axis=-1).T
    14591459    phase =  TA[nxs,:,:] + epsinv[nxs,:,nxs]*(glTau[:,nxs,nxs]-SGT[:,3][nxs,:,nxs]+phi[nxs,:,:])
    1460     pcos = np.cos(twopi*phase*epsinv[nxs,:,nxs])      #Ntau,Nops,Natm
    1461     psin = np.sin(twopi*phase*epsinv[nxs,:,nxs])
    1462    
    1463     MmodAp = (Am[nxs,nxs,:,:]*pcos[:,:,:,nxs]+epsinv[nxs,:,nxs,nxs]*Bm[nxs,nxs,:,:]*psin[:,:,:,nxs])/2.    #Ntau,Nops,Natm,Mxyz
    1464     MmodBp = (Am[nxs,nxs,:,:]*psin[:,:,:,nxs]+epsinv[nxs,:,nxs,nxs]*Bm[nxs,nxs,:,:]*pcos[:,:,:,nxs])/2.
    1465     MmodAm = (Am[nxs,nxs,:,:]*pcos[:,:,:,nxs]+epsinv[nxs,:,nxs,nxs]*Bm[nxs,nxs,:,:]*psin[:,:,:,nxs])/2.
    1466     MmodBm = (Am[nxs,nxs,:,:]*psin[:,:,:,nxs]+epsinv[nxs,:,nxs,nxs]*Bm[nxs,nxs,:,:]*pcos[:,:,:,nxs])/2.
    1467     MmodAp = np.sum(SGMT[nxs,:,nxs,:,:]*MmodAp[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs]
    1468     MmodBp = np.sum(SGMT[nxs,:,nxs,:,:]*MmodBp[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs]
    1469     MmodAm = np.sum(SGMT[nxs,:,nxs,:,:]*MmodAm[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs]
    1470     MmodBm = np.sum(SGMT[nxs,:,nxs,:,:]*MmodBm[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs]
    1471     return MmodAp,MmodBp,MmodAm,MmodBm    #Ntau,Nops,Natm,Mxyz; cos & sin parts
    1472                
     1460    psin = np.sin(twopi*phase)
     1461    pcos = np.cos(twopi*phase)
     1462    MmodA = Am[nxs,nxs,:,:]*pcos[:,:,:,nxs]    #cos term
     1463    MmodB = Bm[nxs,nxs,:,:]*psin[:,:,:,nxs]    #sin term
     1464    MmodA = np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=-1)*SGData['SpnFlp'][nxs,:,nxs,nxs]
     1465    MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=-1)*SGData['SpnFlp'][nxs,:,nxs,nxs]
     1466    return MmodA,MmodB    #Ntau,Nops,Natm,Mxyz; cos & sin parts; sum matches drawn atom moments
     1467       
    14731468def Modulation(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt):
    14741469    '''
     
    15001495    return np.array([cosHA,sinHA])             # 2 x refBlk x SGops x atoms
    15011496   
    1502 #def MagModulation(H,HP,nWaves,Fmod,Xmod,Umod,Mmod,glTau,glWt):
    1503 #    '''
    1504 #    H: array nRefBlk x ops X hklt
    1505 #    HP: array nRefBlk x ops X hklt proj to hkl
    1506 #    nWaves: list number of waves for frac, pos, uij & mag
    1507 #    Fmod: array 2 x atoms x waves    (sin,cos terms)
    1508 #    Xmod: array atoms X 3 X ngl
    1509 #    Umod: array atoms x 3x3 x ngl
    1510 #    Mmod: array atoms x 3x3 x ngl
    1511 #    glTau,glWt: arrays Gauss-Lorentzian pos & wts
    1512 #    '''
    1513 #   
    1514 #    if nWaves[2]:       #uij (adp) waves
    1515 #        if len(HP.shape) > 2:
    1516 #            HbH = np.exp(-np.sum(HP[:,:,nxs,nxs,:]*np.inner(HP,Umod),axis=-1)) # refBlk x ops x atoms x ngl add Overhauser corr.?
    1517 #        else:
    1518 #            HbH = np.exp(-np.sum(HP[:,nxs,nxs,:]*np.inner(HP,Umod),axis=-1)) # refBlk x ops x atoms x ngl add Overhauser corr.?
    1519 #    else:
    1520 #        HbH = 1.0
    1521 #    HdotX = np.inner(HP,Xmod)                   #refBlk x ops x atoms X ngl
    1522 #    if len(H.shape) > 2:
    1523 #        D = H[:,:,3:]*glTau[nxs,nxs,:]              #m*e*tau; refBlk x ops X ngl
    1524 #        HdotXD = twopi*(HdotX+D[:,:,nxs,:])
    1525 #    else:
    1526 #        D = H[:,3:]*glTau[nxs,:]              #m*e*tau; refBlk x ops X ngl
    1527 #        HdotXD = twopi*(HdotX+D[:,nxs,:])
    1528 #    M = np.swapaxes(Mmod,1,2)
    1529 #    cosHA = np.sum(M[nxs,nxs,:,:,:]*(Fmod*HbH*np.cos(HdotXD)[:,:,:,nxs,:]*glWt),axis=-1)       #real part; refBlk X ops x atoms; sum for G-L integration
    1530 #    sinHA = np.sum(M[nxs,nxs,:,:,:]*(Fmod*HbH*np.sin(HdotXD)[:,:,:,nxs,:]*glWt),axis=-1)       #imag part; ditto
    1531 #    return np.array([cosHA,sinHA])             # 2 x refBlk x SGops x atoms
    1532 #
    15331497def ModulationTw(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt):
    15341498    '''
  • trunk/GSASIIplot.py

    r4531 r4535  
    28812881        xLabel = r'$d, \AA$'
    28822882    else:
    2883         if 'C' in ParmList[0]['Type'][0]:
    2884             xLabel = r'$\mathsf{2\theta}$'
    2885         else:
     2883        if 'T' in ParmList[0]['Type'][0]:
    28862884            if G2frame.Contour:
    28872885                xLabel = r'Channel no.'
    28882886            else:
    28892887                xLabel = r'$TOF, \mathsf{\mu}$s'
     2888        else:
     2889            xLabel = r'$\mathsf{2\theta}$'
    28902890    if G2frame.Weight:
    28912891        Plot.set_visible(False)         #hide old plot frame, will get replaced below
  • trunk/GSASIIstrMath.py

    r4533 r4535  
    15171517            mXYZ = np.hstack((mXYZ,mXYZ))
    15181518
    1519         MmodAp,MmodBp,MmodAm,MmodBm = G2mth.MagMod(glTau,mXYZ,modQ,MSSdata,SGData,SSGData)  #Ntau,Nops,Natm,Mxyz cos,sim parts sum matches drawing
    1520 #        MmodAp,MmodBp,MmodAm,MmodBm = G2mth.MagMod2(mXYZ,modQ,MSSdata,SGData,SSGData)  #Nops,Natm,Mxyz cos,sim parts sum matches drawing
     1519        MmodA,MmodB = G2mth.MagMod(glTau,mXYZ,modQ,MSSdata,SGData,SSGData)  #Ntau,Nops,Natm,Mxyz cos,sim parts sum matches drawing
    15211520       
    15221521        if not SGData['SGGray']:    #for fixed Mx,My,Mz
     
    15531552        for iel,El in enumerate(refDict['FF']['El']):
    15541553            refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ)
    1555 #    time0 = time.time()
    15561554#reflection processing begins here - big arrays!
    15571555    iBeg = 0
     
    16031601            eM = (HM/np.sqrt(np.sum(HM**2,axis=0))).T    # normalize  HP  Nref,hkl=Unit vectors || Q
    16041602
    1605 #            fam0 = 0.
    1606 #            fbm0 = 0.
    16071603            if not SGData['SGGray']:     #correct -fixed Mx,My,Mz contribution             
    16081604                fam0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*cosm[:,:,:,nxs]    #Nref,Nops,Natm,Mxyz
    16091605                fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs]
    16101606#  calc mag. structure factors; Nref,Ntau,Nops,Natm,Mxyz                           
    1611 #            fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*cosm[i,nxs,:,:,nxs]+   
    1612 #                H[3,i]*MmodB*sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])          #Nref,Ntau,Nops,Natm,Mxyz
    1613 #                       
    1614 #            fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*sinm[i,nxs,:,:,nxs]+   
    1615 #                H[3,i]*MmodB*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])          #Nref,Ntau,Nops,Natm,Mxyz
    1616 #
    1617 #            if not SGData['SGGray']:           
    1618 #                fams += fam0[:,nxs,:,:,:]
    1619 #                fbms += fbm0[:,nxs,:,:,:]
    1620                
    1621             fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,np.where(H[3,i]>0,
    1622                 (MmodAp*cosm[i,nxs,:,:,nxs]+MmodBp*sinm[i,nxs,:,:,nxs]),
    1623                 (MmodAm*cosm[i,nxs,:,:,nxs]+MmodBm*sinm[i,nxs,:,:,nxs])),0.) for i in range(mRef)])  #Nref,Nops,Natm,Mxyz
     1607            fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*cosm[i,nxs,:,:,nxs]+   
     1608                H[3,i]*MmodB*sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])          #Nref,Ntau,Nops,Natm,Mxyz
    16241609                       
    1625             fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,np.where(H[3,i]>0,
    1626                 (MmodAp*sinm[i,nxs,:,:,nxs]+MmodBp*cosm[i,nxs,:,:,nxs]),
    1627                 (MmodAm*sinm[i,nxs,:,:,nxs]+MmodBm*cosm[i,nxs,:,:,nxs])),0.) for i in range(mRef)])  #Nref,Nops,Natm,Mxyz
     1610            fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*sinm[i,nxs,:,:,nxs]+   
     1611                H[3,i]*MmodB*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])          #Nref,Ntau,Nops,Natm,Mxyz
    16281612
    16291613            if not SGData['SGGray']:           
    16301614                fams += fam0[:,nxs,:,:,:]
    16311615                fbms += fbm0[:,nxs,:,:,:]
    1632                
     1616                               
    16331617#sum ops & atms                               
    16341618            fasm = np.sum(np.sum(fams,axis=-2),axis=-2)    #Nref,Mxyz; sum ops & atoms
     
    16681652            refl.T[8] = np.copy(refl.T[10])               
    16691653        iBeg += blkSize
    1670 #    print ('nRef %d time %.4f\r'%(nRef,time.time()-time0))
    16711654    return copy.deepcopy(refDict['RefList'])
    16721655
Note: See TracChangeset for help on using the changeset viewer.