Changeset 4138
- Timestamp:
- Sep 5, 2019 4:08:51 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r4125 r4138 1396 1396 MmodA = np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs] 1397 1397 MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs] 1398 return MmodA,MmodB #Ntau,Nops,Natm,,Mxyz; cos & sin parts; sum matches dr wa1398 return MmodA,MmodB #Ntau,Nops,Natm,,Mxyz; cos & sin parts; sum matches drawn atom moments 1399 1399 1400 def MagMod2(XYZ,modQ,MSSdata,SGData,SSGData):1401 '''1402 this needs to make magnetic moment modulations & magnitudes1403 '''1404 Am = np.array(MSSdata[:3]).T #atoms x waves x sin mag mods1405 Bm = np.array(MSSdata[3:]).T #...cos mag mods1406 nWaves = Am.shape[1]1407 if not nWaves:1408 return 0.0,0.01409 SGMT = np.array([ops[0] for ops in SGData['SGOps']]) #not .T!!1410 Sinv = np.array([nl.inv(ops[0]) for ops in SSGData['SSGOps']])1411 SGT = np.array([ops[1] for ops in SSGData['SSGOps']])1412 if SGData['SGInv']:1413 SGMT = np.vstack((SGMT,-SGMT))1414 Sinv = np.vstack((Sinv,-Sinv))1415 SGT = np.vstack((SGT,-SGT))1416 SGMT = np.vstack([SGMT for cen in SGData['SGCen']]) #Nops,3,31417 Sinv = np.vstack([Sinv for cen in SGData['SGCen']]) #Nops,4,41418 SGT = np.vstack([SGT+cen for cen in SSGData['SSGCen']])%1.1419 detSM = nl.det(SGMT)1420 mst = Sinv[:,3,:3]1421 epsinv = Sinv[:,3,3] #Nops1422 kdr = np.inner(XYZ,modQ).T #Nops,Natm1423 1424 phase = (np.sum(mst*(XYZ-SGT[nxs,:,:3]),axis=-1)).T+epsinv[:,nxs]*(kdr-SGT[:,nxs,3])1425 1426 psin = np.sin(twopi*phase) #Nops,Natm1427 pcos = np.cos(twopi*phase)1428 MmodA = np.sum(Bm[nxs,:,:,:]*pcos[:,:,nxs,nxs],axis=2)1429 MmodB = np.sum(Am[nxs,:,:,:]*psin[:,:,nxs,nxs],axis=2) #Nops,Natm,31430 MmodA = np.sum(SGMT[:,nxs,:,:]*MmodA[:,:,nxs,:],axis=-1)1431 MmodB = np.sum(SGMT[:,nxs,:,:]*MmodB[:,:,nxs,:],axis=-1)1432 if SGData['SGGray']:1433 MmodA = -MmodA*detSM[:,nxs,nxs]1434 MmodB = -MmodB*detSM[:,nxs,nxs]1435 else:1436 MmodA = MmodA*SGData['MagMom'][:,nxs,nxs]1437 MmodB = MmodB*SGData['MagMom'][:,nxs,nxs]1438 # MmodA+MmodB matches drawn tau=0 atom moments1439 return MmodA,MmodB #Nops,Natm,Mxyz; cos & sin parts1440 1400 #def MagMod2(XYZ,modQ,MSSdata,SGData,SSGData): 1401 # ''' 1402 # this needs to make magnetic moment modulations & magnitudes 1403 # ''' 1404 # Am = np.array(MSSdata[:3]).T #atoms x waves x sin mag mods 1405 # Bm = np.array(MSSdata[3:]).T #...cos mag mods 1406 # nWaves = Am.shape[1] 1407 # if not nWaves: 1408 # return 0.0,0.0 1409 # SGMT = np.array([ops[0] for ops in SGData['SGOps']]) #not .T!! 1410 # Sinv = np.array([nl.inv(ops[0]) for ops in SSGData['SSGOps']]) 1411 # SGT = np.array([ops[1] for ops in SSGData['SSGOps']]) 1412 # if SGData['SGInv']: 1413 # SGMT = np.vstack((SGMT,-SGMT)) 1414 # Sinv = np.vstack((Sinv,-Sinv)) 1415 # SGT = np.vstack((SGT,-SGT)) 1416 # SGMT = np.vstack([SGMT for cen in SGData['SGCen']]) #Nops,3,3 1417 # Sinv = np.vstack([Sinv for cen in SGData['SGCen']]) #Nops,4,4 1418 # SGT = np.vstack([SGT+cen for cen in SSGData['SSGCen']])%1. 1419 # detSM = nl.det(SGMT) 1420 # mst = Sinv[:,3,:3] 1421 # epsinv = Sinv[:,3,3] #Nops 1422 # kdr = np.inner(XYZ,modQ).T #Nops,Natm 1423 # 1424 # phase = (np.sum(mst*(XYZ-SGT[nxs,:,:3]),axis=-1)).T+epsinv[:,nxs]*(kdr-SGT[:,nxs,3]) 1425 # 1426 # psin = np.sin(twopi*phase) #Nops,Natm 1427 # pcos = np.cos(twopi*phase) 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 1430 # MmodA = np.sum(SGMT[:,nxs,:,:]*MmodA[:,:,nxs,:],axis=-1) 1431 # MmodB = np.sum(SGMT[:,nxs,:,:]*MmodB[:,:,nxs,:],axis=-1) 1432 # if SGData['SGGray']: 1433 # MmodA = -MmodA*detSM[:,nxs,nxs] 1434 # MmodB = -MmodB*detSM[:,nxs,nxs] 1435 # else: 1436 # MmodA = MmodA*SGData['MagMom'][:,nxs,nxs] 1437 # MmodB = MmodB*SGData['MagMom'][:,nxs,nxs] 1438 ##MmodA+MmodB matches drawn tau=0 atom moments 1439 # return MmodA,MmodB #Nops,Natm,Mxyz; cos & sin parts 1440 # 1441 1441 def Modulation(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt): 1442 1442 ''' -
trunk/GSASIIstrMath.py
r4137 r4138 1510 1510 1511 1511 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 1512 # TmagA,TmagB = G2mth.MagMod2(mXYZ,modQ,MSSdata,SGData,SSGData) #Nops,Natm,Mxyz-TmagA+TmagB matches drawing moments @ tau=0.1513 1512 MmodA,MmodB = G2mth.MagMod(glTau,mXYZ,modQ,MSSdata,SGData,SSGData) #Ntau,Nops,Natm,Mxyz sum matches drawing 1514 1513 1515 1514 if not SGData['SGGray']: #for fixed Mx,My,Mz 1516 # Mmod += Gdata.T[:,nxs,:]1517 1515 GSdata = np.inner(Gdata.T,np.swapaxes(SGMT,1,2)) #apply sym. ops.--> Natm,Nops,Nxyz 1518 1516 if SGData['SGInv'] and not SGData['SGFixed']: #inversion if any … … 1613 1611 1614 1612 if not SGData['SGGray']: 1613 fams *= 0.5 1614 fbms *= 0.5 1615 1615 fams += fam0[:,nxs,:,:,:] 1616 1616 fbms += fbm0[:,nxs,:,:,:]
Note: See TracChangeset
for help on using the changeset viewer.