contimod_graphene package

Contents

contimod_graphene package#

Submodules#

contimod_graphene.bernal module#

contimod_graphene.bernal.get_hamiltonian(n_layers: int = 2, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-283, gamma4=138, U=0.0, Delta=0, delta=15, gamma5=0.0, extras=mappingproxy({}), preset_name='blg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json'))[source]#

Get the Hamiltonian function for N-layer Bernal (ABA) graphene.

Parameters:
  • n_layers (int) – Number of layers.

  • params (dict) – Dictionary of graphene parameters (gamma0, gamma1, etc.).

Returns:

A JIT-compiled function h(kx, ky) that returns the Hamiltonian matrix.

Return type:

function

contimod_graphene.bernal.get_hamiltonian_2bands(params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-283, gamma4=138, U=0.0, Delta=0, delta=15, gamma5=0.0, extras=mappingproxy({}), preset_name='blg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json'))[source]#
contimod_graphene.bernal.get_hamiltonian_LL(n_layers: int = 2, n_cut: int = 50, flip_valley: bool = False, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-283, gamma4=138, U=0.0, Delta=0, delta=15, gamma5=0.0, extras=mappingproxy({}), preset_name='blg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json'))[source]#

Get the Landau Level Hamiltonian function for N-layer Bernal (ABA) graphene.

Parameters:
  • n_layers (int) – Number of layers.

  • n_cut (int) – Cutoff for the number of Landau levels.

  • flip_valley (bool) – If True, returns the Hamiltonian for the K’ valley. Default is False (K valley).

  • params (dict) – Dictionary of graphene parameters.

Returns:

A function h(B) that returns the Hamiltonian matrix for a given magnetic field B.

Return type:

function

contimod_graphene.bernal.hamiltonian(kx: float, ky: float, n_layers: int = 3, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-283, gamma4=138, U=0.0, Delta=0, delta=15, gamma5=0.0, extras=mappingproxy({}), preset_name='blg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json')) Array[source]#

Construct the zero-field Hamiltonian for N-layer Bernal (ABA) graphene.

The Hamiltonian includes: - Intralayer hopping (gamma0) - Nearest-neighbor interlayer hopping (gamma1, v3, v4) - Next-nearest-neighbor interlayer hopping (gamma2, gamma5) - Sublattice asymmetry (+Delta/2 on A, -Delta/2 on B) - On-site potential difference between dimer and non-dimer sites (delta) - Interlayer potential difference (U)

Parameters:
  • kx (float) – Momentum in x-direction.

  • ky (float) – Momentum in y-direction.

  • n_layers (int) – Number of layers.

  • params (dict) – Dictionary of graphene parameters.

Returns:

The Hamiltonian matrix of shape (2*n_layers, 2*n_layers).

Return type:

jax.numpy.ndarray

contimod_graphene.bernal.hamiltonian_2bands(kx: float, ky: float, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-283, gamma4=138, U=0.0, Delta=0, delta=15, gamma5=0.0, extras=mappingproxy({}), preset_name='blg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json')) Array[source]#

Compute the effective two-band Hamiltonian for Bilayer Graphene (Bernal). See Eq 30 in https://arxiv.org/pdf/1205.6953.pdf

Parameters:
  • kx (float) – Momentum in x-direction.

  • ky (float) – Momentum in y-direction.

  • params (dict) – Dictionary of graphene parameters.

Returns:

The Hamiltonian matrix of shape (2, 2).

Return type:

jax.numpy.ndarray

contimod_graphene.bernal.hamiltonian_LL(B: float, n_layers: int = 3, n_cut: int = 50, flip_valley: bool = False, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-283, gamma4=138, U=0.0, Delta=0, delta=15, gamma5=0.0, extras=mappingproxy({}), preset_name='blg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json')) ndarray[source]#

Multilayer (ABA) graphene Landau-level Hamiltonian.

Constructs the Hamiltonian in a basis of Landau levels. Uses an asymmetric basis (N_A != N_B) to avoid fermion doubling and properly describe the zero-energy modes.

Parameters:
  • B (float) – Magnetic field in Tesla.

  • n_layers (int) – Number of layers.

  • n_cut (int) – Cutoff for the number of Landau levels.

  • flip_valley (bool) – If True, compute for K’ valley. Default False (K valley).

  • params (dict) – Dictionary of graphene parameters.

Returns:

The Hamiltonian matrix.

Return type:

numpy.ndarray

contimod_graphene.rhombohedral module#

