# Changeset 4997

Ignore:
Timestamp:
Jul 16, 2021 9:21:10 AM (19 months ago)
Message:

move imports to top of G2ctrlGUi code so debugger can find it
fix FillUnitCell? bug when incommensurate mag.
latest revision of incomm. mag. str. factor stuff

Location:
trunk
Files:
5 edited

Unmodified
Removed
• ## trunk/GSASIIctrlGUI.py

 r4987 import glob import copy import ast import random as ran import webbrowser     # could postpone this for quicker startup import GSASIImath as G2mth import GSASIIstrMain as G2stMn import config_example if sys.version_info[0] >= 3: unicode = str
• ## trunk/GSASIImath.py

 r4990 psin = np.sin(twopi*phase) pcos = np.cos(twopi*phase) MmodA = Am[nxs,nxs,:,:]*pcos[:,:,:,nxs]    #cos term MmodB = Bm[nxs,nxs,:,:]*psin[:,:,:,nxs]    #sin term MmodA = np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=-1)*SGData['SpnFlp'][nxs,:,nxs,nxs] MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=-1)*SGData['SpnFlp'][nxs,:,nxs,nxs] return MmodA,MmodB    #Ntau,Nops,Natm,Mxyz; cos & sin parts; sum matches drawn atom moments MmodAR = Am[nxs,nxs,:,:]*pcos[:,:,:,nxs]    #cos term MmodBR = Bm[nxs,nxs,:,:]*psin[:,:,:,nxs]    #sin term MmodAR = np.sum(SGMT[nxs,:,nxs,:,:]*MmodAR[:,:,:,nxs,:],axis=-1) MmodBR = np.sum(SGMT[nxs,:,nxs,:,:]*MmodBR[:,:,:,nxs,:],axis=-1) MmodAI = Am[nxs,nxs,:,:]*psin[:,:,:,nxs]    #cos term MmodBI = Bm[nxs,nxs,:,:]*pcos[:,:,:,nxs]    #sin term MmodAI = np.sum(SGMT[nxs,:,nxs,:,:]*MmodAI[:,:,:,nxs,:],axis=-1) MmodBI = np.sum(SGMT[nxs,:,nxs,:,:]*MmodBI[:,:,:,nxs,:],axis=-1) return MmodAR,MmodBR,MmodAI,MmodBI    #Ntau,Nops,Natm,Mxyz; cos & sin parts; sum matches drawn atom moments def Modulation(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt):
• ## trunk/GSASIIphsGUI.py

 r4992 atom[cx:cx+3] = Opp[key] atom[cs-1] = cell atomData.append(atom[:cuij+9])  #not SS stuff atomData.append(atom[:cuij+7]+atom[-2:])  #not SS stuff data['Drawing']['Atoms'] = atomData GoOn = pgbar.Update(Ind,newmsg='Atoms done=%d'%(Ind))
• ## trunk/GSASIIplot.py

 r4992 def RenderBonds(x,y,z,Bonds,radius,color,slice=20): if not len(Bonds): return GL.glMaterialfv(GL.GL_FRONT_AND_BACK,GL.GL_DIFFUSE,color) GL.glPushMatrix() for i,xyz in enumerate(Atoms): ax,ay,az = xyz RenderBonds(ax,ay,az,bondData[i],bondR,Color[i]) if len(bondData[i]): RenderBonds(ax,ay,az,bondData[i],bondR,Color[i]) def Draw(caller='',Fade=[],NPkey=False):
• ## trunk/GSASIIstrMath.py

 r4995 mXYZ = np.hstack((mXYZ,mXYZ)) MmodA,MmodB = G2mth.MagMod(glTau,mXYZ,modQ,MSSdata,SGData,SSGData)  #Ntau,Nops,Natm,Mxyz cos,sin parts sum matches drawing MmodAR,MmodBR,MmodAI,MmodBI = G2mth.MagMod(glTau,mXYZ,modQ,MSSdata,SGData,SSGData)  #Ntau,Nops,Natm,Mxyz cos,sin parts sum matches drawing if not SGData['SGGray']:    #for fixed Mx,My,Mz MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T   #Nref,Natm TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*Fdata*MF/(2*Nops)     #Nref,Natm HM = np.inner(Bmat,HP.T)                    #put into cartesian space X||H,Z||H*L; Hlen = np.sqrt(np.sum(HM**2,axis=0)) eM = (HM/Hlen).T    # normalize  HP  Nref,hkl=Unit vectors || Q HM = np.inner(Bmat,HP.T)                #put into cartesian space X||H,Z||H*L; eM = (HM*refl.T[5]).T                   # normalize HP by d*    Nref,hkl=Unit vectors || Q if not SGData['SGGray']:     #correct -fixed Mx,My,Mz contribution fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs] #  calc mag. structure factors; Nref,Ntau,Nops,Natm,Mxyz fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*cosm[i,nxs,:,:,nxs]+ H[3,i]*MmodB*sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2.          #Nref,Ntau,Nops,Natm,Mxyz fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,( (MmodAR+H[3,i]*MmodBR)*cosm[i,nxs,:,:,nxs]+ (-MmodAI+H[3,i]*MmodBI)*sinm[i,nxs,:,:,nxs])*SGData['SpnFlp'][nxs,:,nxs,nxs], 0.) for i in range(mRef)])/2.          #Nref,Ntau,Nops,Natm,Mxyz fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*sinm[i,nxs,:,:,nxs]+ H[3,i]*MmodB*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2.          #Nref,Ntau,Nops,Natm,Mxyz fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,( (MmodAR+H[3,i]*MmodBR)*sinm[i,nxs,:,:,nxs]+ (-MmodAI+H[3,i]*MmodBI)*cosm[i,nxs,:,:,nxs])*SGData['SpnFlp'][nxs,:,nxs,nxs], 0.) for i in range(mRef)])/2.          #Nref,Ntau,Nops,Natm,Mxyz if not SGData['SGGray']: fams += fam0[:,nxs,:,:,:] fbsm = np.sum(np.sum(fbms,axis=-2),axis=-2) # #put into cartesian space facm = np.inner(fasm,uAmat.T) facm = np.inner(fasm,uAmat.T)       #.T better than not fbcm = np.inner(fbsm,uAmat.T) #form e.F dot product
Note: See TracChangeset for help on using the changeset viewer.