1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """Module for the conversion of order parameters to specific model parameters and vice versa."""
24
25
26 from math import acos, cos, pi, sqrt
27
28
30 """Convert the isotropic cone angle to the order parameter S.
31
32 This uses Woessner's diffusion in a cone order parameter defined as::
33
34 S = 1/2 (1 + cos(theta)) * cos(theta)
35
36
37 @param theta: The isotropic cone angle.
38 @type theta: float
39 @return: The order parameter value.
40 @rtype: float
41 """
42
43
44 S = 0.5 * (1.0 + cos(theta)) * cos(theta)
45
46
47 return S
48
49
51 """Convert the isotropic cone order parameter S into the cone angle.
52
53 This uses Woessner's diffusion in a cone order parameter defined as::
54
55 S = 1/2 (1 + cos(theta)) * cos(theta)
56
57 The conversion equation is::
58
59 theta = acos((sqrt(8.0*S + 1) - 1)/2)
60
61 Hence the cone angle is only between 0 and 2pi/3, as the order parameter for higher cone angles is ambiguous.
62
63
64 @param S: The order parameter value (not squared).
65 @type S: float
66 @return: The value of cos(theta).
67 @rtype: float
68 """
69
70
71 if S > 1.0:
72 return 0.0
73 if S < -0.125:
74 return 2*pi
75
76
77 theta = acos(0.5*(sqrt(8.0*S + 1) - 1))
78
79
80 return theta
81