- Timestamp:
- Jan 27, 2019 9:04:12 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIlattice.py ¶
r3783 r3801 590 590 591 591 """ 592 cellstar = Gmat2cell(G)592 # cellstar = Gmat2cell(G) 593 593 g = nl.inv(G) 594 594 cell = Gmat2cell(g) 595 A = np.zeros(shape=(3,3)) 596 # from Giacovazzo (Fundamentals 2nd Ed.) p.75 597 A[0][0] = cell[0] # a 598 A[0][1] = cell[1]*cosd(cell[5]) # b cos(gamma) 599 A[0][2] = cell[2]*cosd(cell[4]) # c cos(beta) 600 A[1][1] = cell[1]*sind(cell[5]) # b sin(gamma) 601 A[1][2] = -cell[2]*cosd(cellstar[3])*sind(cell[4]) # - c cos(alpha*) sin(beta) 602 A[2][2] = 1./cellstar[2] # 1/c* 603 B = nl.inv(A) 604 return A,B 595 # A = np.zeros(shape=(3,3)) 596 return cell2AB(cell) 597 # # from Giacovazzo (Fundamentals 2nd Ed.) p.75 598 # A[0][0] = cell[0] # a 599 # A[0][1] = cell[1]*cosd(cell[5]) # b cos(gamma) 600 # A[0][2] = cell[2]*cosd(cell[4]) # c cos(beta) 601 # A[1][1] = cell[1]*sind(cell[5]) # b sin(gamma) 602 # A[1][2] = -cell[2]*cosd(cellstar[3])*sind(cell[4]) # - c cos(alpha*) sin(beta) 603 # A[2][2] = 1./cellstar[2] # 1/c* 604 # B = nl.inv(A) 605 # return A,B 605 606 606 607 def cell2AB(cell): -
TabularUnified trunk/GSASIIstrMath.py ¶
r3795 r3801 976 976 return 977 977 Mag = np.array([np.sqrt(np.inner(mag,np.inner(mag,Ginv))) for mag in Gdata.T]) 978 Gdata = np.inner(Gdata.T, SGMT).T #apply sym. ops.978 Gdata = np.inner(Gdata.T,np.swapaxes(SGMT,1,2)).T #apply sym. ops. 979 979 if SGData['SGInv'] and not SGData['SGFixed']: 980 980 Gdata = np.hstack((Gdata,-Gdata)) #inversion if any … … 982 982 Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata #flip vectors according to spin flip * det(opM) 983 983 Mag = np.tile(Mag[:,nxs],Nops).T #make Mag same length as Gdata 984 VGi = np.sqrt(nl.det(Ginv)) 985 Kdata = np.inner(Gdata.T,uAmat).T*VGi/Mag #Cartesian unit vectors 984 Kdata = np.inner(Gdata.T,uAmat.T).T/Mag #Cartesian unit vectors 986 985 Uij = np.array(G2lat.U6toUij(Uijdata)) 987 986 bij = Mast*Uij.T … … 1130 1129 Mag = np.array([np.sqrt(np.inner(mag,np.inner(mag,Ginv))) for mag in Gdata.T]) 1131 1130 Gones = np.ones_like(Gdata) 1132 Gdata = np.inner(Gdata.T, SGMT).T #apply sym. ops.1131 Gdata = np.inner(Gdata.T,np.swapaxes(SGMT,1,2)).T #apply sym. ops. 1133 1132 Gones = np.inner(Gones.T,SGMT).T 1134 1133 if SGData['SGInv'] and not SGData['SGFixed']: … … 1140 1139 Gones = SGData['MagMom'][nxs,:,nxs]*Gones #flip vectors according to spin flip 1141 1140 Mag = np.tile(Mag[:,nxs],Nops).T #make Mag same length as Gdata 1142 VGi = np.sqrt(nl.det(Ginv)) 1143 Kdata = np.inner(Gdata.T,uAmat).T*VGi/Mag #make unit vectors in Cartesian space 1141 Kdata = np.inner(Gdata.T,uAmat.T).T/Mag #Cartesian unit vectors 1144 1142 Uij = np.array(G2lat.U6toUij(Uijdata)) 1145 1143 bij = Mast*Uij.T … … 1417 1415 GS = G/np.outer(ast,ast) 1418 1416 Ginv = g/np.outer(ainv,ainv) 1419 VGi = np.sqrt(nl.det(Ginv))1420 1417 uAmat = G2lat.Gmat2AB(GS)[0] 1421 1418 Mast = twopisq*np.multiply.outer(ast,ast) … … 1442 1439 1443 1440 if parmDict[pfx+'isMag']: #TODO: fix the math 1444 GSdata = Gdata[:,nxs,:]+Mmod.T 1445 GSdata = np.inner(GSdata.T, SGMT).T #apply sym. ops.1441 GSdata = Gdata[:,nxs,:]+Mmod.T #Mxyz,Ntau,nAtm 1442 GSdata = np.inner(GSdata.T,np.swapaxes(SGMT,1,2)).T #apply sym. ops. 1446 1443 if SGData['SGInv'] and not SGData['SGFixed']: 1447 1444 GSdata = np.hstack((GSdata,-GSdata)) #inversion if any … … 1449 1446 GSdata = SGData['MagMom'][nxs,:,nxs,nxs]*GSdata #flip vectors according to spin flip * det(opM) 1450 1447 SMag = np.sqrt(np.sum((np.inner(GSdata.T,Ginv)*GSdata.T),axis=-1)).T 1451 Kdata = np.inner(G Sdata.T,uAmat).T*VGi/SMag[nxs,:,:,:] #Cartesian unit vectors = 0.9626 for hexagonal???1448 Kdata = np.inner(Gdata.T,uAmat.T).T/SMag[nxs,:,:,:] #Cartesian unit vectors 1452 1449 1453 1450 FF = np.zeros(len(Tdata))
Note: See TracChangeset
for help on using the changeset viewer.