TABLE OF CONTENTS
::pwtk::coorToCrystal
SYNOPSIS
proc ::pwtk::coorToCrystal {latvec coor} {
PURPOSE
Transform Cartesian coordinates to crystal coordinates. It is assumed that unit-cell vectors and coordinates are in the same units.
ARGUMENTS
- latvec -- unit-cell lattice vectors (specified either as a vector of 9 numbers, {v1x v1y v1z v2x v2y v2z v3x v3y v3z}, or 3x3 list of lists)
- coor -- atomic Cartesian coordinates
RETURN VALUE
- atomic coordinates in crystal units
SOURCE
set crysCoor {} set Tinv [invert3x3 $latvec] foreach line [split [purifyCoor $coor] \n] { if { [llength $line] == 4 || [llength $line] == 7 } { set xyz [lassign $line asym] append crysCoor "$asym [::math::linearalgebra::matmul $xyz $Tinv]\n" } } return $crysCoor }