Skip to content

Adding nanoprisms model (pure python)#699

Open
sara-mokhtari wants to merge 9 commits intomasterfrom
adding_nanoprisms_model
Open

Adding nanoprisms model (pure python)#699
sara-mokhtari wants to merge 9 commits intomasterfrom
adding_nanoprisms_model

Conversation

@sara-mokhtari
Copy link
Contributor

Description

Adding a pure python model for nanoprisms of different cross sections with orientation averaging using Fibonacci quadrature.

Fixes #685

How Has This Been Tested?

Unit tests worked.
This model was compared to an another numerical calculation : for a gold nanoprism with a pentagonal cross section, agreement was found with the Debye equation (Debye calculator: https://github.com/FrederikLizakJohansen/DebyeCalculator). The Debye equation is based on atomic positions while SasView model is based on analytical expressions.
The model was also used to fit an experimental data (AuAg nanoprism of pentagonal cross section D = 30 nm, L = 117 nm).

Since it's a python model, there is still the issue: "the support orientational dispersion in pure python model" ( #695).

More tests should be made on small q. Indeed, like the previous model (octahedron_truncated model), we encouter issues when it comes to small q (q<10^-6 Angs). More precise mathematical should be used (see PR #694 comments).

Note : the fibonacci quadrature code (sasmodels/quadratures/fibonacci.py) was added to a new repository called "quadratures" because it could be also useful for other models.

To do:

  • take care of the orientational dispersion for pure python model
  • add numba acceleration (tests have to be made first)
  • take care of the singularities

Review Checklist:

[if using the editor, use [x] in place of [ ] to check a box]

Documentation (check at least one)

  • There is nothing that needs documenting
  • Documentation changes are in this PR
  • There is an issue open for the documentation (link?)

Installers

  • There is a chance this will affect the installers, if so
    • Windows installer (GH artifact) has been tested (installed and worked)
    • MacOSX installer (GH artifact) has been tested (installed and worked)
    • Wheels installer (GH artifact) has been tested (installed and worked)

Licensing (untick if necessary)

  • The introduced changes comply with SasView license (BSD 3-Clause)

@butlerpd
Copy link
Member

butlerpd commented Mar 9, 2026

I have not had the chance to look at this but note that you created a new directory at sasmodels.quadratures. I thought all our current quadratures reside in sasmodels.models.lib It may be that we want to move quadruture code into its own directory but that should be a discussion I guess? Also not sure the higher level (under sasmodels rather than sasmodels.models is the right answer?

@pkienzle
Copy link
Contributor

pkienzle commented Mar 9, 2026

I don't remember the details, but I found that I needed to put the 2-Yukawa support libraries into sasmodels.TwoYukawa rather than sasmodels.models.TwoYukawa. Similarly, the additional quadrature support code cannot be in the sasmodels.models namespace.

We may want to create a sasmodels.lib package to contain the support libraries for pure python models. Currently these are in sasmodels.special, the sasmodels.TwoYukawa package, and the new sasmodels.quadrature module.

Note: PEP8 says package names should be snake_case. Somehow both the author (me) and the reviewers messed up with TwoYukawa. We can fix that if we move support libraries to lib.

I'll create a ticket for this.

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.

Nanoprism model

7 participants