Changeset 4140
 Timestamp:
 Sep 9, 2019 11:50:58 AM (3 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIstrMath.py
r4139 r4140 1528 1528 Kdata = np.inner(Mmod,uAmat) #Cartesian vectors; Mxyz,Natm,Nop,Ntau 1529 1529 Kmean = np.sqrt(np.sum(Kdata**2,axis=1)) 1530 Kdata /= Kmean[:,:,:,nxs] #Ntau,Nop,Natm,Mxyz 1531 1530 Kdata /= Kmean[:,:,:,nxs] #normalized cartesian mag. moment Ntau,Nop,Natm,Mxyz 1532 1531 1533 1532 FF = np.zeros(len(Tdata)) … … 1606 1605 # 1607 1606 HM = np.inner(Bmat,HP.T) #put into cartesian space 1608 eM = HM/np.sqrt(np.sum(HM**2,axis=0)).T #& normalize; Nref,Mhkl 1609 eDotK = np.sum(eM[:,nxs,nxs,:]*Kdata[:,nxs,:,:],axis=0) 1607 eM = (HM/np.sqrt(np.sum(HM**2,axis=0))).T #& normalize; Nref,Mhkl 1608 eDotK = np.sum(eM[:,nxs,nxs,nxs,:]*Kdata[nxs,:,:,:,:],axis=1) #Nref,Ntau,Nops,Natm 1609 Q = eM[:,nxs,nxs,nxs,:]*eDotK[:,:,:,:,nxs]Kdata[nxs,:,:,:,:] #Nref,Ntau,Nops,Natm,Mxyz 1610 Q = 1.0 1610 1611 1611 1612 fam0 = 0. 1612 1613 fbm0 = 0. 1613 1614 if not SGData['SGGray']: #correct fixed Mx,My,Mz contribution 1614 fam0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*cosm[:,:,:,nxs] #Nref,Nops,Natm,Mxyz1615 fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs]1615 fam0 = Q*TMcorr[:,nxs,nxs,:,nxs]*GSdata[nxs,nxs,:,:,:]*cosm[:,nxs,:,:,nxs] #Nref,Ntau,Nops,Natm,Mxyz 1616 fbm0 = Q*TMcorr[:,nxs,nxs,:,nxs]*GSdata[nxs,nxs,:,:,:]*sinm[:,nxs,:,:,nxs] 1616 1617 #for modulated moments > m != 0 reflections 1617 1618 1618 fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*cosm[i,nxs,:,:,nxs] \1619 fams = Q*TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*cosm[i,nxs,:,:,nxs] \ 1619 1620 np.sign(H[3,i])*MmodB*sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)]) #Nref,Ntau,Nops,Natm,Mxyz 1620 1621 1621 fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*sinm[i,nxs,:,:,nxs]+ \1622 fbms = Q*TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*sinm[i,nxs,:,:,nxs]+ \ 1622 1623 np.sign(H[3,i])*MmodB*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)]) #Nref,Ntau,Nops,Natm,Mxyz 1623 1624 … … 1625 1626 fams *= .5 1626 1627 fbms *= .5 1627 fams += fam0 [:,nxs,:,:,:]1628 fbms += fbm0 [:,nxs,:,:,:]1628 fams += fam0 1629 fbms += fbm0 1629 1630 1630 1631 # do GL integral before making mag F's  less correct; gives F's where there shouldn't be any 1631 1632 faqs = np.sum(fams**2,axis=1)*(1.eDotK**2) #mag intensity calc F^2(e.F)^2 1633 fbqs = np.sum(fbms**2,axis=1)*(1.eDotK**2) 1634 1635 fass = np.sum(glWt[nxs,:,nxs,nxs]*faqs,axis=1) #GL integration 1636 fbss = np.sum(glWt[nxs,:,nxs,nxs]*fbqs,axis=1) 1637 1638 fas = np.sum(np.sum(fass,axis=1),axis=1) #Nref,Ntau,Mxyz; sum ops & atoms 1639 fbs = np.sum(np.sum(fbss,axis=1),axis=1) 1640 1632 # 1633 # fass = np.sum(glWt[nxs,:,nxs,nxs,nxs]*fams,axis=1) #GL integration 1634 # fbss = np.sum(glWt[nxs,:,nxs,nxs,nxs]*fbms,axis=1) 1635 # 1636 # fas = np.sum(np.sum(fass,axis=1),axis=1) #Nref,Ntau,Mxyz; sum ops & atoms 1637 # fbs = np.sum(np.sum(fbss,axis=1),axis=1) 1638 # refl.T[10] = np.sum(fas**2,axis=1)+np.sum(fbs**2,axis=1) 1639 # refl.T[11] = atan2d(fbs[:,0],fas[:,0]) 1640 ## 1641 1641 # do GL integral after making mag. F's  better but not right 1642 1642 1643 famqs = np.sum(np.sum(fams,axis=2),axis=2) #Nref,Ntau,Mxyz; sum ops & atoms 1643 1644 fbmqs = np.sum(np.sum(fbms,axis=2),axis=2) … … 1652 1653 fbmcs = np.nan_to_num(fbmcs) 1653 1654 1654 fass = np.sum(famqs**2,axis=1)*(1.np.sum(eM .T[:,nxs,:]*famcs,axis=1)**2) #mag intensity calc F^2(e.F)^21655 fbss = np.sum(fbmqs**2,axis=1)*(1.np.sum(eM .T[:,nxs,:]*fbmcs,axis=1)**2)1655 fass = np.sum(famqs**2,axis=1)*(1.np.sum(eM[:,nxs,:]*famcs,axis=1)**2) #mag intensity calc F^2(e.F)^2 1656 fbss = np.sum(fbmqs**2,axis=1)*(1.np.sum(eM[:,nxs,:]*fbmcs,axis=1)**2) #WRONG  needs mag. moment not F! 1656 1657 1657 1658 fas = np.sum(glWt*fass,axis=1) #GL integration … … 1660 1661 refl.T[10] = fas+fbs 1661 1662 refl.T[11] = atan2d(fbs,fas) 1662 1663 # 1663 1664 else: 1664 1665 GfpuA = G2mth.Modulation(Uniq,UniqP,nWaves,Fmod,Xmod,Umod,glTau,glWt) #2 x refBlk x sym X atoms
Note: See TracChangeset
for help on using the changeset viewer.