# pmm_tools.models.parity_qubit_microscopic

*module*

Exact many-body model for two Kitaev chains coupled through one dot.

The Fock basis is ordered as `(L_1, ..., L_N, M, R_1, ..., R_N)`.
Hamiltonians are assembled by [`second_quantization`][second_quantization] and restricted to a
fixed total fermion-parity block before numerical evaluation.

## pmm_tools.models.parity_qubit_microscopic.basis_indices

*function*

```python
def basis_indices(n_sites: int, parity: str = 'even') -> np.ndarray
```

Return device Fock-basis indices belonging to one total parity.

**Parameters**

- `n_sites` (`int`) — Number of sites in each chain. The device has `2 * n_sites + 1` fermionic modes including the middle dot.
- `parity` (`str`) (default: `'even'`) — Total fermion-parity sector, `"even"` or `"odd"`.

**Returns**

- (`np.ndarray`) — Indices into the full occupation basis.

[View source](https://gitlab.kwant-project.org/qt/pmm_tools/-/blob/e412d66507a554f455ef935b755fc39f28ab4e05/pmm_tools/models/parity_qubit_microscopic.py#L104-L122)

## pmm_tools.models.parity_qubit_microscopic.clean_product_state

*function*

```python
def clean_product_state(n_sites: int, parameters: Mapping[str, float], label: str = 'ee') -> np.ndarray
```

Return a clean dot-empty logical product state.

**Parameters**

- `n_sites` (`int`) — Number of sites in each chain.
- `parameters` (`Mapping[str, float]`) — Complete device parameter mapping. Each isolated chain is evaluated with its corresponding onsite, hopping, pairing, and phase values.
- `label` (`str`) (default: `'ee'`) — Left/right chain parities: `"ee"`, `"eo"`, `"oe"`, or `"oo"`.

**Returns**

- (`np.ndarray`) — Normalized product of the two isolated-chain ground states and the empty-dot state, restricted to the matching total-parity block.

[View source](https://gitlab.kwant-project.org/qt/pmm_tools/-/blob/e412d66507a554f455ef935b755fc39f28ab4e05/pmm_tools/models/parity_qubit_microscopic.py#L125-L173)

## pmm_tools.models.parity_qubit_microscopic.device_matrix_dict

*function* · *cached*

```python
def device_matrix_dict(n_sites: int, parity: str | None = 'even')
```

Symbolic coefficients mapped to sparse device matrices.

Select physical parity "even" or "odd", or None for the full Fock basis.
Phases remain symbolic; energies use one caller-chosen unit.

[View source](https://gitlab.kwant-project.org/qt/pmm_tools/-/blob/e412d66507a554f455ef935b755fc39f28ab4e05/pmm_tools/models/parity_qubit_microscopic.py#L77-L90)

## pmm_tools.models.parity_qubit_microscopic.device_operators

*function*

```python
def device_operators(n_sites=2, *, phi_R=0.0)
```

Return (real-parameter coefficient matrices, physical +/-1 parity).

Full dense Fock ordering is (L1,...,LN,M,R1,...,RN), L1 most significant.
Matrix coefficients can be complex at nonzero fixed phi_R; controls are real.

[View source](https://gitlab.kwant-project.org/qt/pmm_tools/-/blob/e412d66507a554f455ef935b755fc39f28ab4e05/pmm_tools/models/parity_qubit_microscopic.py#L93-L101)

## pmm_tools.models.parity_qubit_microscopic.parameter_names

*function*

```python
def parameter_names(n_sites: int) -> tuple[str, ...]
```

Return the parameter names for a chain--dot--chain device.

**Parameters**

- `n_sites` (`int`) — Number of sites in each Kitaev chain.

**Returns**

- (`tuple of str`) — Names of all onsite, hopping, pairing, phase, and dot-link parameters.

[View source](https://gitlab.kwant-project.org/qt/pmm_tools/-/blob/e412d66507a554f455ef935b755fc39f28ab4e05/pmm_tools/models/parity_qubit_microscopic.py#L22-L47)
