Changeset 5320
- Timestamp:
- Aug 21, 2022 10:16:38 AM (16 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIimgGUI.py
r5257 r5320 75 75 76 76 :param wx.Frame G2frame: main GSAS-II frame 77 :param :dict data: Image Controls dictionary77 :param dict data: Image Controls dictionary 78 78 79 79 :returns: array sumImg: corrected image for background/dark/flat back -
trunk/GSASIImath.py
r5312 r5320 858 858 859 859 :param dict data: GSAS-II phase data structure 860 :param :dict seqData: GSAS-II sequential refinement results structure860 :param dict seqData: GSAS-II sequential refinement results structure 861 861 :param bool PF2: if True then seqData is from a sequential run of PDFfit2 862 862 -
trunk/GSASIIphsGUI.py
r5317 r5320 5586 5586 mainSizer.Add(grpBox,0) 5587 5587 5588 RMCPdict['addThermalBroadening'] = RMCPdict.get('addThermalBroadening',False) 5589 mainSizer.Add((-1,5)) 5590 distBox = wx.BoxSizer(wx.HORIZONTAL) 5591 distBox.Add(wx.StaticText(G2frame.FRMC,label=' Add thermal broadening? '),0,WACV) 5592 distBox.Add(G2G.G2CheckBox(G2frame.FRMC,'',RMCPdict,'addThermalBroadening',OnChange=UpdateRMC), 5593 0,WACV) 5594 if RMCPdict['addThermalBroadening']: 5595 distBox.Add((15,-1)) 5596 distBox.Add(wx.StaticText(G2frame.FRMC,label='Uiso equiv.'),0,WACV) 5597 RMCPdict['ThermalU'] = RMCPdict.get('ThermalU',{}) 5598 for atm in RMCPdict['aTypes']: 5599 RMCPdict['ThermalU'][atm] = RMCPdict['ThermalU'].get(atm,0.005) 5600 distBox.Add(wx.StaticText(G2frame.FRMC,label=' '+atm+':'),0,WACV) 5601 distBox.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['ThermalU'],atm, 5602 xmin=0.0001,xmax=0.25,size=(50,25)),0,WACV) 5603 mainSizer.Add(distBox,0) 5604 if RMCPdict['addThermalBroadening']: mainSizer.Add((-1,5)) 5605 5588 5606 # Torsions are difficult to implement. Need to be internal to a unit cell & named with fullrmc 5589 5607 # atom labels. Leave this out, at least for now. … … 6869 6887 G2frame.GPXtree.SetItemPyData(psub,G2obj.SetNewPhase(Name=PhaseName,SGData=SGData)) 6870 6888 newPhase = G2frame.GPXtree.GetItemPyData(psub) 6871 # add a restraint tree entry6872 subr = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,'Restraints')6873 G2frame.GPXtree.GetItemPyData(subr).update({PhaseName:{}})6874 6889 # read in info from file 6875 6890 pName = (G2frame.GSASprojectfile.split('.')[0] + '-' 6876 6891 + data['General']['Name']) 6877 6892 pName = pName.replace(' ','_') 6878 with open(pName+'-fullrmc.atoms','r') as fp: 6879 cell = [float(i) for i in fp.readline().split(':')[1].split()] 6880 supercell = [int(i) for i in fp.readline().split(':')[1].split()] 6881 if super: 6882 for i in range(3): cell[i] *= supercell[i] 6883 # set cell & volume 6884 newPhase['General']['Cell'][1:7] = cell 6885 newPhase['General']['Cell'][7] = G2lat.calc_V(G2lat.cell2A(cell)) 6886 A,B = G2lat.cell2AB(cell) 6887 # add atoms 6888 for line in fp: 6889 Name,El,ox,oy,oz = line.split() 6890 oxyz = [float(i) for i in (ox,oy,oz)] 6893 try: 6894 with open(pName+'-fullrmc.atoms','r') as fp: 6895 cell = [float(i) for i in fp.readline().split(':')[1].split()] 6896 supercell = [int(i) for i in fp.readline().split(':')[1].split()] 6891 6897 if super: 6892 (x,y,z) = np.inner(B,oxyz) 6893 else: 6894 (x,y,z),disp = G2spc.MoveToUnitCell(np.inner(B,oxyz)) 6895 atId = ran.randint(0,sys.maxsize) 6896 newPhase['Atoms'].append([Name,El,'',x,y,z,1.,'1',1,'I',0.01,0,0,0,0,0,0,atId]) 6897 6898 for i in range(3): cell[i] *= supercell[i] 6899 # set cell & volume 6900 newPhase['General']['Cell'][1:7] = cell 6901 newPhase['General']['Cell'][7] = G2lat.calc_V(G2lat.cell2A(cell)) 6902 A,B = G2lat.cell2AB(cell) 6903 # add atoms 6904 for line in fp: 6905 Name,El,ox,oy,oz = line.split() 6906 oxyz = [float(i) for i in (ox,oy,oz)] 6907 if super: 6908 (x,y,z) = np.inner(B,oxyz) 6909 else: 6910 (x,y,z),disp = G2spc.MoveToUnitCell(np.inner(B,oxyz)) 6911 atId = ran.randint(0,sys.maxsize) 6912 newPhase['Atoms'].append([Name,El,'',x,y,z,1.,'1',1,'I',0.01,0,0,0,0,0,0,atId]) 6913 except: 6914 G2G.G2MessageBox(G2frame, 6915 'Unable to open or read file '+pName+'-fullrmc.atoms. ' 6916 'Was a fullrmc run from the current .gpx file ' 6917 'and for the current phase?', 6918 'Error on read') 6919 G2frame.GPXtree.Delete(psub) 6920 return 6921 # add a restraint tree entry for new phase 6922 subr = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,'Restraints') 6923 G2frame.GPXtree.GetItemPyData(subr).update({PhaseName:{}}) 6898 6924 SetupGeneral() # index elements 6899 6925 -
trunk/GSASIIpwd.py
r5317 r5320 3687 3687 Files = RMCPdict['files'] 3688 3688 rundata = '' 3689 rundata += '## ## fullrmc %s file; edit by hand if you so choose #####\n'%scrname3689 rundata += '## fullrmc %s file ##\n## OK to edit this by hand ##\n'%scrname 3690 3690 rundata += '# created in '+__file__+" v"+filversion.split()[1] 3691 3691 rundata += dt.datetime.strftime(dt.datetime.now()," at %Y-%m-%dT%H:%M\n") … … 3719 3719 # utility routines 3720 3720 def writeHeader(ENGINE,statFP): 3721 'header for stats file'3721 """header for stats file""" 3722 3722 statFP.write('generated-steps, total-error, ') 3723 3723 for c in ENGINE.constraints: … … 3728 3728 3729 3729 def writeCurrentStatus(ENGINE,statFP,plotF): 3730 'line in stats file & current constraint plots'3730 """line in stats file & current constraint plots""" 3731 3731 statFP.write(str(ENGINE.generated)) 3732 3732 statFP.write(', ') … … 3749 3749 3750 3750 def calcRmax(ENGINE): 3751 'from Bachir, works for non-orthorhombic cells'3751 """from Bachir, works for non-orthorhombic cells""" 3752 3752 a,b,c = ENGINE.basisVectors 3753 3753 lens = [] … … 3759 3759 lens.extend( [ts/np.linalg.norm(a), ts/np.linalg.norm(c)] ) 3760 3760 return min(lens) 3761 3761 ''' 3762 if RMCPdict.get('Groups',[]): rundata += ''' 3762 3763 def makepdb(atoms, coords, bbox=None): 3763 'creates a supercell directly from atom info'3764 """creates a supercell directly from atom info""" 3764 3765 # used when ENGINE.build_crystal_set_pdb is not called 3765 3766 prevcell = None … … 3918 3919 rundata += ' ENGINE.add_constraints([GofR])\n' 3919 3920 rundata += ' GofR.set_limits((None, calcRmax(ENGINE)))\n' 3921 if RMCPdict['addThermalBroadening']: 3922 rundata += " GofR.set_thermal_corrections({'defaultFactor': 0.001})\n" 3923 rundata += " GofR.thermalCorrections['factors'] = {\n" 3924 RMCPdict['addThermalBroadening'] 3925 for atm1 in RMCPdict['aTypes']: 3926 for atm2 in RMCPdict['aTypes']: 3927 rundata += " ('{}', '{}'): {},\n".format( 3928 atm1,atm2, 3929 (RMCPdict['ThermalU'].get(atm1,0.005)+ RMCPdict['ThermalU'].get(atm2,0.005))/2) 3930 rundata += ' }\n' 3920 3931 elif '(Q)' in File: 3921 3932 rundata += ' SOQ = np.loadtxt(os.path.join(dirName,"%s")).T\n'%filDat[0] -
trunk/GSASIIscriptable.py
r5307 r5320 851 851 datadir = "/Users/toby/software/G2/Tutorials/PythonScript/data" 852 852 PathWrap = lambda fil: os.path.join(datadir,fil) 853 gpx = G2sc.G2Project( filename='PbSO4sim.gpx') # create a project853 gpx = G2sc.G2Project(newgpx='PbSO4sim.gpx') # create a project 854 854 phase0 = gpx.add_phase(PathWrap("PbSO4-Wyckoff.cif"), 855 855 phasename="PbSO4",fmthint='CIF') # add a phase to the project … … 878 878 cifdir = "/Users/toby/software/G2/Tutorials/PythonScript/data" 879 879 datadir = "/Users/toby/software/G2/Tutorials/TOF-CW Joint Refinement/data" 880 gpx = G2sc.G2Project( filename='/tmp/PbSO4simT.gpx') # create a project880 gpx = G2sc.G2Project(newgpx='/tmp/PbSO4simT.gpx') # create a project 881 881 phase0 = gpx.add_phase(os.path.join(cifdir,"PbSO4-Wyckoff.cif"), 882 882 phasename="PbSO4",fmthint='CIF') # add a phase to the project … … 972 972 PathWrap = lambda fil: os.path.join(datadir,fil) 973 973 974 gpx = G2sc.G2Project( filename=PathWrap('inttest.gpx'))974 gpx = G2sc.G2Project(newgpx=PathWrap('inttest.gpx')) 975 975 imlst = gpx.add_image(PathWrap('Si_free_dc800_1-00000.tif'),fmthint="TIF") 976 976 imlst[0].loadControls(PathWrap('Si_free_dc800_1-00000.imctrl')) … … 990 990 fil) 991 991 992 gpx = G2sc.G2Project( filename='/tmp/img.gpx')992 gpx = G2sc.G2Project(newgpx='/tmp/img.gpx') 993 993 for f in glob.glob(PathWrap('*.tif')): 994 994 im = gpx.add_image(f,fmthint="TIF") … … 1044 1044 fil) 1045 1045 1046 gpx = G2sc.G2Project( filename='/tmp/calib.gpx')1046 gpx = G2sc.G2Project(newgpx='/tmp/calib.gpx') 1047 1047 for f in glob.glob(PathWrap('*.tif')): 1048 1048 im = gpx.add_image(f,fmthint="TIF") … … 2018 2018 :param str newgpx: The filename the project should be saved to in 2019 2019 the future. If both newgpx and gpxfile are present, the project is 2020 loaded from the gpxfile, then when saved will be written to newgpx. 2021 :param str filename: Name to be used to save the project. Has same function as 2022 parameter newgpx (do not use both gpxfile and filename). Use of newgpx 2023 is preferred over filename. 2020 loaded from the file named by gpxfile and then when saved will 2021 be written to the file named by newgpx. 2022 :param str filename: To be deprecated. Serves the same function as newgpx, 2023 which has a somewhat more clear name. 2024 (Do not specify both newgpx and filename). 2024 2025 2025 2026 There are two ways to initialize this object: … … 2061 2062 if filename is not None and newgpx is not None: 2062 2063 raise G2ScriptException('Do not use filename and newgpx together') 2064 elif filename is not None: 2065 G2fil.G2Print("Warning - recommending use of parameter newgpx rather than filename\n\twhen creating a G2Project") 2063 2066 elif newgpx: 2064 2067 filename = newgpx … … 5711 5714 Example: 5712 5715 5713 >>> sclEnt = p.getHAPentryList(0,'Scale')[0] >>> sclEnt 5716 >>> sclEnt = p.getHAPentryList(0,'Scale')[0] 5717 >>> sclEnt 5714 5718 [(['PWDR test Bank 1', 'Scale'], list, [1.0, False])] 5715 5719 >>> p.getHAPentryValue(sclEnt[0]) … … 6237 6241 Example use of G2Image: 6238 6242 6239 >>> gpx = G2sc.G2Project( filename='itest.gpx')6243 >>> gpx = G2sc.G2Project(newgpx='itest.gpx') 6240 6244 >>> imlst = gpx.add_image(idata,fmthint="TIF") 6241 6245 >>> imlst[0].loadControls('stdSettings.imctrl')
Note: See TracChangeset
for help on using the changeset viewer.