Changeset 646
- Timestamp:
- Jun 4, 2012 2:43:15 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIImath.py ¶
r645 r646 584 584 585 585 def findOffset(SGData,rho,Fhkl): 586 587 def calcPhase(DX,DH,Dphi): 588 H,K,L = DH.T 589 Phi = (H*DX[0]+K*DX[1]+L*DX[2]+0.5) % 1. 590 return Dphi-Phi 591 592 if SGData['SpGrp'] == 'P 1': 593 return [0,0,0] 594 # will need to consider 'SGPolax': one of '','x','y','x y','z','x z','y z','xyz','111' 586 595 mapShape = rho.shape 596 steps = np.array(mapShape) 587 597 hklShape = Fhkl.shape 588 598 mapHalf = np.array(mapShape)/2 … … 600 610 F = str(1.e6) 601 611 i = 0 612 DH = [] 613 Dphi = [] 602 614 while float(F) > 0.5*Fmax: 603 615 F = Flist[i] 604 616 hkl = np.unravel_index(Fdict[F],hklShape) 605 iabsnt,mulp,Uniq,phi = G2spc.GenHKLf(list(hkl-hklHalf),SGData,Friedel=True) 606 Uniq = np.array(Uniq,dtype='i')+hklHalf 607 print hkl-hklHalf 617 iabsnt,mulp,Uniq,Phi = G2spc.GenHKLf(list(hkl-hklHalf),SGData) 618 Uniq = np.array(Uniq,dtype='i') 619 Phi = np.array(Phi) 620 Uniq = np.concatenate((Uniq,-Uniq))+hklHalf # put in Friedel pairs & make as index to Farray 621 Phi = np.concatenate((Phi,-Phi)) # and their phase shifts 608 622 Fh0 = Fhkl[hkl[0],hkl[1],hkl[2]] 609 ph0 = np.angle(Fh0,deg=True)/360. 610 for j,H in enumerate(Uniq): 611 Fh = Fhkl[H[0],H[1],H[2]] 612 h,k,l = H-hklHalf 613 ang = (np.angle(Fh,deg=True)/360.-phi[j]) % 1. 614 print '(%3d,%3d,%3d) %9.5f'%(h,k,l,ang) 623 ang0 = np.angle(Fh0,deg=True)/360. 624 for j,H in enumerate(Uniq[1:]): 625 ang = (np.angle(Fhkl[H[0],H[1],H[2]],deg=True)/360.-Phi[j+1]) 626 dH = H-hkl 627 dang = ang-ang0 628 DH.append(dH) 629 Dphi.append((dang+0.5) % 1.0) 615 630 i += 1 616 617 618 619 return [0,0,0] 631 # for item in zip(DH,Dphi): 632 # print item 633 DH = np.array(DH) 634 Dphi = np.array(Dphi) 635 DX = np.zeros(3) 636 X,Y,Z = np.mgrid[0:1:steps[0]*(0+1j),0:1:steps[1]*(0+1j),0:1:steps[2]*(0+1j)] 637 XYZ = np.array(zip(X.flatten(),Y.flatten(),Z.flatten())) 638 Mmin = 1.e10 639 640 for xyz in XYZ: 641 M = np.sum(calcPhase(xyz,DH,Dphi)**2) 642 if M < Mmin: 643 DX = xyz 644 Mmin = M 645 646 print DX,Mmin 647 result = so.leastsq(calcPhase,DX,full_output=True,args=(DH,Dphi)) 648 chisq = np.sum(result[2]['fvec']**2) 649 DX = np.array(np.rint(-result[0]*steps),dtype='i') 650 print chisq,DX 651 print result[0],result[0]*steps 652 return DX 620 653 621 654 def ChargeFlip(data,reflData,pgbar): -
TabularUnified trunk/GSASIIphsGUI.py ¶
r636 r646 3497 3497 H = ref[:3] 3498 3498 ref[4] = np.sqrt(1./G2lat.calc_rDsq2(H,G)) 3499 iabsnt,mulp,Uniq,phi = G2spc.GenHKLf(H,SGData ,Friedel=False)3499 iabsnt,mulp,Uniq,phi = G2spc.GenHKLf(H,SGData) 3500 3500 ref[3] = mulp/2 #convert from powder mulp. 3501 3501 ref[11] = Uniq -
TabularUnified trunk/GSASIIplot.py ¶
r644 r646 2863 2863 glMatrixMode(GL_MODELVIEW) 2864 2864 glLoadIdentity() 2865 glRotate(anglez,0,0,1) 2866 glRotate(angley,sind(anglez),cosd(anglez),0) 2867 glRotate(anglex,cosd(anglez),-sind(anglez),0) 2865 matX = G2lat.rotdMat(anglex,axis=0) 2866 matY = G2lat.rotdMat(angley,axis=1) 2867 matZ = G2lat.rotdMat(anglez,axis=2) 2868 matRot = np.inner(matX,np.inner(matY,matZ)) 2869 matRot = np.concatenate((np.concatenate((matRot,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0) 2870 glMultMatrixf(matRot.T) 2868 2871 glMultMatrixf(A4mat.T) 2869 2872 glTranslate(-Tx,-Ty,-Tz) -
TabularUnified trunk/GSASIIspc.py ¶
r584 r646 35 35 'SGOps': symmetry operations as [M,T] so that M*x+T = x' 36 36 'SGSys': one of 'triclinic','monoclinic','orthorhombic','tetragonal','rhombohedral','trigonal','hexagonal','cubic' 37 'SGPolax': one of '','x','y','x y','z','x z','y z','xyz','111' for arbitrary axes 37 38 ''' 38 39 LaueSym = ('-1','2/m','mmm','4/m','4/mmm','3R','3mR','3','3m1','31m','6/m','6/mmm','m3','m3m') … … 312 313 return zip(XYZEquiv,Idup,Cell) 313 314 314 def GenHKLf(HKL,SGData ,Friedel=False):315 def GenHKLf(HKL,SGData): 315 316 ''' 316 317 Uses old GSAS Fortran routine genhkl.for … … 318 319 HKL - [h,k,l] 319 320 SGData - space group data obtained from SpcGroup 320 Friedel = True to retain Friedel pairs for centrosymmetric case321 321 returns: 322 322 iabsnt = True is reflection is forbidden by symmetry 323 mulp = reflection multiplicity including Fri del pairs323 mulp = reflection multiplicity including Friedel pairs 324 324 Uniq = numpy array of equivalent hkl in descending order of h,k,l 325 325 ''' … … 335 335 Uniq=np.array(zip(h[:Nuniq],k[:Nuniq],l[:Nuniq])) 336 336 phi = f[:Nuniq] 337 Uniq = np.array(Uniq) 338 339 return iabsnt,2*mulp,Uniq,phi #include Friedel pairs in powder mulp 337 338 return iabsnt,mulp,Uniq,phi 340 339 341 340 def GetOprPtrName(key): -
TabularUnified trunk/GSASIIstruct.py ¶
r637 r646 1211 1211 for h,k,l,d in HKLd: 1212 1212 ext,mul,Uniq,phi = G2spc.GenHKLf([h,k,l],SGData) 1213 mul *= 2 # for powder overlap of Friedel pairs 1213 1214 if ext: 1214 1215 continue … … 1983 1984 biso = -SQfactor*Uisodata 1984 1985 Tiso = np.where(biso<1.,np.exp(biso),1.0) 1985 # HbH = np.array([-np.inner(h,np.inner(bij,h)) for h in Uniq])1986 1986 HbH = -np.inner(H,np.inner(bij,H)) 1987 1987 Hij = np.array([Mast*np.multiply.outer(U,U) for U in Uniq])
Note: See TracChangeset
for help on using the changeset viewer.