Skip to content

Commit e63cb8e

Browse files
sara-mokhtarijellybean2004
authored andcommitted
Merge pull request #735 from SasView/Fix_doc_polyhedrons
Fix doc polyhedrons
1 parent 00240c8 commit e63cb8e

9 files changed

Lines changed: 105 additions & 114 deletions
429 Bytes
Loading
-607 KB
Binary file not shown.
121 KB
Loading
72.9 KB
Loading
-323 KB
Binary file not shown.

sasmodels/models/prism.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
r"""
2-
This model provides the form factor for a right prism which cross-section is a regular polygon.
2+
This model provides the form factor for a right prism whose cross-section is a regular polygon.
33
Orientation averaging is done by using the Fibonacci quadrature.
44
This quadrature provides a quasi-uniform distribution of points on the unit sphere
55
using the golden ratio. The number of points to generate on the unit sphere is set to 500 points, it usually provides
@@ -8,7 +8,8 @@
88
Definition
99
----------
1010
11-
We consider particles having the shape of a right prism of length L and a cross section made of a regular polygon with n sides as illustrated in the figure below.
11+
We consider particles having the shape of a right prism of length *L* (parameter called *length* in the model) and a cross section made of
12+
a regular polygon with a certain number of sides *n* (parameter called *n_sides* in the model) as illustrated in the figure below.
1213
1314
.. figure:: img/nanoprisms_geometry.jpg
1415
@@ -25,7 +26,7 @@
2526
2627
R\cos(\pi/n)
2728
28-
For comparison purposes, it is convenient to introduce an average radius R_ave (shown in red in the figure).
29+
For comparison purposes, it is convenient to introduce an average radius :math:`R_ave` (parameter called *radius_average* in the model). It is shown in red in the figure.
2930
The area of the n-sided regular polygon is given by :
3031
3132
.. math::
@@ -39,7 +40,7 @@
3940
4041
V = L \times {A}
4142
42-
where R_ave is the radius of the equivalent disc having the same area as the n-sided polygon.
43+
where :math:`R_ave` is the radius of the equivalent disc having the same area as the n-sided polygon.
4344
It is also the squared average of the distance from the center of the polygon to any point of its perimeter. It is related to the circumradius R by :
4445
4546
.. math::
@@ -99,8 +100,8 @@
99100
it is equivalent to integrate the 3D scattering vector over a sphere of radius q with the shape in its reference orientation.
100101
101102
The sphere is sampled using Fibonacci quadrature to provide a quasi-uniform distribution of points on the unit sphere.
102-
The repartition of the N points is computed using the golden ratio (see fibonacci.py).
103-
Each point of the quadrature on the unit sphere correspond to a vector :math:`\mathbf{u}_{j}`.
103+
The distribution of the N points is computed using the golden ratio (see fibonacci.py).
104+
Each point of the quadrature on the unit sphere corresponds to a vector :math:`\mathbf{u}_{j}`.
104105
In the sum, all weights :math:`w_j` are taken identical and equal to :math:`\frac{1}{N}`.
105106
106107
.. math::
@@ -121,21 +122,19 @@
121122
References
122123
----------
123124
124-
1. Jules Marcone et al. "Form factor of prismatic particles for small-angle scattering analysis".
125-
In: J. Appl. Cryst. (2025) 58, 543-552
126-
DOI: https://doi.org/10.1107/S1600576725000676
125+
1. Marcone, J., Trazo, J. G., Nag, R., Goldmann, C., Ratel-Ramond, N., Hamon, C., & Impéror-Clerc, M. (2025).
126+
Form factor of prismatic particles for small-angle scattering analysis.
127+
*Journal of Applied Crystallography*, 58(2), 543‑552. https://doi.org/10.1107/S1600576725000676
127128
128-
2. Wei-Ren Chen et al. "Scattering functions of Platonic solids".
129-
In: Journal of Applied Crystallography - J. Appl. Cryst. (June 2011).
130-
DOI: https://doi.org/10.1107/S0021889811011691
129+
2. Li, X., Shew, C., He, L., Meilleur, F., Myles, D. A. A., Liu, E., Zhang, Y., Smith, G. S.,
130+
Herwig, K. W., Pynn, R., & Chen, W. (2011). Scattering functions of Platonic solids.
131+
*Journal Of Applied Crystallography*, 44(3), 545‑557. https://doi.org/10.1107/s0021889811011691
131132
132-
3. Croset, Bernard, "Form factor of any polyhedron: a general compact
133-
formula and its singularities" In: J. Appl. Cryst. (2017). 50, 1245–1255
134-
DOI: https://doi.org/10.1107/S1600576717010147
133+
3. Croset, B. (2017). Form factor of any polyhedron : a general compact formula and its singularities.
134+
*Journal Of Applied Crystallography*, 50(5), 1245‑1255. https://doi.org/10.1107/s1600576717010147
135135
136-
4. Wuttke, J. Numerically stable form factor of any polygon and polyhedron
137-
J Appl Cryst 54, 580-587 (2021)
138-
DOI: https://doi.org/10.1107/S1600576721001710
136+
4. Wuttke, J. (2021). Numerically stable form factor of any polygon and polyhedron.
137+
*Journal Of Applied Crystallography*, 54(2), 580‑587. https://doi.org/10.1107/s1600576721001710
139138
140139
Authorship and Verification
141140
----------------------------

sasmodels/models/tetrahedron.py

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
Definition
1010
----------
1111
12-
This model computes the form factor of a regular tetrahedron from its circumradius.
13-
The size of the tetrahedron is described by its circumradius :math:`R`,
14-
which is the radius of the circumscribed sphere. The relationship between the circumradius
15-
and the edge length is also implemented. The edge length :math:`L`
12+
This model computes the form factor of a regular tetrahedron by defining its size through its circumradius :math:`R`
13+
(parameter called *radius* in the model), which is the radius of the circumscribed sphere.
14+
The relationship between the circumradius and the edge length is also implemented. The edge length :math:`L`
1615
and volume :math:`V` are given by:
1716
1817
.. math::
@@ -23,7 +22,7 @@
2322
2423
V = \frac{\sqrt{2}}{12} \, L^3
2524
26-
.. figure:: img/tetrahedron_regular.png
25+
.. figure:: img/tetrahedron.png
2726
2827
Regular tetrahedron in its reference orientation.
2928
@@ -36,7 +35,7 @@
3635
3736
.. math::
3837
39-
\mathbf{v}_1 = (\frac{L}{\sqrt{2}},\ \frac{L}{\sqrt{2}},\ 0\right)
38+
\mathbf{v}_1 = (\frac{L}{\sqrt{2}},\ \frac{L}{\sqrt{2}},\ 0)
4039
4140
.. math::
4241
@@ -76,7 +75,7 @@
7675
7776
F_\mathrm{tetra}(\mathbf{q}) = |\det(\mathbf{T})| \left\{
7877
\frac{i}{Q_1 (Q_1 - Q_2)(Q_1 - Q_3)} \exp(i Q_1)
79-
+ \frac{i}{Q_2 (Q_2 - Q_1)(Q_2 - Q_3)} \exp(i Q_2)
78+
+ \frac{i}{Q_2 (Q_2 - Q_1)(Q_2 - Q_3)} \exp(i Q_2) \\
8079
+ \frac{i}{Q_3 (Q_3 - Q_2)(Q_3 - Q_1)} \exp(i Q_3)
8180
- \frac{i}{Q_1 Q_2 Q_3}
8281
\right\}
@@ -136,9 +135,9 @@
136135
137136
The sphere is sampled using Fibonacci quadrature to provide a quasi-uniform
138137
distribution of points on the unit sphere.
139-
The repartition of the N points is computed using the golden ratio
138+
The distribution of the N points is computed using the golden ratio
140139
(see fibonacci.py). Each point of the quadrature on the unit sphere
141-
correspond to a vector :math:`\mathbf{u}_{j}`. In the sum,
140+
corresponds to a vector :math:`\mathbf{u}_{j}`. In the sum,
142141
all weights :math:`w_j` are taken identical and equal to :math:`\frac{1}{N}`.
143142
144143
.. math::
@@ -168,29 +167,24 @@
168167
tetrahedrons at synchrotron Soleil.
169168
Moreover, comparisons with Debye formula calculations were made using
170169
DebyeCalculator library (https://github.com/FrederikLizakJohansen/DebyeCalculator).
171-
Good agreement was found at q < 1 1/Angstrom.
170+
Good agreement was found at q < 1 1/Å.
172171
173172
References
174173
----------
175174
176-
1. Patterson, A. L. (1939)
177-
"The Diffraction of X-Rays by Small Crystalline Particles".
178-
In: Phys. Rev. 56 (1939), pp. 972–977.
179-
https://link.aps.org/doi/10.1103/PhysRev.56.972.
175+
1. Patterson, A. L. (1939). The Diffraction of X-Rays by Small Crystalline Particles.
176+
*Physical Review*, 56(10), 972‑977. https://doi.org/10.1103/physrev.56.972
180177
181-
2. Wei-Ren Chen et al. "Scattering functions of Platonic solids".
182-
In: Journal of Applied Crystallography - J APPL CRYST 44 (June 2011).
183-
DOI: 10.1107/S0021889811011691
178+
2. Li, X., Shew, C., He, L., Meilleur, F., Myles, D. A. A., Liu, E., Zhang, Y., Smith, G. S.,
179+
Herwig, K. W., Pynn, R., & Chen, W. (2011). Scattering functions of Platonic solids.
180+
*Journal Of Applied Crystallography*, 44(3), 545‑557. https://doi.org/10.1107/s0021889811011691
184181
185-
3. Croset, B. (2017)
186-
Form factor of any polyhedron: a general compact formula and its singularities.
187-
Journal of Applied Crystallography, 50(5), 1245-1255.
188-
https://doi.org/10.1107/s1600576717010147.
182+
3. Croset, B. (2017). Form factor of any polyhedron : a general compact formula and its singularities.
183+
*Journal Of Applied Crystallography*, 50(5), 1245‑1255. https://doi.org/10.1107/s1600576717010147
189184
190185
4. Yang, T., Chen, X., Zhang, J., Ma, J., & Liu, S. (2023).
191-
Form factor of any polyhedron and its singularities derived from a projection method.
192-
Journal of Applied Crystallography, 56(1), 167–177.
193-
DOI: https://doi.org/10.1107/s160057672201130x
186+
Form factor of any polyhedron and its singularities derived from a projection method.
187+
*Journal of Applied Crystallography*, 56(1), 167–177. https://doi.org/10.1107/s160057672201130x
194188
195189
196190
Authorship and Verification

sasmodels/models/truncated_octahedron.py

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Note: model title and parameter table are inserted automatically
33
r"""
44
This model provides the form factor P(q) for a general octahedron.
5-
It can be a regular octahedron shape with all edges of the same length.
5+
It can be a regular octahedron, with all edges of equal length.
66
Or a general shape with different elongations along the three perpendicular two-fold axes.
77
It includes the possibility to add an adjustable square truncation at each of the six vertices.
88
This model includes the general cuboctahedron shape for the maximum value of truncation.
@@ -13,24 +13,33 @@
1313
Definition
1414
----------
1515
16-
The general octahedron is defined by its dimensions along its three perpendicular two-fold axes along x, y and z directions.
17-
:math:`radius_a`, :math:`radius_b` and :math:`radius_c` are the distances from the center of the general octahedron to its 6 vertices,
16+
This model computes the form factor of a general octahedron by defining its size through
17+
its circumradius :math:`radius_a` (parameter called *radius_a* in the model),
18+
the elongations through the ratios :math:`\frac{b}{a}` and :math:`\frac{c}{a}` (parameters called *b2a_ratio* and *c2a_ratio* in the model) and the truncation level through the
19+
truncation ratio *t* (parameter called *truncation* in the model).
20+
21+
Indeed, the general octahedron is defined by its dimensions along its three perpendicular two-fold axes along x, y and z directions.
22+
:math:`radius_a` (parameter called *radius_a* in the model), :math:`radius_b` and :math:`radius_c` are the distances from the center of the general octahedron to its 6 vertices,
1823
which are equivalent to the circumradiuses of the general octahedron along the three directions.
1924
2025
Coordinates of the six vertices are:
21-
(:math:`radius_a`, 0, 0),
22-
(:math:`-radius_a`, 0, 0),
23-
(0, :math:`radius_b`, 0),
24-
(0, :math:`-radius_b`, 0),
25-
(0, 0, :math:`radius_c`),
26-
(0, 0, :math:`-radius_c`)
26+
27+
.. math::
28+
29+
(radius_a,\ 0,\ 0) \\
30+
(-radius_a,\ 0,\ 0) \\
31+
(0,\ radius_b,\ 0) \\
32+
(0,\ -radius_b,\ 0) \\
33+
(0,\ 0,\ radius_c) \\
34+
(0,\ 0,\ -radius_c)
2735
2836
Truncation adds a square facet for each vertex that is perpendicular to a 2-fold axis.
2937
The resulting shape consists of six squares and eight hexagons, which may be irregular depending on the three dimensions.
30-
The user-defined parameter `t` is the truncation ratio and is defined as: 0 ≤ t ≤ 0.5, 0 corresponding to no truncation
38+
The truncation ratio *t* (parameter called `truncation` in the model) is defined as: 0 ≤ t ≤ 0.5, 0 corresponding to no truncation
3139
(full octahedron) and 0.5 corresponding to the maximum truncation (cuboctahedron).
3240
For the following formulas, we will use the notation :math:`t_inv = 1 - t`.
33-
Indeed, a square facet crosses the x, y, z directions at distances equal to :math:`t_inv radius_a`, :math:`t_inv radius_b` and :math:`t_inv radius_c`.
41+
Indeed, a square facet crosses the x, y, z directions at distances equal to
42+
:math:`t_{\mathrm{inv}} \, radius_a`, :math:`t_{\mathrm{inv}} \, radius_b` and :math:`t_{\mathrm{inv}} \, radius_c`.
3443
3544
A regular octahedron corresponds to:
3645
@@ -44,28 +53,12 @@
4453
4554
radius_a = radius_b = radius_c, \quad t = \frac{1}{2}
4655
47-
The model contains 4 parameters: :math:`radius_a`, the two ratios :math:`b2a_ratio` and :math:`c2a_ratio` and :math:`t`:
48-
49-
.. math::
50-
51-
b2a_{\text{ratio}} = \frac{radius_b}{radius_a}, \quad
52-
c2a_{\text{ratio}} = \frac{radius_c}{radius_a}, \quad
53-
54-
0 ≤ t ≤ \frac{1}{2}
55-
56-
5756
58-
For a regular shape:
57+
The volume of the general shape including truncation is given by:
5958
6059
.. math::
6160
62-
b2a_{\text{ratio}} = c2a_{\text{ratio}} = 1
63-
64-
Volume of the general shape including truncation is given by:
65-
66-
.. math::
67-
68-
V = \frac{4}{3}\, radius_{\text{a}}^{3}\, b2a_{\text{ratio}}\, c2a_{\text{ratio}}\,\bigl(1 - 3t^{3}\bigr)
61+
V = \frac{4}{3}\, radius_{\text{a}}^{3}\, \frac{b}{a}\, \frac{c}{a}\,\bigl(1 - 3t^{3}\bigr)
6962
7063
The general octahedron is made of eight triangular faces. The three edge lengths
7164
are:
@@ -80,8 +73,14 @@
8073
8174
.. math::
8275
83-
b2a_{\text{ratio}} = c2a_{\text{ratio}} = 1,\qquad
84-
A_{\text{edge}} = B_{\text{edge}} = C_{\text{edge}} = radius_{\text{a}} \sqrt{2},\qquad
76+
\frac{b}{a} = \frac{c}{a} = 1
77+
78+
.. math::
79+
80+
A_{\text{edge}} = B_{\text{edge}} = C_{\text{edge}} = radius_{\text{a}} \sqrt{2}
81+
82+
.. math::
83+
8584
radius_{\text{a}} = radius_{\text{b}} = radius_{\text{c}} = A_{\text{edge}} / \sqrt{2}
8685
8786
.. math::
@@ -98,21 +97,21 @@
9897
.. math::
9998
10099
AA = \frac{1}{2\,(q_y^2 - q_z^2)\,(q_y^2 - q_x^2)}\Big[(q_y - q_x)\sin\big(q_y t - q_x t_{\text{inv}}\big)
101-
+ (q_y + q_x)\sin\big(q_y t + q_x t_{\text{inv}}\big)\Big]
100+
+ (q_y + q_x)\sin\big(q_y t + q_x t_{\text{inv}}\big)\Big] \\
102101
+ \frac{1}{2\,(q_z^2 - q_x^2)\,(q_z^2 - q_y^2)}\Big[(q_z - q_x)\sin\big(q_z t - q_x t_{\text{inv}}\big)
103102
+ (q_z + q_x)\sin\big(q_z t + q_x t_{\text{inv}}\big)\Big]
104103
105104
.. math::
106105
107106
BB = \frac{1}{2\,(q_z^2 - q_x^2)\,(q_z^2 - q_y^2)}\Big[(q_z - q_y)\sin\big(q_z t - q_y t_{\text{inv}}\big)
108-
+ (q_z + q_y)\sin\big(q_z t + q_y t_{\text{inv}}\big)\Big]
107+
+ (q_z + q_y)\sin\big(q_z t + q_y t_{\text{inv}}\big)\Big] \\
109108
+ \frac{1}{2\,(q_x^2 - q_y^2)\,(q_x^2 - q_z^2)}\Big[(q_x - q_y)\sin\big(q_x t - q_y t_{\text{inv}}\big)
110109
+ (q_x + q_y)\sin\big(q_x t + q_y t_{\text{inv}}\big)\Big]
111110
112111
.. math::
113112
114113
CC = \frac{1}{2\,(q_x^2 - q_y^2)\,(q_x^2 - q_z^2)}\Big[(q_x - q_z)\sin\big(q_x t - q_z t_{\text{inv}}\big)
115-
+ (q_x + q_z)\sin\big(q_x t + q_z t_{\text{inv}}\big)\Big]
114+
+ (q_x + q_z)\sin\big(q_x t + q_z t_{\text{inv}}\big)\Big] \\
116115
+ \frac{1}{2\,(q_y^2 - q_z^2)\,(q_y^2 - q_x^2)}\Big[(q_y - q_z)\sin\big(q_y t - q_z t_{\text{inv}}\big)
117116
+ (q_y + q_z)\sin\big(q_y t + q_z t_{\text{inv}}\big)\Big]
118117
@@ -165,29 +164,28 @@
165164
166165
.. figure:: img/octahedrons_intensity_plot.png
167166
168-
Scattering intensity of a cuboctahedron (t=0.5) and a regular octahedron (t=0) of a = 300 Angstroms.
167+
Scattering intensity of a cuboctahedron (t=0.5) and a regular octahedron (t=0) of radius_a = 400 Å.
169168
170169
Validation
171170
----------
172171
173172
Validation of the code is made using numerical checks.
174173
Comparisons with Debye formula calculations were made using DebyeCalculator library (https://github.com/FrederikLizakJohansen/DebyeCalculator).
175-
Good agreement was found at q < 0.1 1/Angstrom.
174+
Good agreement was found at q < 0.1 1/Å.
176175
177176
References
178177
----------
179178
180-
1. Wei-Ren Chen et al. "Scattering functions of Platonic solids".
181-
In: Journal of Applied Crystallography - J APPL CRYST 44 (June 2011).
182-
DOI: 10.1107/S0021889811011691
179+
1. Li, X., Shew, C., He, L., Meilleur, F., Myles, D. A. A., Liu, E., Zhang, Y., Smith, G. S.,
180+
Herwig, K. W., Pynn, R., & Chen, W. (2011). Scattering functions of Platonic solids.
181+
*Journal Of Applied Crystallography*, 44(3), 545‑557. https://doi.org/10.1107/s0021889811011691
182+
183+
2. Croset, B. (2017). Form factor of any polyhedron : a general compact formula and its singularities.
184+
*Journal Of Applied Crystallography*, 50(5), 1245‑1255. https://doi.org/10.1107/s1600576717010147
183185
184-
2. Croset, Bernard, "Form factor of any polyhedron: a general compact
185-
formula and its singularities" In: J. Appl. Cryst. (2017). 50, 1245–1255
186-
https://doi.org/10.1107/S1600576717010147
186+
3. Wuttke, J. (2021). Numerically stable form factor of any polygon and polyhedron.
187+
*Journal Of Applied Crystallography*, 54(2), 580‑587. https://doi.org/10.1107/s1600576721001710
187188
188-
3. Wuttke, J. Numerically stable form factor of any polygon and polyhedron
189-
J Appl Cryst 54, 580-587 (2021)
190-
https://doi.org/10.1107/S160057672100171
191189
192190
Authorship and Verification
193191
----------------------------

0 commit comments

Comments
 (0)