Changeset 3861
- Timestamp:
- Mar 25, 2019 1:32:58 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r3853 r3861 1356 1356 return ngl,nWaves,Fmod,Xmod,Umod,Mmod,glTau,glWt 1357 1357 1358 def MagMod(XYZ,modQ,MSSdata,SSGData): 1358 def MagMod(XYZ,modQ,MSSdata,SGData,SSGData): 1359 1360 SGMT = np.array([ops[0] for ops in SGData['SGOps']]) 1361 SGT = np.array([ops[1] for ops in SSGData['SSGOps']]) 1362 if SGData['SGInv']: 1363 SGMT = np.vstack((SGMT,-SGMT)) 1364 SGT = np.vstack((SGT,-SGT)) 1365 SGMT = np.vstack([SGMT for cen in SGData['SGCen']]) 1366 SGT = np.vstack([SGT+cen for cen in SSGData['SSGCen']])%1. 1367 1368 #works for DyMn6Ge6 but not MnWO4 1359 1369 Bm = np.array(MSSdata[:3]).T #atoms x waves x sin pos mods 1360 1370 Am = np.array(MSSdata[3:]).T #...cos pos mods … … 1366 1376 if nWaves: 1367 1377 modind = np.arange(nWaves)+1. 1368 phase = np.sum(twopi*XYZ[:,:,nxs,:]*modind[nxs,nxs,:,nxs]*modQ[nxs,nxs,nxs,:],axis=-1) 1369 phase = np.swapaxes(phase,0,1) #Nops,Natm,Nwave 1378 phaseA = twopi*(modind[:,nxs,nxs]*(np.inner(XYZ,modQ))).T #= 2pimk.r Nops,Natm,Nwave 1370 1379 if nCen > 0: 1371 phshp = phase .shape1372 phase = np.reshape(phase,(nCen,mEqv,phshp[1],-1))1380 phshp = phaseA.shape 1381 phaseA = np.reshape(phaseA,(nCen,mEqv,phshp[1],-1)) 1373 1382 for ic,cen in enumerate(SSGData['SSGCen']): 1374 phase[ic] += twopi*cen[3]/2. 1375 phase = np.reshape(phase,phshp) 1376 MmodA = Am[nxs,:,:,:]*np.cos(phase[:,:,:,nxs])-Bm[nxs,:,:,:]*np.sin(phase[:,:,:,nxs]) 1377 MmodB = Am[nxs,:,:,:]*np.sin(phase[:,:,:,nxs])+Bm[nxs,:,:,:]*np.cos(phase[:,:,:,nxs]) 1383 phaseA[ic] += twopi*cen[3]/2. 1384 phaseA = np.reshape(phaseA,phshp) 1385 MmodAA = Am[nxs,:,:,:]*np.cos(phaseA[:,:,:,nxs])-Bm[nxs,:,:,:]*np.sin(phaseA[:,:,:,nxs]) 1386 MmodBA = Am[nxs,:,:,:]*np.sin(phaseA[:,:,:,nxs])+Bm[nxs,:,:,:]*np.cos(phaseA[:,:,:,nxs]) 1387 1388 #fails 1389 modQp = np.zeros(4); modQp[:3] = modQ; modQp[3] = 1. 1390 poff = SGData['SpnFlp']*np.inner(modQp,SGT) 1391 Bm = np.array(MSSdata[:3]).T #atoms x waves x sin pos mods 1392 Am = np.array(MSSdata[3:]).T #...cos pos mods 1393 nWaves = Am.shape[1] 1394 MmodA = 0; MmodB = 0 1395 if nWaves: 1396 modind = np.arange(nWaves)+1. 1397 phase = twopi*(modind[:,nxs,nxs]*(np.inner(XYZ,modQ)+poff)).T 1398 psin = np.sin(phase) 1399 pcos = np.cos(phase) 1400 RAM = np.rollaxis(np.inner(Am,SGMT),2) 1401 RBM = np.rollaxis(np.inner(Bm,SGMT),2) 1402 MmodA = SGData['MagMom'][nxs,nxs,:,nxs]*(RAM*pcos[:,:,:,nxs]-RBM*psin[:,:,:,nxs]) 1403 MmodB = SGData['MagMom'][nxs,nxs,:,nxs]*(RAM*psin[:,:,:,nxs]+RBM*pcos[:,:,:,nxs]) 1404 # MmodA = RAM*pcos[:,:,:,nxs]-RBM*psin[:,:,:,nxs] 1405 # MmodB = RAM*psin[:,:,:,nxs]+RBM*pcos[:,:,:,nxs] 1406 1378 1407 return MmodA,MmodB #cos & sin Nops,Natm,Nwaves,Mxyz 1379 1408 -
trunk/GSASIIstrMath.py
r3859 r3861 1518 1518 1519 1519 mXYZ = np.array([[xyz[0] for xyz in list(G2spc.GenAtom(xyz,SGData,All=True,Move=True))] for xyz in (Xdata+dXdata).T])%1. #Natn,Nop,xyz 1520 MmodA,MmodB = G2mth.MagMod(mXYZ,modQ,MSSdata,SSGData) #Re cos/Im sin,Nops,Natm,Nwaves,Mxyz 1521 MmodA = np.inner(MmodA,uAmat.T)*(SGData['MagMom']/SGData['SpnFlp'])[:,nxs,nxs,nxs] #make cartesian * apply det(ops) 1522 MmodB = np.inner(MmodB,uAmat.T)*(SGData['MagMom']/SGData['SpnFlp'])[:,nxs,nxs,nxs] 1520 MmodA,MmodB = G2mth.MagMod(mXYZ,modQ,MSSdata,SGData,SSGData) #Re cos/Im sin,Nops,Natm,Nwaves,Mxyz 1521 MmodA *= (SGData['MagMom']/SGData['SpnFlp'])[:,nxs,nxs,nxs] #apply det(ops) 1522 MmodB *= (SGData['MagMom']/SGData['SpnFlp'])[:,nxs,nxs,nxs] 1523 MmodA = np.inner(MmodA,uAmat.T) #make cartesian 1524 MmodB = np.inner(MmodB,uAmat.T) 1523 1525 1524 1526 FF = np.zeros(len(Tdata)) … … 1590 1592 phasem = twopi*np.inner(H.T[:,:3],mXYZ) 1591 1593 phasem = np.swapaxes(phasem,1,2) 1594 cosm = np.cos(phasem) 1592 1595 sinm = np.sin(phasem) 1593 cosm = np.cos(phasem)1594 1596 MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T #Nref,Natm 1595 1597 TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Fdata*Mdata*MF/(2*Nops) #Nref,Natm
Note: See TracChangeset
for help on using the changeset viewer.