Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spherical harmonics refinement controls in scripting #108

Open
operandos opened this issue Nov 22, 2024 · 1 comment
Open

Spherical harmonics refinement controls in scripting #108

operandos opened this issue Nov 22, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed Scripting enhancement/bug for GSASIIscriptable Someday... Problem noted, but will not be addressed right now.

Comments

@operandos
Copy link

I'm looking for assistance in adding spherical harmonics refinement parameters to a GSAS-II script (python)

I couldn't find spherical harmonics (SH) in the histogram and phase refinement parameters table in the docs

https://gsas-ii.readthedocs.io/en/latest/GSASIIscriptable.html#hap-parameters-table

So I attempted to work backwards by adjusting the SH refinement parameters using the GUI, then loading the project with gsas2script.
Refined SH parameters in GUI:

Inspecting the same project with gsas2 script (after saving gpx, closing GUI etc.), the phase dictionary ( gpx.phase('phs_name').data['General']['SH Texture'] ) of SH refinement parameters has no SH coefficients.

'SH Texture': {'Order': 0,
  'Model': 'cylindrical',
  'Sample omega': [False, 0.0],
  'Sample chi': [False, 0.0],
  'Sample phi': [False, 0.0],
  'SH Coeff': [False, {}],
  'SHShow': False,
  'PFhkl': [0, 0, 1],
  'PFxyz': [0, 0, 1],
  'PlotType': 'Pole figure',
  'Penalty': [[''], 0.1, False, 1.0]},

I did come across this in the docs, but am unsure of how to implement it in a refinement script.

https://gsas-ii.readthedocs.io/en/latest/GSASIIutil.html#GSASIIlattice.GenRBCoeff

@briantoby briantoby added enhancement New feature or request help wanted Extra attention is needed Someday... Problem noted, but will not be addressed right now. labels Nov 22, 2024
@briantoby
Copy link
Collaborator

In case this is not already clear, there are two SH implementations in G2. One is for the case where one does multiple measurements on the same sample to characterize texture. This is done with the Texture tab and one set of coefficients are used for all histograms associated with a phase. The second variety is where one wants to treat the texture as part of a refinement. This is done on the Data tab and there is a set of coefficients for every histogram in every phase. Bob and I call such parameters that exist for every "histogram x phase" HAP parameters, because they were labeled that way in the should-be-now-long-defunct original GSAS .EXP file.

The reason you did not find the SH info in gpx.phase('phs_name').data['General']['SH Texture'] is because that is the data item associated with the texture tab. Look in gpx.phase('phs_name').data['Histograms'][h] (see G2Phase.HAPvalue()).

I did not tackle SH in scripting because it is not simple. As you likely know, the user sets the order, but based on the Laue group (and for the Texture tab, the processing symmetry) the correct number of terms are generated. , though to be honest I never looked to see how complex it would be to crib the code from the GUI. It depends in part on how much needs to be moved out of the GGUI.py file(s) and how much is already in computation modules. I will leave this ticket open as a reminder to look into this when I am looking for something more fun than tracking down a bug. To be honest I never looked to see how complex it would be to crib the SH setup code from the GUI. It depends in part on how much needs to be moved out of the GGUI.py file(s) and how much is already in computation modules

I don't think there would be any problems with hard coding in your script(s) for a particular space group with whatever settings you find in the appropriate section of the HAP parameters after you have set things up in the GUI.

@briantoby briantoby added the Scripting enhancement/bug for GSASIIscriptable label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed Scripting enhancement/bug for GSASIIscriptable Someday... Problem noted, but will not be addressed right now.
Projects
None yet
Development

No branches or pull requests

2 participants