Changeset 2212 for trunk/GSASIIlattice.py
 Timestamp:
 Apr 14, 2016 3:44:39 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIlattice.py
r2154 r2212 31 31 ########### SVN repository information ################### 32 32 import math 33 import copy 34 import sys 35 import random as ran 33 36 import numpy as np 34 37 import numpy.linalg as nl … … 225 228 Uij = np.inner(Trans,np.inner(U6toUij(U6),Trans)) 226 229 return UijtoU6(Uij) 227 230 231 def TransformPhase(oldPhase,newPhase,Trans,Vec): 232 '''Transform atoms from oldPhase to newPhase by Trans & Vec 233 234 :param oldPhase: dict G2 phase info for old phase 235 :param newPhase: dict G2 phase info for new phase; with new cell & space group 236 atoms are from oldPhase & will be transformed 237 :param Trans: array transformation matrix 238 :param Vec: array transformation vector 239 ''' 240 241 cx,ct,cs,cia = oldPhase['General']['AtomPtrs'] 242 SGData = newPhase['General']['SGData'] 243 invTrans = nl.inv(Trans) 244 newAtoms = FillUnitCell(oldPhase) 245 for atom in newAtoms: 246 atom[cx:cx+3] = TransformXYZ(atom[cx:cx+3],invTrans.T,Vec) 247 if atom[cia] == 'A': 248 atom[cia+2:cia+8] = TransformU6(atom[cia+2:cia+8],invTrans) 249 atom[cs:cs+2] = G2spc.SytSym(atom[cx:cx+3],SGData) 250 atom[cia+8] = ran.randint(0,sys.maxint) 251 newPhase['Atoms'] = newAtoms 252 # GetUnique(newPhase) 253 return newPhase 254 255 256 def FillUnitCell(Phase): 257 atomData = copy.deepcopy(Phase['Atoms']) 258 nAtoms = len(atomData) 259 SGData = Phase['General']['SGData'] 260 cx,ct,cs,cia = Phase['General']['AtomPtrs'] 261 for atom in atomData[:nAtoms]: 262 XYZ = np.array(atom[cx:cx+3]) 263 if atom[cia] == 'A': 264 Uij = atom[cia+2:cia+8] 265 result = G2spc.GenAtom(XYZ,SGData,False,Uij,True) 266 for item in result: 267 atom[cx:cx+3] = item[0] 268 atom[cia+2:cia+8] = item[1] 269 atomData.append(atom[:cia+9]) #not SS stuff 270 else: 271 result = G2spc.GenAtom(XYZ,SGData,False,Move=True) 272 for item in result: 273 atom[cx:cx+3] = item[0] 274 atomData.append(atom[:cia+9]) #not SS stuff 275 return atomData 276 277 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 310 228 311 def calc_rVsq(A): 229 312 """Compute the square of the reciprocal lattice volume (1/V**2) from A'
Note: See TracChangeset
for help on using the changeset viewer.