Changeset 4535 for trunk/GSASIImath.py


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.

File:
1 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    '''
Note: See TracChangeset for help on using the changeset viewer.