aboutsummaryrefslogtreecommitdiff
path: root/src/cell.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cell.c')
-rw-r--r--src/cell.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cell.c b/src/cell.c
index 5747ed63..408b5bf3 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -262,11 +262,25 @@ static UnitCell *cell_new_from_axes(struct rvec as, struct rvec bs,
cell->cy = gsl_matrix_get(inv, 2, 1);
cell->cz = gsl_matrix_get(inv, 2, 2);
+ gsl_matrix_free(inv);
+
cell_update_crystallographic(cell);
return cell;
}
+UnitCell *cell_new_from_cell(UnitCell *orig)
+{
+ UnitCell *new;
+
+ new = malloc(sizeof(UnitCell));
+
+ *new = *orig;
+
+ return new;
+}
+
+
void cell_get_cartesian(UnitCell *cell,
double *ax, double *ay, double *az,
double *bx, double *by, double *bz,
@@ -321,6 +335,8 @@ void cell_get_reciprocal(UnitCell *cell,
*asz = gsl_matrix_get(inv, 2, 0);
*bsz = gsl_matrix_get(inv, 2, 1);
*csz = gsl_matrix_get(inv, 2, 2);
+
+ gsl_matrix_free(inv);
}