frac_to_orth: From fractional to orthogonal coordinates

View source: R/clattice.R

frac_to_orthR Documentation

From fractional to orthogonal coordinates

Description

This function transforms any number of fractional coordinates (x_f,y_f,z_f), arranged as a vector or in a matrix or data frame, into the corresponding number of orthogonal coordinates (x,y,z), arranged in the same format.

  1. ochoice = 1: X axis along a; Y axis normal to a, in the (a,b) plane; Z axis normal to X and Y (and therefore parallel to c*).

  2. ochoice = 2: this is also called "Cambridge setting". The X axis is along a*; the Y axis lies in the (a*,b*) plane; the Z axis is, consequently, along c.

Usage

frac_to_orth(xyzf, a, b, c, aa, bb, cc, ochoice = 1)

Arguments

xyzf

A vector or n\times 3 matrix or data frame of fractional crystal coordinates.

a

A real number. One of the unit cell's side lengths, in angstroms.

b

A real number. One of the unit cell's side lengths, in angstroms.

c

A real number. One of the unit cell's side lengths, in angstroms.

aa

A real number. One of the unit cell's angles, in degrees.

bb

A real number. One of the unit cell's angles, in degrees.

cc

A real number. One of the unit cell's angles, in degrees.

ochoice

A natural integer indicating the choice of orthogonal transformation. 1 corresponds to the first choice and 2 to the second choice in Giacovazzo's book (see xtal_mat01 and xtal_mat02).

Value

A n\times 3 matrix or data frame of orthogonal coordinates corresponding to the fractional coordinates provided in the input.

Examples

# Matrix containing 3 fractional coordinates
xyzf <- matrix(c(0.1,0.2,0.3,0.2,0.6,0.7,0.15,0.28,0.55),ncol=3,byrow=TRUE)

# Cartesian coordinates
xyz <- frac_to_orth(xyzf,10,30,20,90,90,90,1)

cry documentation built on Oct. 10, 2022, 9:06 a.m.