Changeset 4535
- Timestamp:
- Jul 31, 2020 9:04:06 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r4533 r4535 1458 1458 TA = np.sum(mst[nxs,:,:]*(XYZ-SGT[:,:3][nxs,:,:]),axis=-1).T 1459 1459 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 1473 1468 def Modulation(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt): 1474 1469 ''' … … 1500 1495 return np.array([cosHA,sinHA]) # 2 x refBlk x SGops x atoms 1501 1496 1502 #def MagModulation(H,HP,nWaves,Fmod,Xmod,Umod,Mmod,glTau,glWt):1503 # '''1504 # H: array nRefBlk x ops X hklt1505 # HP: array nRefBlk x ops X hklt proj to hkl1506 # nWaves: list number of waves for frac, pos, uij & mag1507 # Fmod: array 2 x atoms x waves (sin,cos terms)1508 # Xmod: array atoms X 3 X ngl1509 # Umod: array atoms x 3x3 x ngl1510 # Mmod: array atoms x 3x3 x ngl1511 # glTau,glWt: arrays Gauss-Lorentzian pos & wts1512 # '''1513 #1514 # if nWaves[2]: #uij (adp) waves1515 # 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.01521 # HdotX = np.inner(HP,Xmod) #refBlk x ops x atoms X ngl1522 # if len(H.shape) > 2:1523 # D = H[:,:,3:]*glTau[nxs,nxs,:] #m*e*tau; refBlk x ops X ngl1524 # HdotXD = twopi*(HdotX+D[:,:,nxs,:])1525 # else:1526 # D = H[:,3:]*glTau[nxs,:] #m*e*tau; refBlk x ops X ngl1527 # 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 integration1530 # sinHA = np.sum(M[nxs,nxs,:,:,:]*(Fmod*HbH*np.sin(HdotXD)[:,:,:,nxs,:]*glWt),axis=-1) #imag part; ditto1531 # return np.array([cosHA,sinHA]) # 2 x refBlk x SGops x atoms1532 #1533 1497 def ModulationTw(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt): 1534 1498 ''' -
trunk/GSASIIplot.py
r4531 r4535 2881 2881 xLabel = r'$d, \AA$' 2882 2882 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]: 2886 2884 if G2frame.Contour: 2887 2885 xLabel = r'Channel no.' 2888 2886 else: 2889 2887 xLabel = r'$TOF, \mathsf{\mu}$s' 2888 else: 2889 xLabel = r'$\mathsf{2\theta}$' 2890 2890 if G2frame.Weight: 2891 2891 Plot.set_visible(False) #hide old plot frame, will get replaced below -
trunk/GSASIIstrMath.py
r4533 r4535 1517 1517 mXYZ = np.hstack((mXYZ,mXYZ)) 1518 1518 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 1521 1520 1522 1521 if not SGData['SGGray']: #for fixed Mx,My,Mz … … 1553 1552 for iel,El in enumerate(refDict['FF']['El']): 1554 1553 refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ) 1555 # time0 = time.time()1556 1554 #reflection processing begins here - big arrays! 1557 1555 iBeg = 0 … … 1603 1601 eM = (HM/np.sqrt(np.sum(HM**2,axis=0))).T # normalize HP Nref,hkl=Unit vectors || Q 1604 1602 1605 # fam0 = 0.1606 # fbm0 = 0.1607 1603 if not SGData['SGGray']: #correct -fixed Mx,My,Mz contribution 1608 1604 fam0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*cosm[:,:,:,nxs] #Nref,Nops,Natm,Mxyz 1609 1605 fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs] 1610 1606 # 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 1624 1609 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 1628 1612 1629 1613 if not SGData['SGGray']: 1630 1614 fams += fam0[:,nxs,:,:,:] 1631 1615 fbms += fbm0[:,nxs,:,:,:] 1632 1616 1633 1617 #sum ops & atms 1634 1618 fasm = np.sum(np.sum(fams,axis=-2),axis=-2) #Nref,Mxyz; sum ops & atoms … … 1668 1652 refl.T[8] = np.copy(refl.T[10]) 1669 1653 iBeg += blkSize 1670 # print ('nRef %d time %.4f\r'%(nRef,time.time()-time0))1671 1654 return copy.deepcopy(refDict['RefList']) 1672 1655
Note: See TracChangeset
for help on using the changeset viewer.