Changeset 4268


Ignore:
Timestamp:
Jan 28, 2020 3:04:53 PM (4 years ago)
Author:
vondreele
Message:

fixes to RMCProfile - GSAS-II stuff.
works with x-ray F(Q), etc.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r4248 r4268  
    606606#    return A,B
    607607   
    608 def cell2AB(cell):
     608def cell2AB(cell,alt=False):
    609609    """Computes orthogonalization matrix from unit cell constants
    610610
     
    617617    cellstar = Gmat2cell(G)
    618618    A = np.zeros(shape=(3,3))
     619    if alt: #as used in RMCProfile!!
     620        A[0][0] = 1./cellstar[0]
     621        A[0][1] = cell[0]*cosd(cell[5])*sind(cell[3])
     622        A[0][2] = cell[0]*cosd(cell[4])
     623        A[1][1] = cell[1]*sind(cell[3])
     624        A[1][2] = cell[1]*cosd(cell[3])
     625        A[2][2] = cell[2]
     626        B = nl.inv(A)
     627        return A,B
    619628    # from Giacovazzo (Fundamentals 2nd Ed.) p.75
    620629    A[0][0] = cell[0]                # a
  • trunk/GSASIIphsGUI.py

    r4267 r4268  
    26532653            else:
    26542654                phaseName = newPhase['General']['Name']
    2655                 newPhase,atCodes = G2lat.TransformPhase(data,newPhase,Trans,Uvec,Vvec,ifMag)
     2655                newPhase,atCodes = G2lat.TransformPhase(data,newPhase,Trans.T,Uvec,Vvec,ifMag)
    26562656                detTrans = np.abs(nl.det(Trans))
    26572657                generalData = newPhase['General']
     
    51775177            generalData = data['General']
    51785178            RMCPdict = data['RMC']['RMCProfile']
    5179             atSeq = RMCPdict['atSeq']
    51805179            pName = generalData['Name'].replace(' ','_')
    51815180            dlg = wx.FileDialog(G2frame, "Choose any RMCProfile csv results file for "+pName+":",
     
    52515250                '_SQ1partials.csv':[r'$\mathsf{Q,\AA^{-1}}$','S(Q)','RMCP S(Q) partials for '],
    52525251                '_SQ2partials.csv':[r'$\mathsf{Q,\AA^{-1}}$','S(Q)','RMCP S(Q) partials for '],
    5253                 '_FQ1partials.csv':[r'$\mathsf{Q,\AA^{-1}$','F(Q)','RMCP F(Q) partials for ']}
     5252                '_FQ1partials.csv':[r'$\mathsf{Q,\AA^{-1}}$','F(Q)','RMCP F(Q) partials for ']}
    52545253            for label in Labels:
    52555254                X = []
     
    52985297                        odfData = np.fromfile(OutFile,sep=' ')
    52995298                        numx,numy = odfData[:2]
    5300                         G2plt.Plot3dXYZ(G2frame,int(numx),int(numy),odfData[2:],newPlot=False,Title='Bond %s-%s'%(bond[0],bond[1]))       
     5299                        G2plt.Plot3dXYZ(G2frame,int(numx),int(numy),odfData[2:],
     5300                            newPlot=False,Title='Bond %s-%s'%(bond[0],bond[1]),Centro=True)       
    53015301       
    53025302           
  • trunk/GSASIIplot.py

    r4265 r4268  
    51125112################################################################################
    51135113       
    5114 def Plot3dXYZ(G2frame,nX,nY,Zdat,labelX='X',labelY='Y',labelZ='Z',newPlot=False,Title=''):
     5114def Plot3dXYZ(G2frame,nX,nY,Zdat,labelX='X',labelY='Y',labelZ='Z',newPlot=False,Title='',Centro=False):
    51155115   
    51165116    def OnMotion(event):
     
    51335133    G2frame.G2plotNB.status.SetStatusText('',1)
    51345134    Zmul = Zdat.reshape((nX,-1)).T
     5135    if Centro:
     5136        Zmul = Zmul+np.fliplr(np.roll(Zmul,nY//2,0))
    51355137    PHI = np.linspace(0.,360.,int(nY),True)
    51365138    PSI = np.linspace(0.,180.,int(nX),True)
     
    51585160        Plot.set_ylabel(labelY)
    51595161        Plot.set_zlabel(labelZ)
    5160     Page.canvas.draw()
     5162        Page.canvas.draw()
    51615163       
    51625164################################################################################
  • trunk/GSASIIpwd.py

    r4266 r4268  
    21412141        fl.write('1\n')
    21422142        fl.write('%d\n'%int(inst[prms[0]][1]))
    2143         fl.write('%10.5f%10.5f%10.4f%10d\n'%(inst[prms[1]][1],inst[prms[2]][1]/100.,inst[prms[3]][1],0))
     2143        fl.write('%10.5f%10.5f%10.4f%10d\n'%(inst[prms[1]][1],-100.*inst[prms[2]][1],inst[prms[3]][1],0))
    21442144        fl.write('%10.3f%10.3f%10.3f\n'%(inst[prms[4]][1],inst[prms[5]][1],inst[prms[6]][1]))
    21452145        fl.write('%10.3f%10.3f%10.3f\n'%(inst[prms[7]][1]+Xsb,inst[prms[8]][1]+Ysb,0.0))   
     
    21982198    newPhase = copy.deepcopy(Phase)
    21992199    newPhase['General']['SGData'] = G2spc.SpcGroup('P 1')[1]
    2200     newPhase['General']['Cell'][1:] = G2lat.TransformCell(Cell,Trans.T)
     2200    newPhase['General']['Cell'][1:] = G2lat.TransformCell(Cell,Trans)
    22012201    newPhase,Atcodes = G2lat.TransformPhase(Phase,newPhase,Trans,np.zeros(3),np.zeros(3),ifMag=False)
    22022202    Natm = np.core.defchararray.count(np.array(Atcodes),'+')    #no. atoms in original unit cell
     
    22462246    fl.write('Cell (Ang/deg): %12.6f%12.6f%12.6f%12.6f%12.6f%12.6f\n'%(
    22472247            Cell[0],Cell[1],Cell[2],Cell[3],Cell[4],Cell[5]))
    2248     A,B = G2lat. cell2AB(Cell)
     2248    A,B = G2lat.cell2AB(Cell,True)
    22492249    fl.write('Lattice vectors (Ang):\n')   
    22502250    for i in [0,1,2]:
     
    22742274    Sample = PWDdata['Sample Parameters']
    22752275    Scale = Sample['Scale'][0]
     2276    if 'X' in Inst['Type'][0]:
     2277        Scale *= 2.
    22762278    Limits = PWDdata['Limits'][1]
    22772279    Ibeg = np.searchsorted(Data[0],Limits[0])
     
    22882290        DT = np.diff(Data[0])
    22892291        for i in range(Ibeg,Ifin-1):
    2290             fl.write('%11.6f%15.2f\n'%(Data[0][i]-DT[i],Data[1][i]))       
     2292            fl.write('%11.6f%15.2f\n'%(Data[0][i],Data[1][i]))       
    22912293    fl.close()
    22922294    return fname
     
    24122414    for File in Files:
    24132415        if Files[File][0]:
     2416            if 'Xray' in File and 'F(Q)' in File:
     2417                fqdata = open(Files[File][0],'r')
     2418                lines = int(fqdata.readline()[:-1])
    24142419            fl.write('\n')
    24152420            fl.write('%s ::\n'%File.split(';')[0].upper().replace(' ','_'))
     
    24172422            fl.write('  > DATA_TYPE :: %s\n'%Files[File][2])
    24182423            fl.write('  > FIT_TYPE :: %s\n'%Files[File][2])
    2419             fl.write('  > START_POINT :: 1\n')
    2420             fl.write('  > END_POINT :: 3000\n')
     2424            if 'Xray' not in File:
     2425                fl.write('  > START_POINT :: 1\n')
     2426                fl.write('  > END_POINT :: 3000\n')
     2427                fl.write('  > WEIGHT :: %.4f\n'%Files[File][1])
    24212428            fl.write('  > CONSTANT_OFFSET 0.000\n')
    24222429            fl.write('  > NO_FITTED_OFFSET\n')
    24232430            if Files[File][3] !='RMC':
    24242431                fl.write('  > %s\n'%Files[File][3])
    2425             fl.write('  > WEIGHT :: %.4f\n'%Files[File][1])
    24262432            if 'reciprocal' in File:
    24272433                fl.write('  > CONVOLVE ::\n')
    24282434                fl.write('  > NO_FITTED_SCALE\n')
    24292435                if 'Xray' in File:
    2430                     fl.write('  > RECIPROCAL_SPACE_FIT :: 1 3000 1\n')
    2431                     fl.write('  > RECIPROCAL_SPACE_PARAMETERS :: 1 3000 %.4f\n'%Files[File][1])
    2432                     fl.write('  > REAL_SPACE_FIT :: 1 3000 1\n')
    2433                     fl.write('  > REAL_SPACE_PARAMETERS :: 1 3000 %.4f\n'%Files[File][1])
     2436                    fl.write('  > RECIPROCAL_SPACE_FIT :: 1 %d 1\n'%lines)
     2437                    fl.write('  > RECIPROCAL_SPACE_PARAMETERS :: 1 %d %.4f\n'%(lines,Files[File][1]))
     2438                    fl.write('  > REAL_SPACE_FIT :: 1 %d 1\n'%(3*lines//2))
     2439                    fl.write('  > REAL_SPACE_PARAMETERS :: 1 %d %.4f\n'%(3*lines//2,Files[File][1]))
    24342440    fl.write('\n')
    24352441    fl.write('BRAGG ::\n')
Note: See TracChangeset for help on using the changeset viewer.