Conversion from cartesian to fractional coordinates

AI Thread Summary
The discussion focuses on the challenges of converting Cartesian coordinates to fractional coordinates, with the original poster expressing doubts about their code's functionality despite following Wikipedia's guidelines. They suspect that the issue may stem from the orientation of the axes, particularly whether the chosen lattice vector aligns with the Cartesian x-axis. A suggestion is made to use a transformation matrix for the conversion, emphasizing the importance of correctly selecting the lattice vector's orientation. The poster seeks validation of their code and additional test data from others in the community. The conversation highlights the complexities involved in coordinate transformation and the need for precise axis alignment.
pushkalcodes
Messages
2
Reaction score
0
Hi all,

I have been trying to write code to convert from cartesian to fractional coordinates. I think everything is correct in my code (i have used wikipedia as reference - http://en.wikipedia.org/wiki/Fractional_coordinates), but still, the code doesn't work for some test values. The code is here http://codepad.org/sOV5ws5R. The code has the test data in there, if you want to check.

Could there be something wrong with the orientation of the axes? In wikipedia it has been assumed that cartesian coordinate axes X is in line with the lattice vector 'a'. It might be that the data I have doesn't correspond to this scheme (that the lattice vector 'a' is taken along x-axis). How to check if this the data which I have adheres to this scheme or is some other axis is directional along x-axis?

Other references that might be helpful -
http://www.angelfire.com/linux/myp/FracCor/fraccor.html
http://cci.lbl.gov/cctbx/frac_cart.html

I have really tried hard to find a solution for this, but couldn't find out where I am going wrong.

Thanks for your time.
 
Last edited by a moderator:
Mathematics news on Phys.org
It seems like you're doing a lot more work than necessary. You want something like:

\vec{R} = x_1 \vec{a}_1 + x_2 \vec{a}_2 + x_3 \vec{a}_3

which can be written in matrix form as

\vec{R} = A \cdot<br /> \left( \begin{array}{c} x_1 \\ x_2 \\ x_3 \end{array}\right)<br />

where the matrix A is formed with the vectors a_i as its columns. Then you just need to invert the matrix to find the x's.
 
Hi,
Thanks for your reply. I have done the conversion exactly as you have described, using the inverse transformation matrix for conversion from cartesian to fractional coordinates.
The problem is with the axes I am choosing. In the conversion, one has to choose one of the lattice vectors being parallel to either of the x,y or z axis (x,y,z axis of cartesian or orthonormal coordinates). I might be going wrong there.

If anyone else can kindly validate the code with any other data they have, or can post data here, it'd be great.

Thanks
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top