Opened 5 weeks ago

Last modified 23 hours ago

#1156 new defect

dnn should be lattice spacing for paracrystalline models

Reported by: pkienzle Owned by:
Priority: major Milestone: SasView 4.2.0
Component: SasView Keywords:
Cc: Work Package: SasView Bug Fixing

Description

[Copied from ticket comment:4:ticket:805]

The parameter to the model is labelled as nearest neighbour distance, but I believe it is lattice spacing.

In units of lattice spacing, a, the q positions of the peaks are well determined by:

q = 2*pi/a * sqrt(h2 + k2 + l2)

where SC allows all integer hkl, BCC requires h+k+l even and FCC require hkl all even or hkl all odd. Also need peak multiplicity to predict the peak height, since [100] = [-100] = [010] = [0-10] = [001] = [00-1], etc.

I checked peak position and height for dnn=20 and d_factor=0.06 for sc, bcc and fcc to verify the calculation.

We should rename dnn to length_a as in the parallelepiped model, and rename d_factor to lattice_distortion. Lattice distortion is actually proportional, Delta a / a, but distortion_proportion is too much of a mouthful.

Change History (8)

comment:1 Changed 7 days ago by pkienzle

Renaming parameters requires too much work for the 4.2 release.

Could simply update the docs with the correct parameter description and leave any parameter renaming to 4.3.

comment:2 follow-up: Changed 7 days ago by butler

Actually Andrew started a branch on that but did not issue a PR … partly because he made the changes but did not remember where the magic "conversion" file was that allows for backward compatibility.

comment:3 in reply to: ↑ 2 Changed 5 days ago by pkienzle

Replying to butler:

Actually Andrew started a branch on that but did not issue a PR … partly because he made the changes but did not remember where the magic "conversion" file was that allows for backward compatibility.

Conversions go in sasmodels/convert.py.

Long term, may want to have version numbers for each model, and conversion functions within them. This would even work for plugin models.

This wouldn't handle model renaming, so still need convert.py or something like it.

comment:4 Changed 41 hours ago by butler

Looking at convert.py and conversion_table.py the infrastructure seems designed for translation from old style to new style models? Not at all clear to me how to use it for cases such as this? Assuming it can be used for such, some simple instruction somewhere might help?

comment:5 follow-up: Changed 38 hours ago by butler

Actually reading the docs and then the code, the problems look like they go much deeper. I think dnn was in fact intended to be nearest neighbor *NOT* lattice spacing. Indeed the volume correction (ratio of sphere volume to unit cell volume) converts dnn (the nearest neighbor distance) to lattice spacing. NOTE: this seems to be done correctly in the code but is in incorrect in the BCC docs (both docs give the equation for FCC. SC also seems correct but then lattice and nearest neighbor are the same in this case). On the other hand the first peak position seems to suggest that dnn is the lattice spacing and the volume correction should only affect the intensity, though the P(Q) and distortion should move the peak position around. I suspect that whoever originally coded this model used the two (lattice and nearest neighbor spacing) interchangeably.

As noted by Michael Weir in an email:

Any chance there is confusion between parameters as Matsuoka paper uses "a_n" for nearest neighbour distance when you might reasonably expect "a" to refer to a lattice constant?

I believe the models need a complete going over and checked against the original references before going in and making changes. This probably means we need to move this to 4.3. Question would be if we change the vol ratio equation in BCC docs. We should add to Known Issues.

comment:6 Changed 29 hours ago by richardh

See also earlier comments and numerical issues in #975 and #805

Ought perhaps to for now put some large comments in the user docs as to where there may be issues.

comment:7 Changed 27 hours ago by smk78

I was just logging in to say exactly that… the Known Issues is too obscure.

comment:8 in reply to: ↑ 5 Changed 24 hours ago by pkienzle

Replying to butler:

Actually reading the docs and then the code, the problems look like they go much deeper. I think dnn was in fact intended to be nearest neighbor *NOT* lattice spacing. Indeed the volume correction (ratio of sphere volume to unit cell volume) converts dnn (the nearest neighbor distance) to lattice spacing.

In ticket:805#comment:4 point (6), I only checked the peak positions correspond to a rather than dnn. I did not check the volume fraction scaling factor.

Agreed that the code for volume fraction seems to be wrong.

  • SC has one sphere per cell and should be V(sphere)/a3 = V(r/a).
  • BCC has two spheres per cell and should be 2 V(r/a).
  • FCC has four spheres per cell and should be 4 V(r/a).

Also, need to understand whether returning form_volume as the volume of the sphere is correct when shape is scaled by volume fraction of lattice.

Last edited 23 hours ago by pkienzle (previous) (diff)
Note: See TracTickets for help on using tickets.