problems reading hdf5 with matlab
Amnon Willinger <[email protected]> Tue, 28 Aug 2012 01:21:58 +0300
| Newsgroups | gmane.comp.science.photonic-bands |
|---|---|
| Message-ID | <[email protected]> |
Hello everyone, I started looking at the fields of different modes in a PhC slab with air holes in both square or triangular lattice configurations. I use hdf5read function in matlab, in some cases the data I receive for the field components contains NaN or Inf values. I worte a function in matlab to read a certain component form a hdf5 file and return the field: function F = read_mpb_field_h5(filename, component_str) data_r_str = [component_str,'.r']; data_i_str = [component_str,'.i']; F = hdf5read(filename,data_r_str)+1i*hdf5read(filename,data_i_str); If it matters, I run mpb on cygwin. I wouldn't mind that much except that I have several other problems regarding the calculations I do in matlab so I think I'm not doint int right and I'm missing something basic. This is the simplest problem I could describe at the moment and perhaps from that I would figure out the other problems... Any help with this thing would be appreciated. here's an example of a ctl script I use. if you can run this and read the files in matlab, and see if you too have Inf and/or NaN values. If you look below you could see I use cvector-field-nonbloch for the fields, because I don't want to have the bloch-phase-exponent in the fields data. Nonetheless, I comment those lines just to see what happends and I still have Inf and NaN values ;define the cell geometry of air holes in dielectric slab (define-param eps 10.048900000000000000000000000000000000000000000000) (define-param r 0.179999999999999990000000000000000000000000000000000) (define-param h 0.414899999999999990000000000000000000000000000000000) (define-param supercell-z 5.0) (define-param dielectricon (make dielectric (epsilon eps) ) ) (set! default-material air) (set! geometry (list (make block (center 0 0 0) (size 1 1 h) (material dielectricon) ) (make cylinder (center 0 0 0) (radius r) (height supercell-z) (material air) ) ) ) ;define the lattice vectors of square lattice (set! geometry-lattice (make lattice (size 1 1 supercell-z) (basis1 1 0 0) (basis2 0 1 0) (basis3 0 0 1) ) ) ;define the k-points (set! k-points (list (cartesian->reciprocal (vector3 0.1 0.0 0.0)) (cartesian->reciprocal (vector3 0.5 0.0 0.0)) ) ) (define-param k-interp 17) (set! k-points (interpolate k-interp k-points) ) ;define the simulation settings (set-param! resolution 10) (set-param! num-bands 5) (define-param top-bands 5) ;this can sometimes be lower than num-bands (set-param! tolerance 0.0001) ;special calculation functions to pass to run (define (output-nonbloch-efield which-band) (get-efield which-band) (cvector-field-nonbloch! cur-field) (output-field-to-file -1 "e.") ) (define (output-nonbloch-hfield which-band) (get-hfield which-band) (cvector-field-nonbloch! cur-field) (output-field-to-file -1 "h.") ) (define (topbands-functions) (let topbands-loop ((n (- top-bands 1))) (output-nonbloch-efield (- num-bands n)) (output-nonbloch-hfield (- num-bands n)) (if (> n 0) (topbands-loop (- n 1)) 0) ) ) ;run command (run-zeven topbands-functions display-group-velocities) ---------- Walla! Mail - Get your free unlimited mail today ---------- Walla! Mail - Get your free unlimited mail today _______________________________________________ mpb-discuss mailing list [email protected] http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/mpb-discuss