Wednesday, November 11, 2015

A comes in, but ..

I was a little over excited to hear that A finally came in.  My expectation was very high.

But the database seems stuck as I don't have the right on the computer.  Fortunately, the it still runs under DOS although the built version seems several years old.

back to square 1. in reality 

Coming back to set eflech=. and set path=%path%;.  it still works fine. 

Just dug out so many lines of old code that can be savaged. for example, from dif to val and cpi.  this is for the case when you have more than 1000 files.  do this on a single file is a waste of time.


1.bat{
ls *.dif | sed -f 2val-dif
call 3.bat}

2val-dif{
s/\(.*\)\(...\)/cat & | sed -f 2valx_dif >5 \
mv 5 \1val\
cat \1val | sed -f 2val_dif_cpix >5 \
mv 5 \1cpi\
/w 3.bat}
2valx_dif {
1 {
s/\(.*\)\ *\(.*\)/FilePar\
\2\
\
1\
0\
N\
CU\
0\
1\
0\
1\
BerPar01\
99/g
}
2 {
s/^ //
s/\(.*\)\ \ \(.*\)\ \ .*\ Cu\ .*\ \ \(.*\)\ \ \(.*\)/\1\
\3\
\2\
T\
99\
1\
\4\
N\
N\
0\
Intens01/
}
s/^ //
s/  /\
/g
}

2val_dif_cpix {
1 s/.*/SIETRONICS XRD SCAN/
2 h
2,13 d
17,21 d
22 s/.*/CU\
1.54056\
11\/13\/01\
1/
23 x
24 s/.*/SCANDATA/}

Saturday, November 7, 2015

Profex is quite convenient

Profex is quite a convenient tool to put things together.

It can read Bruker's latest format of diffraction files; whereas other commercial products cannot.
It also put the sticks in cache. so it is not necessary to regenerate the sticks each single time. Moreover, double clicking will find you a match.

But when you read from CIF, it doesn't recognize the HM symbols and leaves the Wyckoff letters blank.  The Wyckoff letters have to be put there manually.

Occasionally it hiccups.  This morning I found there are so many entries in the registry table.  hard to guess how these were generated.  but after deleting all the related items, it worked fine. The entries in the registry table became neat and necessary again.

Thursday, October 22, 2015

Odd rietveld analysis

 
In the oil and gas industry, so many people pretend to do Rietveld analysis.  The smart ones don't put a diffractogram on the side; there would be simply some text: Rietveld analysis shows 3% of graphite.
 
 
 


Tuesday, October 13, 2015

Fmult

The lengthy calculation now comes from vector stacking; suppose we know the scattering capacity F along certain direction vector, u, for each layer a,b,c,d.  The origins of neighbouring layers form vectors R,


Fa(u)+Fb(u)_corrected_by_Rab+Fc(u)_corrected_by_(Rab+Rbc)+Fd(u)_corrected_by_(Rab+Rbc+Rcd)

so vector manipulation is a lengthy one if you have one thousand layers.

but it is not that bad if they can be clustered.


_____________________
BGMN provided two phase functions, reFmult and Fmult; the 1st one, I tend to call it a physical phase, and the 2nd one, I tend to call it a metaphysical phase; for the Fmult, the F_i and phi_i are automatically calculated, i being from 1 and N as defined in the statement Fmult=N. 


Sunday, October 11, 2015

intensity 3


A bunch of other things would lower the intensity, assuming the Xray is a perfect parallel beam, such as
absorption
Lorentz factor
polarization
The amount of material irradiated
thermal vibration of the dots

Talking about the thermal vibration thing.  Various software call it different names, such as U, beq, TDS, etc.  note the conversion and unit.  What is interesting is that a guy wrote a good thesis on this in Ruperto-Carola University of Heidelberg. 


Jacopo Negroni, 2012. Validation of Crystallographic B Factors and Analysis of Ribosomal Crystal Structures.

Permission to use this graph is NOT granted.  will take it off in a short while.

Saturday, October 10, 2015

intensity 2


