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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
//! Unit consistency checks for physical quantities
//!
//! This module provides runtime checks to ensure physical quantities
//! have the correct units and magnitudes expected in spintronics calculations.
//!
//! # Example
//! ```
//! use spintronics::units::*;
//!
//! // Check if a value is a valid magnetization (A/m)
//! let ms = 1.4e5; // YIG saturation magnetization
//! assert!(is_valid_magnetization(ms));
//!
//! // Check if a value is a valid damping parameter
//! let alpha = 0.01;
//! assert!(is_valid_damping(alpha));
//! ```
use crate*;
/// Check if a magnetization value is physically reasonable \[A/m\]
///
/// Valid range: 1e3 to 1e7 A/m
/// - Lower bound: weak ferrimagnets
/// - Upper bound: strong ferromagnets like Fe, Co
/// Check if a damping parameter is physically reasonable (dimensionless)
///
/// Valid range: 1e-5 to 1.0
/// - Lower bound: ultra-low damping materials (YIG)
/// - Upper bound: heavily damped or critical systems
/// Check if an exchange stiffness is physically reasonable \[J/m\]
///
/// Valid range: 1e-12 to 1e-10 J/m
/// - Typical ferromagnets: 1-50 pJ/m
/// Check if a spin Hall angle is physically reasonable (dimensionless)
///
/// Valid range: -1.0 to 1.0
/// - Pt: ~0.07-0.15
/// - Ta: ~-0.12 to -0.15
/// - W: ~-0.30 to -0.50
/// Check if a temperature is physically reasonable \[K\]
///
/// Valid range: 0 to 2000 K
/// - Lower bound: absolute zero (exclusive)
/// - Upper bound: above Curie temperature of most materials
/// Check if a magnetic field is physically reasonable \[T\]
///
/// Valid range: 0 to 100 T
/// - Typical lab fields: 0-10 T
/// - Pulsed fields: up to ~100 T
/// Check if a thickness is physically reasonable \[m\]
///
/// Valid range: 0.1 nm to 1 mm
/// Check if a resistivity is physically reasonable \[Ω·m\]
///
/// Valid range: 1e-9 to 1e-3 Ω·m
/// - Metals: 1e-8 to 1e-6 Ω·m
/// - Semiconductors: up to 1e-3 Ω·m
/// Check if a spin diffusion length is physically reasonable \[m\]
///
/// Valid range: 0.1 nm to 1 μm
/// Check if a DMI constant is physically reasonable \[J/m²\]
///
/// Valid range: 1e-5 to 1e-2 J/m²
/// - Typical values: 0.1-10 mJ/m²
/// Check if a gyromagnetic ratio is close to the electron value \[rad/(s·T)\]
///
/// Checks if within 10% of the standard electron gyromagnetic ratio
/// Validate energy scale is reasonable \[J\]
///
/// Valid range: 1e-25 to 1e-15 J (approximately 1 μeV to 1 eV)
/// Check if a current density is physically reasonable \[A/m²\]
///
/// Valid range: 1e6 to 1e12 A/m²
/// - Lower bound: minimum for spin-torque effects
/// - Upper bound: near breakdown limit
/// Check if a voltage is physically reasonable \[V\]
///
/// Valid range: 1 nV to 1000 V