1 | #pragma TextEncoding = "UTF-8" |
---|
2 | #pragma rtGlobals=3 // Use modern global access method and strict wave access. |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | //**************************************************************************************************** |
---|
7 | //this is Irena Modeling package User form factor. |
---|
8 | //to use, open Modeling package, switch to Model controls and select "User" for Form Factor. |
---|
9 | Function TriaxSpheroid(Q,radius, par1,par2,par3,par4,par5) //Triaxial Spheroid, |
---|
10 | variable Q, radius, par1,par2,par3,par4,par5 |
---|
11 | //based on Triaxial Spherdoid from NIST SANS tools, |
---|
12 | //ftp.ncnr.nist.gov/pub/sans/kline/Download/SANS_Model_Docs_v4.10.pdf |
---|
13 | //the shape is elllipsoid with 3 different radii : dimensions R, R1, R2, R<R1<R2. This is important!!! |
---|
14 | // note Rg = (R^2+R1^2+R2^2)/5 |
---|
15 | //assumptions: Par1 is ratio of R1/R, requirement: Par1>1 |
---|
16 | // Par2 is R2/R, requirements: Par2>1, Par2>Par1 |
---|
17 | //Par3-Par5 are not used |
---|
18 | if(Par2<1 || Par1<1 || Par2<Par1) |
---|
19 | abort "Parameters in TriaxSpheroid form factor are not correct" |
---|
20 | endif |
---|
21 | variable aa,bb,cc |
---|
22 | aa=radius |
---|
23 | bb=Par1*radius |
---|
24 | cc=Par2*radius |
---|
25 | return sqrt(TriaxSpheroidIntgOut(Q,aa,bb,cc)) //TriaxSpheroidIntgOut return F^2, code expect F. |
---|
26 | end |
---|
27 | //**************************************************************************************************** |
---|
28 | Function TriaxSpheroidVolume(radius, par1,par2,par3,par4,par5) |
---|
29 | variable radius, par1,par2,par3,par4,par5 |
---|
30 | //based on Triaxial Spherdoid from NIST SANS tools, |
---|
31 | //ftp://ftp.ncnr.nist.gov/pub/sans/kline/Download/SANS_Model_Docs_v4.10.pdf |
---|
32 | variable aa,bb,cc |
---|
33 | aa=radius |
---|
34 | bb=Par1*radius |
---|
35 | cc=Par2*radius |
---|
36 | return 4*pi*aa*bb*cc/3 |
---|
37 | end |
---|
38 | //**************************************************************************************************** |
---|
39 | //work functions, do not change |
---|
40 | Function TriaxSpheroidIntgOut(qq,aa,bb,cc) |
---|
41 | Variable qq,aa,bb,cc |
---|
42 | make/Free TempWave |
---|
43 | SetScale/I x, 0, 1, TempWave |
---|
44 | multithread TempWave = TriaxSpheroidIntgInside(qq,aa,bb,cc,x) |
---|
45 | return area(TempWave) |
---|
46 | end |
---|
47 | //**************************************************************************************************** |
---|
48 | threadsafe Function TriaxSpheroidIntgInside(qq,aa,bb,cc,dy) |
---|
49 | Variable qq,aa,bb,cc,dy |
---|
50 | make/Free TempWave |
---|
51 | SetScale/I x, 0, 1, TempWave |
---|
52 | TempWave = TriaxSpheroidInside(qq,aa,bb,cc,x,dy) |
---|
53 | return area(TempWave) |
---|
54 | end |
---|
55 | //**************************************************************************************************** |
---|
56 | threadsafe Function TriaxSpheroidInside(qq,aa,bb,cc,dx,dy) |
---|
57 | Variable qq,aa,bb,cc,dx,dy |
---|
58 | //aa, bb, cc are simply dimensions |
---|
59 | //qq is Q |
---|
60 | //dx, dy are integrants. |
---|
61 | Variable val,arg |
---|
62 | arg = aa*aa*cos(pi*dx/2)*cos(pi*dx/2) |
---|
63 | arg += bb*bb*sin(pi*dx/2)*sin(pi*dx/2)*(1-dy*dy) |
---|
64 | arg += cc*cc*dy*dy |
---|
65 | arg = qq*sqrt(arg) |
---|
66 | if(arg == 0) |
---|
67 | val = 1 |
---|
68 | else |
---|
69 | val = 9*((sin(arg) - arg*cos(arg))/arg^3 )^2 |
---|
70 | endif |
---|
71 | return(val) |
---|
72 | end |
---|
73 | //**************************************************************************************************** |
---|