Changeset 143 for trunk/GSASIIspc.py


Ignore:
Timestamp:
Aug 5, 2010 2:35:29 PM (13 years ago)
Author:
vondreel
Message:

Modification of SGPrint to put building of op strings into MT2text & Latt2text - used also in G2phsGUI

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIspc.py

    r142 r143  
    117117    returns a list of strings with the space group details
    118118    '''
    119     XYZ = ('-Z ','-Y ','-X ','X-Y','ERR','Y-X',' X ',' Y ',' Z ','+X ','+Y ','+Z ')
    120     TRA = ('   ','ERR','1/6','1/4','1/3','ERR','1/2','ERR','2/3','3/4','5/6','ERR')
    121119    POL = (' ','x','y','x y','z','x z','y z','xyz','111')
    122120    Mult = len(SGData['SGCen'])*len(SGData['SGOps'])*(int(SGData['SGInv'])+1)
     
    147145        SGText.append('The location of the origin is arbitrary in '+POL[NPol])
    148146    SGText.append('\n'+'The equivalent positions are:')
    149     if SGData['SGLatt'] in 'A':
    150         SGText.append('\n'+'    (0,0,0; 0,1/2,1/2)+')
    151     elif SGData['SGLatt'] in 'B':
    152         SGText.append('\n'+'    (0,0,0; 1/2,0,1/2)+')
    153     elif SGData['SGLatt'] in 'C':
    154         SGText.append('\n'+'    (0,0,0; 1/2,1/2,0)+')
    155     elif SGData['SGLatt'] in 'I':
    156         SGText.append('\n'+'    (0,0,0; 1/2,1/2,1/2)+')
    157     elif SGData['SGLatt'] in 'F':
    158         SGText.append('\n'+'    (0,0,0; 0,1/2,1/2; 1/2,0,1/2; 1/2,1/2,0)+')
    159     elif SGData['SGLatt'] in 'R':
    160         SGText.append('\n'+'    (0,0,0; 1/3,2/3,2/3; 2/3,1/3,1/3)+')
     147    if SGData['SGLatt'] != 'P':
     148        SGText.append('\n('+Latt2text(SGData['SGLatt'])+')+')
    161149    if SGData['SGLaue'] in ['-1','2/m','mmm','4/m','4/mmm']:
    162150        Ncol = 2
     
    168156            SGText.append(line)       
    169157            line = ''
    170         Fld = '(%2i) ' % (iop+1)
    171         for j in range(3):
    172             IJ = int(round(2*M[j][0]+3*M[j][1]+4*M[j][2]+4)) % 12
    173             IK = int(round(T[j]*12)) % 12
    174             if IK > 0 and IJ > 4: IJ += 3
    175             Fld += TRA[IK]+XYZ[IJ]
    176             if j != 2: Fld += ','
     158        Fld = '(%2i) ' % (iop+1)+MT2text(M,T)+'\t'
    177159        line += Fld
    178160    SGText.append(line)       
    179161    return SGText
    180162   
     163def MT2text(M,T):
     164    #From space group matrix/translation operator returns text version
     165    XYZ = ('-Z ','-Y ','-X ','X-Y','ERR','Y-X',' X ',' Y ',' Z ','+X ','+Y ','+Z ')
     166    TRA = ('   ','ERR','1/6','1/4','1/3','ERR','1/2','ERR','2/3','3/4','5/6','ERR')
     167    Fld = ''
     168    for j in range(3):
     169        IJ = int(round(2*M[j][0]+3*M[j][1]+4*M[j][2]+4)) % 12
     170        IK = int(round(T[j]*12)) % 12
     171        if IK > 0 and IJ > 4: IJ += 3
     172        Fld += TRA[IK]+XYZ[IJ]
     173        if j != 2: Fld += ','
     174    return Fld
     175   
     176def Latt2text(Latt):
     177    #From lattice type ('P',A', etc.) returns ';' delimited cell centering vectors
     178    lattTxt = {'A':'0,0,0; 0,1/2,1/2','B':'0,0,0; 1/2,0,1/2',
     179        'C':'0,0,0; 1/2,1/2,0','I':'0,0,0; 1/2,1/2,1/2',
     180        'F':'0,0,0; 0,1/2,1/2; 1/2,0,1/2; 1/2,1/2,0',
     181        'R':'0,0,0; 1/3,2/3,2/3; 2/3,1/3,1/3','P':'0,0,0'}
     182    return lattTxt[Latt]   
     183       
    181184def SpaceGroup(SgSym):
    182185    '''
     
    490493    return GetKNsym(str(Isym)),Mult
    491494   
     495def U2Uij(U):
     496    #returns the UIJ vector U11,U22,U33,U12,U13,U23 from tensor U
     497    return [U[0][0],U[1][1],U[2][2],U[0][1],U[0][2],U[1][2]]
     498   
     499def Uij2U(Uij):
     500    #returns the thermal motion tensor U from Uij as numpy array
     501    return np.array([[Uij[0],Uij[3],Uij[4]],[Uij[3],Uij[1],Uij[5]],[Uij[4],Uij[5],Uij[2]]])
     502   
    492503'''A list of space groups as ordered and named in the pre-2002 International
    493504Tables Volume A, except that spaces are used following the GSAS convention to
Note: See TracChangeset for help on using the changeset viewer.