Efficient electromagnetic solver based on rigorous coupled-wave analysis for 3D and 2D multi-layered structures with in-plane periodicity

Overview

logo

Inkstone simulates the electromagnetic properties of 3D and 2D multi-layered structures with in-plane periodicity, such as gratings, photonic-crystal slabs, metasurfaces, vertical-cavity or photonic-crystal surface-emitting lasers (VCSEL, PCSEL), (patterned) solar cells, nano-antennas, and more.

Internally, Inkstone implements rigorous coupled-wave analysis (RCWA), a. k. a. Fourier Modal Method (FMM).

Inkstone can calculate:

  • the reflection, transmission, and absorption of the structure
  • the total and by-order power fluxes of the propagating and the evanescent waves in each layer
  • electric and magnetic field amplitudes at any locations in the structure,
  • band-structures based on the determinant of the scattering matrix of the structure.

Features of Inkstone:

  • It supports efficient and flexible parameter-scanning. You can change part of your structure such as the shapes and sizes of some patterns, or some material parameters. Inkstone only recalculates the modified parts and produces the final results efficiently.
  • It allows both tensorial permittivities and tensorial permeabilities, such as in anisotropic, magneto-optical, or gyromagnetic materials.
  • It can calculate the determinant of the scattering matrix on the complex frequency plane.
  • Pre-defined shapes of patterns can be used, including rectangular, parallelogram, disk, ellipse, 1D, and polygons. Closed-form Fourier transforms and corrections for Gibbs phenomena are implemented.
  • It is fully 3D.
  • It is written in pure python, with heavy-lifting done in numpy and scipy.

Quick Start

Installation:

$ pip install inkstone

Or,

$ git clone git://github.com/alexysong/inkstone
$ pip install .

Usage

The examples folder contains various self-explaining examples to get you started.

Dependencies

  • python 3.6+
  • numpy
  • scipy

Units, conventions, and definitions

Unit system

We adopt a natural unit system, where vacuum permittivity, permeability, and light speed are $\varepsilon_0=\mu_0=c_0=1$.

Sign convention

Sign conventions in electromagnetic waves:

$$e^{i(kx-\omega t)}$$

where $k$ is the wavevector, $x$ is spatial location, $\omega$ is frequency, $t$ is time.

By this convention, a permittivity of $\varepsilon_r + i\varepsilon_i$ with $\varepsilon_i>0$ means material loss, and $\varepsilon_i<0$ means material gain.

Coordinates and incident angles

drawing

(Inkstone, Incident $\bm{k}$ on stacked periodic nano electromagnetic structures.)

Citing

If you find Inkstone useful for your research, we would apprecite you citing our paper. For your convenience, you can use the following BibTex entry:

@article{song2018broadband,
  title={Broadband Control of Topological Nodes in Electromagnetic Fields},
  author={Song, Alex Y and Catrysse, Peter B and Fan, Shanhui},
  journal={Physical review letters},
  volume={120},
  number={19},
  pages={193903},
  year={2018},
  publisher={American Physical Society}
}
You might also like...
Code for
Code for "Unsupervised Layered Image Decomposition into Object Prototypes" paper

DTI-Sprites Pytorch implementation of "Unsupervised Layered Image Decomposition into Object Prototypes" paper Check out our paper and webpage for deta

Codes for TS-CAM: Token Semantic Coupled Attention Map for Weakly Supervised Object Localization.
Codes for TS-CAM: Token Semantic Coupled Attention Map for Weakly Supervised Object Localization.

TS-CAM: Token Semantic Coupled Attention Map for Weakly SupervisedObject Localization This is the official implementaion of paper TS-CAM: Token Semant

