Changeset 2218
- Timestamp:
- Apr 18, 2016 11:26:02 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIlattice.py
r2212 r2218 250 250 atom[cia+8] = ran.randint(0,sys.maxint) 251 251 newPhase['Atoms'] = newAtoms 252 # GetUnique(newPhase) 252 newPhase['Atoms'] = GetUnique(newPhase) 253 newPhase['Drawing']['Atoms'] = [] 253 254 return newPhase 254 255 255 256 256 def FillUnitCell(Phase): 257 atomData = copy.deepcopy(Phase['Atoms'])258 nAtoms = len(atomData)257 Atoms = Phase['Atoms'] 258 atomData = [] 259 259 SGData = Phase['General']['SGData'] 260 260 cx,ct,cs,cia = Phase['General']['AtomPtrs'] 261 for atom in atomData[:nAtoms]:261 for atom in Atoms: 262 262 XYZ = np.array(atom[cx:cx+3]) 263 263 if atom[cia] == 'A': … … 265 265 result = G2spc.GenAtom(XYZ,SGData,False,Uij,True) 266 266 for item in result: 267 if item[0][2] >= .95: item[0][2] -= 1. 267 268 atom[cx:cx+3] = item[0] 268 269 atom[cia+2:cia+8] = item[1] … … 271 272 result = G2spc.GenAtom(XYZ,SGData,False,Move=True) 272 273 for item in result: 274 if item[0][2] >= .95: item[0][2] -= 1. 273 275 atom[cx:cx+3] = item[0] 274 276 atomData.append(atom[:cia+9]) #not SS stuff … … 276 278 277 279 def GetUnique(Phase): 278 pass 279 # def noDuplicate(xyz,peaks,Amat): 280 # if True in [np.allclose(np.inner(Amat,xyz),np.inner(Amat,peak),atol=0.5) for peak in peaks]: 281 # return False 282 # return True 283 # 284 # generalData = data['General'] 285 # cell = generalData['Cell'][1:7] 286 # Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 287 # A = G2lat.cell2A(cell) 288 # SGData = generalData['SGData'] 289 # mapPeaks = data['Map Peaks'] 290 # Indx = {} 291 # XYZ = {} 292 # for ind in Ind: 293 # XYZ[ind] = np.array(mapPeaks[ind][1:4]) 294 # Indx[ind] = True 295 # for ind in Ind: 296 # if Indx[ind]: 297 # xyz = XYZ[ind] 298 # for jnd in Ind: 299 # if ind != jnd and Indx[jnd]: 300 # Equiv = G2spc.GenAtom(XYZ[jnd],SGData,Move=True) 301 # xyzs = np.array([equiv[0] for equiv in Equiv]) 302 # Indx[jnd] = noDuplicate(xyz,xyzs,Amat) 303 # Ind = [] 304 # for ind in Indx: 305 # if Indx[ind]: 306 # Ind.append(ind) 307 # return Ind 308 309 280 281 def noDuplicate(xyzA,XYZ,Amat): 282 if True in [np.allclose(np.inner(Amat,xyzA),np.inner(Amat,xyzB),atol=0.05) for xyzB in XYZ]: 283 return False 284 return True 285 286 cx,ct,cs,cia = Phase['General']['AtomPtrs'] 287 cell = Phase['General']['Cell'][1:7] 288 Amat,Bmat = cell2AB(cell) 289 SGData = Phase['General']['SGData'] 290 Atoms = Phase['Atoms'] 291 Ind = len(Atoms) 292 newAtoms = [] 293 Indx = {} 294 XYZ = {} 295 for ind in range(Ind): 296 XYZ[ind] = np.array(Atoms[ind][cx:cx+3]) 297 Indx[ind] = True 298 for ind in range(Ind): 299 if Indx[ind]: 300 xyz = XYZ[ind] 301 for jnd in range(Ind): 302 if ind != jnd and Indx[jnd]: 303 Equiv = G2spc.GenAtom(XYZ[jnd],SGData,Move=True) 304 xyzs = np.array([equiv[0] for equiv in Equiv]) 305 Indx[jnd] = noDuplicate(xyz,xyzs,Amat) 306 Ind = [] 307 for ind in Indx: 308 if Indx[ind]: 309 newAtoms.append(Atoms[ind]) 310 return newAtoms 310 311 311 312 def calc_rVsq(A): -
trunk/GSASIIphsGUI.py
r2216 r2218 1213 1213 1214 1214 def OnTransform(event): 1215 '''What is needed here? Get user to refer to Intl. Tables 1A (or Bilbao server) & use new1216 space group, cell transformation & origin displacement (if needed) given therein.1217 Do this in popup dialog box with OK, Cancel buttons; if OK1218 apply to lattice parameters & atom position/Uij parameters1219 need to start with full unit cell contents, transform & then filter out symm. equiv.1220 '''1221 1215 dlg = G2gd.TransformDialog(G2frame,data) 1222 1216 try: … … 1229 1223 phaseName = newPhase['General']['Name'] 1230 1224 newPhase = G2lat.TransformPhase(data,newPhase,Trans,Vec) 1225 newPhase['General']['Map'] = mapDefault.copy() 1231 1226 sub = G2frame.PatternTree.AppendItem(parent= 1232 1227 G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases'),text=phaseName)
Note: See TracChangeset
for help on using the changeset viewer.