Changeset 5050


Ignore:
Timestamp:
Oct 20, 2021 7:57:52 AM (7 months ago)
Author:
vondreele
Message:

further progress on PDFfit interface
fix formats in RMCProfile setup.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r5049 r5050  
    49924992                    fileSizer.Add((5,5),0)
    49934993                if 'Select' not in Rfile and 'PDFfit' in G2frame.RMCchoice:
    4994                     fileSizer.Add(wx.StaticText(G2frame.FRMC,label=' Rrange (from/to)'),0,WACV)
     4994                    fileSizer.Add(wx.StaticText(G2frame.FRMC,label=' R-range (from/to)'),0,WACV)
    49954995                    fileSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict[Name]['Fitrange'],0,xmin=RMCPdict[Name]['Datarange'][0],xmax=3.0),0,WACV)
    49964996                    fileSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict[Name]['Fitrange'],1,xmin=10.0,xmax=RMCPdict[Name]['Datarange'][1]),0,WACV)
     
    61286128                    subp.Popen(['/bin/bash','pdffit2.sh'])
    61296129            #update choice? here?
    6130            
    6131             G2pwdr.UpdatePDFfit(data,RMCPdata)
    6132            
     6130            wx.MessageBox('PDFfit finished',caption='Updating results',style=wx.ICON_EXCLAMATION)
     6131            RMCPdict = data['RMC']['PDFfit']
     6132            G2pwd.UpdatePDFfit(data,RMCPdict)
     6133            wx.CallAfter(UpdateRMC)
     6134           
    61336135                   
    61346136           
  • trunk/GSASIIpwd.py

    r5049 r5050  
    26912691    fl.write('IGNORE_HISTORY_FILE ::\n')
    26922692    fl.write('\n')
    2693     fl.write('NEUTRON_COEFFICIENTS :: '+''.join(['%8.5f'%coeff for coeff in Ncoeff])+'\n')
     2693    fl.write('NEUTRON_COEFFICIENTS :: '+''.join(['%9.5f'%coeff for coeff in Ncoeff])+'\n')
    26942694    fl.write('DISTANCE_WINDOW ::\n')
    26952695    fl.write('  > MNDIST :: %s\n'%minD)
     
    27892789    fl.write('  > DMIN :: %.2f\n'%(dMin-0.02))
    27902790    fl.write('  > WEIGHT :: %10.3f\n'%BraggWt)
    2791     fl.write('  > SCATTERING LENGTH :: '+''.join(['%7.4f'%blen for blen in Nblen])+'\n')
     2791    fl.write('  > SCATTERING LENGTH :: '+''.join(['%8.4f'%blen for blen in Nblen])+'\n')
    27922792    fl.write('\n')
    27932793    fl.write('END  ::\n')
     
    30003000from diffpy.pdffit2 import PdfFit
    30013001pf = PdfFit()
    3002 
    30033002# Load data ------------------------------------------------------------------
    3004 
    3005 # Load experimental x-ray PDF data
    30063003qmax = 30.0  # Q-cutoff used in PDF calculation in 1/A
    30073004qdamp = 0.01 # instrument Q-resolution factor, responsible for PDF decay
    3008 pf.read_data('Ni-xray.gr', 'X', qmax, qdamp)
    3009 pf.read_data('Ni-neutron.gr', 'N', qmax, qdamp)
    3010 
    3011 # Load nickel structure, must be in PDFFIT or DISCUS format
    3012 pf.read_struct('Ni.stru')
    30133005'''
     3006    rundata += "pf.read_data(%s, 'X', qmax, qdamp)\n"
     3007    rundata += "pf.read_data(%s, 'N', qmax, qdamp)\n"   
     3008    rundata += "pf.read_struct(%s)\n"
    30143009 
    3015     fName = General['Name']+'.py'
    3016    
     3010    fName = General['Name']+'.py'   
    30173011    rfile = open(fName,'w')
    30183012    rfile.writelines(rundata)
     
    30203014   
    30213015 
    3022     print('PDFfit2 prep under construction')
    30233016   
    30243017def UpdatePDFfit(Phase,RMCPdict):
     
    30283021    rstr = open(fName.replace(' ','_'),'r')
    30293022    lines = rstr.readlines()
    3030     resdict = dict(zip(lines[:6].split(' ',)))
    3031     General['Cell'][:7] = resdict['cell']
    3032     for inam,name in enumerate(['delta1','delta2','sratio','spdiameter']):
    3033         RMCPdict['delta1'] = resdict['sharp'][0]
    3034    
    3035    
    3036     print('PDFfit2 update under construction')
     3023    rstr.close()
     3024    header = [line[:-1].split(' ',1) for line in lines[:7]]
     3025    resdict = dict(header)
     3026    for item in ['scale','sharp','cell']:
     3027        resdict[item] = [float(val) for val in resdict[item].split(',')]
     3028    General['Cell'][1:7] = resdict['cell']
     3029    for inam,name in enumerate(['delta2','delta1','sratio']):
     3030        RMCPdict[name][0] = resdict['sharp'][inam]
     3031    if 'shape' in resdict and 'sphere' in resdict['shape']:
     3032        RMCPdict['spdiameter'][0] = resdict['shape'][-1]
     3033    cx,ct,cs,ci = G2mth.getAtomPtrs(Phase)     
     3034    Atoms = Phase['Atoms']
     3035    atmBeg = 0
     3036    for line in lines:
     3037        atmBeg += 1
     3038        if 'atoms' in line:
     3039            break
     3040    for atom in Atoms:
     3041        atstr = lines[atmBeg][:-1].split()
     3042        Uiistr = lines[atmBeg+2][:-1].split()
     3043        Uijstr = lines[atmBeg+4][:-1].split()
     3044        atom[cx:cx+4] = [float(atstr[1]),float(atstr[2]),float(atstr[3]),float(atstr[4])]
     3045        atom[ci] = 'A'
     3046        atom[ci+2:ci+5] = [float(Uiistr[0]),float(Uiistr[1]),float(Uiistr[2])]
     3047        atom[ci+5:ci+8] = [float(Uijstr[0]),float(Uijstr[1]),float(Uijstr[2])]
     3048        atmBeg += 6
    30373049       
    30383050def MakefullrmcRun(pName,Phase,RMCPdict):
Note: See TracChangeset for help on using the changeset viewer.