File: dump-formfactor.py

package info (click to toggle)
bornagain 23.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,936 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (54 lines) | stat: -rwxr-xr-x 1,312 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
"""
Dump formfactor for different q scans
"""

import math
import bornagain as ba

eps = 0.005

if __name__ == '__main__':

    width = 1.
    height = 1.
    length = 100.0

    particle = ba.FormFactorCosineRippleBox(length, width, height)
#    particle = ba.FormFactorSawtoothRippleBox(length, width, height, 0.)

    print("# " + particle.shapeName() + " form factor, for different q scans")

    print("# q vs |F(q)| for q in direction 010")
    t = 0.2
    while t < 200:
        q = ba.C3(0, t, 0)
        print(t, " ", abs(particle.formfactor_at_bottom(q)))
        t *= 1+eps
    print()

    print("# q vs |F(q)| for q in direction 0001")
    t = 0.2
    while t < 200:
        q = ba.C3(0, 0, t)
        print(t, " ", abs(particle.formfactor_at_bottom(q)))
        t *= 1+eps
    print()

    print("# q vs |F(q)| for q in direction 011")
    t = 0.2
    s2 = math.sqrt(2)
    while t < 200:
        q = ba.C3(0, t/s2, t/s2)
        print(t, " ", abs(particle.formfactor_at_bottom(q)))
        t *= 1+eps
    print()

    print("# q vs |F(q)| for |q|=50, q on cercle in 100 plane")
    ampl = 50
    t = 0
    while t < 2*math.pi:
        q = ba.C3(0, ampl*math.cos(t), ampl*math.sin(t))
        print(t, " ", abs(particle.formfactor_at_bottom(q)))
        t += eps
    print()