Monday, March 13, 2017

Saturday, April 2, 2016

Introduction

The finite photonic structures package was created to allow the calculation of local density of optical states (LDOS) and density of optical states (DOS) in finite-sized non-periodic structures.
We try to make calculations as easy as possible in a way that a very basic knowledge of operating system is enough to handle LDOS and DOS calculation. In the first release you need to use terminal of Linux to do calculation but in the second release you can easily use our GUI. Please check out our paper: Density of optical states in rolled-up photonic crystals and quasi crystals

We kindly ask that you cite FPS in any publication for which you found it useful, thanks!
E. Saei Ghareh Naz, M.R. Jorgensen, O.G. Schmidt, Computer Physics Communications 214 (2017) 117-127.

Tuesday, March 1, 2016

Download

The finite photonic structures package in binary format can be downloaded from here. For parallel processing, Fourier transforms, and visualization of the dielectric function the latest versions of MPI, fftw, and Paraview downloaded from the Linux repository are required. HDF5 viewer is recommended for viewing the data in dielectric functions (which are processed in h5 format) directly.

The Software is available for download at CPC program library or Mendeley Data repository for free under GNU GPL 3.0.

Saturday, November 28, 2015

Example


Let's start with a diamond lattice of spheres as an example. Here we will show, how one can compute DOS or LDOS in a perfect diamond lattice from scratch. We assume that you have already  installed FPS in your home folder and you have also  installed MPB (see Quick tutorial and Appendix - A beginner's guide to calculating photonic band diagrams: Getting setup). We need to carry out three steps to compute DOS in our structure. We use MPB to generate epsilon function called "epsilon.h5". There is, however, no limit on the generating epsilon function. Epsilon functions that are generated by MEEP cannot be used with FPS (see the reason here: why not MEEP?).

1) Finding center of each sphere in diamond lattice and writing them in a text file with the following format and giving the size of box that contains these spheres:
For example here we want to compute DOS in a 5a*5a*5a block made of air and contains all the spheres with diamond lattice arrangement:

Block: size_x size_y size_z dielectric_constant resolution/unit_cell
      5      5      5      1.0    32
Sph: center_x center_y center_z radius dielectric_constant
    0.0        0.0        0.0        0.35   11.56
    0.0        0.25       0.0        0.35   11.56

These parameters for all the spheres should be presented in the file (here we just showed two of them).

Once the file is ready we should make a folder that we want to save our results. Here we assume that name of folder is "diamond" and is in "Desktop". Open a terminal window and enter the directory of the folder:
cd ~/Desktop/diamond

Run the following command:
~/FPS/text2ctl
text2ctl will read the text file and based on the information that you provided it will write a ctl file for MPB and then it will use MPB itself to generate "epsilon.h5" file that we need for the next step. This will take a few seconds (see Tutorial - Making a dielectric function with MPB and Tutorial - Visualizing dielectric functions for visualization).
Dielectric function of diamond lattice of spheres in air


2) Modifying controller file of FPS:

Now here we provide all the modifications that are required to be done in the controller file


CPU -> 10
DOS_x -> 1
DOS_y -> 1
LDOS_resolution -> 5
DOS_z ->
center_wavelength -> 2.0
PML_dist -> 0
delta_x -> 0.04 //(1/25.0)
lattice_constant -> 1.0
resolution -> 32
size -> 160 160 160 // (5*32) (5*32) (5*32)
time_step -> 8000
unit_cell_end -> 80 80 80
unit_cell_Start -> 80 80 80 


All these parameters should be entered in the "controller.h5" file. the file should be saved in "diamond" folder.
Now every thing is ready to compute DOS or LDOS. run the follwing command:
~/FPS/FPC

It will take less than 15 minutes to compute one LDOS in this structure. FPC also estimates required time for calculation and reports in terminal.

3) Once the calculation is done the user can use the reported data for post processing. FPS creates a folder called "results" in the folder that is used for calculation. It then creates two text files with the name of  "reduced_frequency.txt" and "DOS.txt". The first file contains frequency in reduced format and the second file contains DOS for those frequency.
Here we compared the results of LDOS in z direction calculated by FPS with band diagram of infinitely extended crystal:
Band diagram of infinitely extended diamond lattice (right) of spheres and LDOS in Z direction (left)