The following graph shows the process of adding all of them together.  I don't know the credit goes to whom.  But when I did the dielectric log interpretation, we always did the similar graph.  The real part in that case was the permittivity and the imaginary part was conductivity.  After plotting the square root of the vector for each mineral, you add them up (with the length shortened in a way proportional to the volumetric fraction), and the total should be what you measured.  if they are not matching, you can start pulling your hair like I did.

certainly in this case, the length is represented by the scattering capacity of the atom/dot in the lattice (sounds like a vegetable).  Note that each dot has different capacity, and the capacity changes with 2theta. 

 
Finally we have one Ftotal and Phi_total; in my junior years, I was thinking whether we could measure the amplitude and phase angle at each spot.  The my dream broke, at each point, you could see only a bright spot in old days or a count number of Xrays as of today.  The intensity or power or brightness is the only thing we can measure, which is normally related to the squares of the amplitudes. 

Friday, October 9, 2015

intensity 1

The previous short post shows where the reflexions are at the 2theta position.

but how strong is it?

then we need consider the contribution of every single atoms, what elements (how much an atom can scatter the photons) and what position (what a phase angle difference it can cause) can tell us how strong it is. 

 
add all of then together, you'll have something very closely related to the theoretical intensity value.  (sorry, one of the i's is for the root of -1; the other i's are indices);

Wednesday, October 7, 2015

reFmult

 

 
Many moons ago, the teacher, who spent 5 or 6 year in Moscow on XRD of quartz, could explain all things crystally clear, and we were wondering what he was doing spending so many years on XRD of the simplest mineral in front the primitive instrument. 
 
one of the good thing we learned was that after you plot the planes (which are many dots) in the reciprocal space, then you would start drawing spheres with radius of 2sin(theta)/lamda. so when the sphere intercepts the dots, that's where r=1/d.  then at this 2theta angle, interference is strong.  Using the same principle, you can find the intensity of the peak. 
 
This plot certainly does not look elegant as the Debye formula. But it is so easy to remember: the radius is proportional to 2theta at small angle or 2sin(theta). Certainly if the mineral is center symmetric, you can add another dot in the 3rd quadrant; so on so forth.  it changes the multiplicity but the graph remains valid.

 
 

The refFmult function is useful when there are two subphases of the same mineral; for example, you can have some detrital kaolinite and some authigenic kaolinite crystals in the same rock; the representation of the detrital one will be a large dot, whereas of the authigenic one will be a smaller one. both at the same position in the reciprocal space. certainly you can write two str files; linking the basic cell parameters.  Or to make life easier, you can use reFmult function in the str file.

Found a graph from Dr. Kleeberg.  here it is

once this reFmult is defined, most of the descriptors can be parameterized into arrays.






































___________________________________________



Before I wrote anything XRD, I wrote stories using various alias.  I just finishing translating this one


Huashan Mountain; an excursion

[the story was first published in Chinese: mixing the present tense with the past makes me feel right]

Huashan is a beautiful mountain that attracts hundreds of thousands of visitors annually.  Many years ago when I went to college, there were segments of wood planks on 70 to 80 degree rock surfaces; almost vertical. Some segments have only carved foot holds and some others only wood planks; there was a iron chain to grab on, but no harness and no railing.  Also, there was no alternative to bypass these dangerous segments to the top of the mountain.

The following picture from the internet shows the same path, but with both foothold AND a plank of wood. More importantly, a steel rope is put there and visitors nowadays are wearing harnesses. The safety factor is at least ten times higher than it was.

On one end of the narrow plank path, there are very steep and very narrow steps carved out of the granitic rock,  Climbing up is much easier than getting down.
________________________________________________________________

A few days back, an old friend, W, visited us in Houston with his family.  He was an old classmate of mine.  When we parted after graduation, each of us was single; now both of us are married with kids.  The wives got acquainted very fast, and topics were on kids and shopping deals.  Then there was a proud display of the deals my wife got.


W looked quite macho, obviously muscular in the upper body; his wife was petite; On the dinner table, my wife said, "look at W, he keeps such a good figure, you need follow him to the gym more often, instead of eating like hog each meal". 

