Changeset 4763 for trunk/GSASIImath.py
 Timestamp:
 Jan 13, 2021 4:34:34 PM (11 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r4761 r4763 558 558 ################################################################################ 559 559 560 def getAtomPtrs(data,draw=False): 561 ''' get atom data pointers cx,ct,cs,cia in Atoms or Draw Atoms lists 562 NB:may not match column numbers in displayed table 563 564 param: dict: data phase data structure 565 draw: boolean True if Draw Atoms list pointers are required 566 return: cx,ct,cs,cia pointers to atom xyz, type, site sym, uiso/aniso flag 567 ''' 568 if draw: 569 return data['Drawing']['atomPtrs'] 570 else: 571 return data['General']['AtomPtrs'] 572 560 573 def FindMolecule(ind,generalData,atomData): #uses numpy & masks  very fast even for proteins! 561 574 … … 752 765 generalData = data['General'] 753 766 SGData = generalData['SGData'] 754 cx,ct,cs,cia = ge neralData['AtomPtrs']767 cx,ct,cs,cia = getAtomPtrs(data) 755 768 drawingData = data['Drawing'] 756 dcx,dct,dcs,dci = drawingData['atomPtrs']769 dcx,dct,dcs,dci = getAtomPtrs(data,True) 757 770 atoms = data['Atoms'] 758 771 drawAtoms = drawingData['Atoms'] … … 785 798 def FindNeighbors(phase,FrstName,AtNames,notName=''): 786 799 General = phase['General'] 787 cx,ct,cs,cia = General['AtomPtrs']800 cx,ct,cs,cia = getAtomPtrs(phase) 788 801 Atoms = phase['Atoms'] 789 802 atNames = [atom[ct1] for atom in Atoms] … … 873 886 def FindAllNeighbors(phase,FrstName,AtNames,notName='',Orig=None,Short=False): 874 887 General = phase['General'] 875 cx,ct,cs,cia = General['AtomPtrs']888 cx,ct,cs,cia = getAtomPtrs(phase) 876 889 Atoms = phase['Atoms'] 877 890 atNames = [atom[ct1] for atom in Atoms] … … 1885 1898 SGData = generalData['SGData'] 1886 1899 SSGData = generalData['SSGData'] 1887 cx,ct,cs,cia = ge neralData['AtomPtrs']1900 cx,ct,cs,cia = getAtomPtrs(data) 1888 1901 drawingData = data['Drawing'] 1889 1902 modul = generalData['SuperVec'][0] 1890 dcx,dct,dcs,dci = drawingData['atomPtrs']1903 dcx,dct,dcs,dci = getAtomPtrs(data,True) 1891 1904 atoms = data['Atoms'] 1892 1905 drawAtoms = drawingData['Atoms'] … … 2943 2956 General = Phase['General'] 2944 2957 Amat,Bmat = G2lat.cell2AB(General['Cell'][1:7]) 2945 cx,ct,cs,cia = General['AtomPtrs']2958 cx,ct,cs,cia = getAtomPtrs(data) 2946 2959 Atoms = Phase['Atoms'] 2947 2960 cartAtoms = [] … … 4147 4160 Unique.append(icntr) 4148 4161 return Unique 4162 4163 def AtomsCollect(data,Ind,Sel): 4164 '''Finds the symmetry set of atoms for those selected. Selects 4165 the one closest to the selected part of the unit cell. 4166 Works on the contents of data['Map Peaks']. Called from OnPeaksUnique in 4167 GSASIIphsGUI.py, 4168 4169 :param data: the phase data structure 4170 :param list Ind: list of selected peak indices 4171 :param int Sel: selected part of unit to find atoms closest to 4172 4173 :returns: the list of symmetry unique peaks from among those given in Ind 4174 ''' 4175 cx,ct,cs,ci = getAtomPtrs(data) 4176 cent = np.ones(3)*.5 4177 generalData = data['General'] 4178 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 4179 SGData = generalData['SGData'] 4180 Atoms = copy.deepcopy(data['Atoms']) 4181 Indx = [True for ind in Ind] 4182 # scan through peaks, finding all peaks equivalent to peak ind 4183 for ind in Ind: 4184 if Indx[ind]: 4185 xyz = Atoms[ind][cx:cx+3] 4186 uij = Atoms[ind][ci+2:ci+8] 4187 if Atoms[ind][ci] == 'A': 4188 Equiv = list(G2spc.GenAtom(xyz,SGData,Uij=uij)) 4189 Uijs = np.array([x[1] for x in Equiv]) 4190 else: 4191 Equiv = G2spc.GenAtom(xyz,SGData) 4192 xyzs = np.array([x[0] for x in Equiv]) 4193 dzeros = np.sqrt(np.sum(np.inner(Amat,xyzs)**2,axis=0)) 4194 dcent = np.sqrt(np.sum(np.inner(Amat,xyzscent)**2,axis=0)) 4195 xyzs = np.hstack((xyzs,dzeros[:,nxs],dcent[:,nxs])) 4196 cind = np.argmin(xyzs.T[Sel1]) 4197 Atoms[ind][cx:cx+3] = xyzs[cind][:3] 4198 if Atoms[ind][ci] == 'A': 4199 Atoms[ind][ci+2:ci+8] = Uijs[cind] 4200 return Atoms 4149 4201 4150 4202 ################################################################################ … … 5061 5113 SGT = np.array([SGData['SGOps'][i][1] for i in range(len(SGData['SGOps']))]) 5062 5114 fixAtoms = data['Atoms'] #if any 5063 cx,ct,cs = ge neralData['AtomPtrs'][:3]5115 cx,ct,cs = getAtomPtrs(data)[:3] 5064 5116 aTypes = set([]) 5065 5117 parmDict = {'Bmat':Bmat,'Gmat':Gmat}
Note: See TracChangeset
for help on using the changeset viewer.