aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorAlexandra Tolstikova <alexandra.tolstikova@desy.de>2015-02-11 16:18:18 +0100
committerAlexandra Tolstikova <alexandra.tolstikova@desy.de>2015-02-11 16:18:18 +0100
commit21b67e8dc422ee5f437bf2e31c5616982fc41c98 (patch)
tree4df32d02e3ad6f5cb9c6b35256d30fa6c7309627 /libcrystfel/src
parenta095923e5ee59201c43e3722903bae8745e40bf3 (diff)
Move cell_get_volume from asdf.c to cell_utils.c
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/asdf.c27
-rw-r--r--libcrystfel/src/cell-utils.c28
-rw-r--r--libcrystfel/src/cell-utils.h2
3 files changed, 30 insertions, 27 deletions
diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c
index 28afe82d..0b890ef8 100644
--- a/libcrystfel/src/asdf.c
+++ b/libcrystfel/src/asdf.c
@@ -995,33 +995,6 @@ static int index_refls(gsl_vector **reflections, int N_reflections,
}
-double cell_get_volume(UnitCell *cell)
-{
- double asx, asy, asz;
- double bsx, bsy, bsz;
- double csx, csy, csz;
- struct rvec aCb;
- double volume;
-
- if ( cell_get_reciprocal(cell, &asx, &asy, &asz,
- &bsx, &bsy, &bsz,
- &csx, &csy, &csz) ) {
- ERROR("Couldn't get cell cartesian.\n");
- return 0;
- }
-
- /* "a" cross "b" */
- aCb.u = asy*bsz - asz*bsy;
- aCb.v = - (asx*bsz - asz*bsx);
- aCb.w = asx*bsy - asy*bsx;
-
- /* "a cross b" dot "c" */
- volume = (aCb.u*csx + aCb.v*csy + aCb.w*csz)/1e30;
-
- return 1/volume;
-}
-
-
int run_asdf(struct image *image, IndexingPrivate *ipriv)
{
int i, j;
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c
index 95e7353e..5fc885e5 100644
--- a/libcrystfel/src/cell-utils.c
+++ b/libcrystfel/src/cell-utils.c
@@ -1567,3 +1567,31 @@ int forbidden_reflection(UnitCell *cell,
return 0;
}
+
+
+/* Returns cell volume in A^3 */
+double cell_get_volume(UnitCell *cell)
+{
+ double asx, asy, asz;
+ double bsx, bsy, bsz;
+ double csx, csy, csz;
+ struct rvec aCb;
+ double rec_volume;
+
+ if ( cell_get_reciprocal(cell, &asx, &asy, &asz,
+ &bsx, &bsy, &bsz,
+ &csx, &csy, &csz) ) {
+ ERROR("Couldn't get reciprocal cell.\n");
+ return 0;
+ }
+
+ /* "a" cross "b" */
+ aCb.u = asy*bsz - asz*bsy;
+ aCb.v = - (asx*bsz - asz*bsx);
+ aCb.w = asx*bsy - asy*bsx;
+
+ /* "a cross b" dot "c" */
+ rec_volume = (aCb.u*csx + aCb.v*csy + aCb.w*csz)/1e30;
+
+ return 1/rec_volume;
+}
diff --git a/libcrystfel/src/cell-utils.h b/libcrystfel/src/cell-utils.h
index 0b900096..98bc667c 100644
--- a/libcrystfel/src/cell-utils.h
+++ b/libcrystfel/src/cell-utils.h
@@ -74,6 +74,8 @@ extern LatticeType lattice_from_str(const char *s);
extern int forbidden_reflection(UnitCell *cell,
signed int h, signed int k, signed int l);
+extern double cell_get_volume(UnitCell *cell);
+
#ifdef __cplusplus
}
#endif