diff options
author | Thomas White <taw@physics.org> | 2010-01-12 14:57:57 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-01-12 14:57:57 +0100 |
commit | aec12416e6af499306fd7579ec897b7d03e0f251 (patch) | |
tree | 46d1aea008149167aa83a9ed5c40c7b949efc36c | |
parent | f15a2bd9185819365e3d84f878d1225822a93e3e (diff) |
Read the unit cell the right way round
-rw-r--r-- | src/cell.c | 12 | ||||
-rw-r--r-- | src/cell.h | 9 | ||||
-rw-r--r-- | src/dirax.c | 24 |
3 files changed, 21 insertions, 24 deletions
@@ -146,31 +146,31 @@ void cell_set_cartesian(UnitCell *cell, } -void cell_set_cartesian_x(UnitCell *cell, double ax, double bx, double cx) +void cell_set_cartesian_a(UnitCell *cell, double ax, double ay, double az) { if ( !cell ) return; - cell->ax = ax; cell->bx = bx; cell->cx = cx; + cell->ax = ax; cell->ay = ay; cell->az = az; cell_update_crystallographic(cell); } -void cell_set_cartesian_y(UnitCell *cell, double ay, double by, double cy) +void cell_set_cartesian_b(UnitCell *cell, double bx, double by, double bz) { if ( !cell ) return; - cell->ay = ay; cell->by = by; cell->cy = cy; + cell->bx = bx; cell->by = by; cell->bz = bz; cell_update_crystallographic(cell); } -void cell_set_cartesian_z(UnitCell *cell, double az, double bz, double cz) +void cell_set_cartesian_c(UnitCell *cell, double cx, double cy, double cz) { if ( !cell ) return; - cell->az = az; cell->bz = bz; cell->cz = cz; + cell->cx = cx; cell->cy = cy; cell->cz = cz; cell_update_crystallographic(cell); } @@ -60,12 +60,9 @@ extern void cell_get_cartesian(UnitCell *cell, double *bx, double *by, double *bz, double *cx, double *cy, double *cz); -extern void cell_set_cartesian_x(UnitCell *cell, - double ax, double bx, double cx); -extern void cell_set_cartesian_y(UnitCell *cell, - double ay, double by, double cy); -extern void cell_set_cartesian_z(UnitCell *cell, - double az, double bz, double cz); +extern void cell_set_cartesian_a(UnitCell *cell, double ax, double ay, double az); +extern void cell_set_cartesian_b(UnitCell *cell, double bx, double by, double bz); +extern void cell_set_cartesian_c(UnitCell *cell, double cx, double cy, double cz); extern void cell_get_reciprocal(UnitCell *cell, double *asx, double *asy, double *asz, diff --git a/src/dirax.c b/src/dirax.c index 8606ff44..070e714d 100644 --- a/src/dirax.c +++ b/src/dirax.c @@ -83,26 +83,26 @@ static void dirax_parseline(const char *line, struct image *image) /* Parse unit cell vectors as appropriate */ if ( image->dirax_read_cell == 1 ) { /* First row of unit cell values */ - float x1, x2, x3, d; - sscanf(line, "%f %f %f %f %f %f", &d, &d, &d, &x1, &x2, &x3); - cell_set_cartesian_x(image->molecule->cell, - x1*1e-10, x2*1e-10, x3*1e-10); + float ax, ay, az, d; + sscanf(line, "%f %f %f %f %f %f", &d, &d, &d, &ax, &ay, &az); + cell_set_cartesian_a(image->molecule->cell, + ax*1e-10, ay*1e-10, az*1e-10); image->dirax_read_cell++; return; } else if ( image->dirax_read_cell == 2 ) { /* First row of unit cell values */ - float y1, y2, y3, d; - sscanf(line, "%f %f %f %f %f %f", &d, &d, &d, &y1, &y2, &y3); - cell_set_cartesian_y(image->molecule->cell, - y1*1e-10, y2*1e-10, y3*1e-10); + float bx, by, bz, d; + sscanf(line, "%f %f %f %f %f %f", &d, &d, &d, &bx, &by, &bz); + cell_set_cartesian_b(image->molecule->cell, + bx*1e-10, by*1e-10, bz*1e-10); image->dirax_read_cell++; return; } else if ( image->dirax_read_cell == 3 ) { /* First row of unit cell values */ - float z1, z2, z3, d; - sscanf(line, "%f %f %f %f %f %f", &d, &d, &d, &z1, &z2, &z3); - cell_set_cartesian_z(image->molecule->cell, - z1*1e-10, z2*1e-10, z3*1e-10); + float cx, cy, cz, d; + sscanf(line, "%f %f %f %f %f %f", &d, &d, &d, &cx, &cy, &cz); + cell_set_cartesian_c(image->molecule->cell, + cx*1e-10, cy*1e-10, cz*1e-10); STATUS("Read a direct space unit cell from DirAx\n"); /* FIXME: Do something */ image->dirax_read_cell = 0; |