r"""Palace capacitances of the graphene JoFET.
Two electrostatic datasets from ``qpdk/models/datasets/recipes/jofet.py``
give the gate coupling at the graphene-excluded and ideal-channel limits:
- ``jofet_palace`` leaves the graphene out. Its Maxwell matrix over ``d``,
``s`` and ``g`` gives the gate-to-contact capacitances
:math:`C_\text{dg}`, :math:`C_\text{sg}` and the contact-to-contact
:math:`C_\text{ds}`. Their gate sum
:math:`C_\text{metal} = C_\text{dg} + C_\text{sg}` is the gate-to-signal
mutual capacitance in this case.
- ``jofet_channel_palace`` replaces the graphene with an ideal conductor joined
to both contacts. The gate-to-channel capacitance is the geometric limit
:math:`C_\text{geo}`.
A real sheet adds its quantum capacitance :math:`C_\text{q}` in series with
the sheet share :math:`C_\text{sheet} = C_\text{geo} - C_\text{metal}` only,
.. math::
C_\text{g} = C_\text{metal}
+ \left(\frac{1}{C_\text{sheet}} + \frac{1}{C_\text{q}}\right)^{-1},
with the sheet term split equally between drain and source (Meyer). Use
:func:`jofet_gate_ground_capacitances` for the separate gate-to-reference
branches at the two limits. The reference is an ideal grounded back-gate
plate. The geometric :math:`C_\text{ds}` accounts for the contacts. Add the
junction capacitance separately in the circuit.
"""
from functools import cache
from pathlib import Path
import jax
import jax.numpy as jnp
from jax.typing import ArrayLike
from qpdk.models.datasets import Dataset, GridInterpolator, check_maxwell
__all__ = [
"JOFET_CHANNEL_DATASET",
"JOFET_DATASET",
"jofet_capacitances",
"jofet_gate_capacitances",
"jofet_gate_ground_capacitances",
]
JOFET_DATASET = "jofet_palace"
"""Graphene-excluded dataset, terminals ``d``, ``s``, ``g``."""
JOFET_CHANNEL_DATASET = "jofet_channel_palace"
"""Ideal-channel dataset, terminals ``channel``, ``g``."""
_TERMINALS = {
JOFET_DATASET: ("d", "s", "g"),
JOFET_CHANNEL_DATASET: ("channel", "g"),
}
def _lookup_from(
data: Dataset, layout: str, terminals: tuple[str, ...]
) -> GridInterpolator:
"""Check the terminals and Maxwell matrices, then build the interpolator."""
grid = data.grid("maxwell_capacitance", allow_missing=False, layout=layout)
if grid.terminals != terminals:
msg = f"Expected terminals {terminals}, got {grid.terminals}"
raise ValueError(msg)
check_maxwell(grid.values)
return GridInterpolator(grid)
@cache
def _cached_lookup(
location: Path | str, layout: str, terminals: tuple[str, ...]
) -> GridInterpolator:
"""Open a dataset by name or path once per process and layout."""
return _lookup_from(Dataset(location), layout, terminals)
def _lookup(
dataset: Dataset | Path | str, layout: str, terminals: tuple[str, ...]
) -> GridInterpolator:
"""Load one layout variant outside numerical evaluation."""
if isinstance(dataset, Dataset):
return _lookup_from(dataset, layout, terminals)
return _cached_lookup(dataset, layout, terminals)
def _maxwell(
dataset: Dataset | Path | str,
layout: str,
dataset_name: str,
channel_length: ArrayLike,
channel_width: ArrayLike,
) -> jax.Array:
"""Look up a validated Maxwell matrix at the supplied dimensions."""
with jax.ensure_compile_time_eval():
lookup = _lookup(dataset, layout, _TERMINALS[dataset_name])
return lookup(channel_length=channel_length, channel_width=channel_width)
[docs]
def jofet_capacitances(
*,
channel_length: ArrayLike = 0.35,
channel_width: ArrayLike = 20.0,
layout: str = "intrinsic",
dataset: Dataset | Path | str = JOFET_DATASET,
) -> tuple[jax.Array, jax.Array, jax.Array]:
r"""Return the graphene-excluded JoFET capacitances, in F.
From the Maxwell matrix :math:`C` over drain, source and gate:
:math:`C_\text{dg} = -C_\text{dg}`, :math:`C_\text{sg} = -C_\text{sg}` and
:math:`C_\text{ds} = -C_\text{ds}`. The gate terms give the mutual coupling
to the contact metal. See :func:`jofet_gate_capacitances` for the
sheet contribution.
The stored grid holds the default :func:`~qpdk.cells.jofet` channel only;
other dimensions return NaN. Every other layout parameter is fixed at its
cell default. Supports JIT and vmap. Geometry derivatives require a dataset
sampled at more than one point along the differentiated axis.
Args:
channel_length: Source-drain gap in µm.
channel_width: Channel width in µm.
layout: ``"intrinsic"`` or ``"access"``; static under JIT.
dataset: Dataset or path with terminals ``d``, ``s``, ``g``.
Returns:
``(C_dg, C_sg, C_ds)`` in F, each with the broadcast input shape.
"""
c = _maxwell(dataset, layout, JOFET_DATASET, channel_length, channel_width)
return -c[..., 0, 2], -c[..., 1, 2], -c[..., 0, 1]
[docs]
def jofet_gate_ground_capacitances(
*,
channel_length: ArrayLike = 0.35,
channel_width: ArrayLike = 20.0,
layout: str = "intrinsic",
dataset: Dataset | Path | str = JOFET_DATASET,
channel_dataset: Dataset | Path | str = JOFET_CHANNEL_DATASET,
) -> tuple[jax.Array, jax.Array]:
r"""Return the gate-to-reference branches at the two sheet limits, in F.
Each value is the gate row sum of its Maxwell matrix. With drain and
source held at reference voltage, add the corresponding gate-to-signal
mutual sum from :func:`jofet_gate_capacitances` to obtain the input
capacitance, equal to the Maxwell diagonal :math:`C_\text{gg}`. The finite
quantum-capacitance reduction models only the gate-to-signal mutual
branches. The shipped grid fixes all geometry at the cell defaults.
Geometry derivatives require a dataset with multiple valid points.
Args:
channel_length: Source-drain gap in µm.
channel_width: Channel width in µm.
layout: ``"intrinsic"`` or ``"access"``; static under JIT.
dataset: Graphene-excluded dataset, terminals ``d``, ``s``, ``g``.
channel_dataset: Ideal-channel dataset, terminals ``channel``, ``g``.
Returns:
Gate-to-reference capacitance for the graphene-excluded and ideal-channel
cases, in that order. Each value has the broadcast input shape.
"""
excluded = _maxwell(dataset, layout, JOFET_DATASET, channel_length, channel_width)
channel = _maxwell(
channel_dataset, layout, JOFET_CHANNEL_DATASET, channel_length, channel_width
)
return excluded[..., -1, :].sum(axis=-1), channel[..., -1, :].sum(axis=-1)
[docs]
def jofet_gate_capacitances(
*,
quantum_capacitance: ArrayLike = jnp.inf,
channel_length: ArrayLike = 0.35,
channel_width: ArrayLike = 20.0,
layout: str = "intrinsic",
dataset: Dataset | Path | str = JOFET_DATASET,
channel_dataset: Dataset | Path | str = JOFET_CHANNEL_DATASET,
) -> tuple[jax.Array, jax.Array]:
r"""Return the gate-to-drain and gate-to-source mutual capacitances, in F.
.. math::
S = \left(\frac{1}{C_\text{geo} - C_\text{metal}}
+ \frac{1}{C_\text{q}}\right)^{-1},
\qquad C_\text{gd} = C_\text{dg} + \frac{S}{2},
\qquad C_\text{gs} = C_\text{sg} + \frac{S}{2}
with :math:`C_\text{metal} = C_\text{dg} + C_\text{sg}` from the
graphene-excluded dataset and :math:`C_\text{geo}` from the ideal-channel
dataset. The mutual sum equals :math:`C_\text{geo}` at ``+inf`` and
:math:`C_\text{metal}` at ``0``. At the ideal-channel limit the contacts
share one terminal, so the split is a circuit approximation. Use
:func:`jofet_gate_ground_capacitances` for the separate gate-to-reference
terms at these limits. For graphene,
:math:`C_\text{q} = c_\text{q} L W` with the per-area
:math:`c_\text{q} = 2 e^2 |E_\text{F}| / (\pi \hbar^2 v_\text{F}^2)`,
the degenerate (:math:`|E_\text{F}| \gg k_\text{B} T`) limit, which
depends on the gate bias. It ignores the residual-carrier floor of real
sheets, so :math:`E_\text{F} \to 0` understates :math:`C_\text{q}`.
At finite quantum capacitance the reduction is approximate. The sheet
share :math:`C_\text{geo} - C_\text{metal}` takes :math:`C_\text{metal}`
from a solve without the sheet, which does not screen the gate-to-contact
field, and the series form :math:`S` neglects the sheet's own coupling to
the back gate. The two ground branches are limiting cases, and this
reduction does not interpolate between them. The sheet term is split
equally between drain and source,
the Meyer model of a channel in its linear regime.
Supports JIT, vmap and grad in ``quantum_capacitance``; dimensions off
the stored grid return NaN, as do negative or NaN quantum capacitances
and datasets with a negative sheet share beyond roundoff. A zero sheet
share gives zero series contribution, including at :math:`C_\text{q} = 0`.
Args:
quantum_capacitance: Total sheet quantum capacitance :math:`C_\text{q}`
in F, non-negative or ``+inf``.
channel_length: Source-drain gap in µm.
channel_width: Channel width in µm.
layout: ``"intrinsic"`` or ``"access"``; static under JIT.
dataset: Graphene-excluded dataset, terminals ``d``, ``s``, ``g``.
channel_dataset: Ideal-channel dataset, terminals ``channel``, ``g``.
Returns:
``(C_gd, C_gs)`` in F, each with the broadcast input shape.
"""
c_dg, c_sg, _ = jofet_capacitances(
channel_length=channel_length,
channel_width=channel_width,
layout=layout,
dataset=dataset,
)
channel = _maxwell(
channel_dataset, layout, JOFET_CHANNEL_DATASET, channel_length, channel_width
)
c_geo = -channel[..., 0, 1]
c_metal = c_dg + c_sg
c_sheet = c_geo - c_metal
roundoff = 4 * jnp.finfo(c_sheet.dtype).eps * jnp.maximum(c_geo, c_metal)
c_q = jnp.asarray(quantum_capacitance, dtype=float)
valid = (c_q >= 0) & (c_sheet >= -roundoff)
c_sheet = jnp.where(valid & (c_sheet > 0), c_sheet, 0.0)
ideal = jnp.isposinf(c_q)
finite = jnp.where(valid & ~ideal, c_q, 0.0)
denominator = c_sheet + finite
denominator = jnp.where(denominator > 0, denominator, 1.0)
series = jnp.where(ideal, c_sheet, c_sheet * (finite / denominator))
series = jnp.where(valid, series, jnp.nan)
return c_dg + series / 2, c_sg + series / 2