contimod_graphene.rhombohedral.get_2band_hamiltonian(n_layers: int = 3, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-290, gamma4=141, U=30.0, Delta=-1.15, delta=-5.25, gamma5=0.0, extras=mappingproxy({}), preset_name='tlg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json'))[source]#

Get the effective 2-band Hamiltonian function for N-layer Rhombohedral (ABC) graphene.

Parameters:
  • n_layers (int) – Number of layers. Defaults to the trilayer ABC entry point.

  • params (dict) – Dictionary of graphene parameters. Defaults to the ABC/TLG preset.

Returns:

A JIT-compiled function h(kx, ky) that returns the 2x2 effective Hamiltonian matrix.

Return type:

function

contimod_graphene.rhombohedral.get_hamiltonian(n_layers: int = 3, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-290, gamma4=141, U=30.0, Delta=-1.15, delta=-5.25, gamma5=0.0, extras=mappingproxy({}), preset_name='tlg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json'))[source]#

Get the Hamiltonian function for N-layer Rhombohedral (ABC) graphene.

Parameters:
  • n_layers (int) – Number of layers. Defaults to the trilayer ABC entry point.

  • params (dict) – Dictionary of graphene parameters. Defaults to the ABC/TLG preset.

Returns:

A JIT-compiled function h(kx, ky) that returns the Hamiltonian matrix.

Return type:

function

contimod_graphene.rhombohedral.get_hamiltonian_LL(n_layers: int = 3, n_cut: int = 50, flip_valley: bool = False, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-290, gamma4=141, U=30.0, Delta=-1.15, delta=-5.25, gamma5=0.0, extras=mappingproxy({}), preset_name='tlg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json'))[source]#

Get the Landau Level Hamiltonian function for N-layer Rhombohedral (ABC) graphene.

Parameters:
  • n_layers (int) – Number of layers. Defaults to the trilayer ABC entry point.

  • n_cut (int) – Cutoff for the number of Landau levels.

  • flip_valley (bool) – If True, returns the Hamiltonian for the K’ valley. Default is False (K valley).

  • params (dict) – Dictionary of graphene parameters. Defaults to the ABC/TLG preset.

Returns:

A function h(B) that returns the Hamiltonian matrix for a given magnetic field B.

Return type:

function

contimod_graphene.rhombohedral.hamiltonian(kx: float, ky: float, n_layers: int = 3, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-290, gamma4=141, U=30.0, Delta=-1.15, delta=-5.25, gamma5=0.0, extras=mappingproxy({}), preset_name='tlg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json')) Array[source]#

Construct the zero-field Hamiltonian for N-layer Rhombohedral (ABC) graphene.

U controls the inversion-odd layer bias across the stack. Delta controls the inversion-even layer-offset profile (matching the trilayer Δ2 convention for n_layers=3). The shared parameter key delta is currently accepted for compatibility but is not used by the ABC kernels.

Parameters:
  • kx (float) – Momentum in x-direction.

  • ky (float) – Momentum in y-direction.

  • n_layers (int) – Number of layers.

  • params (dict) – Dictionary of graphene parameters.

Returns:

The Hamiltonian matrix of shape (2*n_layers, 2*n_layers).

Return type:

jax.numpy.ndarray

contimod_graphene.rhombohedral.hamiltonian_2bands(kx: float, ky: float, n_layers: int = 3, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-290, gamma4=141, U=30.0, Delta=-1.15, delta=-5.25, gamma5=0.0, extras=mappingproxy({}), preset_name='tlg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json')) Array[source]#

Compute the effective two-band Hamiltonian for an N-layer ABC stacked graphene system following the projection method in Eq. (1) of arXiv:0906.4634.

Parameters:
  • kx (float) – Momentum in x-direction.

  • ky (float) – Momentum in y-direction.

  • n_layers (int) – Number of layers in the ABC stack (N must be > 0).

  • params (dict) – Dictionary of parameters including: “gamma0”, “gamma1”, “gamma2”, “gamma3”, “gamma4”, “U”, “Delta”, “delta” where delta is currently accepted for compatibility but unused.

Returns:

A 2x2 JAX array representing the effective, numerically projected Hamiltonian.

contimod_graphene.rhombohedral.hamiltonian_LL(B: float, n_layers: int = 3, n_cut: int = 50, flip_valley: bool = False, params: dict = GrapheneTBParameters(gamma0=3160, gamma1=380, gamma2=-15, gamma3=-290, gamma4=141, U=30.0, Delta=-1.15, delta=-5.25, gamma5=0.0, extras=mappingproxy({}), preset_name='tlg', source='/home/runner/work/contimod_graphene/contimod_graphene/src/contimod_graphene/data/params.json')) ndarray[source]#