Tuesday, November 24, 2015

Quick Tutorial

To start quickly we assume that the user has a "epsilon.h5" file that contains mesh of the desired structure (see Tutorial - Making a dielectric function with MPB). Using MPB is one straightforward way of generating epsilon file, in FPC. Others methods (see an example here: Making a dielectric function using C++), can be used as well.

Installation

The user must install MPICH and g++ and fftw3 libraries to be able to use our software.
use these commands:

     sudo apt-get install g++

     sudo apt-get install libfftw3-dev

     sudo apt-get install mpich2



It is also recommended to install HD5, paraview and OCTAVE.
One can use these commands to install them:

     sudo apt-get install libhdf5-serial-dev

     sudo apt-get install paraview

     sudo apt-get install octave



Now the system is ready to run FPS. We provided executable files so the user doesn't need to compile any file which is very useful for users who are not familiar with programming and Linux.
To use FPS just copy the zip file into a folder of your interest. We recommend to use "home folder" because it is easier to work with it later. In this quick tutorial we assume that you copied the zip file to your home folder.
After copying the zip file, unzip it and don't change any file in the folder that is just created and called FPS.

First LDOS or DOS calculation
Copy a controller file which is provided inside FPS folder and is called "controller.h5" into the folder that you have your "epsilon.h5" file.

"controller.h5" has 14 sections that needs to be modified by the user:





1. CPU
Change it to the number of cores that you want to use for calculation. For example if you have 4 core machine and you just want to 3 of these cores for calculations then change the value of CPU to 3.
2. DOS_x
It only accepts 0 and 1. "0" means that you don't want to compute LDOS or DOS in "x" direction
3. DOS_y
It only accepts 0 and 1. "0" means that you don't want to compute LDOS or DOS in "y" direction
4. DOS_z
It only accepts 0 and 1. "0" means that you don't want to compute LDOS or DOS in "z" direction
5. LDOS_resolution
Declares the resolution in unit cell that you want to integrate LDOS in it.
6. PML_dist
Declares the distance between PML and the structure. If you were sure that the structure is big and you don't have evanescent wave leave it to zero.
7. center_wavelength
Declares the center wavelength of point dipole. For example if you want to compute LDOS in the range of [0,1] in reduced frequency it is recommended to choose center_wavelength=2.0.
8. delta_x
Is the minimum distance in the mesh that you used in epsilon.h5 file
9. lattice_constant
Is a constant value in meter that could be used in calculations. If you want to use reduced format you should choose lattice_constant=1.0.
10. resolution
Is the number of mesh points per lattice constant.
11. size
Is the size of structure in terms of mesh points.For example if the lattice_constant was 1.0 and resolution was 25 points per lattice constant then the size is
25*size_x
25*size_y
25*size_z


you can simply find these numbers in the "epsilon.h5" file.
12. time_step
Is the number of time steps that you want to use for calculation. We recommend 8000.
13. unit_cell_end
Coordinates of end corner of the unit area that you want to compute DOS.
14. unit_cell_start
Coordinate of start corner of the unit area that you want to compute DOS.


After modifying the "controller.h5" file all you need to do is opening a terminal window
going to the directory that you have both "epsilon.h5" and "controller.h5" files together, and then run the following command:

     ~/FPS/FPC

FPS package will do the rest automatically.

Friday, August 14, 2015

Making a dielectric function using C++

To make a dielectric function that is compatible with FPS use the following code as an example:

In this example we define a sphere with radius of R, refractive index of "refractive_index" and located at point (i0,j0,k0) in a cubic domain of free space


 

for (int i=0; i<i_max;i++){
    for (int j=0; j<j_max; j++){
        for(int k=0; k<k_max;k++){
           if((pow(i-i0,2.0) + pow(j-j0,2.0) + pow(k-k0,2.0)) <= pow(R,2.0)){
               epsilon[i][j][k] = pow(refractive_index,2.0);
}
}
}
}

User Guide V2.0

In this version we introduce GUI of FPS.

You don't need to write even one line of code, terminal command... to carry out your calculations. You ask how??? so stay tuned