Skip to main content

A lightweight Python package for converting between fractional and Cartesian coordinates, supporting both forward and inverse transformations.

Project description

Frac-to-cart-coordinates

The Frac-to-cart-coordinates package allows users to easily convert atomic coordinates from Cartesian to fractional format and vice versa, based on the unit cell parameters.

Overview

In crystallography, atomic positions within a crystal's unit cell can be described using:

  • Fractional coordinates $(x/a, y/b, z/c)$, which refer to the natural axes (a, b, c), scaled by their respective unit cell lengths.
  • Orthogonal coordinates $(X, Y, Z)$, which use a right-angled Cartesian system with distances measured in Ångstroms.

For triclinic unit cells, the relationship between these coordinate systems involves a transformation matrix with non-trivial elements.

This implementation follows the methodology described on Jon Cooper's website, fractorth. It relies on the fundamental principles of spherical trigonometry (see implementation_details).

Installation

Run the following command in your terminal:

pip install Frac-to-cart-coordinates

Make sure you have numpy installed and Python 3.6 or higher.

Usage

Importing the Module

from Fractocart import convert_to_fractional_coordinates, convert_to_cartesian_coordinates

Functions

  1. Convert to Fractional Coordinates

    fractional_coords = convert_to_fractional_coordinates(cartesian_coords, unit_cell)
    
  2. Convert to Cartesian Coordinates

    cartesian_coords = convert_to_cartesian_coordinates(fractional_coords, unit_cell)
    

Contributing

Contributions are welcome! To contribute:

  1. Clone the repository.
  2. Create a feature branch (git checkout -b feature-name).
  3. Commit your changes (git commit -m "Add new feature").
  4. Push to the branch (git push origin feature-name).
  5. Open a merge request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Frac-to-cart-coordinates-1.1.4.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Frac_to_cart_coordinates-1.1.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file Frac-to-cart-coordinates-1.1.4.tar.gz.

File metadata

File hashes

Hashes for Frac-to-cart-coordinates-1.1.4.tar.gz
Algorithm Hash digest
SHA256 f5fa80b79b9a10f828604559e837addde9b19af3051bd12ae3171ed1c3ee3fcc
MD5 e3ab7c5ff0e4664c4371b9f86f05e8b7
BLAKE2b-256 fbd3fa1bcde6b70e68bb25ade99504c3b7ad410ff4fbc5ec6f2da89e83cde22d

See more details on using hashes here.

File details

Details for the file Frac_to_cart_coordinates-1.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for Frac_to_cart_coordinates-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fb389b9a8f707ea0d656a8d4bf4aba94b6ec6c1f97f3e32cd6f82128dc6aebac
MD5 8c5efb3271c0bbb5e4b84574b5f6cd2b
BLAKE2b-256 09ca36381c23decc6fe8fc097d25d85a62572336cf916efdc8de0118adc5b6be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page