Changeset 3097


Ignore:
Timestamp:
Sep 24, 2017 8:02:10 PM (4 years ago)
Author:
vondreele
Message:

fix origin shift transformation & vec,matrix, vec transformations; now works

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r3092 r3097  
    229229    return UijtoU6(Uij)
    230230   
    231 def TransformPhase(oldPhase,newPhase,Trans,Vec,ifMag):
     231def TransformPhase(oldPhase,newPhase,Trans,Uvec,Vvec,ifMag):
    232232    '''Transform atoms from oldPhase to newPhase by Trans & Vec
    233233   
     
    286286        newPhase['Draw Atoms'] = []
    287287    for atom in newAtoms:
    288         atom[cx:cx+3] = TransformXYZ(atom[cx:cx+3],invTrans.T,Vec)%1.
     288        atom[cx:cx+3] = TransformXYZ(atom[cx:cx+3]-Uvec,invTrans,Vvec)%1.
    289289        if atom[cia] == 'A':
    290290            atom[cia+2:cia+8] = TransformU6(atom[cia+2:cia+8],invTrans)
     
    306306   
    307307def FillUnitCell(Phase):
    308     Atoms = Phase['Atoms']
     308    Atoms = copy.deepcopy(Phase['Atoms'])
    309309    atomData = []
    310310    atCodes = []
  • trunk/GSASIImath.py

    r3095 r3097  
    26882688        else:
    26892689            if atom[3].strip() == 'C':
    2690                 tgts = [tgt for tgt in tgts if not (cartAtoms[tgt][3].strip() == 'N' and int(cartAtoms[tgt][0]) == ires+1)]
     2690                tgts = [tgt for tgt in tgts if not (cartAtoms[tgt][3].strip() == 'N' and int(cartAtoms[tgt][0])  in [ires-1,ires+1])]
    26912691            elif atom[3].strip() == 'N':
    2692                 tgts = [tgt for tgt in tgts if not (cartAtoms[tgt][3].strip() == 'C' and int(cartAtoms[tgt][0]) == ires-1)]
     2692                tgts = [tgt for tgt in tgts if not (cartAtoms[tgt][3].strip() == 'C' and int(cartAtoms[tgt][0])  in [ires-1,ires+1])]
    26932693        for tgt in tgts:
    26942694            dsqt = np.sqrt(np.sum((XYZ[ia]-XYZ[tgt])**2))
     
    27242724                    mtrx[4] += IntAct[j]['NO']
    27252725            mtrx /= summ
     2726#            print i+1,mtrx*summ
    27262727            if old:
    27272728                mtrx -= avg_old
  • trunk/GSASIIphsGUI.py

    r3095 r3097  
    377377            else:
    378378                if self.Common == G2gd.commonNames[-1]:      #change setting
    379                     self.Vec = G2spc.spg2origins[self.oldSpGrp]
     379                    self.Vvec = G2spc.spg2origins[self.oldSpGrp]
    380380                    self.newSpGrp = self.oldSpGrp
    381381                else:
     
    21882188            cx,ct,cs,cia = generalData['AtomPtrs']
    21892189            SGData = generalData['SGData']
    2190        
     2190            if SGData['SpGrp'] in G2spc.spg2origins:
     2191                T = G2spc.spg2origins[SGData['SpGrp']]
    21912192            Atoms = data['Atoms']
    21922193            for atom in Atoms:
    2193                 for i in range(3):
    2194                     atom[cx+i] -= Uvec[i]
    2195                 atom[cs:cs+2] = G2spc.SytSym(atom[cx:cx+3],SGData)[:2]
     2194                for i in [0,1,2]:
     2195                    atom[cx+i] += T[i]
    21962196            data['Drawing'] = []
    21972197        else:
    21982198            phaseName = newPhase['General']['Name']
    2199             newPhase,atCodes = G2lat.TransformPhase(data,newPhase,Trans,Vvec,ifMag)
     2199            newPhase,atCodes = G2lat.TransformPhase(data,newPhase,Trans,Uvec,Vvec,ifMag)
    22002200            detTrans = np.abs(nl.det(Trans))
    22012201   
  • trunk/GSASIIspc.py

    r2875 r3097  
    29122912        'F m -3 m','F m -3 c','F d -3 m','F d -3 c',
    29132913        'I m -3 m','I a -3 d',]                                       #195-230
    2914 
     2914spg2origins = {}
     2915''' A dictionary of all spacegroups that have 2nd settings; the value is the
     29161st --> 2nd setting transformation vector as X(2nd) = X(1st)-V, nonstandard ones are included.
     2917'''
     2918spg2origins = {
     2919        'P n n n':[-.25,-.25,-.25],
     2920        'P b a n':[-.25,-.25,0],'P n c b':[0,-.25,-.25],'P c n a':[-.25,0,-.25],
     2921        'P m m n':[-.25,-.25,0],'P n m m':[0,-.25,-.25],'P m n m':[-.25,0,-.25],
     2922        'C c c a':[0,-.25,-.25],'C c c b':[-.25,0,-.25],'A b a a':[-.25,0,-.25],
     2923        'A c a a':[-.25,-.25,0],'B b c b':[-.25,-.25,0],'B b a b':[0,-.25,-.25],
     2924        'F d d d':[-.125,-.125,-.125],
     2925        'P 4/n':[-.25,-.25,0],'P 42/n':[-.25,-.25,-.25],'I 41/a':[0,-.25,-.125],
     2926        'P 4/n b m':[-.25,-.25,0],'P 4/n n c':[-.25,-.25,-.25],'P 4/n m m':[-.25,-.25,0],'P 4/n c c':[-.25,-.25,0],
     2927        'P 42/n b c':[-.25,-.25,-.25],'P 42/n n m':[-.25,.25,-.25],'P 42/n m c':[-.25,.25,-.25],'P 42/n c m':[-.25,.25,-.25],
     2928        'I 41/a m d':[0,.25,-.125],'I 41/a c d':[0,.25,-.125],
     2929        'p n -3':[-.25,-.25,-.25],'F d -3':[-.125,-.125,-.125],'P n -3 n':[-.25,-.25,-.25],
     2930        'P n -3 m':[-.25,-.25,-.25],'F d -3 m':[-.125,-.125,-.125],'F d -3 c':[-.375,-.375,-.375],
     2931        'p n 3':[-.25,-.25,-.25],'F d 3':[-.125,-.125,-.125],'P n 3 n':[-.25,-.25,-.25],
     2932        'P n 3 m':[-.25,-.25,-.25],'F d 3 m':[-.125,-.125,-.125],'F d - c':[-.375,-.375,-.375]}
    29152933spglist = {}
    29162934'''A dictionary of space groups as ordered and named in the pre-2002 International
     
    30013019        'F -4 3 c','F m -3 m','F m 3 m','F m -3 c','F d -3 m','F d -3 c',),
    30023020}
    3003 
    3004 spg2origins = {}
    3005 ''' A dictionary of all space groups with two alternative origin settings.
    3006 each entry is symbol: atom transpation vector for setting #1 --> setting #2
    3007 '''
    3008 spg2origins = {"P n n n":[-.25,-.25,-.25],"P b a n":[-.25,-.25 ,0],     
    3009     "P n c b":[0,-.25,-.25],"P c n a":[-.25,0,-.25],"P m m n":[-.25,-.25 ,0],       
    3010     "P n m m":[0,-.25,-.25],"P m n m":[-.25,0,-.25],"C c c a":[0,-.25,-.25],         
    3011     "C c c b":[-.25,0,-.25],"A b a a":[-.25,0,-.25],"A c a a":[-.25,-.25,0],       
    3012     "B b c b":[-.25,-.25,0],"B b a b":[0,-.25,-.25],"F d d d":[.125,.125,.125],     
    3013     "P 4/n":[.25,-.2, 0],"P 42/n":[.25,.25,.25],"I 41/a":[0,.25,.125],         
    3014     "P 4/n b m":[.25,.25,0],"P 4/n n c":[.25,.25,.25],"P 4/n m m":[.25,-.25,0],         
    3015     "P 4/n c c":[.25,-.25,0],"P 42/n b c":[.25,-.25,.25],"P 42/n n m":[.25,-.25,.25],       
    3016     "P 42/n m c":[.25,-.25,.25],"P 42/n c m":[.25,-.25,.25],       
    3017     "I 41/a m d":[0,-.25,.125],"I 41/a c d":[0,-.25,.125],       
    3018     "P n 3":[.25,.25,.25],"F d 3":[.125,.125,.125],"P n 3 n":[.25,.25,.25],               
    3019     "P n 3 m":[.25,.25,.25],"F d 3 m":[.125,.125,.125],"F d 3 c":[.375,.375,.375],           
    3020     "P n -3":[.25,.25,.25],"F d -3":[.125,.125,.125],"P n -3 n":[.25,.25,.25],               
    3021     "P n -3 m":[.25,.25,.25],"F d -3 m":[.125,.125,.125],"F d -3 c":[.375,.375,.375]}           
    30223021
    30233022ssdict = {}
Note: See TracChangeset for help on using the changeset viewer.