The smile on W's face disappeared, and I knew something reminded him of C. whether was Camille or Camylla,  I didn't remember and never had the courage to ask.

How they got together escaped me but I can never forget their ending.   When W and his wife were leaving, I asked whether I could write down this story; he agreed, but would like to keep his identity unrevealed.

_________________________his story___________________________

We met the first day of school on the registration day.

It was hot. Ninety degrees. Students got the paperwork done and started dragging the luggage towards the dorm.  I was turning around the building and found C sitting on the curb. One wheel on her luggage was broken. 

Mine had big wheels.  A Hi from me and She smiled back.  I offered to carry her luggage on top of mine as she's heading to the same direction.

We started to chat.  we came from the neighboring towns.  If my GPA had been 0.2 point higher, we could've ended in the same high school.

Certainly, it was never too late.  We were here on the college campus, chatting while walking.  For a moment, I wished that she wasn't so chubby.  But her character was definitely an attracting one.  

The feeling that day was mutual.  Both understood for the first time what was love at first sight.

____________________________________________________________

Busy classes.  Projects; Field trips; the mundane college stuff for other kids.

These years were my best years; and hers, too.  Happy days outnumbered strained ones by 100 to 1.

A wink, a touch of hands, all of these sweet things were what left in my memory.

____________________________________________________________

Junior year summer, we had a little clique of four.  J proposed to have an excursion to Huashan.

We started in the late afternoon and the plan was to see the sunrise.

Except the next morning was very cloudy. Disappointed, we started heading down.

I was the leading the pack. 

On the last of these steep step, I was on the plank already; an ouch from C. 

Simple reflex.  Within a split of second, I fell to the plank.  Left hand on the inside of the plank and right hand grabbed C's arm.

____________________________________________________________
Every body yell hold on. Some guys tried to help to no avail.  There was no space.

I yelled hold on, grab tight.  Her voice is low, eyes were teary, murmuring, don't let me go.  

Sweat came out; it creeped from the back in the beginning then all the way to the hands. 

A piece of red sleeve was the only thing in the hand.

_____________________________________________________________

It escaped me how I got to the motel, although I wanted to jump down to go with her at one moment.

__________________________My story__________________________________

Guilty; because I proposed for the excursion. 

I went to the police station and told what happened. Then made a lot of phone calls to get thru to W and C's families.  Hard to be the messenger when the news was not a good one.

It didn't take too long for the police to recover the body in the late afternoon.  Half a dozen people fell each year at the same location; they knew exactly where to find them.

The next morning, both W's father and C's uncle came to meet us.  Broken hearts.  Some are more broken. Her mother got hospitalized at the news.

At the night in the hotel room, we were sitting there silently.  W murmured to carry her to the family graveyard, and his father shook his head.  There was not for negotiation.

____________________________________________________________________

The two middle aged men from the two families talked in business tone.  The final decision was W's father would pay for all the expenses. 

As per local custom of central China, they needed to find a dead husband for C, so she would form a family in the other world.  Otherwise she would be lonely.  This was normally done by an agreement of the two families without consent of the deceased ones, then the tomb of the previously deceased one was reopen and the coffin of the newly deceased was buried side by side. 

This had to be done fast as these days were hot.  Fortunately or unfortunately,  20 mile to the north, a young bachelor died of car accident several weeks ago.  His family felt so happy that they could find a wife for him.

There was a brief ceremony in the village of the young dead guy. We were told to keep off.  But W insisted and I had to go with him.  

W could not suppress this sobbing at one point. then we were pushed out.  "we are having a marriage ceremony; your irrelevant guys messed up the merry air "

_____________________________________________________________________

There are things that it is hard to let go.  I know that is what happening with W, as shown by the combination: the wife is a much smaller version of C, and the muscles of arms twice as large as these of a regular man.

But life doesn't give a chance to let you relive part of it.

Tuesday, October 6, 2015

Training material

The best way of learning is to sit in a training class.  Unfortunately either because short of fund on my personal side or on the employer side or on both side, I never got a chance to going to any of the these software training classes.  [Certainly in the remote past, I took several semesters of crystallography and mineralogy, and a semester of x ray diffraction in graduate school].  Thinking about the translations and rotations of the atoms really helps when having a hard time sleeping.

