or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

constants-utilities.mdelements.mdformulas.mdindex.mdneutron-scattering.mdxray-scattering.md

neutron-scattering.mddocs/

0

# Neutron Scattering

1

2

Comprehensive neutron scattering calculations including scattering length densities, cross sections, penetration depths, and wavelength conversions for elements, isotopes, and compounds with energy-dependent and activation analysis support.

3

4

## Capabilities

5

6

### Scattering Length Density Calculations

7

8

Calculate neutron scattering length densities for materials, which are fundamental for neutron reflectometry, small-angle neutron scattering, and other neutron techniques.

9

10

```python { .api }

11

def neutron_sld(compound, density: float = None, wavelength: float = None,

12

energy: float = None) -> tuple:

13

"""

14

Calculate neutron scattering length density for a compound.

15

16

Args:

17

compound: Formula string, Formula object, or list of (atom, count) pairs

18

density: Mass density in g/cm³ (uses compound.density if available)

19

wavelength: Neutron wavelength in Ångström (default 1.798 Å)

20

energy: Neutron energy in meV (alternative to wavelength)

21

22

Returns:

23

tuple: (sld_real, sld_imag, sld_incoh) in units of 10⁻⁶ Ų⁻²

24

sld_real: Real scattering length density (coherent)

25

sld_imag: Imaginary scattering length density (absorption)

26

sld_incoh: Incoherent scattering length density

27

"""

28

29

def neutron_sld_from_atoms(atoms: dict, density: float, wavelength: float = None,

30

energy: float = None) -> tuple:

31

"""

32

Low-level SLD calculation from atomic composition.

33

34

Args:

35

atoms: Dictionary mapping atoms to counts

36

density: Mass density in g/cm³

37

wavelength: Neutron wavelength in Ångström

38

energy: Neutron energy in meV

39

40

Returns:

41

tuple: (sld_real, sld_imag, sld_incoh) in 10⁻⁶ Ų⁻² units

42

"""

43

```

44

45

Usage examples:

46

47

```python

48

import periodictable as pt

49

50

# Simple compounds

51

water = pt.formula("H2O", density=1.0)

52

sld_real, sld_imag, sld_incoh = pt.neutron_sld(water)

53

print(f"H2O SLD: {sld_real:.4f} + {sld_imag:.4f}i (10⁻⁶ Ų⁻²)")

54

print(f"H2O incoherent SLD: {sld_incoh:.4f} (10⁻⁶ Ų⁻²)")

55

56

# Heavy water comparison

57

heavy_water = pt.formula("D2O", density=1.107)

58

d2o_sld = pt.neutron_sld(heavy_water)

59

print(f"D2O SLD: {d2o_sld[0]:.4f} (10⁻⁶ Ų⁻²)")

60

61

# At different wavelengths

62

thermal_sld = pt.neutron_sld(water, wavelength=1.8) # Thermal neutrons

63

cold_sld = pt.neutron_sld(water, wavelength=4.0) # Cold neutrons

64

print(f"H2O SLD at 1.8 Å: {thermal_sld[0]:.4f}")

65

print(f"H2O SLD at 4.0 Å: {cold_sld[0]:.4f}")

66

67

# Using energy instead of wavelength

68

energy_sld = pt.neutron_sld(water, energy=25.3) # 25.3 meV = 1.798 Å

69

print(f"H2O SLD at 25.3 meV: {energy_sld[0]:.4f}")

70

71

# Complex materials

72

steel = pt.mix_by_weight("Fe", 95, "C", 0.8, "Cr", 4.2, density=7.8)

73

steel_sld = pt.neutron_sld(steel)

74

print(f"Steel SLD: {steel_sld[0]:.4f} (10⁻⁶ Ų⁻²)")

75

```

76

77

### Comprehensive Scattering Calculations

78

79

Calculate complete neutron scattering properties including cross sections, penetration depths, and transmission coefficients.

80

81

