# tree_d_3d.bodies

*module*

Charged particles, alone or adopted by a simulation.

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L1-L1)

## tree_d_3d.bodies.ChargedBody

*class*

```python
class ChargedBody
```

A physical particle or weighted macroparticle in consistent units.

Input mass and charge are per physical particle. Weight multiplies both,
preserving q/m; stored mass and charge are the totals. A fixed source
stays immobile. SI inputs give SI outputs.

State lives in arrays. A simulation adopts its bodies, after which
``pos``, ``vel`` and ``force`` are views of columns of the simulation's
``(2, N)`` arrays, and reading or assigning any attribute reads or writes
them.

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L10-L90)

### tree_d_3d.bodies.ChargedBody.charge

*attribute* · *class attribute* · *instance attribute*

```python
charge = property(lambda self: float(self._charge[self._index]), lambda self, value: self._charge.__setitem__(self._index, value))
```

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L39-L42)

### tree_d_3d.bodies.ChargedBody.fixed

*attribute* · *class attribute* · *instance attribute*

```python
fixed = property(lambda self: bool(self._fixed[self._index]), lambda self, value: self._fixed.__setitem__(self._index, value))
```

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L43-L46)

### tree_d_3d.bodies.ChargedBody.force

*attribute* · *class attribute* · *instance attribute*

```python
force = property(lambda self: self._force[:, self._index], lambda self, value: self._force.__setitem__((slice(None), self._index), value))
```

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L31-L34)

### tree_d_3d.bodies.ChargedBody.mass

*attribute* · *class attribute* · *instance attribute*

```python
mass = property(lambda self: float(self._mass[self._index]), lambda self, value: self._mass.__setitem__(self._index, value))
```

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L35-L38)

### tree_d_3d.bodies.ChargedBody.pos

*attribute* · *class attribute* · *instance attribute*

```python
pos = property(lambda self: self._pos[:, self._index], lambda self, value: self._pos.__setitem__((slice(None), self._index), value))
```

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L23-L26)

### tree_d_3d.bodies.ChargedBody.vel

*attribute* · *class attribute* · *instance attribute*

```python
vel = property(lambda self: self._vel[:, self._index], lambda self, value: self._vel.__setitem__((slice(None), self._index), value))
```

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L27-L30)

### tree_d_3d.bodies.ChargedBody.weight

*attribute* · *instance attribute*

```python
weight = _finite('weight', weight, positive=True)
```

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L69-L69)

### tree_d_3d.bodies.ChargedBody.add_force

*method*

```python
def add_force(fx: float, fy: float) -> None
```

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L89-L90)

### tree_d_3d.bodies.ChargedBody.reset_force

*method*

```python
def reset_force() -> None
```

[View source](https://github.com/max-models/tree-d-3d/blob/devel/src/tree_d_3d/bodies.py#L86-L87)
