Changeset 825
- Timestamp:
- Jan 11, 2013 11:35:34 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIlattice.py
r812 r825 771 771 coeffNames.append('C(%d,%d)'%(iord,n)) 772 772 return coeffNames 773 773 774 774 def CrsAng(H,cell,SGData): 775 775 a,b,c,al,be,ga = cell -
trunk/GSASIIrestrGUI.py
r823 r825 1540 1540 1541 1541 def OnDeleteRestraint(event): 1542 r = ChemComps.GetSelectedRows()[0]1542 rows = ChemComps.GetSelectedRows()[0] 1543 1543 if not rows: 1544 1544 return -
trunk/GSASIIstruct.py
r824 r825 13 13 import time 14 14 import math 15 import copy 15 16 import random 16 17 import cPickle … … 2144 2145 shModels = ['cylindrical','none','shear - 2/m','rolling - mmm'] 2145 2146 SamSym = dict(zip(shModels,['0','-1','2/m','mmm'])) 2147 sam = SamSym[textureData['Model']] 2146 2148 phaseRest = restraintDict[phase] 2147 2149 names = {'Bond':'Bonds','Angle':'Angles','Plane':'Planes', … … 2153 2155 if pId == int(pnames[0]): 2154 2156 name = pnames[1] 2157 if not name: #empty for Pawley restraints; pName has '::' in it - skip the rest 2158 continue 2155 2159 id = int(pnames[2]) 2156 2160 itemRest = phaseRest[name] … … 2184 2188 dNames = [] 2185 2189 for ind in indx: 2186 dNames += str(pId)+'::Afrac:'+str(AtLookup[ind])2190 dNames += [str(pId)+'::Afrac:'+str(AtLookup[ind])] 2187 2191 mul = np.array(G2mth.GetAtomItemsById(Atoms,AtLookUp,indx,cs+1)) 2188 2192 deriv = mul*factors 2189 2193 elif 'Texture' in name: 2194 deriv = [] 2195 dNames = [] 2190 2196 hkl,grid,esd1,ifesd2,esd2 = itemRest[names[name]][id] 2197 hkl = np.array(hkl) 2191 2198 if np.any(lasthkl-hkl): 2192 2199 PH = np.array(hkl) 2193 2200 phi,beta = G2lat.CrsAng(np.array(hkl),cell,SGData) 2194 2201 ODFln = G2lat.Flnh(False,SHCoef,phi,beta,SGData) 2195 # R,P,Z = G2mth.getRestPolefig(ODFln,SamSym[textureData['Model']],grid)2196 2202 lasthkl = copy.copy(hkl) 2197 2203 if 'unit' in name: … … 2199 2205 else: 2200 2206 gam = float(pnames[3]) 2201 phi = float(pnames[4]) 2202 pass 2203 2204 raise Exception 2207 psi = float(pnames[4]) 2208 for SHname in ODFln: 2209 l,m,n = eval(SHname[1:]) 2210 Ksl = G2lat.GetKsl(l,m,sam,psi,gam)[0] 2211 dNames += [str(pId)+'::'+SHname] 2212 deriv.append(-ODFln[SHname][0]*Ksl/SHCoef[SHname]) 2205 2213 for dName,drv in zip(dNames,deriv): 2206 2214 try: … … 2211 2219 for i,item in enumerate(varyList): 2212 2220 if item in pNames: 2213 pId = int(item.split(':')[0])2214 2221 pDerv[i][pNames.index(item)] += 1. 2215 2222 return pDerv … … 3510 3517 if np.any(pVals): 3511 3518 print 'Penalty function: %.3f on %d terms'%(np.sum(pWt*pVals**2),len(pVals)) 3519 Nobs += len(pVals) 3512 3520 M = np.concatenate((M,pWt*pVals)) 3513 3521 return M
Note: See TracChangeset
for help on using the changeset viewer.