Changeset 4514
- Timestamp:
- Jul 6, 2020 1:35:05 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIdataGUI.py
r4511 r4514 4108 4108 for f in files: 4109 4109 dirname,filroot = os.path.split(f) 4110 if os.path.exists(f) :4110 if os.path.exists(f) and '.gpx' in f: 4111 4111 sellist.append("{} from {}".format(filroot,dirname)) 4112 4112 # else: -
trunk/GSASIImath.py
r4513 r4514 1468 1468 MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=-1)*SGData['SpnFlp'][nxs,:,nxs,nxs] 1469 1469 return MmodA,MmodB #Ntau,Nops,Natm,Mxyz; cos & sin parts; sum matches drawn atom moments 1470 1471 def MagMod2(m,glTau,XYZ,modQ,MSSdata,SGData,SSGData): 1472 ''' 1473 this needs to make magnetic moment modulations & magnitudes as 1474 fxn of gTau points; NB: this allows only 1 mag. wave fxn. 1475 ''' 1476 Am = np.array(MSSdata[3:]).T[:,0,:] #atoms x cos pos mods; only 1 wave 1477 Bm = np.array(MSSdata[:3]).T[:,0,:] #...sin pos mods 1478 SGMT = np.array([ops[0] for ops in SGData['SGOps']]) #not .T!! 1479 Sinv = np.array([nl.inv(ops[0]) for ops in SSGData['SSGOps']]) 1480 SGT = np.array([ops[1] for ops in SSGData['SSGOps']]) 1481 if SGData['SGInv']: 1482 SGMT = np.vstack((SGMT,-SGMT)) 1483 Sinv = np.vstack((Sinv,-Sinv)) 1484 SGT = np.vstack((SGT,-SGT)) 1485 SGMT = np.vstack([SGMT for cen in SGData['SGCen']]) 1486 Sinv = np.vstack([Sinv for cen in SGData['SGCen']]) 1487 SGT = np.vstack([SGT+cen for cen in SSGData['SSGCen']])%1. 1488 if SGData['SGGray']: 1489 SGMT = np.vstack((SGMT,SGMT)) 1490 Sinv = np.vstack((Sinv,Sinv)) 1491 SGT = np.vstack((SGT,SGT+.5))%1. 1492 mst = Sinv[:,3,:3] 1493 epsinv = Sinv[:,3,3] 1494 phase = np.inner(XYZ,modQ).T+(np.inner(mst,modQ)-epsinv)[:,nxs]+glTau 1495 1496 psin = np.sin(twopi*m*phase).T 1497 pcos = np.cos(twopi*m*phase).T 1498 MmodA = Am[nxs,nxs,:,:]*pcos[:,:,nxs,nxs] #cos term 1499 MmodB = Bm[nxs,nxs,:,:]*psin[:,:,nxs,nxs] #sin term 1500 MmodA = np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=-1)*SGData['SpnFlp'][nxs,:,nxs,nxs] 1501 MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=-1)*SGData['SpnFlp'][nxs,:,nxs,nxs] 1502 return MmodA,MmodB #Nref,Ntau,Nops,Natm,Mxyz; cos & sin parts; sum matches drawn atom moments 1470 1503 1471 1504 def Modulation(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt): -
trunk/GSASIIstrMath.py
r4513 r4514 1486 1486 ast = np.sqrt(np.diag(G)) 1487 1487 GS = G/np.outer(ast,ast) 1488 gs = nl.inv(GS) 1488 1489 uAmat,uBmat = G2lat.Gmat2AB(GS) 1489 1490 Mast = twopisq*np.multiply.outer(ast,ast) … … 1514 1515 if parmDict[pfx+'isMag']: #This part correct for making modulated mag moments on equiv atoms - Mmod matched drawing & Bilbao drawings 1515 1516 1516 # mTau = np.linspace(0,1.,ngl,False)1517 1517 mXYZ = np.array([[XYZ[0] for XYZ in list(G2spc.GenAtom(xyz,SGData,All=True,Move=True))] for xyz in (Xdata+dXdata).T]) #Natn,Nop,xyz 1518 1518 if SGData['SGGray']: … … 1597 1597 if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']: 1598 1598 1599 MmodA,MmodB = G2mth.MagMod2(H[3],glTau,mXYZ,modQ,MSSdata,SGData,SSGData) #Nref,Ntau,Nops,Natm,Mxyz 1599 1600 phasem = twopi*np.inner(mXYZ,HP.T).T #2pi(Q.r) 1600 1601 cosm = np.cos(phasem) #Nref,nops,natm … … 1602 1603 MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T #Nref,Natm 1603 1604 TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*Fdata*MF/(2*Nops) #Nref,Natm 1604 HM = np.inner(u Bmat,HP.T) #put into cartesian space X||H,Z||H*L1605 HM = np.inner(uAmat,HP.T) #put into cartesian space X||H,Z||H*L; uAmat better than uBmat 1605 1606 eM = (HM/np.sqrt(np.sum(HM**2,axis=0))).T # normalize HP Nref,hkl=Unit vectors || Q 1606 1607 … … 1611 1612 fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs] 1612 1613 1613 fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA *cosm[i,nxs,:,:,nxs]+ \1614 np.sign(H[3,i])*MmodB *sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2. #Nref,Ntau,Nops,Natm,Mxyz1614 fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA[i]*cosm[i,nxs,:,:,nxs]+ 1615 np.sign(H[3,i])*MmodB[i]*sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2. #Nref,Ntau,Nops,Natm,Mxyz 1615 1616 1616 fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA *sinm[i,nxs,:,:,nxs]+ \1617 np.sign(H[3,i])*MmodB *cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2. #Nref,Ntau,Nops,Natm,Mxyz1617 fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA[i]*sinm[i,nxs,:,:,nxs]+ 1618 np.sign(H[3,i])*MmodB[i]*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2. #Nref,Ntau,Nops,Natm,Mxyz 1618 1619 1619 1620 if not SGData['SGGray']: 1620 1621 fams += fam0[:,nxs,:,:,:] 1621 1622 fbms += fbm0[:,nxs,:,:,:] 1622 # else:1623 # fams /= 2.1624 # fbms /= 2.1625 1623 1626 1624 # # do sum on ops, atms 1st … … 1628 1626 fbsm = np.sum(np.sum(fbms,axis=-2),axis=-2) 1629 1627 # #put into cartesian space 1630 facm = np.inner(fasm,uBmat.T) 1628 facm = np.inner(fasm,uBmat.T) #uBmat better than uAmat 1631 1629 fbcm = np.inner(fbsm,uBmat.T) 1632 1630 # #form e.F dot product 1633 1631 eDotFa = np.sum(eM[:,nxs,:]*facm,axis=-1) #Nref,Ntau 1634 1632 eDotFb = np.sum(eM[:,nxs,:]*fbcm,axis=-1) 1635 # #intensity 1636 fass = np.sum((facm-eM[:,nxs,:]*eDotFa[:,:,nxs])**2,axis=-1) 1637 fbss = np.sum((fbcm-eM[:,nxs,:]*eDotFb[:,:,nxs])**2,axis=-1) 1638 # fass = np.sum(facm**2,axis=-1)-eDotFa**2 1639 # fbss = np.sum(fbcm**2,axis=-1)-eDotFb**2 1633 # #intensity Halpern & Johnson 1634 fass = np.sum(facm**2,axis=-1)-eDotFa**2 1635 fbss = np.sum(fbcm**2,axis=-1)-eDotFb**2 1640 1636 1641 1637 # #do integration
Note: See TracChangeset
for help on using the changeset viewer.