# [MPB-discuss] Woodpile structure using simple cubic lattice

```Dear MPB users,
```
```
I'm recently working on a woodpile structure and as example I took the code
posted by Professor Steven G. Johnson years ago.

The structure consists of a supercell with a brick (waveguide) defect at its
center, so I have modified the code appropriately.

This code uses the fcc lattice to obtain the structure and consists of two
brick rods disposed along the fcc lattice base.

However, due to the peculiar lattice base used, I'm finding quiete lot of
difficulty to take a 2D slice of the structure in the defect direction and plot
fields.

I thought that having the same structure realized along common cartesian axes
could lead to more straightforward field plot possibilites (for example, if z
is the direction of the waveguide defect, one can cut a 2D slice on the xy
plane and observe the fields),

so I tried to make the same structure by using a simple cubic lattice. The code
I wrote is the following:

; Woodpile structure.

(set! geometry-lattice (make lattice
(basis1 1 0 0)
(basis2 0 1 0)
(basis3 0 0 1)))

(define-param k-interp 9)

(define Gamma (vector3 0 0 0))
(define R (vector3 0.5 0.5 0.5))
(define X (vector3 0 0.5 0))
(define M (vector3 0.5 0.5 0))
(set! k-points (interpolate k-interp (list Gamma X M Gamma R X M R)))

(define-param eps 9.8) ; the dielectric constant of the "log" material

(define diel (make dielectric (epsilon eps)))

(define-param w 0.20) ; width of the logs
(define-param h 0.25) ; height of logs

(set! geometry
(list
(make block (material diel)
(center 0 0 0)
(size infinity w h))
(make block (material diel)
(center 0 0 h)
(size w infinity h))
(make block (material diel)
(center 0 0.5 0.5)
(size infinity w h))
(make block (material diel)
(center 0.5 0 0.75)
(size w infinity h))

))

(set-param! resolution 32)
(set-param! num-bands 20)
(run)

The structure consists of four bricks disposed opportunely along the stack (z)
direction.

By running it, i find a band gap that is large as the one calculated by the
structure on fcc lattice, BUT it is centered at slightly lower normalized
frequency.

I think that this is due to the different basis sizes used in fcc and CUB
lattices; in fact, by plotting the epsilon function along some periods, I noted
that the horizontal center to center distance between the brick is larger in
the CUB representation than the fcc representation.

The question is, is this code correct/have any sense? Can I use it as an
alternative to the classic fcc representation?

Did I miss something or something is wrong?

In the case that this code is inconsistent, is there a pratical way (some code
example would be appreciated) to cut a slice in a 2D plane along the defect
direction for a woodpile fcc representation?

I'm also attaching the base code with a defect inserted:

; Woodpile structure.

(set! geometry-lattice (make lattice
(basis1 0 1 1)
(basis2 1 0 1)
(basis3 1 1 0)
(basis-size (sqrt 0.5) (sqrt 0.5) (sqrt 0.5))
(size 5 5 1))
)

(define-param k-interp 9)

; Corners of the irreducible Brillouin zone for the fc lattice,
; in a canonical order. In this case, woodpile breaks some of
; the symmetry so we have additional points W'', X', etc.

(define X (vector3 0 0.5 0.5))
(define U (vector3 0.25 0.625 0.625))
(define L (vector3 0.5 0.5 0.5))
(define Gamma (vector3 0 0 0))
(define W (vector3 0.25 0.5 0.75))
(define K (vector3 0.375 0.375 0.75))
(define W'' (rotate-reciprocal-vector3 X (deg->rad 90) W))
(define X' (vector3 0.5 0.5 0)) ; z (stacking) direction
(define K' (rotate-reciprocal-vector3 L (deg->rad -120) K))
(define W' (rotate-reciprocal-vector3 L (deg->rad -120) W))
(define U' (rotate-reciprocal-vector3 L (deg->rad -120) U))

(set! k-points (interpolate k-interp (list X U L Gamma W K X' U' W' K'
W'')))

(define-param eps 9.8) ; the dielectric constant of the "log" material

(define diel (make dielectric (epsilon eps)))

(define-param w 0.2) ; radius of the cylinder rod
(define-param h 0.25)
(define-param wdef 0.4)
(define-param ldef 0.35)

; shortcut for cartesian->lattice function:
(define (c->l . args) (cartesian->lattice (apply vector3 args)))

(set! geometry
(list
(make block (material diel)
(center (c->l 0 0 0))
(e1 (c->l 1 1 0))
(e2 (c->l 1 -1 0))
(e3 (c->l 0 0 1))
(size infinity w h))
(make block (material diel)
(center (c->l 0.125 0.125 h))
(e1 (c->l 1 1 0))
(e2 (c->l 1 -1 0))
(e3 (c->l 0 0 1))
(size w infinity h))))
(set! geometry (geometric-objects-lattice-duplicates geometry))

(set! geometry (append geometry
(list
(make block (material air)
(center (c->l 0 0 0))
(e1 (c->l 1 1 0))
(e2 (c->l 1 -1 0))
(e3 (c->l 0 0 1))
(size infinity wdef ldef))
)))

(set-param! resolution 16)
(set-param! num-bands 70)
(run (output-at-kpoint (vector3 0.375 0.375 0.75) output-dpwr))

```_______________________________________________