Training material on BGMN: 

Dr. Bergmann: bgmn.de

DR. Doblin
http://profex.doebelin.org/wp-content/uploads/2014/02/Lesson-4-Rietveld-Refinement.pdf

http://journals.iucr.org/j/issues/2015/05/00/kc5013/kc5013.pdf

Dr. Ufer and Dr. Kleeberg
http://www.nist.gov/mml/upload/6-3_KUfer_APD_IV.pdf

and their papers in 2004 and 2012 (I'll put the links here)
http://topaz.ethz.ch/function/web-het-secured/pdfs/Ufer-2005.pdf


(the following is my personal opinion.  you may completely disagree)

The 2004 paper's highlight: supercell and separate treatments of 00l and hkl

The 2012 paper's highlight: mixed-layer illite/smectite with random or ordered stratification (variation of reichweite number from 0 to 3); linked model (or shared parameters) between the two structures. My dream a while back was to combine newmod and wildfire together with refinable parameters; now it comes true.  

Interfaces & Editors


I  just read through Dr Dobelin's manual .  Dr Dobelin not only wrote a nice software, but also teaches very clearly.

The GUI puts together things for you unless you like the DOS window very much.  The nicest feature is that it calls out the mineral if you double click on the peak.  That is a big step forward.

Loading various files is handled in the background.  You can add or remove a str file by a click.  It also has an internal editor. 

What is a little confusing to me includes the following items:
1. when reading Bruker's raw files, the time may be a combination of the number of 1D PSD channels and the real time.
2. the index number of str files can be very stubborn after you manually change one number.

MAYBE I NEED TO COME BACK TO THIS AFTER AQ COMES IN
_______________________
Talking about an editor.  I always wish that there is a notepad-like editor that allows you to define various key words. PFE is a good one as it allows metacharacters, such as \n, \t etc.  http://www.lancaster.ac.uk/staff/steveb/cpaap/pfe/.   Notepad2 is my current favorite http://www.flos-freeware.ch/notepad2.html.  It shows the keywords of various languages.  Fortunately we have these editors, using something like vi is a nightmare.  Only occasionally I use the command "cat  >1.sav", which allow you drag an icon from window explorer to the black window without typing the lengthy path.  Notepad++ allows you to define your own keyword sets, but the size of the program is too large for me.

_______________________
So much for editors with GUIs.
I like the stream editor a lot; cannot go too much into details because the next generation will laugh at the idea of using a stream editor. 


Friday, October 2, 2015

Software Usage in Clay Quantification Contests

I always get intrigued about how many people in Houston texas are using each of the following software.  Unfortunately, I don't know anything.

Here is the software usage for the top places in Reynold's cup. 


Year
Gold
Silver
Bronze
2002
BGMN/AQ
BGMN/AQ
XLSMin, RockJock
2004
0.5SiroQT, 0.5Topas
Quanta
BGMN/AQ, XLSMin
2006
Quanta
XLSMin
BGMN/AQ
2008
XLSMin
2xBGMN/AQ
BGMN/AQ, SiroQT, FullPat, RockJock
2010
SiroQT
RockJock
BGMN/AQ
2012
BGMN/AQ
XLSMin
BGMN/AQ
2014
BGMN/AQ
XLSMin
2xBGMN/AQ

cat used in named functions

"cat" can also be named as previously said.  These examples show its uses.  note the examples are for demonstration purposes; certainly anything can be named.

To define/name a function, use the ":"
for example, I would like to name a function "testJZ", which would take 5 arguments.  It would be like (note the following function is not doing any meaningful thing except returning a value of 1)

testJZ(5): cat(ifthenelse(#1*#2*#3*#4*#5.eq.0, 1, testJZ(#1+1,#2+2,#3+3,#4+4,#5+5)))

where the arguments are referred to as # and the order they appear in the definition statement. 
The logic check .eq. means equals to; or eq(exp1, exp2), returning 1 if they are equal; or 0 if they are not.

another example, to test how powerful your computer, is.

testJZ(1):cat(#1+1+testJZ(#1+1))

certainly the problem arises if you define testJZ(10000000)


_____________________________
The following paragraphs in italics are from bgmn.de:

name(argumentcount):expression
A positive count of argument defines a fixed value, the absolute value of a negative argument count defines a lower limit of argument count. expression may contain the special symbols
#1 #2...
which are replaced by the evaluated numeric value of the first, second... argument.

Every argument is evaluated only once. An erroneous argument causes an error only if it will be used. Example:

faculty(1):ifthenelse(eq(#1,0),1,#1*faculty(#1-1))
or using level 3.3.29 or above:

faculty(1):cat(n==#1,ret==1,while(n,ret==ret*n,n==n-1),ret)
 
Note, the word faculty in the above functions is normally called factorial on this side of the ocean.  Normally it is realized via recursive method as in the example. 
 
Factorial(N)=N*(N-1)*(N-2)*..............*3*2*1

Wednesday, September 30, 2015

command "cat": clean and powerful

There are several commands that are very powerful; such as the command "cat".

The word cat comes from the word concatenate; it is commonly used in various languages.  For example, cat in unix connects/links the file content to the monitor. 

 

The cat command can be "infinitely" long; it contains/links a mixture of expressions and statements; the last one is normally an expression, which happens to be the return value.  (sometimes, I wonderwhat  if the right most one is a statement; does it evaluate and return? e.g a=7  does it return a true or false or return a value for the assignment )

Here is an example:

cat(s==0,i==1,while(le(i,N),s==s+p[i],i==i+1), 5*s)

the command line contains two assignments, one loop, one return value.  In plain English, the above line says that we assign 0 to s and 1 to i; then we check whether i is smaller or equal to N or not, if yes, we add up all the p elements, and move up the counter i to the next one; when this thing done, we evaluate the expression 5 multiplied by s and return it if there is a holder for it.

if we write in C++, it may look like this

for (s=0, i=1; i <=N; i++) s+=p[i]; return 5*s;

For a simple loop, one may wonder why bother using cat (my kid used to ask me why write several lines to calculate the sum of 3 numbers, in a similar way); the beauty of using cat is for complicated cases; it is very powerful and it is cleanly structured.  moreover, nesting is permitted.

Imagine the whole thing is named; how more powerful can we get? 

I personally admire the beautiful mind from where these nice things flew out. 


Monday, September 28, 2015

The strengths of TOPAS

Dr. Wang, an expert in Topas, of Bruker, would like to emphasize that Topas has many advance features.

Listed here are some of them:

  • Topas has a batch command on top of the GUI and kernel; and Topas BBQ is widely used in cement industry and mineral industry
    • peak file parameters are not refined, i.e. the peak profiles are based on the physics, such as the the Xray tube, radii, all slits size.  "The fundamental parameter approach in TOPAS also use convolution based peak shape and calculate instrumental peak broadening based on physical parameters like divergence slit size and goniometer radius etc. The actual fundamental parameter approach is published by the author of TOPAS: Dr. Coelho himself."  
    • background refinement is automated. 
    • There is no hard limit on the number of phases, parameters, and data points for refinement
  • Both spherical harmonics and MD are implemented to handle preferred orientation
  • Line broadening are modeled.
  • Strongly disordered kaolinite and turbostratically disordered phases can be handled. Available in various versions.
  • Mircoabsorption is corrected wit Brindley model since v1.
  • "TOPAS has implemented both Internal standard method and External standard method, and PONKCS method for quantification of phases without structure model"
  • Many other special features, such as defining rigid and non-rigid bodies, the rotation, translation and torsion of the whole or parts of them, bond length linked to atom occupancy.

On top of these advance features, convenience features are also there.  For example, all the keywords are written in English and self explanatory; and  running the refinement needs only two files ( the raw data, .raw file and the input, .inp file).

Because of these and many other possibilities TOPAS offers, the usage of TOPAS is much more wider.  A search in the International Union of Crystallography themselves would show the current the number of citations.  The following is an example, showing a high number of appearance.  http://journals.iucr.org/