Register to reply

Conversion from cartesian to fractional coordinates

Share this thread:
Jun4-10, 09:03 AM
P: 2
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 -, but still, the code doesn't work for some test values. The code is here 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 -

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.
Phys.Org News Partner Mathematics news on
Researcher figures out how sharks manage to act like math geniuses
Math journal puts Rauzy fractcal image on the cover
Heat distributions help researchers to understand curved space
Jun4-10, 01:29 PM
P: 416
It seems like you're doing a lot more work than necessary. You want something like:

[tex]\vec{R} = x_1 \vec{a}_1 + x_2 \vec{a}_2 + x_3 \vec{a}_3[/tex]

which can be written in matrix form as

[tex]\vec{R} = A \cdot
\left( \begin{array}{c} x_1 \\ x_2 \\ x_3 \end{array}\right)

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.
Jun7-10, 12:44 AM
P: 2
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.


Register to reply

Related Discussions
Conversion of cartesian coordinates to polar coordinates Calculus & Beyond Homework 3
Screen Coordinates to Cartesian Coordinates Programming & Computer Science 3
Conversion from Cartesian to toroidal coordinates Linear & Abstract Algebra 22
Conversion from Cartesian to Cylindrical Coordinates Calculus & Beyond Homework 14
Ball coordinates to cartesian coordinates General Math 5