Changeset 2480
- Timestamp:
- Sep 28, 2016 12:16:00 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r2473 r2480 1197 1197 G2frame.dataFrame.Bind(wx.EVT_MENU, AddResidueRB, id=G2gd.wxID_RIGIDBODYADD) 1198 1198 G2frame.dataFrame.Bind(wx.EVT_MENU, OnImportRigidBody, id=G2gd.wxID_RIGIDBODYIMPORT) 1199 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDefineTorsSeq, id=G2gd.wxID_RESIDUETORSSEQ) 1199 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDefineTorsSeq, id=G2gd.wxID_RESIDUETORSSEQ) #enable only if residue RBs exist? 1200 1200 G2frame.Page = [page,'rrb'] 1201 1201 UpdateResidueRB() … … 1418 1418 rbNames.sort() 1419 1419 rbId = 0 1420 if len(rbNames) > 1: 1420 if len(rbNames) == 0: 1421 print 'There are no rigid bodies defined' 1422 G2frame.ErrorDialog('No rigid bodies','There are no rigid bodies defined', 1423 parent=G2frame.dataFrame) 1424 return 1425 elif len(rbNames) > 1: 1421 1426 dlg = wx.SingleChoiceDialog(G2frame,'Select rigid body for torsion sequence','Torsion sequence',rbNames) 1422 1427 if dlg.ShowModal() == wx.ID_OK: -
trunk/GSASIIgrid.py
r2466 r2480 530 530 self.newCell = self.Phase['General']['Cell'][1:8] 531 531 self.Common = 'abc' 532 self.ifMag = False 532 533 self.Draw() 533 534 … … 616 617 self.newCell = G2lat.TransformCell(self.oldCell[:6],self.Trans) 617 618 wx.CallAfter(self.Draw) 619 620 def OnMag(event): 621 self.ifMag = mag.GetValue() 618 622 619 623 self.panel.Destroy() … … 673 677 sgSizer.Add(SGTxt,0,WACV) 674 678 mainSizer.Add(sgSizer,0,WACV) 679 if 'magnetic' not in self.Phase['General']['Type']: 680 mag = wx.CheckBox(self.panel,label=' Make magnetic phase?') 681 mag.Bind(wx.EVT_CHECKBOX,OnMag) 682 mainSizer.Add(mag,0,WACV) 675 683 676 684 TestBtn = wx.Button(self.panel,-1,"Test") … … 697 705 self.Phase['General']['Name'] += ' %s'%(self.Common) 698 706 self.Phase['General']['Cell'][1:] = G2lat.TransformCell(self.oldCell[:6],self.Trans) 699 return self.Phase,self.Trans,self.Vec 707 return self.Phase,self.Trans,self.Vec,self.ifMag 700 708 701 709 def OnOk(self,event): -
trunk/GSASIIlattice.py
r2476 r2480 229 229 return UijtoU6(Uij) 230 230 231 def TransformPhase(oldPhase,newPhase,Trans,Vec ):231 def TransformPhase(oldPhase,newPhase,Trans,Vec,ifMag): 232 232 '''Transform atoms from oldPhase to newPhase by Trans & Vec 233 233 NB: doesnt transform moments correctly - TBD … … 238 238 :param Trans: array transformation matrix 239 239 :param Vec: array transformation vector 240 :param ifMag: bool True if convert to magnetic phase 240 241 ''' 241 242 … … 252 253 atom[cx+i] += 1. 253 254 newAtoms += moreAtoms 255 if ifMag: 256 cia += 3 257 cs += 3 258 newPhase['General']['Type'] = 'magnetic' 259 newPhase['General']['AtomPtrs'] = [cx,ct,cs,cia] 260 magAtoms = [] 261 for atom in newAtoms: 262 magAtoms.append(atom[:cx+4]+[0.,0.,0.]+atom[cx+4:]) 263 newAtoms = magAtoms 264 newPhase['Draw Atoms'] = [] 254 265 for atom in newAtoms: 255 266 atom[cx:cx+3] = TransformXYZ(atom[cx:cx+3],invTrans.T,Vec)%1. -
trunk/GSASIIphsGUI.py
r2476 r2480 1377 1377 try: 1378 1378 if dlg.ShowModal() == wx.ID_OK: 1379 newPhase,Trans,Vec = dlg.GetSelection()1379 newPhase,Trans,Vec,ifMag = dlg.GetSelection() 1380 1380 else: 1381 1381 return … … 1383 1383 dlg.Destroy() 1384 1384 phaseName = newPhase['General']['Name'] 1385 newPhase = G2lat.TransformPhase(data,newPhase,Trans,Vec )1385 newPhase = G2lat.TransformPhase(data,newPhase,Trans,Vec,ifMag) 1386 1386 newPhase['General']['Map'] = mapDefault.copy() 1387 1387 sub = G2frame.PatternTree.AppendItem(parent= -
trunk/GSASIIplot.py
r2479 r2480 5117 5117 glEnable(GL_LIGHT0) 5118 5118 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,0) 5119 glLightfv(GL_LIGHT0,GL_AMBIENT,[. 8,.8,.8,1])5119 glLightfv(GL_LIGHT0,GL_AMBIENT,[.1,.1,.1,1]) 5120 5120 glLightfv(GL_LIGHT0,GL_DIFFUSE,[.8,.8,.8,1]) 5121 5121 # glLightfv(GL_LIGHT0,GL_SPECULAR,[1,1,1,1]) … … 5443 5443 glPushMatrix() 5444 5444 glTranslate(x,y,z) 5445 glMaterialfv(GL_FRONT_AND_BACK,GL_ AMBIENT_AND_DIFFUSE,color)5445 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,color) 5446 5446 glShadeModel(GL_SMOOTH) 5447 5447 glMultMatrixf(B4mat.T) -
trunk/GSASIIstrMath.py
r2478 r2480 599 599 'AU11:':Uijdata[0],'AU22:':Uijdata[1],'AU33:':Uijdata[2], 600 600 'AU12:':Uijdata[3],'AU13:':Uijdata[4],'AU23:':Uijdata[5], 601 'AMx ':Gdata[0],'AMy':Gdata[1],'AMz':Gdata[2],}601 'AMx:':Gdata[0],'AMy:':Gdata[1],'AMz:':Gdata[2],} 602 602 for iatm in range(Natoms): 603 603 for key in keys: … … 668 668 SGMT = np.array([ops[0].T for ops in SGData['SGOps']]) 669 669 SGT = np.array([ops[1] for ops in SGData['SGOps']]) 670 Ncen = len(SGData['SGCen']) 670 671 FFtables = calcControls['FFtables'] 671 672 BLtables = calcControls['BLtables'] 672 673 MFtables = calcControls['MFtables'] 674 Amat,Bmat = G2lat.Gmat2AB(G) 673 675 Flack = 1.0 674 676 if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType'] and phfx+'Flack' in parmDict: … … 684 686 Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \ 685 687 GetAtomFXU(pfx,calcControls,parmDict) 688 if parmDict[pfx+'isMag']: 689 Mag = np.sqrt(np.sum(Gdata**2,axis=0)) #magnitude of moments for uniq atoms 690 Gdata = np.where(Mag>0.,Gdata/Mag,0.) #normalze mag. moments 691 Gdata = np.inner(Bmat,Gdata.T) #convert to crystal space 692 Gdata = np.inner(Gdata.T,SGMT).T #apply sym. ops. 693 if SGData['SGInv']: 694 Gdata = np.hstack((Gdata,-Gdata)) #inversion if any 695 Gdata = np.repeat(Gdata,Ncen,axis=1) #dup over cell centering 696 Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata #flip vectors according to spin flip 697 Gdata = np.inner(Amat,Gdata.T) #convert back to cart. space MXYZ, Natoms, NOps*Inv*Ncen 698 Gdata = np.swapaxes(Gdata,1,2) # put Natoms last 699 # GSASIIpath.IPyBreak() 700 Mag = np.tile(Mag[:,nxs],len(SGMT)*Ncen).T 701 if SGData['SGInv']: 702 Mag = np.repeat(Mag,2,axis=0) #Mag same length as Gdata 686 703 if 'NC' in calcControls[hfx+'histType']: 687 704 FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam']) … … 709 726 for iel,El in enumerate(refDict['FF']['El']): 710 727 refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ) 711 # GSASIIpath.IPyBreak()712 728 #reflection processing begins here - big arrays! 713 729 iBeg = 0 … … 750 766 FF = np.repeat(refDict['FF']['FF'][iBeg:iFin].T[Tindx].T,len(SGT)*len(TwinLaw),axis=0) 751 767 if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']: 752 MF = np.repeat(refDict['FF']['MF'][iBeg:iFin].T[Tindx].T,len(SGT)*len(TwinLaw),axis=0) 753 #calc fam & fbm here 768 MF = np.repeat(refDict['FF']['MF'][iBeg:iFin].T[Tindx].T,len(TwinLaw),axis=0) #Nref,Natm 769 TMcorr = 0.539*Tcorr[:,0,:]*MF #Nref,Natm 770 if SGData['SGInv']: 771 mphase = np.hstack((phase,-phase)) 772 else: 773 mphase = phase 774 mphase = np.array([mphase+twopi*np.inner(cen,H)[:,nxs,nxs] for cen in SGData['SGCen']]) 775 mphase = np.concatenate(mphase,axis=1) #Nref,Nop,Natm 776 sinm = np.sin(mphase) #ditto - match magstrfc.for 777 cosm = np.cos(mphase) #ditto 778 HM = np.inner(Bmat.T,H) #put into cartesian space 779 HM = HM/np.sqrt(np.sum(HM**2,axis=0)) #Gdata = MAGS & HM = UVEC in magstrfc.for both OK 780 eDotK = np.sum(HM[:,:,nxs,nxs]*Gdata[:,nxs,:,:],axis=0) 781 Q = -HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]+Gdata[:,nxs,:,:] #xyz,Nref,Nop,Natm = BPM in magstrfc.for OK 782 fam = Q*TMcorr[nxs,:,nxs,:]*SGData['MagMom'][nxs,nxs,:,nxs]*cosm[nxs,:,:,:] #ditto 783 fbm = Q*TMcorr[nxs,:,nxs,:]*SGData['MagMom'][nxs,nxs,:,nxs]*sinm[nxs,:,:,:] #ditto 784 fams = np.sum(np.sum(fam,axis=-1),axis=-1) #xyz,Nref 785 fbms = np.sum(np.sum(fbm,axis=-1),axis=-1) #ditto 786 GSASIIpath.IPyBreak() 754 787 if 'T' in calcControls[hfx+'histType']: #fa,fb are 2 X blkSize X nTwin X nOps x nAtoms 755 788 fa = np.array([np.reshape(((FF+FP).T-Bab).T,cosp.shape)*cosp*Tcorr,-np.reshape(Flack*FPP,sinp.shape)*sinp*Tcorr]) … … 763 796 fbs[0] *= 0. 764 797 fas[1] *= 0. 765 if 'P WDR' in calcControls[hfx+'histType']: #PWDR: F^2 = A[0]^2 + A[1]^2 + B[0]^2 + B[1]^2798 if 'P' in calcControls[hfx+'histType']: #PXC, PNC & PNT: F^2 = A[0]^2 + A[1]^2 + B[0]^2 + B[1]^2 766 799 refl.T[9] = np.sum(fas**2,axis=0)+np.sum(fbs**2,axis=0) #add fam**2 & fbm**2 here 767 800 refl.T[10] = atan2d(fbs[0],fas[0]) #ignore f' & f" 801 if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']: 802 refl.T[9] += np.sum(fams**2,axis=0)+np.sum(fbms**2,axis=0) 768 803 else: #HKLF: F^2 = (A[0]+A[1])^2 + (B[0]+B[1])^2 769 804 if len(TwinLaw) > 1: -
trunk/imports/G2pwd_xye.py
r2463 r2480 38 38 self.GSAS = False 39 39 for i,S in enumerate(filepointer): 40 if not S: 41 break 40 42 if i > 1000: break 41 43 if begin:
Note: See TracChangeset
for help on using the changeset viewer.