Changeset 2218


Ignore:
Timestamp:
Apr 18, 2016 11:26:02 AM (6 years ago)
Author:
vondreele
Message:

work on cell transformations - fills new cell with unique atom set, deletes map (if any)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r2212 r2218  
    250250        atom[cia+8] = ran.randint(0,sys.maxint)
    251251    newPhase['Atoms'] = newAtoms
    252 #   GetUnique(newPhase)
     252    newPhase['Atoms'] = GetUnique(newPhase)
     253    newPhase['Drawing']['Atoms'] = []
    253254    return newPhase
    254255   
    255    
    256256def FillUnitCell(Phase):
    257     atomData = copy.deepcopy(Phase['Atoms'])
    258     nAtoms = len(atomData)
     257    Atoms = Phase['Atoms']
     258    atomData = []
    259259    SGData = Phase['General']['SGData']
    260260    cx,ct,cs,cia = Phase['General']['AtomPtrs']
    261     for atom in atomData[:nAtoms]:
     261    for atom in Atoms:
    262262        XYZ = np.array(atom[cx:cx+3])
    263263        if atom[cia] == 'A':
     
    265265            result = G2spc.GenAtom(XYZ,SGData,False,Uij,True)
    266266            for item in result:
     267                if item[0][2] >= .95: item[0][2] -= 1.
    267268                atom[cx:cx+3] = item[0]
    268269                atom[cia+2:cia+8] = item[1]
     
    271272            result = G2spc.GenAtom(XYZ,SGData,False,Move=True)
    272273            for item in result:
     274                if item[0][2] >= .95: item[0][2] -= 1.
    273275                atom[cx:cx+3] = item[0]
    274276                atomData.append(atom[:cia+9])  #not SS stuff
     
    276278       
    277279def 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
    310311           
    311312def calc_rVsq(A):
  • trunk/GSASIIphsGUI.py

    r2216 r2218  
    12131213       
    12141214    def OnTransform(event):
    1215         '''What is needed here? Get user to refer to Intl. Tables 1A (or Bilbao server) & use new
    1216         space group, cell transformation & origin displacement (if needed) given therein.
    1217         Do this in popup dialog box with OK, Cancel buttons; if OK
    1218         apply to lattice parameters & atom position/Uij parameters
    1219         need to start with full unit cell contents, transform & then filter out symm. equiv.
    1220         '''
    12211215        dlg = G2gd.TransformDialog(G2frame,data)
    12221216        try:
     
    12291223        phaseName = newPhase['General']['Name']
    12301224        newPhase = G2lat.TransformPhase(data,newPhase,Trans,Vec)
     1225        newPhase['General']['Map'] = mapDefault.copy()
    12311226        sub = G2frame.PatternTree.AppendItem(parent=
    12321227            G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Phases'),text=phaseName)
Note: See TracChangeset for help on using the changeset viewer.