aboutsummaryrefslogtreecommitdiff
path: root/src/cell.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-11-15 16:17:02 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:05 +0100
commit1b4fa114decd9c36324feed00296cb40088a9062 (patch)
tree2d313458c29c6f4ac5de5513639020558eaaa556 /src/cell.c
parentfcde5d4f2fd95845402b86c3838f15b6632a8071 (diff)
Zap quats
The "orientation" quaternion should not rotate the Ewald sphere, but the crystal. This cleans things up a little, removing "orientation" from "struct image".
Diffstat (limited to 'src/cell.c')
-rw-r--r--src/cell.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/cell.c b/src/cell.c
index 7b5379a5..e95a0573 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -486,6 +486,28 @@ static const char *cell_rep(UnitCell *cell)
}
+UnitCell *cell_rotate(UnitCell *in, struct quaternion quat)
+{
+ struct rvec a, b, c;
+ struct rvec an, bn, cn;
+ UnitCell *out = cell_new();
+
+ cell_get_cartesian(in, &a.u, &a.v, &a.w,
+ &b.u, &b.v, &b.w,
+ &c.u, &c.v, &c.w);
+
+ an = quat_rot(a, quat);
+ bn = quat_rot(b, quat);
+ cn = quat_rot(c, quat);
+
+ cell_set_cartesian(out, an.u, an.v, an.w,
+ bn.u, bn.v, bn.w,
+ cn.u, cn.v, cn.w);
+
+ return out;
+}
+
+
void cell_print(UnitCell *cell)
{
double asx, asy, asz;