Changeset 4125 for trunk/GSASIImath.py
- Timestamp:
- Aug 30, 2019 2:03:45 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r4073 r4125 1360 1360 return ngl,nWaves,Fmod,Xmod,Umod,Mmod,glTau,glWt 1361 1361 1362 def MagMod( ngl,XYZ,modQ,MSSdata,SGData,SSGData):1362 def MagMod(glTau,XYZ,modQ,MSSdata,SGData,SSGData): 1363 1363 ''' 1364 1364 this needs to make magnetic moment modulations & magnitudes as 1365 fxn of ngl tau points1365 fxn of gTau points 1366 1366 ''' 1367 1367 Am = np.array(MSSdata[:3]).T #atoms x waves x sin pos mods 1368 1368 Bm = np.array(MSSdata[3:]).T #...cos pos mods 1369 1369 nWaves = Am.shape[1] 1370 tau = np.arange(ngl)/ngl1371 if not nWaves:1372 return 0.0,0.01373 1370 SGMT = np.array([ops[0] for ops in SGData['SGOps']]) #not .T!! 1374 1371 Sinv = np.array([nl.inv(ops[0]) for ops in SSGData['SSGOps']]) … … 1386 1383 phi = np.inner(XYZ,modQ).T 1387 1384 TA = np.sum(mst[nxs,:,:]*(XYZ-SGT[:,:3][nxs,:,:]),axis=-1).T 1388 tauT = TA[nxs,:,:] + epsinv[nxs,:,nxs]*( tau[:,nxs,nxs]-SGT[:,3][nxs,:,nxs]+phi[nxs,:,:])1385 tauT = TA[nxs,:,:] + epsinv[nxs,:,nxs]*(glTau[:,nxs,nxs]-SGT[:,3][nxs,:,nxs]+phi[nxs,:,:]) 1389 1386 modind = np.arange(nWaves)+1. 1390 1387 phase = (modind[:,nxs,nxs]*tauT) #Nops,Natm,Nwave 1391 1388 psin = np.sin(twopi*phase) 1392 1389 pcos = np.cos(twopi*phase) 1393 Mmod B= np.sum(Bm[nxs,nxs,:,:,:]*pcos[:,:,:,nxs,nxs],axis=3)1394 Mmod A= np.sum(Am[nxs,nxs,:,:,:]*psin[:,:,:,nxs,nxs],axis=3)1390 MmodA = np.sum(Bm[nxs,nxs,:,:,:]*pcos[:,:,:,nxs,nxs],axis=3) 1391 MmodB = np.sum(Am[nxs,nxs,:,:,:]*psin[:,:,:,nxs,nxs],axis=3) 1395 1392 if SGData['SGGray']: 1396 1393 MmodA = -np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=-1)*detSM[nxs,:,nxs,nxs] … … 1399 1396 MmodA = np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs] 1400 1397 MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs] 1401 Mmod = MmodA+MmodB 1402 return Mmod,MmodA,MmodB #Ntau,Nops,Natm,,Mxyz; sum,sin & cos parts 1398 return MmodA,MmodB #Ntau,Nops,Natm,,Mxyz; cos & sin parts; sum matches drwa 1403 1399 1404 1400 def MagMod2(XYZ,modQ,MSSdata,SGData,SSGData): … … 1425 1421 epsinv = Sinv[:,3,3] #Nops 1426 1422 kdr = np.inner(XYZ,modQ).T #Nops,Natm 1427 # phase = kdr+(epsinv*(np.inner(SGT[:,:3],modQ)-SGT[:,3]))[:,nxs] #Nops,Natm1428 1423 1429 1424 phase = (np.sum(mst*(XYZ-SGT[nxs,:,:3]),axis=-1)).T+epsinv[:,nxs]*(kdr-SGT[:,nxs,3]) … … 1431 1426 psin = np.sin(twopi*phase) #Nops,Natm 1432 1427 pcos = np.cos(twopi*phase) 1433 MmodA = np.sum( Am[nxs,:,:,:]*psin[:,:,nxs,nxs],axis=2) #Nops,Natm,31434 MmodB = np.sum( Bm[nxs,:,:,:]*pcos[:,:,nxs,nxs],axis=2)1428 MmodA = np.sum(Bm[nxs,:,:,:]*pcos[:,:,nxs,nxs],axis=2) 1429 MmodB = np.sum(Am[nxs,:,:,:]*psin[:,:,nxs,nxs],axis=2) #Nops,Natm,3 1435 1430 MmodA = np.sum(SGMT[:,nxs,:,:]*MmodA[:,:,nxs,:],axis=-1) 1436 1431 MmodB = np.sum(SGMT[:,nxs,:,:]*MmodB[:,:,nxs,:],axis=-1) … … 1442 1437 MmodB = MmodB*SGData['MagMom'][:,nxs,nxs] 1443 1438 #MmodA+MmodB matches drawn tau=0 atom moments 1444 return MmodA,MmodB #Nops,Natm,Mxyz; sin & cosparts1439 return MmodA,MmodB #Nops,Natm,Mxyz; cos & sin parts 1445 1440 1446 1441 def Modulation(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt):
Note: See TracChangeset
for help on using the changeset viewer.