Multilayer (ABC) graphene Landau-level Hamiltonian in an asymmetric LL basis that removes unphysical LLs by using different numbers of LLs on the two sublattices. For valley K we use (N_B, N_A) = (n_cut, n_cut-1); for K’ we swap.

Parameters:
  • B – magnetic field [T]

  • n_layers – number of layers

  • n_cut – LL cutoff on the sublattice that hosts the n=0 mode

  • flip_valley – if True, build K’ (swap sublattices + sign switches)

  • params – dict with keys “gamma0”, “gamma1”, “gamma2”, “gamma3”, “gamma4”, “U”, “Delta” and optionally “delta”, which is currently unused for ABC models.

Returns:

Dense numpy array of shape (n_layers*(2*n_cut-1), n_layers*(2*n_cut-1))

contimod_graphene.params module#

Public parameter management for graphene tight-binding models.

class contimod_graphene.params.GrapheneTBParameters(gamma0: Any, gamma1: Any, gamma2: Any, gamma3: Any, gamma4: Any, U: Any, Delta: Any, delta: Any, gamma5: Any = 0.0, extras: Mapping[str, ~typing.Any]=<factory>, preset_name: str | None = None, source: str | None = None, _present_keys: frozenset[str] = <factory>)[source]#

Bases: Mapping[str, Any]

Immutable, mapping-compatible graphene tight-binding parameters.

Delta: Any#
U: Any#
delta: Any#
extras: Mapping[str, Any]#
classmethod from_dict(data: Mapping[str, Any], *, preset_name: str | None = None, source: str | None = None, allow_partial: bool = False) GrapheneTBParameters[source]#
classmethod from_json(path: str | Path) GrapheneTBParameters[source]#
gamma0: Any#
gamma1: Any#
gamma2: Any#
gamma3: Any#
gamma4: Any#
gamma5: Any = 0.0#
classmethod preset(kind: str) GrapheneTBParameters[source]#
preset_name: str | None = None#
replace(**overrides: Any) GrapheneTBParameters[source]#
source: str | None = None#
to_dict() dict[str, Any][source]#
to_json(path: str | Path) Path[source]#
tree_flatten()[source]#
classmethod tree_unflatten(aux_data, children)[source]#
validate_for(family: str) GrapheneTBParameters[source]#
contimod_graphene.params.get_params(kind: str | Mapping[str, Any] | GrapheneTBParameters) GrapheneTBParameters[source]#

Compatibility alias for loading a parameter set.

contimod_graphene.params.list_parameter_sets() list[str][source]#

Return the canonical built-in parameter-set names.

contimod_graphene.params.list_sets() list[str][source]#

Compatibility alias for listing canonical built-in parameter sets.

contimod_graphene.params.load(path: str | Path) GrapheneTBParameters[source]#

Compatibility alias for loading a parameter object from JSON.

contimod_graphene.params.load_parameter_set(name_or_path: str | Path | Mapping[str, Any] | GrapheneTBParameters) GrapheneTBParameters[source]#

Load a validated parameter set from a preset name, path, mapping, or object.

contimod_graphene.utils module#

contimod_graphene.utils.batch_hamiltonian(h_fn, *, jit: bool = True)[source]#

Vectorize a single-k Hamiltonian callable over k-arrays (last dim = 2).

contimod_graphene.utils.bernal_dimer_mask(n_layers: int) ndarray[source]#

Return a mask selecting the zero-field Bernal dimer subspace.

contimod_graphene.utils.bernal_nondimer_mask(n_layers: int) ndarray[source]#

Return a mask selecting the zero-field Bernal non-dimer subspace.

contimod_graphene.utils.bernal_trilayer_mirror_block_unitary(block_size: int, *, dtype: type[complexfloating] | type[floating] | type[bool] = <class 'complex'>) ndarray[source]#

Return the ABA-trilayer mirror unitary for a generic per-layer block size.

For block_size=2, this reproduces the zero-field orbital transform with columns ordered as: ((A1-A3)/sqrt(2), (B1-B3)/sqrt(2), (A1+A3)/sqrt(2), (B1+B3)/sqrt(2), A2, B2).

contimod_graphene.utils.bernal_trilayer_mirror_layer_unitary(dtype: type[complexfloating] | type[floating] | type[bool] = <class 'complex'>) ndarray[source]#

