<div dir="ltr">Dear Brian Toby,<div><br></div><div>I hope this email finds you well. As you remember, I have sent you an email in terms of GSASIIscriptable and my Python-based script in which I tried to initialize the Uiso parameter during the Rietveld refinement. Actually, I have another question and appreciate it if you could help me in this case. With all due respect, would you mind telling me whether it is possible to refine the structure factor (F) of the phase in my Python-based script using GSASIIscriptable? I have searched for it a lot but have not found anything useful. Please let me know what you think in this case.</div><div><br></div><div>Thank you in advance, and I am looking forward to hearing from you.</div><div><br></div><div>Best regards,</div><div>Hamidreza  </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jul 25, 2021 at 11:58 PM Toby, Brian H. <<a href="mailto:toby@anl.gov" target="_blank">toby@anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div dir="auto">
You are welcome. I am glad to have helped. <br>
<br>
<div dir="ltr">
<div>Brian</div>
<div><br>
</div>
Sent from a powerful small device but with weak <span style="font-size:13pt">eyes.   </span></div>
<div dir="ltr"><br>
<blockquote type="cite">On Jul 25, 2021, at 3:09 PM, Hamidreza Hekmatjou <<a href="mailto:hamidreza.hekmatjou@ozu.edu.tr" target="_blank">hamidreza.hekmatjou@ozu.edu.tr</a>> wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">Dear Brian Toby,
<div><br>
</div>
<div>Thanks a lot for your help. My code works properly now. It is a great honor for me to know you at this juncture and discuss this issue. This problem has taken a lot of time (maybe about two weeks). However, I learned lots of things in this way, especially
 from you. I appreciate your time and consideration.</div>
<div><br>
</div>
<div>Best regards,</div>
<div>Hamidreza  </div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Jul 25, 2021 at 10:49 PM Toby, Brian H. <<a href="mailto:toby@anl.gov" target="_blank">toby@anl.gov</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>In the code below, I have added what you need to set all the Uiso values to zero and save the file as step7a.gpx so you can check that it does what you want. Note the location is before you have step 8. At that later
 point the refinement is complete and changing the input would have no effect. 
<div><br>
</div>
<div>Brian<br>
<div><br>
<blockquote type="cite">
<div>On Jul 25, 2021, at 1:47 PM, Hamidreza Hekmatjou <<a href="mailto:hamidreza.hekmatjou@ozu.edu.tr" target="_blank">hamidreza.hekmatjou@ozu.edu.tr</a>> wrote:</div>
<br>
<div>
<div dir="ltr">Dear Brian Toby,
<div><br>
</div>
<div>Thank you very much for the provided information. To make it clear, I have attached my script to this email as follows. In step 8, I want to initialize Uiso to 0 and then do the refinement.</div>
<div><br>
</div>
<div>import os<br>
import sys<br>
sys.path.insert(0, os.path.expanduser("C:/Users/SajjaD/gsas2full/GSASII/"))<br>
import GSASIIscriptable as G2sc<br>
workdir = "/Users/SajjaD/Scratch/PythonScript"<br>
datadir = "/Users/SajjaD/software/G2/Tutorials/PythonScript/data"<br>
def HistStats(gpx):<br>
    '''prints profile rfactors for all histograms'''<br>
    print(u"*** profile Rwp, "+os.path.split(gpx.filename)[1])<br>
    for hist in gpx.histograms():<br>
        print("\t{:20s}: {:.2f}".format(<a href="http://hist.name/" target="_blank">hist.name</a>, hist.get_wR()))<br>
    print("")<br>
    gpx.save()<br>
