diff options
author | Thomas White <taw@physics.org> | 2019-02-22 14:50:37 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-03-11 16:49:37 +0100 |
commit | afa301a4737178db4aa0b413c6c0a41f6ee5e4ec (patch) | |
tree | 92b16a6b3b0f4822272928929a03513d0f790e0f | |
parent | 3a098d01569348a9680fca45ba4786f3a15761a3 (diff) |
cell_tool: Implement --cell-choices
-rw-r--r-- | src/cell_tool.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/cell_tool.c b/src/cell_tool.c index 9b7d6a6b..9f41afb7 100644 --- a/src/cell_tool.c +++ b/src/cell_tool.c @@ -60,6 +60,7 @@ static void show_help(const char *s) " --uncenter Calculate a primitive cell.\n" " --rings Calculate powder ring positions.\n" " --compare-cell <file> Compare unit cell with cell from <file>.\n" +" --cell-choices Calculate all three cell choices for monoclinic C cell.\n" "\n" " -y <pointgroup> Real point group of the structure.\n" " --tolerance=<tol> Set the tolerances for cell comparison.\n" @@ -353,6 +354,25 @@ static int transform(UnitCell *cell, const char *trans_str) } +static int cell_choices(UnitCell *cell) +{ + if ( cell_get_lattice_type(cell) != L_MONOCLINIC ) { + ERROR("Cell must be monoclinic to use --cell-choices\n"); + return 1; + } + + if ( cell_get_unique_axis(cell) == 'b' ) { + transform(cell, "-a-c,b,a"); + transform(cell, "c,b,-a-c"); + } else { + ERROR("Sorry, --cell-choices only supports unique axis b.\n"); + return 1; + } + + return 0; +} + + enum { CT_NOTHING, CT_FINDAMBI, @@ -525,8 +545,7 @@ int main(int argc, char *argv[]) if ( mode == CT_RINGS ) return all_rings(cell, sym, rmax); if ( mode == CT_COMPARE ) return comparecells(cell, comparecell, ltl, atl); if ( mode == CT_TRANSFORM ) return transform(cell, trans_str); + if ( mode == CT_CHOICES ) return cell_choices(cell); - /* FIXME: Everything else */ - ERROR("Sorry, this mode of operation is not yet implemented.\n"); return 1; } |