Changeset 4513
 Timestamp:
 Jul 3, 2020 10:18:43 AM (3 years ago)
 Location:
 trunk
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r4491 r4513 1435 1435 ''' 1436 1436 this needs to make magnetic moment modulations & magnitudes as 1437 fxn of gTau points 1437 fxn of gTau points; NB: this allows only 1 mag. wave fxn. 1438 1438 ''' 1439 1439 Am = np.array(MSSdata[3:]).T #atoms x waves x cos pos mods 
trunk/GSASIIphsGUI.py
r4508 r4513 1960 1960 1961 1961 def OnCellChange(invalid,value,tc): 1962 # event.Skip()1963 1962 SGData = generalData['SGData'] 1964 1963 laue = SGData['SGLaue'] … … 1967 1966 cell = generalData['Cell'] 1968 1967 Obj = tc 1969 # Obj = event.GetEventObject()1970 1968 ObjId = cellList.index(Obj.GetId()) 1971 1969 try: … … 2960 2958 break 2961 2959 2962 NShkl = len(G2spc.MustrainNames(SGData))2963 NDij = len(G2spc.HStrainNames(SGData))2964 UseList = newPhase['Histograms']2965 for hist in UseList:2966 UseList[hist]['Scale'] /= detTrans #scale by 1/volume ratio2967 UseList[hist]['Mustrain'][4:6] = [NShkl*[0.01,],NShkl*[False,]]2968 UseList[hist]['HStrain'] = [NDij*[0.0,],NDij*[False,]]2969 newPhase['General']['Map'] = mapDefault.copy()2970 sub = G2frame.GPXtree.AppendItem(parent=2971 G2gd.GetGPXtreeItemId(G2frame,G2frame.root,'Phases'),text=phaseName)2972 G2frame.GPXtree.SetItemPyData(sub,newPhase)2973 newPhase['Drawing'] = []2974 if ifConstr:2975 G2cnstG.TransConstraints(G2frame,data,newPhase,Trans,Vvec,atCodes) #data is old phase2976 G2frame.GPXtree.SelectItem(sub)2960 NShkl = len(G2spc.MustrainNames(SGData)) 2961 NDij = len(G2spc.HStrainNames(SGData)) 2962 UseList = newPhase['Histograms'] 2963 for hist in UseList: 2964 UseList[hist]['Scale'] /= detTrans #scale by 1/volume ratio 2965 UseList[hist]['Mustrain'][4:6] = [NShkl*[0.01,],NShkl*[False,]] 2966 UseList[hist]['HStrain'] = [NDij*[0.0,],NDij*[False,]] 2967 newPhase['General']['Map'] = mapDefault.copy() 2968 sub = G2frame.GPXtree.AppendItem(parent= 2969 G2gd.GetGPXtreeItemId(G2frame,G2frame.root,'Phases'),text=phaseName) 2970 G2frame.GPXtree.SetItemPyData(sub,newPhase) 2971 newPhase['Drawing'] = [] 2972 if ifConstr: 2973 G2cnstG.TransConstraints(G2frame,data,newPhase,Trans,Vvec,atCodes) #data is old phase 2974 G2frame.GPXtree.SelectItem(sub) 2977 2975 2978 2976 def OnCompare(event): 
trunk/GSASIIstrMath.py
r4488 r4513 1512 1512 modQ = np.array([parmDict[pfx+'mV0'],parmDict[pfx+'mV1'],parmDict[pfx+'mV2']]) 1513 1513 1514 if parmDict[pfx+'isMag']: #This part correct for making modulated mag moments on equiv atoms  matched drawing & Bilbao drawings1515 1516 mTau = np.linspace(0,1.,ngl,False)1514 if parmDict[pfx+'isMag']: #This part correct for making modulated mag moments on equiv atoms  Mmod matched drawing & Bilbao drawings 1515 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']: 1519 1519 mXYZ = np.hstack((mXYZ,mXYZ)) 1520 MmodA,MmodB = G2mth.MagMod( mTau,mXYZ,modQ,MSSdata,SGData,SSGData) #Ntau,Nops,Natm,Mxyz cos,sim parts sum matches drawing1520 MmodA,MmodB = G2mth.MagMod(glTau,mXYZ,modQ,MSSdata,SGData,SSGData) #Ntau,Nops,Natm,Mxyz cos,sim parts sum matches drawing 1521 1521 Mmod = MmodA+MmodB 1522 1522 … … 1529 1529 GSdata = np.swapaxes(GSdata,0,1) #Nop,Natm,Mxyz 1530 1530 Mmod += GSdata[nxs,:,:,:] 1531 1532 Kdata = np.inner(Mmod,uAmat) #Ntau,Nop,Natm,Mxyz1533 Mag = np.sqrt(np.sum(Kdata**2,axis=1)) #ntau,nop,natm1534 Kdata /= Mag[:,:,:,nxs] #Cartesian unit vectors1535 Kdata = np.nan_to_num(Kdata) #Ntau,Nops,Natm,Mxyz checked against drawing1536 1531 1537 1532 FF = np.zeros(len(Tdata)) … … 1607 1602 MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T #Nref,Natm 1608 1603 TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*Fdata*MF/(2*Nops) #Nref,Natm 1609 1610 #method 1 very wrong1611 1604 HM = np.inner(uBmat,HP.T) #put into cartesian space XH,ZH*L 1612 1605 eM = (HM/np.sqrt(np.sum(HM**2,axis=0))).T # normalize HP Nref,hkl=Unit vectors  Q 1613 # edotK = np.sum(eM*HP.T,axis=1) #nRef 1614 # Q = edotK[:,nxs,nxs,nxs,nxs]*eM[:,nxs,nxs,nxs,:]Kdata[nxs,:,:,:,:] #nRef,ntau,noops,natm,Mxyz 1615 # fam = Q*TMcorr[:,nxs,nxs,:,nxs]*cosm[:,nxs,:,:,nxs]*Mag[nxs,:,:,:,nxs] #nRef,ntau,noops,natm,Mxyz 1616 # fbm = Q*TMcorr[:,nxs,nxs,:,nxs]*sinm[:,nxs,:,:,nxs]*Mag[nxs,:,:,:,nxs] 1617 # fama = np.sum(np.sum(fam,axis=2),axis=2) #nRef,ntau,Mxyz; sum natm & nops 1618 # fbma = np.sum(np.sum(fbm,axis=2),axis=2) 1619 # fas = np.sum(np.sum(1./ngl*fama**2,axis=1),axis=1) 1620 # fbs = np.sum(np.sum(1./ngl*fbma**2,axis=1),axis=1) 1621 1622 #method 2 sort of wrong 1606 1623 1607 fam0 = 0. 1624 1608 fbm0 = 0. 1625 1609 if not SGData['SGGray']: #correct fixed Mx,My,Mz contribution 1626 1610 fam0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*cosm[:,:,:,nxs] #Nref,Nops,Natm,Mxyz 1627 fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs] 1628 #for modulated moments > m != 0 reflections 1629 1630 fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*cosm[i,nxs,:,:,nxs] \ 1631 np.sign(H[3,i])*MmodB*sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)]) #Nref,Ntau,Nops,Natm,Mxyz 1611 fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs] 1612 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,Mxyz 1632 1615 1633 1616 fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*sinm[i,nxs,:,:,nxs]+ \ 1634 np.sign(H[3,i])*MmodB*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)]) #Nref,Ntau,Nops,Natm,Mxyz1617 np.sign(H[3,i])*MmodB*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2. #Nref,Ntau,Nops,Natm,Mxyz 1635 1618 1636 1619 if not SGData['SGGray']: … … 1638 1621 fbms += fbm0[:,nxs,:,:,:] 1639 1622 # else: 1640 # fams *= Ncen1641 # fbms *= Ncen1642 1643 # do sum on ops, atms 1st1623 # fams /= 2. 1624 # fbms /= 2. 1625 1626 # # do sum on ops, atms 1st 1644 1627 fasm = np.sum(np.sum(fams,axis=2),axis=2) #Nref,Ntau,Mxyz; sum ops & atoms 1645 fbsm = np.sum(np.sum(fbms,axis=2),axis=2) 1646 # put into cartesian space1647 facm = np.inner(fasm,u Amat)1648 fbcm = np.inner(fbsm,u Amat)1649 # form e.F dot product1628 fbsm = np.sum(np.sum(fbms,axis=2),axis=2) 1629 # #put into cartesian space 1630 facm = np.inner(fasm,uBmat.T) 1631 fbcm = np.inner(fbsm,uBmat.T) 1632 # #form e.F dot product 1650 1633 eDotFa = np.sum(eM[:,nxs,:]*facm,axis=1) #Nref,Ntau 1651 1634 eDotFb = np.sum(eM[:,nxs,:]*fbcm,axis=1) 1652 #intensity 1653 fass = np.sum(facm**2,axis=1)eDotFa**2 1654 fbss = np.sum(fbcm**2,axis=1)eDotFb**2 1655 #do integration 1635 # #intensity 1636 fass = np.sum((facmeM[:,nxs,:]*eDotFa[:,:,nxs])**2,axis=1) 1637 fbss = np.sum((fbcmeM[:,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 1656 1640 1657 fas = np.sum(1./ngl*fass,axis=1) 1658 fbs = np.sum(1./ngl*fbss,axis=1) 1641 # #do integration 1642 fas = np.sum(fass*glWt[nxs,:],axis=1) 1643 fbs = np.sum(fbss*glWt[nxs,:],axis=1) 1659 1644 1660 # if SGData['SGInv']:1661 # fbs *= 4.1662 # fas = 0.1663 1664 1645 refl.T[10] = fas+fbs #Sum(fams**2,Mxyz) Re + Im 1665 1646 refl.T[11] = atan2d(fbs,fas)
Note: See TracChangeset
for help on using the changeset viewer.