From 645edae8173996f28686315b05253d4d4db94ccb Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 26 Jul 2011 18:02:53 +0200 Subject: Fix get_asymm() (again) --- src/symmetry.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/symmetry.c') diff --git a/src/symmetry.c b/src/symmetry.c index 70820db2..8f88b69d 100644 --- a/src/symmetry.c +++ b/src/symmetry.c @@ -999,6 +999,15 @@ void special_position(const SymOpList *ops, SymOpMask *m, } +static int any_negative(signed int h, signed int k, signed int l) +{ + if ( h < 0 ) return 1; + if ( k < 0 ) return 1; + if ( l < 0 ) return 1; + return 0; +} + + /** * get_asymm: * @ops: A %SymOpList, usually corresponding to a point group @@ -1027,26 +1036,46 @@ void get_asymm(const SymOpList *ops, int nequiv; int p; signed int best_h, best_k, best_l; + int have_negs; nequiv = num_equivs(ops, NULL); best_h = h; best_k = k; best_l = l; + have_negs = any_negative(best_h, best_k, best_l); for ( p=0; p best_h ) { best_h = *hp; best_k = *kp; best_l = *lp; + have_negs = any_negative(best_h, best_k, best_l); continue; } + if ( *hp < best_h ) continue; if ( *kp > best_k ) { best_h = *hp; best_k = *kp; best_l = *lp; + have_negs = any_negative(best_h, best_k, best_l); continue; } + if ( *kp < best_k ) continue; if ( *lp > best_l ) { best_h = *hp; best_k = *kp; best_l = *lp; + have_negs = any_negative(best_h, best_k, best_l); continue; } -- cgit v1.2.3