```python { .api }

82

def neutron_scattering(compound, density: float = None, wavelength: float = None,

83

energy: float = None) -> dict:

84

"""

85

Calculate comprehensive neutron scattering properties.

86

87

Args:

88

compound: Formula string, Formula object, or atomic composition

89

density: Mass density in g/cm³

90

wavelength: Neutron wavelength in Ångström (default 1.798 Å)

91

energy: Neutron energy in meV

92

93

Returns:

94

dict: Complete scattering information containing:

95

'sld': (real, imag, incoherent) scattering length densities

96

'xs_coherent': Coherent scattering cross section (cm⁻¹)

97

'xs_incoherent': Incoherent scattering cross section (cm⁻¹)

98

'xs_absorption': Absorption cross section (cm⁻¹)

99

'xs_total': Total cross section (cm⁻¹)

100

'penetration_depth': 1/e penetration depth (cm)

101

'transmission': Transmission per cm thickness

102

"""

103

```

104

105

Usage examples:

106

107

```python

108

import periodictable as pt

109

110

# Complete scattering analysis

111

water = pt.formula("H2O", density=1.0)

112

scattering = pt.neutron_scattering(water)

113

114

print("Water neutron scattering properties:")

115

print(f" SLD: {scattering['sld'][0]:.4f} × 10⁻⁶ Ų⁻²")

116

print(f" Coherent XS: {scattering['xs_coherent']:.4f} cm⁻¹")

117

print(f" Incoherent XS: {scattering['xs_incoherent']:.4f} cm⁻¹")

118

print(f" Absorption XS: {scattering['xs_absorption']:.4f} cm⁻¹")

119

print(f" Total XS: {scattering['xs_total']:.4f} cm⁻¹")

120

print(f" Penetration depth: {scattering['penetration_depth']:.2f} cm")

121

print(f" Transmission/cm: {scattering['transmission']:.4f}")

122

123

# Compare different materials

124

materials = [

125

("H2O", pt.formula("H2O", density=1.0)),

126

("D2O", pt.formula("D2O", density=1.107)),

127

("Al", pt.formula("Al", density=2.70)),

128

("Pb", pt.formula("Pb", density=11.34))

129

]

130

131

for name, material in materials:

132

props = pt.neutron_scattering(material)

133

print(f"{name}: SLD={props['sld'][0]:.2f}, μ={props['xs_total']:.3f} cm⁻¹")

134

```

135

136

### Wavelength and Energy Conversions

137

138

Convert between neutron wavelength, energy, and velocity for different neutron sources and experimental conditions.

139

140

```python { .api }

141

def neutron_wavelength(energy: float) -> float:

142

"""

143

Convert neutron energy to wavelength.

144

145

Args:

146

energy: Neutron energy in meV

147

148

Returns:

149

Wavelength in Ångström

150

"""

151

152

def neutron_energy(wavelength: float) -> float:

153

"""

154

Convert neutron wavelength to energy.

155

156

Args:

157

wavelength: Neutron wavelength in Ångström

158

159

Returns:

160

Energy in meV

161

"""

162

163

def neutron_wavelength_from_velocity(velocity: float) -> float:

164

"""

165

Convert neutron velocity to wavelength.

166

167

Args:

168

velocity: Neutron velocity in m/s

169

170

Returns:

171

Wavelength in Ångström

172

"""

173

```

174

175

Usage examples:

176

177

```python

178

import periodictable.nsf as nsf

179

180

# Thermal neutrons (room temperature ~25 meV)

181

thermal_energy = 25.3 # meV

182

thermal_wavelength = nsf.neutron_wavelength(thermal_energy)

183

print(f"Thermal neutrons: {thermal_energy} meV = {thermal_wavelength:.3f} Å")

184

185

# Cold neutrons

186

cold_wavelength = 4.0 # Å

187

cold_energy = nsf.neutron_energy(cold_wavelength)

188

print(f"Cold neutrons: {cold_wavelength} Å = {cold_energy:.2f} meV")

189

190

# Hot neutrons

191

hot_energy = 100 # meV

192

hot_wavelength = nsf.neutron_wavelength(hot_energy)

193

print(f"Hot neutrons: {hot_energy} meV = {hot_wavelength:.3f} Å")

194

195

# From velocity (e.g., neutron velocity selector)

196

velocity = 2200 # m/s (typical thermal neutron velocity)

197

wavelength = nsf.neutron_wavelength_from_velocity(velocity)

198

energy = nsf.neutron_energy(wavelength)

199

print(f"Velocity {velocity} m/s = {wavelength:.3f} Å = {energy:.2f} meV")

200

201

# Common neutron sources

202

sources = [

203

("Thermal (reactor)", 1.8, nsf.neutron_energy(1.8)),

204

("Cold (guide)", 4.0, nsf.neutron_energy(4.0)),

205

("Epithermal", 1.0, nsf.neutron_energy(1.0)),

206

("Hot", 0.5, nsf.neutron_energy(0.5))

207

]

208

209

for name, wl, energy in sources:

210

print(f"{name}: {wl} Å = {energy:.1f} meV")

211

```

