SasView / sasmodels

Package for calculation of small angle scattering models using OpenCL.
BSD 3-Clause "New" or "Revised" License
15 stars 27 forks source link

paracrystalline model simulation #507

Open pkienzle opened 2 years ago

pkienzle commented 2 years ago

For checking implementation of #284 corrections we can simulate a lattice of spheres and compare the resulting patterns.

The dnn parameter as currently implemented represents lattice spacing. For example, the following shows that the peak positions are aligned when the lattice spacing (a=500) matches dnn in the code.

$ python explore/realspace.py -w 0.06 -t fcc -n 20,20,20  -s 10000 -m 500 -z 500,500,500 sphere radius=10

The lineshape broadening appears to be less in the theory than in the simulation for a given distortion factor but I have not investigated different distortion factors and different simulation sizes. It may be that the distortion model (gaussian around the lattice point) is not implemented correctly or does not match what the paracrystal models are using for distortion.

Ignore details at low q due to finite lattice size.

The realspace.py is using an incorrect scaling factor, so ignore offset in y.

The basic simulation of a 2D pattern does not have enough resolution to verify the details of the simulation:

$ python explore/realspace.py -d 2 -w 0.06 -t fcc -n 10,10,10  -s 10000 -m 500 -z 250,250,250 -q 0.2 -v 20,30,40 sphere radius=10

Increasing the lattice size did not help. Increasing the name of samples to s=150000 has not yet completed running since the algorithm is O(n²).

butlerpd commented 1 year ago

Now that the paracrystalline models have been corrected, is this still relevant @pkienzle? If so is it correct given the fix is different from what was supposed in #284?

pkienzle commented 1 year ago

The simulation code is still relevant in as much as it can be used to cross check the analytical results. It may also be useful in the development of models of different types of distortion. It is not part of the released packages so the code does not need careful checking.