Thanks, Brian, for your reply.

  1.  As you pointed out, another thing I tried was to enable the Pref.Ori. 
parameter using the following command.
                gpx.phase(0).getHAPvalues('PWDR 
Si-Beason_2022-R2_csv.csv')['Pref.Ori.']=['MD', 1.0, True, [0, 0, 1], 0, {}, 
[], 0.1]

Then, I refined using the command:
                gpx.refine()

However, the fit did not seem to converge. On GSASII GUI, the fit converged in 
less than a minute, so it indicated that something was wrong. Some of the 
output is as follows:

gpx file saved as 
C:\Users\ADM\Desktop\57_pXRD_Simulation\pXRD_Simulation_v1-11\data\Tasim.gpx
Hessian Levenberg-Marquardt SVD refinement on 7 variables:
initial chi^2 547.6 with 665 obs.
Cycle 0: 0.06s, Chi**2: nan for 665 obs., Lambda: 0,  Delta: nan, SVD=0
ouch #2 bad SVD inversion; dropping terms for for variable(s) #[0]
ouch #2 bad SVD inversion; dropping terms for for variable(s) #[0]
ouch #2 bad SVD inversion; dropping terms for for variable(s) #[0]
giving up with ouch #2
**** Refinement failed with 1 SVD singularities ****
Error: 3 Parameter(s) dropped:
  0:0:MD, :0:Back;0, :0:Back;1
Check covariance matrix for parameter correlation
Hessian Levenberg-Marquardt SVD refinement on 7 variables:
initial chi^2 nan with 665 obs.
ouch #2 bad SVD inversion; dropping terms for for variable(s) #[0]
C:/ProgramData/Anaconda3/envs/G2/GSASII\GSASIIstrMath.py:2509: RuntimeWarning: 
invalid value encountered in sqrt
  A = 1.0/np.sqrt((MD*cosP)**2+sinP**2/MD)
C:/ProgramData/Anaconda3/envs/G2/GSASII\GSASIImath.py:352: UserWarning: 
Warning: converting a masked element to nan.
  (icycle,time.time()-time0,chisq1,Nobs,lamMax,deltaChi2,Nzeros))
C:/ProgramData/Anaconda3/envs/G2/GSASII\GSASIIstrMath.py:2525: RuntimeWarning: 
invalid value encountered in sqrt
  A = 1.0/np.sqrt((MD*cosP)**2+sinP**2/MD)
C:/ProgramData/Anaconda3/envs/G2/GSASII\GSASIIstrMain.py:235: UserWarning: 
Warning: converting a masked element to nan.
  printFile.write(' wR = %7.2f%%, chi**2 = %12.6g, GOF = 
%6.2f\n'%(Rvals['Rwp'],Rvals['chisq'],Rvals['GOF']))
C:/ProgramData/Anaconda3/envs/G2/GSASII\GSASIImath.py:230: UserWarning: 
Warning: converting a masked element to nan.
  G2fil.G2Print('initial chi^2 %.5g with %d obs.'%(chisq00,Nobs))
ouch #2 bad SVD inversion; dropping terms for for variable(s) #[0]
ouch #2 bad SVD inversion; dropping terms for for variable(s) #[0]
giving up with ouch #2
**** Refinement failed with 1 SVD singularities ****


  1.  The above command is for MD model. I copied from the example provided on 
the website https://gsas-ii.readthedocs.io/. For SH model, what is the 
equivalent command to do a spherical harmonic model with order 2? When I tied 
the following, it did NOT work:
                               gpx.phase(0).getHAPvalues('PWDR 
Si-Beason_2022-R2_csv.csv')['Pref.Ori.']=['SH', 'order':2, 'refine': True]


Thanks,
Ray


From: Toby, Brian H. <[email protected]>
Sent: Thursday, August 18, 2022 2:23 PM
To: Gunawidjaja, Ray <[email protected]>
Cc: [email protected]
Subject: Re: [GSAS-II] GSASIIScriptable command to refine the spherical 
harmonics ('SH') of the preferred orientation ('Pref.Ori.') parameter


[EXTERNAL EMAIL]
Hi Ray,

  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() 
(https://gsas-ii.readthedocs.io/en/latest/GSASIIscriptable.html#GSASIIscriptable.G2Phase.getHAPvalues)
 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.

   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.

Brian

On Aug 18, 2022, at 1:13 PM, Gunawidjaja, Ray via GSAS-II 
<[email protected]<mailto:[email protected]>> wrote:

Hello,

I am trying to include preferred orientation refinement into the example script 
below (in red font), but can’t find the right command on the website 
(https://gsas-ii.readthedocs.io/en/latest/). 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.

    from __future__ import division, print_function
    import os,sys
    sys.path.insert(0,'/Users/toby/software/G2/GSASII') # needed to "find" 
GSAS-II modules
    import GSASIIscriptable as G2sc
    datadir = "/Users/Scratch/"

    gpx = G2sc.G2Project(os.path.join(datadir,'test2.gpx'))
    gpx.histogram(0).add_back_peak(4.5,30000,5000,0)
    pardict = {'set': {'Sample Parameters': ['Absorption', 'Contrast', 
'DisplaceX'],
                       'Background': {'type': 'chebyschev-1', 'refine': True,
                                      'peaks':[[0,True]]},
                         'Pref.Ori. ':{ 'type': 'SH', ???????}
}}

           gpx.set_refinement(pardict)

I appreciate your help.
Thanks,
Ray

_______________________________________________
GSAS-II mailing list
[email protected]<mailto:[email protected]>
https://mailman.aps.anl.gov/mailman/listinfo/gsas-ii

_______________________________________________
GSAS-II mailing list
[email protected]
https://mailman.aps.anl.gov/mailman/listinfo/gsas-ii

Reply via email to