212

213

### Composite Material SLD

214

215

Calculate scattering length densities for composite materials and multi-phase systems with volume-weighted averaging.

216

217

```python { .api }

218

def neutron_composite_sld(parts: list, density: float = None,

219

wavelength: float = None) -> tuple:

220

"""

221

Calculate SLD for composite materials with multiple phases.

222

223

Args:

224

parts: List of (formula, volume_fraction) pairs

225

density: Overall density if known (otherwise calculated)

226

wavelength: Neutron wavelength in Ångström

227

228

Returns:

229

tuple: (sld_real, sld_imag, sld_incoh) for composite

230

"""

231

```

232

233

Usage examples:

234

235

```python

236

import periodictable as pt

237

from periodictable.nsf import neutron_composite_sld

238

239

# Polymer composite: 70% polymer + 30% filler by volume

240

polymer = pt.formula("C8H8", density=1.05, name="Polystyrene")

241

filler = pt.formula("SiO2", density=2.20, name="Silica")

242

243

composite_parts = [

244

(polymer, 0.70), # 70% polymer by volume

245

(filler, 0.30) # 30% silica by volume

246

]

247

248

composite_sld = neutron_composite_sld(composite_parts)

249

print(f"Composite SLD: {composite_sld[0]:.4f} × 10⁻⁶ Ų⁻²")

250

251

# Porous material: solid + voids

252

solid = pt.formula("Al2O3", density=3.95)

253

air = pt.formula("N2+3.76Ar", density=0.001225) # Approximation for air

254

255

porous_parts = [

256

(solid, 0.80), # 80% solid

257

(air, 0.20) # 20% porosity

258

]

259

260

porous_sld = neutron_composite_sld(porous_parts)

261

print(f"Porous Al2O3 SLD: {porous_sld[0]:.4f} × 10⁻⁶ Ų⁻²")

262

```

263

264

### Data Tables and Comparisons

265

266

Generate formatted tables comparing neutron properties across elements and isotopes for data analysis and reference.

267

268

```python { .api }

269

def sld_table(table: PeriodicTable = None) -> None:

270

"""Print neutron SLD table for all elements."""

271

272

def energy_dependent_table(table: PeriodicTable = None) -> None:

273

"""List isotopes with energy-dependent scattering."""

274

275

def absorption_comparison_table(table: PeriodicTable = None) -> None:

276

"""Compare neutron absorption cross sections."""

277

278

def coherent_comparison_table(table: PeriodicTable = None) -> None:

279

"""Compare coherent scattering cross sections."""

280

281

def incoherent_comparison_table(table: PeriodicTable = None) -> None:

282

"""Compare incoherent scattering cross sections."""

283

284

def total_comparison_table(table: PeriodicTable = None) -> None:

285

"""Compare total scattering cross sections."""

286

```

287

288

Usage examples:

289

290

```python

291

import periodictable.nsf as nsf

292

293

# Print SLD table for all elements

294

nsf.sld_table()

295

296

# Show elements with energy-dependent scattering

297

nsf.energy_dependent_table()

298

299

# Compare absorption properties

300

nsf.absorption_comparison_table()

301

302

# Compare scattering properties

303

nsf.coherent_comparison_table()

304

nsf.incoherent_comparison_table()

305

nsf.total_comparison_table()

306

```

