Allen J. Hall

Materials Science & Engineering, Productivity, and Life

Tag Archives: Matlab

Simple Matlab Gui Programs for Crystal Symmetry Calculations

Tetragonal Symmetry Angle GuiI’ve made a few small gui programs (MATLAB) for finding all unique angles for vectors (or plane normals) in both the cubic and tetragonal crystal spaces. I thought I’d share them here, as I finally worked out a few kinks. Be aware that the little gui’s use the command window to output their results. Some of my other programs would output latex code so that they could be pasted directly into a thesis for tables etc., but this one just uses the standard out (ala the command window in Matlab).

Essentially you enter the vectors for the two planes of interest, then hit calculate, and all the unique angle solutions for the crystal space you chose (one gui for each crystal space right now- no interest in complicating it by combining at this time) gets output in the command window.

I populate some orientation matrices based upon the vectors you give. Then, from matrix calculations, using tetragonal and crystal symmetry operations, we determine all the symmetric orientations. Then, a simple subspace() command gives us the angles of greatest rise (dihedral angle) between the symmetric orientations. The calculations for these operations can be found in my Thesis (if it ever gets published), but can also be found in: V. Randle and O. Engler. Texture Analysis: Macrotexture, Microtexture & Orientation Mapping. CRC Press, 2000.

Please note- it’s your job to check if these are correct, I make no warranties about this stuff. :) It should work, but feel free to go in and edit everything to your liking. If you use my code, don’t worry too much about citing me (if you do, I appreciate it, but I often leave out others who have contributed also).

These are very simple, but hopefully they’ll help a bit for those working in cubic and tetragonal spaces.

Here’s the cubic symmetry angle calculator:
Vector Angle Calculator Cubic Symmetries

Here’s the tetragonal symmetry angle calculator:
Vector Angle Calculator Tetragonal Symmetries

I hope they work for you- please let me know if you have problems, if I have time I’ll try and help.

Finally- Qspace mapping success!

I have no idea why this took so long, but I finally have the code to import and output various graphs of the reciprocal space maps (RLM or Q-space) taken using the Xpert Xray diffraction system. One of the difficulties in outputting the older data has been solved by our new line-scan detector system. The data is now taken in the more simple Omega-2Theta space instead of Omega-Omega2Theta space. With the help of Mauro Sardela, the fantastic research scientist who runs the XRD lab at the Materials Research Laboratory (FS-MRL), I’ve properly translated the data into Q-space using the same equations the Xpert Epitaxy software uses.
Read More »

More on XRD Q-space mapping.

After some new scans, it appears the XRDMLread.m function I talked about is doing a pretty good job of getting the 2-axis scans into MATLAB. I was able to alter the code to accept the standard Epitaxy software’s translation to Q-space. (In Epitaxy the default is R = 0.5 I believe.) So, the following image was imported with XRDMLread.m the plotted with the standard 2-d example from the author’s website. The code was altered to output 10000xRLU units the same as Epitaxy (Panalytical). I haven’t checked all the numbers, but it’s looking ok so far. Unfortunately the color-scale looses it’s meaning as far as intensity is concerned, it appears at first glance.

(115) Qspace map

Working a bit with my old q-space map code, I’m able to accomplish the following:

3dtrial3d3ii

3dtrial3d3i

3dtrial3d3

Note the strange love-handles the data gains. I suspect this might be due to the Gridfit function (see MATLAB files repository) I used for regridding the data. Gridfit.m uses an extrapolant method. My suspicion is it is trying to fill out the square of the data matrix and is accomplishing relatively correct values for near-by-data that is outside the scanned range. I’ll try it again with regrid or something similar in the future when I have time.

If anyone knows where the current site for XRDMLread.m is, I’d love to link to it. It appears the site may be down (graduated student I suspect). You can obtain the wonderful XRDMLread.m function and examples on the XRDMLread.m website. For now, I have to wait until I hear from the authors before I can share the file. I also don’t yet trust my icky 3D code, so I prefer not to release that until I have things hashed out. Sorry!

I’m extremely happy that Panalytical has published their XRDML file format and that the makers of XRDML.m have released their .m files for MATLAB. In the past, when Philips had the Xpert systems, the data was stuck for the most part in proprietary data formats. [You could slice the data and output in ascii- but making that work was a pain- which is why I never released that previous code.] I’m much closer to the 3d plotting now, and hope to finish it up before the thesis (my primary work which is not this plotting) is published.

Wishing you luck in you research!

Matlab doesn’t open two windows? – Here’s a fix.

After finally installing Leopard (10.5) osX on my Powerbook G4 (Thesis writing computer), I noticed a strange behavior with MATLAB. MATLAB could no longer open more than one instance of itself. As well, it could no longer open a window once it had opened once in any login session. Strange behavior indeed.

Well, here’s the fix… it turns out that Leopard uses launchd to set the display. So, the old method of launching MATLAB was to set the display to 0.0, but this will fail after the first instance, hence the bug. What you can do is simply remove this line from the startup script in matlab (located within the startup application contents).

The line that was:

$SHELL -c 'bin/'$ARCH'/setsid bin/matlab -desktop -display :0.0 &'

should now be:
$SHELL -c 'bin/'$ARCH'/setsid bin/matlab -desktop &'

Once I changed that, everything started up fine! :)

ps- you will know you have this problem if you look at your console log immediately after launching MATLAB and it says something like:
6/29/10 9:03:34 AM [0x0-0x78078].StartMATLAB[23469] Warning: Unable to open display :0.0, MATLAB is starting without a display.

MATLAB and reciprocal space mapping – small update.

Well, I’m one of those guys who believes a picture is usually worth a ton of words. I’ve got a few images to share here on the matlab code I’ve been working on for reciprocal space mapping in MATLAB. I’m still not 100% on my code right now, so I’m not sharing it for the time-being. In particular, I use an import function for .x00 slices for two-axis scans in the Panalytical/Philips XPert system. If you are using XRDML, skip the files for .x00 import that I have in other posts on this blog. In anycase, without much explanation here are the images…

surfacetestusingallomegas2

surfacetestusingallomegas3

qspaceorigtranslateweachomegaload

A Quick Introduction...

I'm a graduate student (PhD Candidate) at the University of Illinois at Urbana-Champaign.

I've studied and researched in two fields of Materials Science and Engineering (Polymers and Semiconductors). My interests are as diverse as my musical tastes and I usually have my hand in some crazy project during my free time.

I'm available for consulting and have access to a world-renown materials research user-facility supported by the D.O.E. If you would like to know more, please contact me.

Popular Tags

Amazon Associate Link Apple Support AppStore Bug CIGS CIS CLI Conferences Cross Platform Data Mining data visualization dual-driver headphones failure Friend Geek Tool Great Scientists HAM Radio Hardware Tips How To Humanitarian IEM IM In-Ear Monitors iPod Touch LaTeX Linux Mac OsX Materials Science and Engineering Matlab Obituary Open Source problem Productivity reciprocal space return Silent Key Software Software Review Support This Blog Thesis Writing Tip UIUC VOIP Windows xrd

Support This Blog

You can support this blog by shopping on Amazon through my Affiliate Store.