# Create the project<br>
gpx = G2sc.G2Project(newgpx='Au.gpx')<br>
# setup step 1: add a histogram to the project<br>
hist1 = gpx.add_powder_histogram(os.path.join(datadir, "LPdebyer_5nm1A_300Kstatic.DAT"), os.path.join(datadir, "inst_1.instprm"))<br>
# setup step 2: add a phase to the histogram<br>
phase0 = gpx.add_phase(os.path.join(datadir, "Au.cif"), phasename="Au", histograms=[hist1])<br>
# setup step 3 not in tutorial: increase # of cycles to improve convergence<br>
gpx.data['Controls']['data']['max cyc'] = 8 # not in API<br>
# setup step 4: set background refinement (Hist), limits and sample parameters<br>
refdict0 = {"set": {"Background": {"type": "lin interpolate", "no. coeffs": 1, "refine": False}, "Limits": [15, 174.995], "Sample Parameters": {"Scale": True}}}<br>
gpx.save("step4.gpx")<br>
gpx.do_refinements([refdict0])<br>
HistStats(gpx)<br>
# setup step 5: lattice parameter refinement<br>
gpx.save("step5.gpx")<br>
refdict1 = {"set": {"Cell": True}} #set the cell flag (for all phases)<br>
gpx.set_refinement(refdict1)<br>
gpx.do_refinements([{}])<br>
HistStats(gpx)<br>
# setup step 6: particle size<br>
gpx.save("step6.gpx")<br>
refdict2 = {"set": {"Size": {"type": "isotropic", "refine": True, "value": 0.01}}}<br>
gpx.set_refinement(refdict2)<br>
gpx.do_refinements([{}]) # refinement after setting<br>
HistStats(gpx)<br>
# setup step 7: Mustrain<br>
gpx.save("step7.gpx")<br>
refdict3 = {"set": {"Mustrain": {"type": "isotropic", "refine": True}}}<br>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div><font face="Courier"><span style="font-style:normal">for atom in phase0.atoms():</span></font></div>
<div><font face="Courier"><span style="font-style:normal"><span style="white-space:pre-wrap"></span>atom.uiso = 0.0</span></font></div>
<div><font face="Courier"><span style="font-style:normal">gpx.save("step7a.gpx”)</span></font></div>
<div><br>
</div>
<blockquote type="cite">
<div>
<div dir="ltr">
<div>gpx.set_refinement(refdict3)<br>
gpx.do_refinements([{}])<br>
HistStats(gpx)<br>
# setup step 8: Uiso<br>
gpx.save("step8.gpx") <br>
</div>
<div><br>
</div>
<div>Please let me know how I need to develop my script to initialize Uiso to zero and then do the refinement. I am looking forward to hearing from you.</div>
<div><br>
</div>
<div>Best regards,</div>
<div>Hamidreza</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Jul 25, 2021 at 9:32 PM Toby, Brian H. <<a href="mailto:toby@anl.gov" target="_blank">toby@anl.gov</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div>Hi Hamidreza,</div>
<div><br>
</div>
The basic way that this would work is to use code something like this:<br>
<br>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><font face="Courier"><span style="font-style:normal">project = G2sc.G2Project(filename='PbSO4sim.gpx') <br>
</span></font><font face="Courier">phase0 = project.add_phase(PathWrap("PbSO4-Wyckoff.cif”),</font><font face="Courier"><span style="font-style:normal">phasename="PbSO4",fmthint='CIF’)<br>
</span></font><font face="Courier"><span style="font-style:normal">atom = phase0.atom(“Pb0”)<br>
</span></font><font face="Courier"><span style="font-style:normal">print(atom.data) # shows initial values<br>
</span></font><font face="Courier"><span style="font-style:normal">atom.uiso = 0.0<br>
</span></font><font face="Courier"><span style="font-style:normal">print(atom.data) # shows changed values</span></font></blockquote>
<br>
Or if opening an existing project, you could use <font face="Courier"><span style="font-style:normal">phase0 = project.phase(0)</span></font> to access the 1st phase and loop over <font face="Courier">project.atoms()</font><span style="font-style:normal"> to
 access all atoms, etc.</span>
<div><br>
</div>
<div>If you need more help, please send a copy of your script with a comment where you want to insert the Uiso change. <br>
<br>
Brian<br>
<br>
<blockquote type="cite">On Jul 25, 2021, at 12:50 PM, Hamidreza Hekmatjou <<a href="mailto:hamidreza.hekmatjou@ozu.edu.tr" target="_blank">hamidreza.hekmatjou@ozu.edu.tr</a>> wrote:<br>
<br>
Dear Brian Toby, <br>
<br>
Thanks a lot for your reply. Actually, I tried the class which is called G2AtomRecord. This class enables us to set a value for Uiso. However, I don't know how I need to call this class in Python. Actually, this class includes 3 arguments, namely data, indices,
 and proj; I don't know what these arguments are and also how I can call this class in Python. I would appreciate it if you help me to figure it out.<br>
<br>
Thank you in advance, and I am looking forward to hearing from you.<br>
<br>
Best regards,<br>
Hamidreza<br>
<br>
On Sun, Jul 25, 2021 at 8:30 PM Toby, Brian H. <<a href="mailto:toby@anl.gov" target="_blank">toby@anl.gov</a>> wrote:<br>
Hi Hamidreza, <br>
<br>
  I agree with Bob that a Uiso value of 0 does not make a whole lot of sense, but there is an object that provides access to read and set atomic parameters so you can do this. See this for Uiso: <a href="https://gsas-ii.readthedocs.io/en/latest/GSASIIscriptable.html#GSASIIscriptable.G2AtomRecord.uiso" target="_blank">https://gsas-ii.readthedocs.io/en/latest/GSASIIscriptable.html#GSASIIscriptable.G2AtomRecord.uiso</a>. Let
 me know if use is not clear. <br>
<br>
Brian<br>
<br>
<blockquote type="cite">On Jul 25, 2021, at 9:00 AM, Hamidreza Hekmatjou <<a href="mailto:hamidreza.hekmatjou@ozu.edu.tr" target="_blank">hamidreza.hekmatjou@ozu.edu.tr</a>> wrote:<br>
<br>
Dear Von Dreele,<br>
<br>
Thanks a lot for your response. The reason that I initialize Uiso to 0 is that my simulation is conducted for Ideal nanocrystals. As you know, Uiso with a default value of 0.01 is too high for ideal crystals so that the refined lattice parameter differs while
 changing the Uiso value from 0.01 to 0. I also worked on energy-minimized particles in which the Uiso needs to be refined; it should be mentioned that I can refine Uiso in this case. However, I am not able to initialize it in my Python-based script. Please
 let me know what you think in this regard.<br>
<br>
Thank you in advance, and I am looking forward to hearing from you.<br>
<br>
Best regards,<br>
Hamidreza  <br>
<br>
On Sun, Jul 25, 2021 at 4:51 PM Von Dreele, Robert B. <<a href="mailto:vondreele@anl.gov" target="_blank">vondreele@anl.gov</a>> wrote:<br>
Dear Hamidreza,<br>
<br>
Why initialize Uiso to 0? A far better value would be 0.01 (which is what is used in GSAS-ii).<br>
<br>
Bob Von Dreele<br>
<br>
 <br>
<br>
Sent from Mail for Windows 10<br>
<br>
 <br>
<br>
From: Hamidreza Hekmatjou via GSAS-II<br>
Sent: Sunday, July 25, 2021 8:48 AM<br>
To: <a href="mailto:gsas-ii@aps.anl.gov" target="_blank">gsas-ii@aps.anl.gov</a><br>
Subject: [GSAS-II] GSASIIscriptable<br>
<br>
 <br>
<br>
Dear all, <br>
<br>
 <br>
<br>
I hope this email finds you well. I am working on a Python-based script using GSASIIscriptable to do Rietveld refinement without using GSASII interface. I have a problem in this regard which I need to discuss with you. For my analyses, the Uiso should be initialized
 to be 0 before running the refinement. However, I could not find how I need to do so. With all due respect, can you tell me how I need to initialize Uiso in Python before running the refinement?<br>
<br>
 <br>
<br>
Thank you in advance, and I am looking forward to hearing from you.<br>
<br>
 <br>
<br>
Best regards,<br>
<br>
Hamidreza<br>
<br>
 <br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>

</blockquote></div>