307

308

### Element Neutron Properties

309

310

Access detailed neutron scattering properties for individual elements and isotopes through the Neutron class attached to atomic objects.

311

312

```python { .api }

313

class Neutron:

314

"""Neutron scattering properties for elements and isotopes."""

315

316

# Scattering lengths (fm)

317

b_c: complex # Coherent scattering length

318

b_inc: float # Incoherent scattering length

319

320

# Cross sections (barns)

321

sigma_coh: float # Coherent cross section

322

sigma_inc: float # Incoherent cross section

323

sigma_abs: float # Absorption cross section

324

sigma_tot: float # Total cross section

325

326

# Nuclear properties

327

abundance: float # Natural abundance (%)

328

nuclear_spin: float # Nuclear spin quantum number

329

330

def sld(self, density: float = None) -> tuple:

331

"""Calculate SLD for this isotope at given density."""

332

333

def has_sld(self) -> bool:

334

"""Check if SLD calculation is possible."""

335

```

336

337

Usage examples:

338

339

```python

340

import periodictable as pt

341

342

# Element neutron properties

343

hydrogen = pt.H

344

if hasattr(hydrogen, 'neutron') and hydrogen.neutron:

345

print(f"H coherent length: {hydrogen.neutron.b_c:.3f} fm")

346

print(f"H incoherent XS: {hydrogen.neutron.sigma_inc:.1f} barns")

347

print(f"H absorption XS: {hydrogen.neutron.sigma_abs:.3f} barns")

348

349

# Isotope properties

350

isotopes = [pt.H[1], pt.H[2], pt.H[3]] # H, D, T

351

for iso in isotopes:

352

if hasattr(iso, 'neutron') and iso.neutron:

353

print(f"{iso} b_c: {iso.neutron.b_c:.3f} fm")

354

355

# Check all nickel isotopes

356

print("Nickel isotope SLDs:")

357

for iso in pt.Ni:

358

if hasattr(iso, 'neutron') and iso.neutron and iso.neutron.has_sld():

359

sld = iso.neutron.sld(density=8.9) # Ni density

360

print(f"{iso}: {sld[0]:.4f} × 10⁻⁶ Ų⁻²")

361

362

# Compare different elements

363

elements = [pt.H, pt.D, pt.C, pt.N, pt.O, pt.Si, pt.Fe]

364

print("Element neutron properties:")

365

for el in elements:

366

if hasattr(el, 'neutron') and el.neutron:

367

print(f"{el.symbol:2s}: b_c={el.neutron.b_c:.2f} fm, "

368

f"σ_abs={el.neutron.sigma_abs:.2f} barns")

369

```

370

371

### Constants and Reference Values

372

373

Standard reference values and wavelengths used in neutron scattering calculations.

374

375

```python { .api }

376

ABSORPTION_WAVELENGTH: float = 1.798 # Reference wavelength in Ångström for absorption XS

377

```

378

379

Usage examples:

380

381

```python

382

import periodictable.nsf as nsf

383

384

# Reference wavelength for absorption cross sections

385

print(f"Standard wavelength: {nsf.ABSORPTION_WAVELENGTH} Å")

386

387

# Convert absorption XS to other wavelengths

388

# σ_abs(λ) = σ_abs(λ_ref) × (λ/λ_ref)

389

lambda_new = 4.0 # Å

390

scaling_factor = lambda_new / nsf.ABSORPTION_WAVELENGTH

391

print(f"Absorption XS scaling for {lambda_new} Å: {scaling_factor:.3f}×")

392

```

393

394

## Types

395

396

```python { .api }

397

class Neutron:

398

"""Neutron scattering properties for elements and isotopes."""

399

b_c: complex

400

b_inc: float

401

sigma_coh: float

402

sigma_inc: float

403

sigma_abs: float

404

sigma_tot: float

405

abundance: float

406

nuclear_spin: float

407

def sld(self, density: float = None) -> tuple: ...

408

def has_sld(self) -> bool: ...

409

410

ABSORPTION_WAVELENGTH: float = 1.798

411

```