[ICCV'21] PlaneTR: Structure-Guided Transformers for 3D Plane Recovery
[ICCV'21] PlaneTR: Structure-Guided Transformers for 3D Plane Recovery

PlaneTR: Structure-Guided Transformers for 3D Plane Recovery This is the official implementation of our ICCV 2021 paper News There maybe some bugs in

PyTorch implementations for our SIGGRAPH 2021 paper: Editable Free-viewpoint Video Using a Layered Neural Representation.
PyTorch implementations for our SIGGRAPH 2021 paper: Editable Free-viewpoint Video Using a Layered Neural Representation.

st-nerf We provide PyTorch implementations for our paper: Editable Free-viewpoint Video Using a Layered Neural Representation SIGGRAPH 2021 Jiakai Zha

 Layered Neural Atlases for Consistent Video Editing
Layered Neural Atlases for Consistent Video Editing

Layered Neural Atlases for Consistent Video Editing Project Page | Paper This repository contains an implementation for the SIGGRAPH Asia 2021 paper L

Dynamical movement primitives (DMPs), probabilistic movement primitives (ProMPs), spatially coupled bimanual DMPs.
Dynamical movement primitives (DMPs), probabilistic movement primitives (ProMPs), spatially coupled bimanual DMPs.

Movement Primitives Movement primitives are a common group of policy representations in robotics. There are many different types and variations. This

ObjectDrawer-ToolBox: a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system
ObjectDrawer-ToolBox: a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system

ObjectDrawer-ToolBox is a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system, Object Drawer.

HeatNet is a python package that provides tools to build, train and evaluate neural networks designed to predict extreme heat wave events globally on daily to subseasonal timescales.

HeatNet HeatNet is a python package that provides tools to build, train and evaluate neural networks designed to predict extreme heat wave events glob

NU-Wave: A Diffusion Probabilistic Model for Neural Audio Upsampling
NU-Wave: A Diffusion Probabilistic Model for Neural Audio Upsampling

NU-Wave: A Diffusion Probabilistic Model for Neural Audio Upsampling For Official repo of NU-Wave: A Diffusion Probabilistic Model for Neural Audio Up

Comments
  • Unable to verify Fresnel equations

    Unable to verify Fresnel equations

    Thank you for your transparent and usable Python port of S4.

    To verify that the code works correctly, I attempted to reproduce the Fresnel equations using a simple two layer model -- the first layer with n=1, and the second with n=1.5. I have been unable to get this to work in Inkstone, but I did get it to work with an equivalent code for Phoebe-P S4 . Attached are the codes I used for both Inkstone, fresnel_inkstone_te.py (which doesn't work); and S4, Fresnel_S4_TE.py (working).

    In inkstone, when I use angle = np.linspace(0, 90, 91) , I get the error: /inkstone/params.py:525: RuntimeWarning: Vacuum propagation constant 0 encountered. Possibly Wood's anomaly. warn("Vacuum propagation constant 0 encountered. Possibly Wood's anomaly.", RuntimeWarning)

    When I use angle = np.linspace(1, 90, 90) , I get the error: Traceback (most recent call last): File "fresnel_inkstone_te.py", line 71, in glapf, glapb = s.GetPowerFlux('gla') File "/inkstone/simulator.py", line 1204, in GetPowerFlux self.solve() File "/inkstone/simulator.py", line 890, in solve self._calc_sm() File "/inkstone/simulator.py", line 704, in _calc_sm s = next(ll[-1] for ll in self.csms if ll[-1][1] == n_layers-2) StopIteration

    If between the "air" air and "gla" glass layers, I add an intermediate layer: s.AddLayer(name='gla-int', thickness=1, material_background='glass')

    and still keep angle = np.linspace(1, 90, 90) then I get the error

    /.local/lib/python3.9/site-packages/inkstone/layer.py:545: RuntimeWarning: divide by zero encountered in divide vh = -1j * p @ v / w[:, None, :] /.local/lib/python3.9/site-packages/inkstone/layer.py:545: RuntimeWarning: invalid value encountered in divide vh = -1j * p @ v / w[:, None, :] Traceback (most recent call last): File "/inkstone/Fresnel_Inkstone/fresnel_inkstone_te.py", line 72, in glapf, glapb = s.GetPowerFlux('gla') File "/.local/lib/python3.9/site-packages/inkstone/simulator.py", line 1204, in GetPowerFlux self.solve() File "/.local/lib/python3.9/site-packages/inkstone/simulator.py", line 890, in solve self._calc_sm() File "/.local/lib/python3.9/site-packages/inkstone/simulator.py", line 682, in _calc_sm ll[ilm].solve() File "/.local/lib/python3.9/site-packages/inkstone/layer.py", line 702, in solve self._calc_im() File "/.local/lib/python3.9/site-packages/inkstone/layer.py", line 652, in _calc_im al0, bl0 = im(self.phil, self.psil, self.pr.phi0, self.pr.psi0, self._phil_is_idt) File "/.local/lib/python3.9/site-packages/inkstone/im.py", line 36, in im term2 = sla.solve(psi1, psi2) File "/.local/lib/python3.9/site-packages/scipy/linalg/_basic.py", line 140, in solve a1 = atleast_2d(_asarray_validated(a, check_finite=check_finite)) File "/.local/lib/python3.9/site-packages/scipy/_lib/_util.py", line 287, in _asarray_validated a = toarray(a) File "/.local/lib/python3.9/site-packages/numpy/lib/function_base.py", line 627, in asarray_chkfinite raise ValueError( ValueError: array must not contain infs or NaNs

    opened by matt8s 0
  • IndexError when calling

    IndexError when calling "ReconstructLayer"

    Hi,

    I'm trying to visualize the epsilon profile of the patterned layer named "slab" in the example file "phc_slab_circ_hole_spectrum.py", using ReconstructLayer (as defined on line 309 of simulator.py).

    I'm not entirely sure about the correct usage of ReconstructLayer but I'm just doing: s.ReconstructLayer('slab', 100, 100) or s.ReconstructLayer('slab') (since nx and ny both seem to default to 101). In both cases, I get the error:

    Traceback (most recent call last):
      File "phc_slab_circ_hole_spectrum.py", line 32, in <module>
        s.ReconstructLayer('slab')
      File "/home/sachin/miniconda3/lib/python3.7/site-packages/inkstone/simulator.py", line 337, in ReconstructLayer
        result = self.layers[name].reconstruct(nx, ny)
      File "/home/sachin/miniconda3/lib/python3.7/site-packages/inkstone/layer.py", line 395, in reconstruct
        for em in [fft.ifftshift(self.epsi_fs, axes=(0, 1)), fft.ifftshift(self.epsi_inv_fs, axes=(0, 1)), fft.ifftshift(self.mu_fs, axes=(0, 1)), fft.ifftshift(self.mu_inv_fs, axes=(0, 1))]]
      File "<__array_function__ internals>", line 6, in ifftshift
      File "/home/sachin/miniconda3/lib/python3.7/site-packages/numpy/fft/helper.py", line 121, in ifftshift
        shift = [-(x.shape[ax] // 2) for ax in axes]
      File "/home/sachin/miniconda3/lib/python3.7/site-packages/numpy/fft/helper.py", line 121, in <listcomp>
        shift = [-(x.shape[ax] // 2) for ax in axes]
    IndexError: tuple index out of range
    

    Could you please help me with this?

    Thanks!

    opened by sachin4594 0
Releases(v0.2.4-alpha)
Owner
Alex Song
Senior Lecturer at the University of Sydney. Research interests include nanophotonics, topological materials, non-Hermicity, quantum optics, and sustainability.
Alex Song
code and models for "Laplacian Pyramid Reconstruction and Refinement for Semantic Segmentation"

Laplacian Pyramid Reconstruction and Refinement for Semantic Segmentation This repository contains code and models for the method described in: Golnaz

55 Jun 18, 2022
a baseline to practice

ccks2021_track3_baseline a baseline to practice 路径可能会有问题,自己改改 torch==1.7.1 pyhton==3.7.1 transformers==4.7.0 cuda==11.0 this is a baseline, you can fi

45 Nov 23, 2022
Springer Link Download Module for Python

♞ pupalink A simple Python module to search and download books from SpringerLink. 🧪 This project is still in an early stage of development. Expect br

Pupa Corp. 18 Nov 21, 2022
Official repo for BMVC2021 paper ASFormer: Transformer for Action Segmentation

ASFormer: Transformer for Action Segmentation This repo provides training & inference code for BMVC 2021 paper: ASFormer: Transformer for Action Segme

42 Dec 23, 2022
Leaf: Multiple-Choice Question Generation

Leaf: Multiple-Choice Question Generation Easy to use and understand multiple-choice question generation algorithm using T5 Transformers. The applicat

Kristiyan Vachev 62 Dec 20, 2022
Efficient Sharpness-aware Minimization for Improved Training of Neural Networks

Efficient Sharpness-aware Minimization for Improved Training of Neural Networks Code for “Efficient Sharpness-aware Minimization for Improved Training

Angusdu 32 Oct 18, 2022
Real-Time Multi-Contact Model Predictive Control via ADMM

Here, you can find the code for the paper 'Real-Time Multi-Contact Model Predictive Control via ADMM'. Code is currently being cleared up and optimize

17 Dec 28, 2022
GeneGAN: Learning Object Transfiguration and Attribute Subspace from Unpaired Data

GeneGAN: Learning Object Transfiguration and Attribute Subspace from Unpaired Data By Shuchang Zhou, Taihong Xiao, Yi Yang, Dieqiao Feng, Qinyao He, W

Taihong Xiao 141 Apr 16, 2021
Space Invaders For Python

Space-Invaders Just download or clone the git repository. To run the Space Invader game you need to have pyhton installed in you system. If you dont h

Fei 5 Jul 27, 2022
Predicting 10 different clothing types using Xception pre-trained model.

Predicting-Clothing-Types Predicting 10 different clothing types using Xception pre-trained model from Keras library. It is reimplemented version from

AbdAssalam Ahmad 3 Dec 29, 2021
Ansible Automation Example: JSNAPY PRE/POST Upgrade Validation

Ansible Automation Example: JSNAPY PRE/POST Upgrade Validation Overview This example will show how to validate the status of our firewall before and a

Calvin Remsburg 1 Jan 07, 2022
GalaXC: Graph Neural Networks with Labelwise Attention for Extreme Classification

GalaXC GalaXC: Graph Neural Networks with Labelwise Attention for Extreme Classification @InProceedings{Saini21, author = {Saini, D. and Jain,

Extreme Classification 28 Dec 05, 2022
This is a code repository for the paper "Graph Auto-Encoders for Financial Clustering".

Repository for the paper "Graph Auto-Encoders for Financial Clustering" Requirements Python 3.6 torch torch_geometric Instructions This is a simple c

Edward Turner 1 Dec 02, 2021
Molecular AutoEncoder in PyTorch

MolEncoder Molecular AutoEncoder in PyTorch Install $ git clone https://github.com/cxhernandez/molencoder.git && cd molencoder $ python setup.py insta

Carlos Hernández 80 Dec 05, 2022
An algorithm that handles large-scale aerial photo co-registration, based on SURF, RANSAC and PyTorch autograd.

An algorithm that handles large-scale aerial photo co-registration, based on SURF, RANSAC and PyTorch autograd.

Luna Yue Huang 41 Oct 29, 2022
You Only Hypothesize Once: Point Cloud Registration with Rotation-equivariant Descriptors

You Only Hypothesize Once: Point Cloud Registration with Rotation-equivariant Descriptors In this paper, we propose a novel local descriptor-based fra

Haiping Wang 80 Dec 15, 2022
Implementation of "Semi-supervised Domain Adaptive Structure Learning"

Semi-supervised Domain Adaptive Structure Learning - ASDA This repo contains the source code and dataset for our ASDA paper. Illustration of the propo

3 Dec 13, 2021
Hyperbolic Image Segmentation, CVPR 2022

Hyperbolic Image Segmentation, CVPR 2022 This is the implementation of paper Hyperbolic Image Segmentation (CVPR 2022). Repository structure assets :

Mina Ghadimi Atigh 46 Dec 29, 2022
TransMVSNet: Global Context-aware Multi-view Stereo Network with Transformers.

TransMVSNet This repository contains the official implementation of the paper: "TransMVSNet: Global Context-aware Multi-view Stereo Network with Trans

旷视研究院 3D 组 155 Dec 29, 2022
Overview of architecture and implementation of TEDS-Net, as described in MICCAI 2021: "TEDS-Net: Enforcing Diffeomorphisms in Spatial Transformers to Guarantee TopologyPreservation in Segmentations"

TEDS-Net Overview of architecture and implementation of TEDS-Net, as described in MICCAI 2021: "TEDS-Net: Enforcing Diffeomorphisms in Spatial Transfo

Madeleine K Wyburd 14 Jan 04, 2023