Return the 3x3 layer-parity unitary for ABA trilayer graphene.

The columns are ordered as (L1-L3)/sqrt(2), (L1+L3)/sqrt(2), and L2. Any per-layer orbital block can be transformed by taking a Kronecker product with the identity on that block.

contimod_graphene.utils.bernal_trilayer_mirror_operator(dtype: type[complexfloating] | type[floating] | type[bool] = <class 'complex'>) ndarray[source]#

Return the ABA-trilayer mirror operator in the site basis.

In the canonical zero-field basis (A1, B1, A2, B2, A3, B3), this operator exchanges the outer layers while leaving the middle layer fixed. It is reconstructed from the odd/even mirror projectors so it stays consistent with bernal_trilayer_mirror_unitary.

contimod_graphene.utils.bernal_trilayer_mirror_projectors(dtype: type[complexfloating] | type[floating] | type[bool] = <class 'complex'>) tuple[ndarray, ndarray][source]#

Return the (odd, even) mirror-parity projectors for ABA trilayer graphene.

contimod_graphene.utils.bernal_trilayer_mirror_unitary(dtype: type[complexfloating] | type[floating] | type[bool] = <class 'complex'>) ndarray[source]#

Return the ABA-trilayer zero-field mirror basis unitary for (A1, B1, A2, B2, A3, B3).

This is equivalent to bernal_trilayer_mirror_block_unitary(2).

contimod_graphene.utils.construct_ll_ops(N_A: int, N_B: int)[source]#

Build square (A,A) and (B,B) ladder operators and rectangular (A<-B) and (B<-A) maps consistent with the Dirac LL algebra.

Parameters:
  • N_A (int) – Dimension of sublattice A basis.

  • N_B (int) – Dimension of sublattice B basis.

Returns:

Dictionary containing ladder operators and identity matrices.

Return type:

dict

contimod_graphene.utils.extract_params(params, keys)[source]#

Extract parameters from a dictionary.

Parameters:
  • params (dict) – Dictionary of parameters.

  • keys (list) – List of keys to extract.

Returns:

List of values corresponding to the keys. Returns 0.0 if a key is missing.

Return type:

list

contimod_graphene.utils.layer_coordinates(n_layers: int) ndarray[source]#

Return per-orbital layer index (A,B per layer).

contimod_graphene.utils.rhombohedral_outer_site_indices(n_layers: int) tuple[int, int][source]#

Return the zero-field low-energy site indices (A1, B_N) for ABC stacks.

contimod_graphene.utils.sublattice_coordinates(n_layers: int) ndarray[source]#

Return per-orbital sublattice index (0 for A, 1 for B).

contimod_graphene.utils.zero_field_orbital_index(n_layers: int, layer: int, sublattice: str) int[source]#

Return the zero-field orbital index for a named site.

contimod_graphene.utils.zero_field_orbital_labels(n_layers: int) tuple[str, ...][source]#

Return the zero-field orbital labels (A1, B1, …, AN, BN).

contimod_graphene.utils.zero_field_orbital_mask(n_layers: int, *, layer: int | Sequence[int] | None = None, sublattice: str | Sequence[str] | None = None) ndarray[source]#

Return a boolean mask selecting zero-field orbitals by layer and/or sublattice.

contimod_graphene.utils.zero_field_orbital_projector(n_layers: int, *, layer: int | Sequence[int] | None = None, sublattice: str | Sequence[str] | None = None, dtype: type[complexfloating] | type[floating] | type[bool] = <class 'complex'>) ndarray[source]#

Return the diagonal projector associated with a zero-field orbital selection.

contimod_graphene.landau module#

Landau-level form-factor helpers for graphene LL workflows.

contimod_graphene.landau.graphene_ll_formfactors(wavefunctions: ndarray, ll_block_sizes: ndarray | list[int] | tuple[int, ...], qx: ndarray | float, qy: ndarray | float = 0, *, a_L: float = 1) ndarray[source]#

Contract graphene LL eigenvectors with orbital LL form factors.

Parameters:
  • wavefunctions – Array of shape (sum(ll_block_sizes), n_states).

  • ll_block_sizes – Number of orbital LL basis states carried by each graphene orbital block. This supports the asymmetric N_A != N_B LL bases used by both Bernal and rhombohedral builders.

  • qx – Momentum-transfer x-component.

  • qy – Momentum-transfer y-component.

  • a_L – Magnetic-length scale used in the orbital form factor.

Returns:

Complex array with shape broadcast(qx, qy) + (n_states, n_states).

contimod_graphene.landau.ll_formfactor(n_prime: ndarray | int, n: ndarray | int, qx: ndarray | float, qy: ndarray | float = 0, a_L: float = 1) ndarray[source]#

Return the orbital LL form factor.

This is the standard single-component Landau-level form factor from J. Phys. C 18 (1985) 1003, kept as a pure NumPy/SciPy helper.

Module contents#

contimod_graphene: Standalone multilayer graphene Hamiltonians and utilities.

This package provides reusable low-level graphene-model tools, including Bernal (ABA) and Rhombohedral (ABC) Hamiltonians, validated parameter sets, immutable model objects, basis metadata, and symmetry helpers.

contimod_graphene.ABAMultilayer#

alias of BernalMultilayer

contimod_graphene.ABCMultilayer#

alias of RhombohedralMultilayer

class contimod_graphene.BernalMultilayer(n_layers: int = 2, params: str | Path | Mapping[str, Any] | GrapheneTBParameters | None = None)[source]#

Bases: object

Thin wrapper around the low-level Bernal (ABA/ABAB/…) kernels.

default_preset_name: str = 'blg'#
family: str = 'bernal'#
hamiltonian(kx: float, ky: float)[source]#
hamiltonian_batch(ks, *, jit: bool = True)[source]#
landau_level_hamiltonian(B: float, *, n_cut: int, valley: str = 'K')[source]#
n_layers: int = 2#
params: str | Path | Mapping[str, Any] | GrapheneTBParameters | None = None#
replace(**changes: Any) BernalMultilayer[source]#
stacking_label: str = 'Bernal'#
two_band_hamiltonian(kx: float, ky: float)[source]#
with_params(**overrides: Any) BernalMultilayer[source]#
class contimod_graphene.GrapheneTBParameters(gamma0: Any, gamma1: Any, gamma2: Any, gamma3: Any, gamma4: Any, U: Any, Delta: Any, delta: Any, gamma5: Any = 0.0, extras: Mapping[str, ~typing.Any]=<factory>, preset_name: str | None = None, source: str | None = None, _present_keys: frozenset[str] = <factory>)[source]#

Bases: Mapping[str, Any]

Immutable, mapping-compatible graphene tight-binding parameters.

Delta: Any#
U: Any#
delta: Any#
extras: Mapping[str, Any]#
classmethod from_dict(data: Mapping[str, Any], *, preset_name: str | None = None, source: str | None = None, allow_partial: bool = False) GrapheneTBParameters[source]#
classmethod from_json(path: str | Path) GrapheneTBParameters[source]#
gamma0: Any#
gamma1: Any#
gamma2: Any#
gamma3: Any#
gamma4: Any#
gamma5: Any = 0.0#
classmethod preset(kind: str) GrapheneTBParameters[source]#
preset_name: str | None = None#
replace(**overrides: Any) GrapheneTBParameters[source]#
source: str | None = None#
to_dict() dict[str, Any][source]#
to_json(path: str | Path) Path[source]#
tree_flatten()[source]#
classmethod tree_unflatten(aux_data, children)[source]#
validate_for(family: str) GrapheneTBParameters[source]#
class contimod_graphene.RhombohedralMultilayer(n_layers: int = 3, params: str | Path | Mapping[str, Any] | GrapheneTBParameters | None = None)[source]#

Bases: object

Thin wrapper around the low-level rhombohedral (ABC…) kernels.

default_preset_name: str = 'tlg'#
family: str = 'rhombohedral'#
hamiltonian(kx: float, ky: float)[source]#
hamiltonian_batch(ks, *, jit: bool = True)[source]#
landau_level_hamiltonian(B: float, *, n_cut: int, valley: str = 'K')[source]#
n_layers: int = 3#
params: str | Path | Mapping[str, Any] | GrapheneTBParameters | None = None#
replace(**changes: Any) RhombohedralMultilayer[source]#
stacking_label: str = 'Rhombohedral'#
two_band_hamiltonian(kx: float, ky: float)[source]#
with_params(**overrides: Any) RhombohedralMultilayer[source]#
contimod_graphene.list_parameter_sets() list[str][source]#

Return the canonical built-in parameter-set names.

contimod_graphene.load_parameter_set(name_or_path: str | Path | Mapping[str, Any] | GrapheneTBParameters) GrapheneTBParameters[source]#

Load a validated parameter set from a preset name, path, mapping, or object.