Changeset 724


Ignore:
Timestamp:
Aug 21, 2012 10:02:39 AM (10 years ago)
Author:
vondreele
Message:

update Fit Peaks.htm to Matt's suggestion
add a force to unit cell option for atom add/transformation
modifications to findOffset to make it more robust

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r721 r724  
    676676## keep this
    677677               
    678 def findOffset(SGData,Fhkl):   
     678def findOffset(SGData,A,Fhkl):   
    679679    if SGData['SpGrp'] == 'P 1':
    680680        return [0,0,0]   
    681681    hklShape = Fhkl.shape
    682682    steps = np.array(hklShape)
     683    Hmax = 2*np.asarray(G2lat.getHKLmax(4.5,SGData,A),dtype='i')
    683684    Fmax = np.max(np.absolute(Fhkl))
    684685    hklHalf = np.array(hklShape)/2
     
    696697    DH = []
    697698    Dphi = []
    698     while i < 20:
     699    while i < 20 and len(DH) < 50:
    699700        F = Flist[i]
    700701        hkl = np.unravel_index(Fdict[F],hklShape)
     
    710711            dH = H-hkl
    711712            dang = ang-ang0
    712             if np.any(np.abs(dH)-6 > 0):    #keep low order DHs
     713            if np.any(np.abs(dH)-Hmax > 0):    #keep low order DHs
    713714                continue
    714715            DH.append(dH)
     
    716717        i += 1
    717718    DH = np.array(DH)
     719    print ' map offset no.of terms: %d'%(len(DH))
    718720    Dphi = np.array(Dphi)
    719721    X,Y,Z = np.mgrid[0:1:1./steps[0],0:1:1./steps[1],0:1:1./steps[2]]
     
    722724    chisq = np.min(Mmap)
    723725    DX = -np.array(np.unravel_index(np.argmin(Mmap),Mmap.shape))
    724     print ' map offset chi**2: %.3f, map offset: %d %d %d, no. terms: %d'%(chisq,DX[0],DX[1],DX[2],len(DH))
     726    print ' map offset chi**2: %.3f, map offset: %d %d %d'%(chisq,DX[0],DX[1],DX[2])
    725727    return DX
    726728   
     
    801803    CErho = np.real(fft.fftn(fft.fftshift(CEhkl)))
    802804    print ' No.cycles = ',Ncyc,'Residual Rcf =%8.3f%s'%(Rcf,'%')+' Map size:',CErho.shape
    803     roll = findOffset(SGData,CEhkl)
     805    roll = findOffset(SGData,A,CEhkl)
    804806       
    805807    mapData['Rcf'] = Rcf
     
    914916            break
    915917        peak = (np.array(x1[1:4])-rMI)/incre
     918        peak = fixSpecialPos(peak,SGData,Amat)
    916919        if not len(peaks):
    917920            peaks.append(peak)
     
    920923            if keepDup:
    921924                if noDuplicate(peak,peaks,Amat):
    922                     peak = fixSpecialPos(peak,SGData,Amat)
    923925                    peaks.append(peak)
    924926                    mags.append(x1[0])
  • trunk/GSASIIphsGUI.py

    r721 r724  
    14341434            generalData = data['General']
    14351435            SGData = generalData['SGData']
    1436             dlg = SymOpDialog(G2frame,SGData,True)
     1436            dlg = SymOpDialog(G2frame,SGData,True,True)
    14371437            try:
    14381438                if dlg.ShowModal() == wx.ID_OK:
     
    14471447                            XYZ = -XYZ
    14481448                        XYZ = XYZ+cent+Cell
     1449                        if Force:
     1450                            XYZ = G2spc.MoveToUnitCell(XYZ)
    14491451                        if New:
    14501452                            atom = copy.copy(atomData[ind])
     
    19701972            generalData = data['General']
    19711973            SGData = generalData['SGData']
    1972             dlg = SymOpDialog(G2frame,SGData,False)
     1974            dlg = SymOpDialog(G2frame,SGData,False,True)
    19731975            try:
    19741976                if dlg.ShowModal() == wx.ID_OK:
     
    19831985                            XYZ = -XYZ
    19841986                        XYZ = XYZ+cent+Cell
     1987                        if Force:
     1988                            XYZ = G2spc.MoveToUnitCell(XYZ)
    19851989                        if noDuplicate(XYZ,atomData):
    19861990                            atom = copy.copy(atomData[ind])
     
    20152019            generalData = data['General']
    20162020            SGData = generalData['SGData']
    2017             dlg = SymOpDialog(G2frame,SGData,False)
     2021            dlg = SymOpDialog(G2frame,SGData,False,True)
    20182022            try:
    20192023                if dlg.ShowModal() == wx.ID_OK:
     
    20282032                            XYZ = -XYZ
    20292033                        XYZ = XYZ+cent+Cell
     2034                        if Force:
     2035                            XYZ = G2spc.MoveToUnitCell(XYZ)
    20302036                        atom = atomData[ind]
    20312037                        atom[cx:cx+3] = XYZ
  • trunk/help/Fit Peaks.htm

    r676 r724  
    2323  <o:Author>Von Dreele</o:Author>
    2424  <o:LastAuthor>Von Dreele</o:LastAuthor>
    25   <o:Revision>16</o:Revision>
    26   <o:TotalTime>275</o:TotalTime>
     25  <o:Revision>18</o:Revision>
     26  <o:TotalTime>293</o:TotalTime>
    2727  <o:Created>2012-05-05T16:28:00Z</o:Created>
    28   <o:LastSaved>2012-07-03T19:35:00Z</o:LastSaved>
     28  <o:LastSaved>2012-08-21T14:48:00Z</o:LastSaved>
    2929  <o:Pages>9</o:Pages>
    30   <o:Words>1831</o:Words>
    31   <o:Characters>10439</o:Characters>
     30  <o:Words>1902</o:Words>
     31  <o:Characters>10843</o:Characters>
    3232  <o:Company>Argonne National Laboratory</o:Company>
    33   <o:Lines>86</o:Lines>
    34   <o:Paragraphs>24</o:Paragraphs>
    35   <o:CharactersWithSpaces>12246</o:CharactersWithSpaces>
     33  <o:Lines>90</o:Lines>
     34  <o:Paragraphs>25</o:Paragraphs>
     35  <o:CharactersWithSpaces>12720</o:CharactersWithSpaces>
    3636  <o:Version>14.00</o:Version>
    3737 </o:DocumentProperties>
     
    599599        mso-font-kerning:14.0pt;}
    600600a:link, span.MsoHyperlink
    601         {mso-style-priority:99;
     601        {mso-style-noshow:yes;
     602        mso-style-priority:99;
    602603        color:blue;
    603604        text-decoration:underline;
     
    14141415style='mso-fareast-font-family:"Times New Roman"'><span style='mso-list:Ignore'>2.<span
    14151416style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]>Now
    1416 add refinement of the peak positions. This can be done by clicking on all the
    1417 refinement flags for the individual peaks or it is possible to set them all at
    1418 the same time using this recipe: </p>
     1417add refinement of the peak positions. This can be done by clicking on all the refinement
     1418flags for the individual peaks or it is possible to set them all at the same
     1419time using this recipe: </p>
    14191420
    14201421<p class=MsoListParagraphCxSpMiddle style='margin-left:1.0in;mso-add-space:
     
    14291430style='mso-fareast-font-family:"Times New Roman"'><span style='mso-list:Ignore'>b.<span
    14301431style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
    1431 class=GramE>double-click</span> on the refine label above the peak position
     1432class=GramE>single-click</span> on the refine label above the peak position
    14321433check-boxes. The entire column of checkboxes is highlighted in blue. Press the <b
    14331434style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
     
    14381439minor-latin'>n</span></b> would turn them off).</p>
    14391440
    1440 <p class=MsoNormal><span style='mso-spacerun:yes'> </span>Next, repeat the
    1441 refinement using the <b style='mso-bidi-font-weight:normal'><span
    1442 style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    1443 mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>Peak
    1444 Fitting/LSQ <span class=SpellE>PeakFit</span></span></b> menu item in the <b
    1445 style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
    1446 mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
    1447 minor-latin'>Peak List</span></b> window.</p>
    1448 
    1449 <p class=MsoNormal><span style='mso-spacerun:yes'> </span>Now, select peak
    1450 widths for refinement. This can be done by refining sigma (Gaussian width)
    1451 and/or gamma (Lorentzian width) for individual peaks, but here we can constrain
    1452 the peaks to follow an instrumental broadening equation. Select the <b
    1453 style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
    1454 mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
    1455 minor-latin'>Instrumental Parameters</span></b> item in the data tree. This
    1456 opens a window for peak profile terms</p>
    1457 
    1458 <p class=MsoNormal><span style='mso-no-proof:yes'><!--[if gte vml 1]><v:shape
     1441<p class=MsoNormal style='margin-left:.5in'>Next, repeat the refinement using
     1442the <b style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
     1443mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
     1444minor-latin'>Peak Fitting/LSQ <span class=SpellE>PeakFit</span></span></b> menu
     1445item in the <b style='mso-bidi-font-weight:normal'><span style='font-family:
     1446"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:
     1447minor-latin;mso-bidi-theme-font:minor-latin'>Peak List</span></b> window.</p>
     1448
     1449<p class=MsoNormal style='margin-left:.5in'><span
     1450style='mso-spacerun:yes'> </span>Now, select peak widths for refinement. <span
     1451style='mso-fareast-font-family:"Times New Roman"'>This can be performed in 2
     1452different ways. &nbsp;Method&nbsp;1:&nbsp;refine sigma (Gaussian width) and/or
     1453gamma (Lorentzian width) for individual peaks. &nbsp;To do this, click the
     1454refinement flags for sigma and/or gamma in the Peak List window.
     1455&nbsp;&nbsp;Method&nbsp;2: preferably,&nbsp;the LS&nbsp;refinement of&nbsp;peak
     1456widths can be&nbsp;constrained to&nbsp;follow an instrumental broadening
     1457equation as described below.&nbsp;Note - one cannot refine ALL peak widths
     1458using both individual&nbsp;sigma &amp; gamma&nbsp;values AND&nbsp;instrumental
     1459broadening terms at the same time.<b style='mso-bidi-font-weight:normal'>&nbsp;</b><o:p></o:p></span></p>
     1460
     1461<p class=MsoNormal style='margin-left:.5in'><span style='mso-fareast-font-family:
     1462"Times New Roman";mso-bidi-font-weight:bold'>To constrain refined peak widths
     1463to an instrumental broadening equation, first<b> s</b></span>elect the <b
     1464style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
     1465mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
     1466minor-latin'>Instrumental Parameters</span></b> item in the data tree. <span
     1467class=GramE>This opens a window for peak profile terms<b> </b><span
     1468style='mso-bidi-font-weight:bold'>and also create</span></span><span
     1469style='mso-bidi-font-weight:bold'> a new plot window&nbsp;showing the
     1470instrument profile resolution curve.</span></p>
     1471
     1472<p class=MsoNormal style='margin-left:.5in'><span style='mso-no-proof:yes'><!--[if gte vml 1]><v:shape
    14591473 id="Picture_x0020_10" o:spid="_x0000_i1037" type="#_x0000_t75" style='width:422.25pt;
    14601474 height:154.5pt;visibility:visible;mso-wrap-style:square'>
     
    15161530normal'><span style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:
    15171531minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>Index
    1518 Peak List</span></b> item in the data tree. In the initially empty window created
    1519 by this action, use menu item <b style='mso-bidi-font-weight:normal'><span
     1532Peak List</span></b> item in the data tree. In the initially empty window
     1533created by this action, use menu item <b style='mso-bidi-font-weight:normal'><span
    15201534style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    15211535mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>Index Peaks
     
    16031617<h2><span class=GramE>Step 8.</span> Select/Refine Cell</h2>
    16041618
    1605 <p class=MsoNormal>Select the cell with M20 ~ 2900 with a = 4.1568 Å. This indexes
    1606 all peaks with almost a perfect fit to the peak positions (compare dashed red
    1607 lines to solid blue ones). Import the cell information using the <b
     1619<p class=MsoNormal>Select the cell with M20 ~ 2900 with a = 4.1568 Å. This
     1620indexes all peaks with almost a perfect fit to the peak positions (compare
     1621dashed red lines to solid blue ones). Import the cell information using the <b
    16081622style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
    16091623mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
     
    16611675class=GramE>do the menu item</span> <b style='mso-bidi-font-weight:normal'><span
    16621676style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    1663 mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>File/Close project</span></b>
    1664 in the <b style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
    1665 mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
    1666 minor-latin'>GSAS-II data tree </span></b>window. You will be asked if you want
    1667 it saved; if <span class=GramE><b style='mso-bidi-font-weight:normal'><span
    1668 style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    1669 mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>Yes</span></b></span>
    1670 then all the peak fitting/indexing &amp; cell refinement results will be saved
    1671 to the <b style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
     1677mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>File/Close
     1678project</span></b> in the <b style='mso-bidi-font-weight:normal'><span
     1679style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
     1680mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>GSAS-II data
     1681tree </span></b>window. You will be asked if you want it saved; if <span
     1682class=GramE><b style='mso-bidi-font-weight:normal'><span style='font-family:
     1683"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:
     1684minor-latin;mso-bidi-theme-font:minor-latin'>Yes</span></b></span> then all the
     1685peak fitting/indexing &amp; cell refinement results will be saved to the <b
     1686style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
    16721687mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
    16731688minor-latin'>LaB6.gpx</span></b> file. If <b style='mso-bidi-font-weight:normal'><span
     
    17181733<p class=MsoNormal>Pick all peaks you can see between the limits (including the
    17191734small ones). Note some peaks have shoulders most notably at 5.07, 6.04,
    1720 7.81deg. I found 28 peaks (there were a few very weak ones I skipped – they
    1721 might be from a second phase? We’ll see later).</p>
     17357.81deg. I found 28 peaks (there were a few very weak ones I skipped – they might
     1736be from a second phase? We’ll see later).</p>
    17221737
    17231738<p class=MsoNormal><!--[if gte vml 1]><v:shape id="Picture_x0020_19" o:spid="_x0000_s1026"
     
    17911806mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
    17921807minor-latin'>Unit Cells List</span></b> window. Progress will be much slower
    1793 and suitable results will be slow in coming so be patient. Watch the console
    1794 window; the right answer will have an obviously large M20 (~630) and a volume
    1795 of ~594Å<sup>3</sup> (10<sup>th</sup> column of console display). Once this is
    1796 seen (it may take more than one try to get this) you can stop the indexing
    1797 search by pressing <b style='mso-bidi-font-weight:normal'><span
    1798 style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    1799 mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>Cancel</span></b>
    1800 on the progress bar window. It may take more than one press to fully stop it.
    1801 My result was </p>
     1808and suitable results will be slow in coming so be patient. Watch the console window;
     1809the right answer will have an obviously large M20 (~630) and a volume of ~594Å<sup>3</sup>
     1810(10<sup>th</sup> column of console display). Once this is seen (it may take
     1811more than one try to get this) you can stop the indexing search by pressing <b
     1812style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
     1813mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:
     1814minor-latin'>Cancel</span></b> on the progress bar window. It may take more
     1815than one press to fully stop it. My result was </p>
    18021816
    18031817<p class=MsoNormal><span style='mso-no-proof:yes'><!--[if gte vml 1]><v:shape
     
    18211835<p class=MsoNormal>Although the weak peak at 2<span style='font-family:Symbol;
    18221836mso-char-type:symbol;mso-symbol-font-family:Symbol'><span style='mso-char-type:
    1823 symbol;mso-symbol-font-family:Symbol'>Q</span></span>~7.3 has a shoulder that wasn’t
    1824 indexed. I presume that is a contaminant. By sliding the cursor over the index
    1825 lines without any visible peak you can see that the missing ones are (010, 100,
    1826 001, 110, 030, 111, 20-1, 10-2, 041, 050, 21-2, 23-1, 22-2, 141, 201,102, 15-1,
    1827 112, &amp; 24-1). Many of these are accidental but the 0k0; k&#8800;2n and h0l;
    1828 h+l&#8800;2n ones characterize the space group P2<sub>1</sub>/n. Armed with
    1829 this information you can <b style='mso-bidi-font-weight:normal'><span
     1837symbol;mso-symbol-font-family:Symbol'>Q</span></span>~7.3 has a shoulder that
     1838wasn’t indexed. I presume that is a contaminant. By sliding the cursor over the
     1839index lines without any visible peak you can see that the missing ones are
     1840(010, 100, 001, 110, 030, 111, 20-1, 10-2, 041, 050, 21-2, 23-1, 22-2, 141,
     1841201,102, 15-1, 112, &amp; 24-1). Many of these are accidental but the 0k0; k&#8800;2n
     1842and h0l; h+l&#8800;2n ones characterize the space group P2<sub>1</sub>/n. Armed
     1843with this information you can <b style='mso-bidi-font-weight:normal'><span
    18301844style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    18311845mso-hansi-theme-font:minor-latin;mso-bidi-theme-font:minor-latin'>Make new
Note: See TracChangeset for help on using the changeset viewer.