<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Ray, 
<div class=""><br class="">
</div>
<div class="">  As of right now, it does not appear that I have written an API to set the model type and parameters for preferred orientation. GSASIIscriptable only is able to turn on and off the refinement flag. This does not mean it can’t be done, but it
 needs some special attention. You can use phase.getHAPvalues() (<a href="https://gsas-ii.readthedocs.io/en/latest/GSASIIscriptable.html#GSASIIscriptable.G2Phase.getHAPvalues" class="">https://gsas-ii.readthedocs.io/en/latest/GSASIIscriptable.html#GSASIIscriptable.G2Phase.getHAPvalues</a>)
 on an .gpx file edited with the GUI to see the dict with all the parameter values so you can see what you want to change and then use .setHAPentryValue (or modify the dict directly) to make the changes. </div>
<div class=""><br class="">
</div>
<div class="">   What you want is something that probably should be implemented, but my recollection is that it is not a simple task, as the Laue group for a phase determines now many terms are allowed for a given SH order and that means to implement a generalized
 scripting routine that allows one to set the SH order requires creating access to a bunch of routines currently only implemented in the GUI. I know I am not going to get to that anytime soon, but f important to your work keep asking iand I’ll add it to my
 to do list. </div>
<div class=""><br class="">
</div>
<div class="">Brian</div>
<div class=""> </div>
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">On Aug 18, 2022, at 1:13 PM, Gunawidjaja, Ray via GSAS-II <<a href="mailto:gsas-ii@aps.anl.gov" class="">gsas-ii@aps.anl.gov</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div class="">
<div class="">
<blockquote style="border-style: none none none solid; border-left-width: 1pt; border-left-color: rgb(204, 204, 204); padding: 0in 0in 0in 6pt; margin-left: 4.8pt; margin-right: 0in;" class="">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Hello,<o:p class=""></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I am trying to include preferred orientation refinement into the example script below (<span style="color: red;" class="">in red font</span>), but can’t find the right command on the website (<a href="https://gsas-ii.readthedocs.io/en/latest/" style="color: blue; text-decoration: underline;" class="">https://gsas-ii.readthedocs.io/en/latest/</a>).
 I would like to achieve the same result as selecting the Spherical harmonics Preferred orientation model with, e.g., a harmonic order of 2 in the Data table in GSASII GUI. to Please help.<o:p class=""></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
  <span class="Apple-converted-space"> </span><span style="color: rgb(0, 112, 192);" class=""> from __future__ import division, print_function<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">    import os,sys<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">    sys.path.insert(0,'/Users/toby/software/G2/GSASII') # needed to "find" GSAS-II modules<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">    import GSASIIscriptable as G2sc<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">    datadir = "/Users/Scratch/"<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">    gpx = G2sc.G2Project(os.path.join(datadir,'test2.gpx'))<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">    gpx.histogram(0).add_back_peak(4.5,30000,5000,0)<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">    pardict = {'set': {'Sample Parameters': ['Absorption', 'Contrast', 'DisplaceX'],<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">                       'Background': {'type': 'chebyschev-1', 'refine': True,<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">                                      'peaks':[[0,True]]},<o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 10.9pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">                        <span class="Apple-converted-space"> </span></span><span style="color: red;" class="">'Pref.Ori. ':{ 'type': 'SH', ???????}</span><span style="color: rgb(0, 112, 192);" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0in 0in 0in 58.45pt; font-size: 11pt; font-family: Calibri, sans-serif; text-indent: 13.55pt;" class="">
<span style="color: rgb(0, 112, 192);" class="">}}<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">   <span class="Apple-converted-space"> </span><o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class="">           gpx.set_refinement(pardict)<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I appreciate your help.<o:p class=""></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Thanks,<o:p class=""></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Ray<o:p class=""></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="color: rgb(0, 112, 192);" class=""><o:p class=""> </o:p></span></div>
</blockquote>
</div>
</div>
</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">GSAS-II
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="mailto:GSAS-II@aps.anl.gov" style="color: blue; text-decoration: underline; font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">GSAS-II@aps.anl.gov</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://mailman.aps.anl.gov/mailman/listinfo/gsas-ii" style="color: blue; text-decoration: underline; font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.aps.anl.gov/mailman/listinfo/gsas-ii</a></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>