Implment Do Loop for Objects

"Ian D. Hosein" <[email protected]>
Newsgroups gmane.comp.science.photonic-bands
Organization Cornell University
Message-ID <[email protected]>
Hello Steven & MPB users,

   I'm trying to simulate the photonic band structure of an FCC lattice with 
random sphere sizes.  I'm working with a supercell of size n (where n is a 
variable) and then I want to fill the cell with spheres on the lattice sites 
with random sizes.  To this end, I have written a do loop to fill in the 
lattice points. However I'm not sure how to append the lists created on my 
loop to return a full list of objects back.  Below is my code: nx ny nx 
denote the 1x1x1 box I'm in, where each box is just the cubic non-primitive 
unit cell of the FCC lattice. In each box I fill in the objects at the four 
basis points: one corner and three faces. I do this for each box in my super 
cell. I'm just not sure how to append the lists I make in my loop to return 
it back to set! geometry.
    Any help would be appreciated.

Thanks,

Ian



; Dielectric dimers in a rotator phase, FCC lattice

(define-param n 2)    		; super cell number of repeat units
(define-param a (sqrt 0.5) )    ; primitive lattice vector magnitude
(define-param r (/ a 2))    	; the radius of rotation

(set! default-material (make dielectric (epsilon (* 3.5 3.5))))

(define (place-particle xx yy zz)
	(make sphere (center xx yy zz) (radius (* 1 r))
	(material (make dielectric (epsilon 1))))
)

(define (fill-lattice)
	(do ((nx 0 (+ nx 1))) ((> nx (- n 1)))
		(do ((ny 0 (+ ny 1))) ((> ny (- n 1)))
			(do ((nz 0 (+ nz 1))) ((> nz (- n 1)))
				(list
					(place-particle nx ny nz)
					(place-particle (+ nx a) (+ ny a) nz)
					(place-particle (+ nx a) ny (+ nz a))
					(place-particle nx (+ ny a) (+ nz a))
				)
			)
		)
	)
)

 (set! geometry-lattice (make lattice
                          (basis-size a a a)
                          (basis1 0 1 1)
                          (basis2 1 0 1)
                          (basis3 1 1 0)
			  (size n n n)
			)
)


; A super cell lattice of n has n "atoms" per unit cell:
 (set! geometry
	(fill-lattice) ;
)

; Corners of the irreducible Brillouin zone for the fcc lattice,
; in a canonical order:
(set! k-points (interpolate 4 (list
			       (vector3 0 0.5 0.5)            ; X
			       (vector3 0 0.625 0.375)        ; U
			       (vector3 0 0.5 0)              ; L
			       (vector3 0 0 0)                ; Gamma
			       (vector3 0 0.5 0.5)            ; X
			       (vector3 0.25 0.75 0.5)        ; W
			       (vector3 0.375 0.75 0.375))))  ; K

(set-param! resolution 16) ; use a 16x16x16 grid
(set-param! mesh-size 5)
(set-param! num-bands 5)

; run calculation:
(run)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.