Changeset 4488
 Timestamp:
 Jun 16, 2020 9:39:08 AM (2 years ago)
 Location:
 trunk
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r4485 r4488 1459 1459 MmodA = np.sum(Am[nxs,nxs,:,:,:]*pcos[:,:,:,nxs,nxs],axis=3) #cos term 1460 1460 MmodB = np.sum(Bm[nxs,nxs,:,:,:]*psin[:,:,:,nxs,nxs],axis=3) #sin term 1461 MmodA = np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=1)*SGData[' MagMom'][nxs,:,nxs,nxs]1462 MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=1)*SGData[' MagMom'][nxs,:,nxs,nxs]1461 MmodA = np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=1)*SGData['SpnFlp'][nxs,:,nxs,nxs] 1462 MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=1)*SGData['SpnFlp'][nxs,:,nxs,nxs] 1463 1463 return MmodA,MmodB #Ntau,Nops,Natm,Mxyz; cos & sin parts; sum matches drawn atom moments 1464 1464 … … 1802 1802 drawatom[dcx:dcx+3] = X 1803 1803 if generalData['Type'] == 'magnetic': 1804 M = G2spc.ApplyStringOpsMom(opr,SGData, SSGData,atmom+mom)1804 M = G2spc.ApplyStringOpsMom(opr,SGData,atmom+mom) 1805 1805 drawatom[dcx+3:dcx+6] = M 1806 1806 return drawAtoms,Fade 
trunk/GSASIIspc.py
r4485 r4488 3567 3567 return newX 3568 3568 3569 def ApplyStringOpsMom(A,SGData, SSGData,Mom):3569 def ApplyStringOpsMom(A,SGData,Mom): 3570 3570 '''Applies string operations to modulated magnetic moment components used in drawing 3571 3571 ''' 3572 3572 SGOps = SGData['SGOps'] 3573 SSGCen = SSGData['SSGCen']3574 3573 Ax = A.split('+') 3575 3574 Ax[0] = int(Ax[0]) … … 3585 3584 M,T = SGOps[nA] 3586 3585 newMom = np.inner(Mom,M).T*SGData['MagMom'][NA+nC] 3587 if SSGCen[iAx//100][3]: #flip spin for BNS centered atoms3588 newMom *= 1.3589 3586 return newMom 3590 3587 
trunk/GSASIIstrMath.py
r4377 r4488 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 1515 1514 if parmDict[pfx+'isMag']: #This part correct for making modulated mag moments on equiv atoms  matched drawing & Bilbao drawings 1515 1516 mTau = np.linspace(0,1.,ngl,False) 1516 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 1517 1518 if SGData['SGGray']: 1518 1519 mXYZ = np.hstack((mXYZ,mXYZ)) 1519 MmodA,MmodB = G2mth.MagMod( glTau,mXYZ,modQ,MSSdata,SGData,SSGData) #Ntau,Nops,Natm,Mxyz cos,sim parts sum matches drawing1520 MmodA,MmodB = G2mth.MagMod(mTau,mXYZ,modQ,MSSdata,SGData,SSGData) #Ntau,Nops,Natm,Mxyz cos,sim parts sum matches drawing 1520 1521 Mmod = MmodA+MmodB 1521 1522 … … 1529 1530 Mmod += GSdata[nxs,:,:,:] 1530 1531 1531 #Kdata = np.inner(Mmod,uAmat) #Ntau,Nop,Natm,Mxyz1532 # Mag = np.sqrt(np.sum(Kdata**2,axis=1)) 1533 #Kdata /= Mag[:,:,:,nxs] #Cartesian unit vectors1534 # Kdata = np.nan_to_num(Kdata) #Ntau,Nops,Natm,Mxyz1532 Kdata = np.inner(Mmod,uAmat) #Ntau,Nop,Natm,Mxyz 1533 Mag = np.sqrt(np.sum(Kdata**2,axis=1)) #ntau,nop,natm 1534 Kdata /= Mag[:,:,:,nxs] #Cartesian unit vectors 1535 Kdata = np.nan_to_num(Kdata) #Ntau,Nops,Natm,Mxyz checked against drawing 1535 1536 1536 1537 FF = np.zeros(len(Tdata)) … … 1599 1600 Tcorr = np.reshape(Tiso,Tuij.shape)*Tuij*Mdata*Fdata/Uniq.shape[1] #refBlk x ops x atoms 1600 1601 1601 if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']: #TODO: mag math here??1602 if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']: 1602 1603 1603 1604 phasem = twopi*np.inner(mXYZ,HP.T).T #2pi(Q.r) 1604 cosm = np.cos(phasem) 1605 cosm = np.cos(phasem) #Nref,nops,natm 1605 1606 sinm = np.sin(phasem) 1606 1607 MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T #Nref,Natm 1607 1608 TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*Fdata*MF/(2*Nops) #Nref,Natm 1608 1609 HM = np.inner(uBmat.T,HP.T) #put into cartesian space XH,ZH*L 1609 1610 #method 1 very wrong 1611 HM = np.inner(uBmat,HP.T) #put into cartesian space XH,ZH*L 1610 1612 eM = (HM/np.sqrt(np.sum(HM**2,axis=0))).T # normalize HP Nref,hkl=Unit vectors  Q 1611 #for fixed moments > m=0 reflections 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 1612 1623 fam0 = 0. 1613 1624 fbm0 = 0. … … 1626 1637 fams += fam0[:,nxs,:,:,:] 1627 1638 fbms += fbm0[:,nxs,:,:,:] 1628 else:1629 fams *= Ncen1630 fbms *= Ncen1639 # else: 1640 # fams *= Ncen 1641 # fbms *= Ncen 1631 1642 1632 1643 # do sum on ops, atms 1st … … 1634 1645 fbsm = np.sum(np.sum(fbms,axis=2),axis=2) 1635 1646 #put into cartesian space 1636 facm = np.inner(fasm,uAmat .T)1637 fbcm = np.inner(fbsm,uAmat .T)1647 facm = np.inner(fasm,uAmat) 1648 fbcm = np.inner(fbsm,uAmat) 1638 1649 #form e.F dot product 1639 1650 eDotFa = np.sum(eM[:,nxs,:]*facm,axis=1) #Nref,Ntau … … 1644 1655 #do integration 1645 1656 1646 fas = np.sum( glWt*fass,axis=1)1647 fbs = np.sum( glWt*fbss,axis=1)1657 fas = np.sum(1./ngl*fass,axis=1) 1658 fbs = np.sum(1./ngl*fbss,axis=1) 1648 1659 1649 if SGData['SGInv']:1650 fbs *= 4.1651 fas = 0.1652 1660 # if SGData['SGInv']: 1661 # fbs *= 4. 1662 # fas = 0. 1663 1653 1664 refl.T[10] = fas+fbs #Sum(fams**2,Mxyz) Re + Im 1654 1665 refl.T[11] = atan2d(fbs,fas)
Note: See TracChangeset
for help on using the changeset viewer.