Changeset 1604
- Timestamp:
- Dec 11, 2014 3:27:57 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r1601 r1604 215 215 return indx 216 216 217 def FillAtomLookUp(atomData ):217 def FillAtomLookUp(atomData,indx): 218 218 '''create a dictionary of atom indexes with atom IDs as keys 219 219 … … 225 225 atomLookUp = {} 226 226 for iatm,atom in enumerate(atomData): 227 atomLookUp[atom[ -1]] = iatm227 atomLookUp[atom[indx]] = iatm 228 228 return atomLookUp 229 229 -
trunk/GSASIIobj.py
r1600 r1604 1254 1254 'A([0-5])' : 'Reciprocal metric tensor component \\1', 1255 1255 'Vol' : 'Unit cell volume', 1256 'mV([0-2])' : 'Modulation vector component \\1',1257 1256 # Atom vars (p::<var>:a) 1258 1257 'dA([xyz])$' : 'change to atomic coordinate, \\1', … … 1294 1293 'RBRTr;.*' : 'Residue rigid body torsion parameter', 1295 1294 'RBR([TLS])([123AB][123AB])' : 'Residue rigid body group disp. param.', 1296 # Global vars (::<var>)1297 1295 'constr([0-9]*)' : 'Parameter from constraint', 1296 # supersymmetry parameters 1297 'mV([0-2])' : 'Modulation vector component \\1', 1298 # 'Flen','Fcent','Fsin','Fcos' 1299 '[XYZ]sin' : 'Sin position wave for \\1', 1300 '[XYZ]cos' : 'Cos position wave for \\1', 1301 'U[123][123]sin' : 'Sin thermal wave for U\\1', 1302 'U[123][123]cos' : 'Cos thermal wave for U\\1', 1303 'M[XYZ]sin' : 'Sin mag. moment wave for \\1', 1304 'M[XYZ]cos' : 'Cos mag. moment wave for \\1', 1298 1305 # SASD vars (l:<var>;l = component) 1299 1306 'Aspect ratio' : 'Particle aspect ratio', -
trunk/GSASIIphsGUI.py
r1601 r1604 110 110 generalData['POhkl'] = [0,0,1] 111 111 if 'Map' not in generalData: 112 generalData['Map'] = mapDefault 112 generalData['Map'] = {} 113 generalData['Map'].update(mapDefault) 113 114 if 'Flip' not in generalData: 114 115 generalData['Flip'] = {'RefList':'','Resolution':0.5,'Norm element':'None', … … 135 136 generalData['SSGData'] = {} 136 137 if '4DmapData' not in generalData: 137 generalData['4DmapData'] = mapDefault 138 generalData['4DmapData'] = {} 139 generalData['4DmapData'].update(mapDefault) 138 140 generalData['4DmapData'].update({'MapType':'Fobs'}) 139 141 # end of patches … … 1970 1972 1971 1973 def OnShowWave(event): 1972 mapBtn.SetValue(False) 1973 G2plt.ModulationPlot(G2frame,data,atom) 1974 Obj = event.GetEventObject() 1975 atom = Indx[Obj.GetId()] 1976 Ax = Obj.GetValue() 1977 G2plt.ModulationPlot(G2frame,data,atom,Ax) 1974 1978 1975 1979 atomSizer = wx.BoxSizer(wx.HORIZONTAL) … … 1979 1983 waveType.Bind(wx.EVT_COMBOBOX,OnWaveType) 1980 1984 atomSizer.Add(waveType,0,WACV) 1981 mapBtn = wx.CheckBox(waveData,label='Show contour map?') 1982 mapBtn.Bind(wx.EVT_CHECKBOX, OnShowWave) 1983 Indx[mapBtn.GetId()] = atom 1984 atomSizer.Add(mapBtn,0,WACV) 1985 axchoice = ['x','y','z'] 1986 atomSizer.Add(wx.StaticText(waveData,label=' Show contour map for axis:'),0,WACV) 1987 mapSel = wx.ComboBox(waveData,value=' ',choices=axchoice, 1988 style=wx.CB_READONLY|wx.CB_DROPDOWN) 1989 mapSel.Bind(wx.EVT_COMBOBOX,OnShowWave) 1990 Indx[mapSel.GetId()] = atom 1991 atomSizer.Add(mapSel,0,WACV) 1985 1992 return atomSizer 1986 1993 … … 2059 2066 2060 2067 Map = generalData['4DmapData'] 2068 Map['Resolution'] = 0.25 2061 2069 refList = data['Histograms'].keys() 2062 2070 mapSizer = wx.BoxSizer(wx.HORIZONTAL) … … 2084 2092 typeNames = {'Sfrac':' Site fraction','Spos':' Position','Sadp':' Thermal motion','Smag':' Magnetic moment'} 2085 2093 numVals = {'Sfrac':2,'Spos':6,'Sadp':12,'Smag':6} 2086 posNames = ['Xsin','Ysin','Zsin','Xcos','Y sin','Zsin']2094 posNames = ['Xsin','Ysin','Zsin','Xcos','Ycos','Zcos'] 2087 2095 adpNames = ['U11sin','U22sin','U33sin','U12sin','U13sin','U23sin', 2088 2096 'U11cos','U22cos','U33cos','U12cos','U13cos','U23cos'] -
trunk/GSASIIplot.py
r1601 r1604 2766 2766 2767 2767 ################################################################################ 2768 ##### 2768 ##### Modulation Plot 2769 2769 ################################################################################ 2770 2770 2771 def ModulationPlot(G2frame,data,atom ):2771 def ModulationPlot(G2frame,data,atom,Ax): 2772 2772 2773 2773 print 'modulation plot for',atom[0] … … 2785 2785 # Page.canvas.mpl_connect('motion_notify_event', OnMotion) 2786 2786 2787 General = data['General'] 2788 cx,ct,cs,cia = General['AtomPtrs'] 2789 Map = General['4DmapData'] 2790 MapType = Map['MapType'] 2791 rhoSize = np.array(Map['rho'].shape) 2792 atxyz = np.array(atom[cx:cx+3]) 2793 Title = MapType+' modulation map for atom '+atom[0]+ \ 2794 ' at %.4f %.4f %.4f'%(atxyz[0],atxyz[1],atxyz[2]) 2795 ix = -np.array(np.rint(rhoSize[:3]*atxyz),dtype='i') 2796 ix += (rhoSize[:3]/2) 2797 ix = ix%rhoSize[:3] 2798 print 'roll',ix,atxyz 2799 rho = np.roll(np.roll(np.roll(Map['rho'],ix[0],axis=0),ix[1],axis=1),ix[2],axis=2) 2800 ix = rhoSize[:3]/2 2801 print 'slab',ix,rhoSize 2802 ib = 4 2803 if Ax == 'x': 2804 slab = np.sum(np.sum(rho[:,ix[1]-ib:ix[1]+ib,ix[2]-ib:ix[2]+ib,:],axis=2),axis=1) 2805 elif Ax == 'y': 2806 slab = np.sum(np.sum(rho[ix[0]-ib:ix[0]+ib,:,ix[2]-ib:ix[2]+ib,:],axis=2),axis=0) 2807 elif Ax == 'z': 2808 slab = np.sum(np.sum(rho[ix[0]-ib:ix[0]+ib,ix[1]-ib:ix[1]+ib,:,:],axis=1),axis=0) 2809 Plot.set_title(Title) 2810 Plot.set_xlabel('t') 2811 Plot.set_ylabel(r'$\mathsf{\Delta}$%s'%(Ax)) 2812 Plot.contour(slab,20,extent=(0.,1.,-.5,.5)) 2813 Page.canvas.draw() 2787 2814 2788 2815 ################################################################################ -
trunk/GSASIIstrIO.py
r1597 r1604 963 963 BLtables.update(BLtable) 964 964 Atoms = PhaseData[name]['Atoms'] 965 AtLookup = G2mth.FillAtomLookUp(Atoms) 965 if Atoms and not General.get('doPawley'): 966 cx,ct,cs,cia = General['AtomPtrs'] 967 AtLookup = G2mth.FillAtomLookUp(Atoms,cia+8) 966 968 PawleyRef = PhaseData[name].get('Pawley ref',[]) 967 969 SGData = General['SGData'] … … 1001 1003 if Atoms and not General.get('doPawley'): 1002 1004 cx,ct,cs,cia = General['AtomPtrs'] 1003 if General['Type'] in ['nuclear','macromolecular']: 1004 Natoms[pfx] = len(Atoms) 1005 for i,at in enumerate(Atoms): 1006 atomIndx[at[-1]] = [pfx,i] #lookup table for restraints 1007 phaseDict.update({pfx+'Atype:'+str(i):at[ct],pfx+'Afrac:'+str(i):at[cx+3],pfx+'Amul:'+str(i):at[cs+1], 1008 pfx+'Ax:'+str(i):at[cx],pfx+'Ay:'+str(i):at[cx+1],pfx+'Az:'+str(i):at[cx+2], 1009 pfx+'dAx:'+str(i):0.,pfx+'dAy:'+str(i):0.,pfx+'dAz:'+str(i):0., #refined shifts for x,y,z 1010 pfx+'AI/A:'+str(i):at[cia],}) 1005 Natoms[pfx] = len(Atoms) 1006 for i,at in enumerate(Atoms): 1007 atomIndx[at[cia+8]] = [pfx,i] #lookup table for restraints 1008 phaseDict.update({pfx+'Atype:'+str(i):at[ct],pfx+'Afrac:'+str(i):at[cx+3],pfx+'Amul:'+str(i):at[cs+1], 1009 pfx+'Ax:'+str(i):at[cx],pfx+'Ay:'+str(i):at[cx+1],pfx+'Az:'+str(i):at[cx+2], 1010 pfx+'dAx:'+str(i):0.,pfx+'dAy:'+str(i):0.,pfx+'dAz:'+str(i):0., #refined shifts for x,y,z 1011 pfx+'AI/A:'+str(i):at[cia],}) 1012 if at[cia] == 'I': 1013 phaseDict[pfx+'AUiso:'+str(i)] = at[cia+1] 1014 else: 1015 phaseDict.update({pfx+'AU11:'+str(i):at[cia+2],pfx+'AU22:'+str(i):at[cia+3],pfx+'AU33:'+str(i):at[cia+4], 1016 pfx+'AU12:'+str(i):at[cia+5],pfx+'AU13:'+str(i):at[cia+6],pfx+'AU23:'+str(i):at[cia+7]}) 1017 if 'F' in at[ct+1]: 1018 phaseVary.append(pfx+'Afrac:'+str(i)) 1019 if 'X' in at[ct+1]: 1020 try: #patch for sytsym name changes 1021 xId,xCoef = G2spc.GetCSxinel(at[cs]) 1022 except KeyError: 1023 Sytsym = G2spc.SytSym(at[cx:cx+3],SGData)[0] 1024 at[cs] = Sytsym 1025 xId,xCoef = G2spc.GetCSxinel(at[cs]) 1026 xId,xCoef = G2spc.GetCSxinel(at[cs]) 1027 names = [pfx+'dAx:'+str(i),pfx+'dAy:'+str(i),pfx+'dAz:'+str(i)] 1028 equivs = [[],[],[]] 1029 for j in range(3): 1030 if xId[j] > 0: 1031 phaseVary.append(names[j]) 1032 equivs[xId[j]-1].append([names[j],xCoef[j]]) 1033 for equiv in equivs: 1034 if len(equiv) > 1: 1035 name = equiv[0][0] 1036 coef = equiv[0][1] 1037 for eqv in equiv[1:]: 1038 eqv[1] /= coef 1039 G2mv.StoreEquivalence(name,(eqv,)) 1040 if 'U' in at[ct+1]: 1011 1041 if at[cia] == 'I': 1012 phase Dict[pfx+'AUiso:'+str(i)] = at[cia+1]1042 phaseVary.append(pfx+'AUiso:'+str(i)) 1013 1043 else: 1014 phaseDict.update({pfx+'AU11:'+str(i):at[cia+2],pfx+'AU22:'+str(i):at[cia+3],pfx+'AU33:'+str(i):at[cia+4],1015 pfx+'AU12:'+str(i):at[cia+5],pfx+'AU13:'+str(i):at[cia+6],pfx+'AU23:'+str(i):at[cia+7]})1016 if 'F' in at[ct+1]:1017 phaseVary.append(pfx+'Afrac:'+str(i))1018 if 'X' in at[ct+1]:1019 1044 try: #patch for sytsym name changes 1020 xId,xCoef = G2spc.GetCSxinel(at[cs])1045 uId,uCoef = G2spc.GetCSuinel(at[cs])[:2] 1021 1046 except KeyError: 1022 1047 Sytsym = G2spc.SytSym(at[cx:cx+3],SGData)[0] 1023 1048 at[cs] = Sytsym 1024 xId,xCoef = G2spc.GetCSxinel(at[cs]) 1025 xId,xCoef = G2spc.GetCSxinel(at[cs]) 1026 names = [pfx+'dAx:'+str(i),pfx+'dAy:'+str(i),pfx+'dAz:'+str(i)] 1027 equivs = [[],[],[]] 1028 for j in range(3): 1029 if xId[j] > 0: 1049 uId,uCoef = G2spc.GetCSuinel(at[cs])[:2] 1050 uId,uCoef = G2spc.GetCSuinel(at[cs])[:2] 1051 names = [pfx+'AU11:'+str(i),pfx+'AU22:'+str(i),pfx+'AU33:'+str(i), 1052 pfx+'AU12:'+str(i),pfx+'AU13:'+str(i),pfx+'AU23:'+str(i)] 1053 equivs = [[],[],[],[],[],[]] 1054 for j in range(6): 1055 if uId[j] > 0: 1030 1056 phaseVary.append(names[j]) 1031 equivs[ xId[j]-1].append([names[j],xCoef[j]])1057 equivs[uId[j]-1].append([names[j],uCoef[j]]) 1032 1058 for equiv in equivs: 1033 1059 if len(equiv) > 1: … … 1036 1062 for eqv in equiv[1:]: 1037 1063 eqv[1] /= coef 1038 G2mv.StoreEquivalence(name,(eqv,)) 1039 if 'U' in at[ct+1]: 1040 if at[cia] == 'I': 1041 phaseVary.append(pfx+'AUiso:'+str(i)) 1042 else: 1043 try: #patch for sytsym name changes 1044 uId,uCoef = G2spc.GetCSuinel(at[cs])[:2] 1045 except KeyError: 1046 Sytsym = G2spc.SytSym(at[cx:cx+3],SGData)[0] 1047 at[cs] = Sytsym 1048 uId,uCoef = G2spc.GetCSuinel(at[cs])[:2] 1049 uId,uCoef = G2spc.GetCSuinel(at[cs])[:2] 1050 names = [pfx+'AU11:'+str(i),pfx+'AU22:'+str(i),pfx+'AU33:'+str(i), 1051 pfx+'AU12:'+str(i),pfx+'AU13:'+str(i),pfx+'AU23:'+str(i)] 1052 equivs = [[],[],[],[],[],[]] 1053 for j in range(6): 1054 if uId[j] > 0: 1055 phaseVary.append(names[j]) 1056 equivs[uId[j]-1].append([names[j],uCoef[j]]) 1057 for equiv in equivs: 1058 if len(equiv) > 1: 1059 name = equiv[0][0] 1060 coef = equiv[0][1] 1061 for eqv in equiv[1:]: 1062 eqv[1] /= coef 1063 G2mv.StoreEquivalence(name,equiv[1:]) 1064 # elif General['Type'] == 'magnetic': 1065 # elif General['Type'] == 'macromolecular': 1064 G2mv.StoreEquivalence(name,equiv[1:]) 1065 if General['Type'] in ['modulated','magnetic']: 1066 AtomSS = at[-1]['SS1'] 1067 print AtomSS 1066 1068 textureData = General['SH Texture'] 1067 1069 if textureData['Order']: … … 1555 1557 SGData = General['SGData'] 1556 1558 Atoms = Phase['Atoms'] 1557 AtLookup = G2mth.FillAtomLookUp(Atoms) 1559 if Atoms and not General.get('doPawley'): 1560 cx,ct,cs,cia = General['AtomPtrs'] 1561 AtLookup = G2mth.FillAtomLookUp(Atoms,cia+8) 1558 1562 cell = General['Cell'] 1559 1563 pId = Phase['pId'] -
trunk/GSASIIstrMath.py
r1597 r1604 66 66 Phase = Phases[phase] 67 67 General = Phase['General'] 68 cx,ct,cs,cia = General['AtomPtrs'] 68 69 cell = General['Cell'][1:7] 69 70 Amat,Bmat = G2lat.cell2AB(cell) 70 AtLookup = G2mth.FillAtomLookUp(Phase['Atoms'] )71 AtLookup = G2mth.FillAtomLookUp(Phase['Atoms'],cia+8) 71 72 pfx = str(Phase['pId'])+'::' 72 73 if Update: … … 159 160 dFdvDict[item] = 0. #NB: this is a vector which is no. refl. long & must be filled! 160 161 General = Phase['General'] 162 cx,ct,cs,cia = General['AtomPtrs'] 161 163 cell = General['Cell'][1:7] 162 164 Amat,Bmat = G2lat.cell2AB(cell) … … 166 168 gvec = np.sqrt(np.array([g[0][0]**2,g[1][1]**2,g[2][2]**2, 167 169 g[0][0]*g[1][1],g[0][0]*g[2][2],g[1][1]*g[2][2]])) 168 AtLookup = G2mth.FillAtomLookUp(Phase['Atoms'] )170 AtLookup = G2mth.FillAtomLookUp(Phase['Atoms'],cia+8) 169 171 pfx = str(Phase['pId'])+'::' 170 172 RBModels = Phase['RBModels'] … … 312 314 negWt[pId] = Phases[phase]['General']['Pawley neg wt'] 313 315 General = Phases[phase]['General'] 316 cx,ct,cs,cia = General['AtomPtrs'] 314 317 textureData = General['SH Texture'] 315 318 SGData = General['SGData'] 316 AtLookup = G2mth.FillAtomLookUp(Phases[phase]['Atoms'] )319 AtLookup = G2mth.FillAtomLookUp(Phases[phase]['Atoms'],cia+8) 317 320 cell = General['Cell'][1:7] 318 321 Amat,Bmat = G2lat.cell2AB(cell) … … 415 418 pId = Phases[phase]['pId'] 416 419 General = Phases[phase]['General'] 420 cx,ct,cs,cia = General['AtomPtrs'] 417 421 SGData = General['SGData'] 418 AtLookup = G2mth.FillAtomLookUp(Phases[phase]['Atoms'] )422 AtLookup = G2mth.FillAtomLookUp(Phases[phase]['Atoms'],cia+8) 419 423 cell = General['Cell'][1:7] 420 424 Amat,Bmat = G2lat.cell2AB(cell) … … 2106 2110 for iref,ref in enumerate(refDict['RefList']): 2107 2111 if ref[5+im] > 0.: 2108 dervDict = SCExtinction(ref, phfx,hfx,pfx,calcControls,parmDict,varylist+dependentVars)[1]2112 dervDict = SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varylist+dependentVars)[1] 2109 2113 Fo = np.sqrt(ref[5+im]) 2110 2114 Fc = np.sqrt(ref[7+im]) … … 2350 2354 for i,ref in enumerate(refDict['RefList']): 2351 2355 if ref[6+im] > 0: 2352 ref[11+im] = SCExtinction(ref, phfx,hfx,pfx,calcControls,parmDict,varylist)[0]2356 ref[11+im] = SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varylist)[0] 2353 2357 w = 1.0/ref[6+im] 2354 2358 ref[7+im] = parmDict[phfx+'Scale']*ref[9+im]*ref[11+im] #correct Fc^2 for extinction
Note: See TracChangeset
for help on using the changeset viewer.