Changeset 4535 for trunk/GSASIImath.py
- Timestamp:
- Jul 31, 2020 9:04:06 AM (3 years ago)
- File:
-
- 1 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 '''
Note: See TracChangeset
for help on using the changeset viewer.