Skip to content

Fix and Extend set_HAP_refinements() for Size and Mustrain Parameters#305

Open
AdamCorrao wants to merge 4 commits intoAdvancedPhotonSource:mainfrom
AdamCorrao:fix/G2sc-size-strain
Open

Fix and Extend set_HAP_refinements() for Size and Mustrain Parameters#305
AdamCorrao wants to merge 4 commits intoAdvancedPhotonSource:mainfrom
AdamCorrao:fix/G2sc-size-strain

Conversation

@AdamCorrao
Copy link
Contributor

Summary

This PR enhances the G2Phase.set_HAP_refinements() method in GSASIIscriptable to properly handle Lorentzian-Gaussian mixing coefficients (LG_mix) for Size and Mustrain parameters, and fixes a bug when setting uniaxial Size and Mustrain values.

Changes to GSASIIscriptable.py

Bug fix:

  • Value setting for uniaxial 'Size' and 'Mustrain'

New functionality:

  • Added LG_mix parameter handling for both Size and Mustrain HAP parameters
  • Users can now set both the value and refinement flag for LG_mix coefficients
  • Included validation to ensure LG_mix values are between 0.0 and 1.0

Example usage:

phase.set_HAP_refinements({
    'Size': {'type': 'isotropic', 'value': 0.1, 'refine': True,
             'LGmix': {'value': 0.5, 'refine': True}},
    'Mustrain': {'type': 'isotropic', 'refine': True,
                 'LGmix': {'value': 0.8, 'refine': True}}
})

Testing Materials

Added testing materials in test-G2sc-size-strain/ directory:

  • Notebook: G2sc_size_strain_test.ipynb - demonstrates the new functionality with a complete workflow
  • Test data: LaB6 standard reference material (SRM 660c) diffraction pattern
  • Supporting files: CIF file and instrument parameter file for reproducible testing
  • Workflow: Shows project creation, histogram and phase addition, Size/Mustrain parameter setting, and refinement execution

The test notebook validates that the enhanced set_HAP_refinements() method correctly:

  • Configures refinement flags for Size and Mustrain parameters
  • Sets and refines LG_mix coefficients for peak shape modeling
  • Integrates with the full GSAS-II refinement workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant