API Reference

Geometry Module

morpho.geometry.Geometry(*args, **kwargs)[source]

Geometry factory.

Parameters
  • args – args

  • kwargs – kwargs

Returns

Return type

Union[Geometry1D, Geometry2D, Geometry3D]

class morpho.geometry.Geometry1D(a1, n1=64, eps_rf=None, mu_rf=None)[source]

Bases: morpho.geometry.GeometryBase

Geometry class.

Parameters
  • a1 (Tuple[float, ...]) – Direct a1 vector.

  • n1 (int) – Number of divisions in the a1 vector direction.

  • eps_rf (Optional[Callable]) – Permittivity matrix eps_r if directly supplied.

  • mu_rf (Optional[Callable]) – Permeabillity matrix mu_r if directly supplied.

property X

Return cartesian positions.

class morpho.geometry.Geometry2D(a1, a2, n1=64, n2=64, eps_rf=None, mu_rf=None)[source]

Bases: morpho.geometry.GeometryBase

Geometry class.

Parameters
  • a1 (Tuple[float, ...]) – Direct a1 vector.

  • a2 (Optional[Tuple[float, ...]]) – Direct a2 vector.

  • n1 (int) – Number of divisions in the a1 vector direction.

  • n2 (int) – Number of divisions in the a2 vector direction.

  • eps_rf (Optional[Callable]) – Permittivity matrix eps_r if directly supplied.

  • mu_rf (Optional[Callable]) – Permeabillity matrix mu_r if directly supplied.

property X

Return cartesian positions.

property eps_r

Return the relative permittivity matrice.

property mu_r

Return the relative permeabillity matrice.

class morpho.geometry.Geometry3D(a1, a2, a3, n1=64, n2=64, n3=64, eps_rf=None, mu_rf=None)[source]

Bases: morpho.geometry.GeometryBase

Geometry class.

Parameters
  • a1 (Tuple[float, float, float]) – Direct a1 vector.

  • a2 (Optional[Tuple[float, float, float]]) – Direct a2 vector.

  • a3 (Optional[Tuple[float, float, float]]) – Direct a3 vector.

  • n1 (int) – Number of divisions in the a1 vector direction.

  • n2 (int) – Number of divisions in the a2 vector direction.

  • n3 (int) – Number of divisions in the a3 vector direction.

  • eps_rf (Optional[Callable]) – Permittivity matrix function eps_rf if directly supplied.

  • mu_rf (Optional[Callable]) – Permeabillity matrix function mu_rf if directly supplied.

property X

Return cartesian positions.

property eps_r

Return the relative permittivity matrice.

property mu_r

Return the relative permeabillity matrice.

BrillouinZone Module

class morpho.brillouinzone.SymmetryPoint(point, name)[source]

Bases: object

Model of a symmetry point at the brillouinzone.

Parameters
  • point (Tuple[float, ...]) – A point in the reciprocal domain.

  • name (str) – A label to describe the point.

morpho.brillouinzone.BrillouinZonePath(a1, *args, **kwargs)[source]

BrillouinZonePath factory.

class morpho.brillouinzone.BrillouinZonePath1D(a1, path, n_points=50, strategy='linear')[source]

Bases: morpho.brillouinzone.BrillouinZonePathBase

BrillouinZonePath1D.

Parameters
  • a1 (Tuple[float]) – Direct lattice vector a1.

  • path (List[SymmetryPoint]) – List of symmetry points.

  • n_points (int) – Number of vectors.

  • strategy (str = 'linear') – Strategy to interpolate.

property b1

Return reciprocal lattice vector b1.

property betas

Return beta vector values and cumsum.

class morpho.brillouinzone.BrillouinZonePath2D(a1, a2, path, n_points=50, strategy='linear')[source]

Bases: morpho.brillouinzone.BrillouinZonePathBase

BrillouinZonePath2D.

Parameters
  • a1 (Tuple[float, float]) – Direct lattice vector a1.

  • a2 (Tuple[float, float]) – Direct lattice vector a2.

  • path (List[SymmetryPoint]) – List of symmetry points.

  • n_points (int) – Number of vectors.

  • strategy (str = 'linear') – Strategy to interpolate.

property b1

Return reciprocal lattice vector b1.

property b2

Return reciprocal lattice vector b2.

property betas

Return beta vector values and cumsum.

class morpho.brillouinzone.BrillouinZonePath3D(a1, a2, a3, path, n_points=50, strategy='interpolate')[source]

Bases: morpho.brillouinzone.BrillouinZonePathBase

BrillouinZonePath3D.

Parameters
  • a1 (Tuple[float, float, float]) – Direct lattice vector a1.

  • a2 (Tuple[float, float, float]) – Direct lattice vector a2.

  • a3 (Tuple[float, float, float]) – Direct lattice vector a3.

  • path (List[SymmetryPoint]) – List of symmetry points.

  • n_points (int) – Number of vectors.

  • strategy (str = 'linear') – Strategy to interpolate.

property b1

Return reciprocal lattice vector b1.

property b2

Return reciprocal lattice vector b2.

property b3

Return reciprocal lattice vector b3.

property betas

Return beta vector values and cumsum.

Solver Module

morpho.solver.Solver(geometry, path, *args, **kwargs)[source]

Solver factory.

class morpho.solver.Solver2D(geometry, path, P=1, Q=1, pol='TM')[source]

Bases: object

Implement a 2D PWE Solver.

Parameters
  • geometry (Geometry) – geometry

  • path (BrillouinZonePath) – A BrillouinZonePath object.

  • P (int) – Number of terms in the direction of the reciprocal vector b1.

  • Q (int) – Number of terms in the direction of the reciprocal vector b2.

run()[source]

Calculate the eigen-wavenumbers and modes.

class morpho.solver.Solver3D(geometry, path, P=1, Q=1, R=1)[source]

Bases: object

Implement a 3D PWE Solver.

Parameters
  • geometry (Geometry) – geometry

  • path (BrillouinZonePath) – A BrillouinZonePath object.

  • P (int) – Number of terms in the direction of the reciprocal vector b1.

  • Q (int) – Number of terms in the direction of the reciprocal vector b2.

  • R (int) – Number of terms in the direction of the reciprocal vector b3.

run()[source]

Calculate the eigen-wavenumbers and modes.

Utils Module

morpho.utils.convmat(A, P=1, Q=1, R=1)[source]

Return a permittivity/permeability convolution matrix.

Parameters
  • A (np.ndarray) – A 3D/2D/1D permittivity or permeability matrix.

  • P (int) – Number of terms in the direction of the reciprocal vector T1.

  • Q (int) – Number of terms in the direction of the reciprocal vector T2.

  • R (int) – Number of terms in the direction of the reciprocal vector T3.

Base Classes

class morpho.geometry.GeometryBase(eps_rf, mu_rf)[source]

Bases: abc.ABC

Base Geometry class.

overwrite(func)[source]

Overwrite decorator.

Parameters

func (Callable) – func

class morpho.brillouinzone.BrillouinZonePathBase(path, n_points=50, strategy='linear')[source]

Bases: abc.ABC

BrillouinZoneBase class.

abstract property betas

Return bloch wave vectors.

property point_locations

Return cumulative sum of vectors’ length.

property point_names

Return list of symmetry point names.

Exceptions Module

Implement morpho exceptions.