Skip to content
76 changes: 76 additions & 0 deletions docs/python/API/particles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Particles

The library provides a comprehensive particle system for particle transport calculations, including predefined particles commonly used in particle therapy and radiation physics.

## Overview

Each particle is characterized by physical properties, including its identifier, element name and acronym, mass number (`A`), and atomic number (`Z`).

## Particle Properties

Each Particle object has the following properties:

- **id** (`int`): Unique identifier for the particle
- **element_name** (`str`): Name of the particle element
- **A** (`int`): Mass number
- **Z** (`float`): Atomic number
- **I_eV_per_Z** (`float`): Ionization energy per proton
- **density_g_cm3** (`float`): Density \[g/cm3\]
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The density unit is written as \[g/cm3\] (and has a trailing space). Other API pages use g/cm³ without escaping; aligning the unit formatting here would improve consistency and readability.

Suggested change
- **density_g_cm3** (`float`): Density \[g/cm3\]
- **density_g_cm3** (`float`): Density g/cm³

Copilot uses AI. Check for mistakes.
- **element_acronym** (`str`): Acronym of the particle element
- **atomic_weight** (`float`): Atomic weight - average mass of element’s isotopes

## Using Particles

### Creating Particle Objects
There are a few ways a particle object can be created:
- Using predefined particle constants

```python
Comment thread
witNie marked this conversation as resolved.
import pyamtrack.particles
carbon = pyamtrack.particles.C
```

- Using a particle code (Z*1000 + A)
```python
carbon = pyamtrack.particles.Particle.from_number(6012)
```
- Using nuclide notation string (e.g., "12C")
```python
carbon = pyamtrack.particles.Particle.from_string("12C")
```

- Using atomic number (Z) directly
```python
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet constructs pyamtrack.particles.Particle(6) but doesn’t import pyamtrack.particles within the code block. If the intent is that each snippet is standalone, add the missing import here too.

Suggested change
```python
```python
import pyamtrack.particles

Copilot uses AI. Check for mistakes.
carbon = pyamtrack.particles.Particle(6)
```
Warning: A particle created this way has `A=None`, so no specific isotope is selected. It represents the element or atomic nucleus identified only by `Z`, unlike isotope-specific inputs such as `"12C"` or `6012`.

### Passing particles as function arguments

You can pass a `Particle` object directly as an argument:

```python
import pyamtrack.stopping as stp
from pyamtrack import particles
particle_carbon = particles.C
results_carbon = stp.stopping_power(energies, particle=particle_carbon, material=1)
```
Comment on lines +52 to +57
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

energies is used in this example but never defined, so the snippet isn’t runnable as-written. Please define energies (e.g., a list or numpy array) within the example code block.

Copilot uses AI. Check for mistakes.

But there are other ways:
- Nuclide notation string (e.g., "12C")
```python
import pyamtrack.stopping as stp
import pyamtrack.particles

particle_carbon = "12C"
results_carbon = stp.stopping_power(energies, particle=particle_carbon, material=1)
```
Comment on lines +65 to +67
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example also calls stopping_power(energies, ...) but energies isn’t defined within the snippet. Please define it in the block so the example is copy-pastable.

Copilot uses AI. Check for mistakes.

- Particle code (A*1000 + Z)
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the “Particle code” example, the formula is written as (A*1000 + Z), but earlier in this page you define the code as (Z*1000 + A) and the example value 6012 matches Z*1000 + A. Please make the formula consistent here to avoid users passing the wrong identifier.

Suggested change
- Particle code (A*1000 + Z)
- Particle code (Z*1000 + A)

Copilot uses AI. Check for mistakes.
```python
import pyamtrack.stopping as stp
import pyamtrack.particles

particle_carbon = 6012
results_carbon = stp.stopping_power(energies, particle=particle_carbon, material=1)
Comment on lines +74 to +75
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

energies is still undefined in this example, so it won’t run if copied as-is. Please add a definition for energies inside the snippet.

Copilot uses AI. Check for mistakes.
```
2 changes: 1 addition & 1 deletion docs/python/function-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Functions for accessing and manipulating particle data.

| Python Module | Status | C/C++ Source |
|-----------------|--------|--------------|
| `particle` | ❌ Not Ported | [AT_ParticleData.h](https://github.com/libamtrack/library/blob/master/include/AT_DataParticle.h#L82) |
| [`particles`](API/particles.md) | ✅ Fully Ported | [AT_ParticleData.h](https://github.com/libamtrack/library/blob/master/include/AT_DataParticle.h#L82) |

## Material Data

Expand Down
Loading