Conversion from cartesian to fractional coordinates

In summary, the conversation is about converting from cartesian to fractional coordinates using reference from Wikipedia and other sources. The code provided by the speaker is not working for some test values, and it is suggested to check the orientation of the axes. The speaker has also tried using the inverse transformation matrix for the conversion, but the issue might be with choosing the correct lattice vector. The speaker requests for validation of the code or alternative data to test it with.
  • #1
pushkalcodes
2
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
  • #2
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)
[/tex]

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.
 
  • #3
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
 

What is the purpose of converting from cartesian to fractional coordinates?

The conversion from cartesian to fractional coordinates is used to represent the position of atoms in a crystal structure in a more convenient and intuitive way. Fractional coordinates are expressed in terms of the unit cell, making it easier to compare the positions of atoms in different crystal structures.

How do you convert cartesian coordinates to fractional coordinates?

To convert from cartesian coordinates to fractional coordinates, the cartesian coordinates are divided by the length of the corresponding unit cell vector. This gives the coordinates in terms of the unit cell dimensions, making them fractional. The resulting fractional coordinates are typically expressed as a fraction or decimal value between 0 and 1.

Can fractional coordinates be negative?

Yes, fractional coordinates can be negative. Negative fractional coordinates represent positions outside the unit cell or positions on the opposite side of the unit cell. This can be useful when representing atoms in a crystal structure that extend beyond the boundaries of the unit cell.

What is the relationship between cartesian and fractional coordinates?

Cartesian and fractional coordinates are two ways of representing the same position of an atom in a crystal structure. Cartesian coordinates use x, y, and z coordinates to represent the position in three-dimensional space, while fractional coordinates use a, b, and c coordinates to represent the position in terms of the unit cell dimensions. The conversion between the two allows for easier comparison and manipulation of crystal structures.

Is there a formula for converting from cartesian to fractional coordinates?

Yes, the formula for converting from cartesian to fractional coordinates is: a = x/a, b = y/b, c = z/c, where x, y, and z are the cartesian coordinates and a, b, and c are the unit cell dimensions. This formula is based on the relationship between the unit cell vectors and the cartesian coordinates.

Similar threads

Replies
2
Views
1K
Replies
1
Views
803
Replies
20
Views
3K
Replies
2
Views
503
  • Electromagnetism
Replies
4
Views
791
  • Differential Geometry
Replies
0
Views
619
  • Precalculus Mathematics Homework Help
Replies
1
Views
2K
  • Linear and Abstract Algebra
Replies
1
Views
759
Back
Top