[GSAS-II] GSASIIscriptable

Hamidreza Hekmatjou hamidreza.hekmatjou at ozu.edu.tr
Mon Sep 20 08:58:34 CDT 2021


Dear Brian Toby,

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.

Thank you in advance, and I am looking forward to hearing from you.

Best regards,
Hamidreza

On Sun, Jul 25, 2021 at 11:58 PM Toby, Brian H. <toby at anl.gov> wrote:

> You are welcome. I am glad to have helped.
>
> Brian
>
> Sent from a powerful small device but with weak eyes.
>
> On Jul 25, 2021, at 3:09 PM, Hamidreza Hekmatjou <
> hamidreza.hekmatjou at ozu.edu.tr> wrote:
>
> 
> Dear Brian Toby,
>
> 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.
>
> Best regards,
> Hamidreza
>
> On Sun, Jul 25, 2021 at 10:49 PM Toby, Brian H. <toby at anl.gov> wrote:
>
>> 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.
>>
>> Brian
>>
>> On Jul 25, 2021, at 1:47 PM, Hamidreza Hekmatjou <
>> hamidreza.hekmatjou at ozu.edu.tr> wrote:
>>
>> Dear Brian Toby,
>>
>> 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.
>>
>> import os
>> import sys
>> sys.path.insert(0,
>> os.path.expanduser("C:/Users/SajjaD/gsas2full/GSASII/"))
>> import GSASIIscriptable as G2sc
>> workdir = "/Users/SajjaD/Scratch/PythonScript"
>> datadir = "/Users/SajjaD/software/G2/Tutorials/PythonScript/data"
>> def HistStats(gpx):
>>     '''prints profile rfactors for all histograms'''
>>     print(u"*** profile Rwp, "+os.path.split(gpx.filename)[1])
>>     for hist in gpx.histograms():
>>         print("\t{:20s}: {:.2f}".format(hist.name, hist.get_wR()))
>>     print("")
>>     gpx.save()
>> # Create the project
>> gpx = G2sc.G2Project(newgpx='Au.gpx')
>> # setup step 1: add a histogram to the project
>> hist1 = gpx.add_powder_histogram(os.path.join(datadir,
>> "LPdebyer_5nm1A_300Kstatic.DAT"), os.path.join(datadir, "inst_1.instprm"))
>> # setup step 2: add a phase to the histogram
>> phase0 = gpx.add_phase(os.path.join(datadir, "Au.cif"), phasename="Au",
>> histograms=[hist1])
>> # setup step 3 not in tutorial: increase # of cycles to improve
>> convergence
>> gpx.data['Controls']['data']['max cyc'] = 8 # not in API
>> # setup step 4: set background refinement (Hist), limits and sample
>> parameters
>> refdict0 = {"set": {"Background": {"type": "lin interpolate", "no.
>> coeffs": 1, "refine": False}, "Limits": [15, 174.995], "Sample Parameters":
>> {"Scale": True}}}
>> gpx.save("step4.gpx")
>> gpx.do_refinements([refdict0])
>> HistStats(gpx)
>> # setup step 5: lattice parameter refinement
>> gpx.save("step5.gpx")
>> refdict1 = {"set": {"Cell": True}} #set the cell flag (for all phases)
>> gpx.set_refinement(refdict1)
>> gpx.do_refinements([{}])
>> HistStats(gpx)
>> # setup step 6: particle size
>> gpx.save("step6.gpx")
>> refdict2 = {"set": {"Size": {"type": "isotropic", "refine": True,
>> "value": 0.01}}}
>> gpx.set_refinement(refdict2)
>> gpx.do_refinements([{}]) # refinement after setting
>> HistStats(gpx)
>> # setup step 7: Mustrain
>> gpx.save("step7.gpx")
>> refdict3 = {"set": {"Mustrain": {"type": "isotropic", "refine": True}}}
>>
>>
>> for atom in phase0.atoms():
>> atom.uiso = 0.0
>> gpx.save("step7a.gpx”)
>>
>> gpx.set_refinement(refdict3)
>> gpx.do_refinements([{}])
>> HistStats(gpx)
>> # setup step 8: Uiso
>> gpx.save("step8.gpx")
>>
>> 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.
>>
>> Best regards,
>> Hamidreza
>>
>> On Sun, Jul 25, 2021 at 9:32 PM Toby, Brian H. <toby at anl.gov> wrote:
>>
>>> Hi Hamidreza,
>>>
>>> The basic way that this would work is to use code something like this:
>>>
>>> project = G2sc.G2Project(filename='PbSO4sim.gpx')
>>> phase0 = project.add_phase(PathWrap("PbSO4-Wyckoff.cif”),
>>> phasename="PbSO4",fmthint='CIF’)
>>> atom = phase0.atom(“Pb0”)
>>> print(atom.data) # shows initial values
>>> atom.uiso = 0.0
>>> print(atom.data) # shows changed values
>>>
>>>
>>> Or if opening an existing project, you could use phase0 =
>>> project.phase(0) to access the 1st phase and loop over project.atoms()
>>> to access all atoms, etc.
>>>
>>> If you need more help, please send a copy of your script with a comment
>>> where you want to insert the Uiso change.
>>>
>>> Brian
>>>
>>> On Jul 25, 2021, at 12:50 PM, Hamidreza Hekmatjou <
>>> hamidreza.hekmatjou at ozu.edu.tr> wrote:
>>>
>>> Dear Brian Toby,
>>>
>>> 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.
>>>
>>> Thank you in advance, and I am looking forward to hearing from you.
>>>
>>> Best regards,
>>> Hamidreza
>>>
>>> On Sun, Jul 25, 2021 at 8:30 PM Toby, Brian H. <toby at anl.gov> wrote:
>>> Hi Hamidreza,
>>>
>>>   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:
>>> https://gsas-ii.readthedocs.io/en/latest/GSASIIscriptable.html#GSASIIscriptable.G2AtomRecord.uiso. Let
>>> me know if use is not clear.
>>>
>>> Brian
>>>
>>> On Jul 25, 2021, at 9:00 AM, Hamidreza Hekmatjou <
>>> hamidreza.hekmatjou at ozu.edu.tr> wrote:
>>>
>>> Dear Von Dreele,
>>>
>>> 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.
>>>
>>> Thank you in advance, and I am looking forward to hearing from you.
>>>
>>> Best regards,
>>> Hamidreza
>>>
>>> On Sun, Jul 25, 2021 at 4:51 PM Von Dreele, Robert B. <vondreele at anl.gov>
>>> wrote:
>>> Dear Hamidreza,
>>>
>>> Why initialize Uiso to 0? A far better value would be 0.01 (which is
>>> what is used in GSAS-ii).
>>>
>>> Bob Von Dreele
>>>
>>>
>>>
>>> Sent from Mail for Windows 10
>>>
>>>
>>>
>>> From: Hamidreza Hekmatjou via GSAS-II
>>> Sent: Sunday, July 25, 2021 8:48 AM
>>> To: gsas-ii at aps.anl.gov
>>> Subject: [GSAS-II] GSASIIscriptable
>>>
>>>
>>>
>>> Dear all,
>>>
>>>
>>>
>>> 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?
>>>
>>>
>>>
>>> Thank you in advance, and I am looking forward to hearing from you.
>>>
>>>
>>>
>>> Best regards,
>>>
>>> Hamidreza
>>>
>>>
>>>
>>>
>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.aps.anl.gov/pipermail/gsas-ii/attachments/20210920/ec406fa9/attachment.html>


More information about the GSAS-II mailing list