Changeset 4514 for trunk/GSASIIstrMath.py
- Timestamp:
- Jul 6, 2020 1:35:05 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIstrMath.py
r4513 r4514 1486 1486 ast = np.sqrt(np.diag(G)) 1487 1487 GS = G/np.outer(ast,ast) 1488 gs = nl.inv(GS) 1488 1489 uAmat,uBmat = G2lat.Gmat2AB(GS) 1489 1490 Mast = twopisq*np.multiply.outer(ast,ast) … … 1514 1515 if parmDict[pfx+'isMag']: #This part correct for making modulated mag moments on equiv atoms - Mmod matched drawing & Bilbao drawings 1515 1516 1516 # mTau = np.linspace(0,1.,ngl,False)1517 1517 mXYZ = np.array([[XYZ[0] for XYZ in list(G2spc.GenAtom(xyz,SGData,All=True,Move=True))] for xyz in (Xdata+dXdata).T]) #Natn,Nop,xyz 1518 1518 if SGData['SGGray']: … … 1597 1597 if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']: 1598 1598 1599 MmodA,MmodB = G2mth.MagMod2(H[3],glTau,mXYZ,modQ,MSSdata,SGData,SSGData) #Nref,Ntau,Nops,Natm,Mxyz 1599 1600 phasem = twopi*np.inner(mXYZ,HP.T).T #2pi(Q.r) 1600 1601 cosm = np.cos(phasem) #Nref,nops,natm … … 1602 1603 MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T #Nref,Natm 1603 1604 TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*Fdata*MF/(2*Nops) #Nref,Natm 1604 HM = np.inner(u Bmat,HP.T) #put into cartesian space X||H,Z||H*L1605 HM = np.inner(uAmat,HP.T) #put into cartesian space X||H,Z||H*L; uAmat better than uBmat 1605 1606 eM = (HM/np.sqrt(np.sum(HM**2,axis=0))).T # normalize HP Nref,hkl=Unit vectors || Q 1606 1607 … … 1611 1612 fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs] 1612 1613 1613 fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA *cosm[i,nxs,:,:,nxs]+ \1614 np.sign(H[3,i])*MmodB *sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2. #Nref,Ntau,Nops,Natm,Mxyz1614 fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA[i]*cosm[i,nxs,:,:,nxs]+ 1615 np.sign(H[3,i])*MmodB[i]*sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2. #Nref,Ntau,Nops,Natm,Mxyz 1615 1616 1616 fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA *sinm[i,nxs,:,:,nxs]+ \1617 np.sign(H[3,i])*MmodB *cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2. #Nref,Ntau,Nops,Natm,Mxyz1617 fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA[i]*sinm[i,nxs,:,:,nxs]+ 1618 np.sign(H[3,i])*MmodB[i]*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2. #Nref,Ntau,Nops,Natm,Mxyz 1618 1619 1619 1620 if not SGData['SGGray']: 1620 1621 fams += fam0[:,nxs,:,:,:] 1621 1622 fbms += fbm0[:,nxs,:,:,:] 1622 # else:1623 # fams /= 2.1624 # fbms /= 2.1625 1623 1626 1624 # # do sum on ops, atms 1st … … 1628 1626 fbsm = np.sum(np.sum(fbms,axis=-2),axis=-2) 1629 1627 # #put into cartesian space 1630 facm = np.inner(fasm,uBmat.T) 1628 facm = np.inner(fasm,uBmat.T) #uBmat better than uAmat 1631 1629 fbcm = np.inner(fbsm,uBmat.T) 1632 1630 # #form e.F dot product 1633 1631 eDotFa = np.sum(eM[:,nxs,:]*facm,axis=-1) #Nref,Ntau 1634 1632 eDotFb = np.sum(eM[:,nxs,:]*fbcm,axis=-1) 1635 # #intensity 1636 fass = np.sum((facm-eM[:,nxs,:]*eDotFa[:,:,nxs])**2,axis=-1) 1637 fbss = np.sum((fbcm-eM[:,nxs,:]*eDotFb[:,:,nxs])**2,axis=-1) 1638 # fass = np.sum(facm**2,axis=-1)-eDotFa**2 1639 # fbss = np.sum(fbcm**2,axis=-1)-eDotFb**2 1633 # #intensity Halpern & Johnson 1634 fass = np.sum(facm**2,axis=-1)-eDotFa**2 1635 fbss = np.sum(fbcm**2,axis=-1)-eDotFb**2 1640 1636 1641 1637 # #do integration
Note: See TracChangeset
for help on using the changeset viewer.