Changeset 4058
- Timestamp:
- Jul 12, 2019 1:16:46 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r4057 r4058 1421 1421 Sinv = np.vstack([Sinv for cen in SGData['SGCen']]) #Nops,4,4 1422 1422 SGT = np.vstack([SGT+cen for cen in SSGData['SSGCen']])%1. 1423 detSM = nl.det(SGMT) 1424 mst = Sinv[:,3,:3] 1423 1425 epsinv = Sinv[:,3,3] #Nops 1424 1426 kdr = np.inner(XYZ,modQ).T #Nops,Natm 1425 phase = kdr+(epsinv*(np.inner(SGT[:,:3],modQ)-SGT[:,3]))[:,nxs] #Nops,Natm 1427 # phase = kdr+(epsinv*(np.inner(SGT[:,:3],modQ)-SGT[:,3]))[:,nxs] #Nops,Natm 1428 1429 phase = (np.sum(mst*(XYZ-SGT[nxs,:,:3]),axis=-1)).T+epsinv[:,nxs]*(kdr-SGT[:,nxs,3]) 1426 1430 1427 1431 psin = np.sin(twopi*phase) #Nops,Natm … … 1431 1435 MmodA = np.sum(SGMT[:,nxs,:,:]*MmodA[:,:,nxs,:],axis=-1) 1432 1436 MmodB = np.sum(SGMT[:,nxs,:,:]*MmodB[:,:,nxs,:],axis=-1) 1433 MmodA = MmodA*SGData['MagMom'][:,nxs,nxs] 1434 MmodB = MmodB*SGData['MagMom'][:,nxs,nxs] 1437 if SGData['SGGray']: 1438 MmodA = -MmodA*detSM[:,nxs,nxs] 1439 MmodB = -MmodB*detSM[:,nxs,nxs] 1440 else: 1441 MmodA = MmodA*SGData['MagMom'][:,nxs,nxs] 1442 MmodB = MmodB*SGData['MagMom'][:,nxs,nxs] 1435 1443 return MmodA,MmodB #Nops,Natm,,Mxyz; sin & cos parts 1436 1444 -
trunk/GSASIIstrMath.py
r4057 r4058 1598 1598 eM = HM/np.sqrt(np.sum(HM**2,axis=0)) #& normalize 1599 1599 #for fixed moments --> m=0 reflections 1600 fa s0 = 0.1601 fb s0 = 0.1600 fam0 = 0. 1601 fbm0 = 0. 1602 1602 if not SGData['SGGray']: #correct -fixed Mx,My,Mz contribution 1603 1603 fam0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*cosm[:,:,:,nxs] #Nref,Nops,Natm,Mxyz 1604 1604 fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs] 1605 1605 1606 famq0 = np.sum(np.sum(fam0,axis=-2),axis=-2) #Nref,Mxyz; sum ops & atoms1607 fbmq0 = np.sum(np.sum(fbm0,axis=-2),axis=-2)1608 1609 fas0 = np.sum(famq0,axis=-1)**2-np.sum(eM.T*famq0,axis=-1)**2 #mag intensity calc F^2-(e.F)^21610 fbs0 = np.sum(fbmq0,axis=-1)**2-np.sum(eM.T*fbmq0,axis=-1)**21606 # famq0 = np.sum(np.sum(fam0,axis=-2),axis=-2) #Nref,Mxyz; sum ops & atoms 1607 # fbmq0 = np.sum(np.sum(fbm0,axis=-2),axis=-2) 1608 # 1609 # fas0 = np.sum(famq0,axis=-1)**2-np.sum(eM.T*famq0,axis=-1)**2 #mag intensity calc F^2-(e.F)^2 1610 # fbs0 = np.sum(fbmq0,axis=-1)**2-np.sum(eM.T*fbmq0,axis=-1)**2 1611 1611 #for modulated moments --> m != 0 reflections 1612 1612 M = np.array(np.abs(H[3]),dtype=np.int)-1 1613 1613 1614 fam = TMcorr[:,nxs,:,nxs]*np.array([np.where(M[i]>=0,(TmagB*cosm[i,:,:,nxs]- \1615 np.sign(H[3,i])*TmagA*sinm[i,:,:,nxs]),0.) for i in range(mRef)]) 1614 fam = 0.5*TMcorr[:,nxs,:,nxs]*np.array([np.where(M[i]>=0,(TmagB*cosm[i,:,:,nxs]- \ 1615 np.sign(H[3,i])*TmagA*sinm[i,:,:,nxs]),0.) for i in range(mRef)])+fam0 1616 1616 1617 fbm = TMcorr[:,nxs,:,nxs]*np.array([np.where(M[i]>=0,(TmagB*sinm[i,:,:,nxs]+ \1618 np.sign(H[3,i])*TmagA*cosm[i,:,:,nxs]),0.) for i in range(mRef)]) 1617 fbm = 0.5*TMcorr[:,nxs,:,nxs]*np.array([np.where(M[i]>=0,(TmagB*sinm[i,:,:,nxs]+ \ 1618 np.sign(H[3,i])*TmagA*cosm[i,:,:,nxs]),0.) for i in range(mRef)])+fbm0 1619 1619 1620 famq = np.sum(np.sum(fam /2.,axis=-2),axis=-2) #Nref,Mxyz; sum ops & atoms1621 fbmq = np.sum(np.sum(fbm /2.,axis=-2),axis=-2)1620 famq = np.sum(np.sum(fam,axis=-2),axis=-2) #Nref,Mxyz; sum ops & atoms 1621 fbmq = np.sum(np.sum(fbm,axis=-2),axis=-2) 1622 1622 1623 1623 fas = np.sum(famq,axis=-1)**2-np.sum(eM.T*famq,axis=-1)**2 #mag intensity calc F^2-(e.F)^2 1624 1624 fbs = np.sum(fbmq,axis=-1)**2-np.sum(eM.T*fbmq,axis=-1)**2 1625 1625 1626 refl.T[10] = np.where(H[3],fas+fbs,fas0+fbs0) 1627 refl.T[11] = np.where(H[3],atan2d(fbs,fas),atan2d(fbs0,fas0)) 1626 # refl.T[10] = np.where(H[3],fas+fbs,fas0+fbs0) 1627 # refl.T[11] = np.where(H[3],atan2d(fbs,fas),atan2d(fbs0,fas0)) 1628 refl.T[10] = fas+fbs 1629 refl.T[11] = atan2d(fbs,fas) 1628 1630 1629 1631 else:
Note: See TracChangeset
for help on using the changeset viewer.