00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef CLIPPER_SPACEGROUP
00047 #define CLIPPER_SPACEGROUP
00048
00049
00050 #include "symop.h"
00051 #include "spacegroup_data.h"
00052
00053
00054 namespace clipper {
00055
00056
00057 class HKL;
00058 class HKL_class;
00059 class Coord_frac;
00060
00061
00063
00073 class Spgr_descr
00074 {
00075 public:
00076 enum TYPE { Hall, HM, Symops, Number, Unknown };
00078 Spgr_descr();
00080 explicit Spgr_descr( const String& symb, TYPE type = Unknown );
00082 explicit Spgr_descr( const int& num );
00084 int spacegroup_number() const;
00086 String symbol_hall() const;
00088 String symbol_hm() const;
00090 static void set_preferred( const char& c );
00091
00093 class Symop_codes : public std::vector<Symop_code>
00094 {
00095 public:
00097 void init_hall( const String& symb );
00099 void init_symops( const String& symb );
00101 Symop_codes expand() const;
00103 Symop_codes primitive_noninversion_ops() const;
00105 Symop_codes inversion_ops() const;
00107 Symop_codes primitive_ops() const;
00109 Symop_codes centering_ops() const;
00111 Symop_codes laue_ops() const;
00113 Symop_codes pgrp_ops() const;
00115 Symop_codes patterson_ops() const;
00117 Symop_codes generator_ops() const;
00119 Symop_codes product( const Symop_codes& ops2 ) const;
00121 unsigned int hash() const;
00122 };
00123
00125 explicit Spgr_descr( const Symop_codes& ops );
00127 const Symop_codes& generator_ops() const { return generators_; }
00129 const unsigned int& hash() const { return hash_; }
00130
00131 protected:
00132 unsigned int hash_;
00133 Symop_codes generators_;
00134
00135 static char pref_12, pref_hr;
00136 };
00137
00138
00139
00140 typedef Spgr_descr Spgr_cachekey;
00141
00142
00143 class Spgr_cacheobj
00144 {
00145 public:
00146 Spgr_cacheobj( const Spgr_cachekey& spgr_cachekey );
00147 bool matches( const Spgr_cachekey& spgr_cachekey ) const;
00148 String format() const;
00149
00150 Spgr_cachekey spgr_cachekey_;
00151 int nsym, nsymn, nsymi, nsymc, nsymp;
00152 int lgrp;
00153 std::vector<Symop> symops;
00154 std::vector<Isymop> isymops;
00155 Vec3<> asu_min_, asu_max_;
00156 };
00157
00158
00160
00169 class Spacegroup : public Spgr_descr
00170 {
00171 public:
00173 enum TYPE { Null, P1 };
00175 enum AXIS { A=0, B=1, C=2 };
00177 Spacegroup() {};
00179 explicit Spacegroup( TYPE type );
00181 explicit Spacegroup( const Spgr_descr& spgr_descr );
00183 void init( const Spgr_descr& spgr_descr );
00184
00186 bool is_null() const;
00187
00188
00190 inline const Spgr_descr& descr() const { return (*this); }
00192 inline const int& num_symops() const { return nsym; }
00194 inline const int& num_primops() const { return num_primitive_symops(); }
00196 inline const int& num_primitive_symops() const { return nsymp; }
00198 inline const int& num_centering_symops() const { return nsymc; }
00200 inline const int& num_inversion_symops() const { return nsymi; }
00202 inline const int& num_primitive_noninversion_symops() const { return nsymn;}
00204 inline const Symop& symop( const int& sym_no ) const
00205 { return symops[sym_no]; }
00207 inline const Symop& primitive_symop( const int& sym_no ) const
00208 { return symops[sym_no]; }
00210 inline const Symop& inversion_symop( const int& sym_no ) const
00211 { return symops[nsymn*sym_no]; }
00213 inline const Symop& centering_symop( const int& sym_no ) const
00214 { return symops[nsymp*sym_no]; }
00216 int order_of_symmetry_about_axis( const AXIS axis ) const;
00217
00219 HKL_class hkl_class( const HKL& hkl ) const;
00221 bool recip_asu( const HKL& hkl ) const;
00222
00224 int product_op( const int& s1, int& s2 ) const;
00226 int inverse_op( const int& s ) const;
00227
00229 Coord_frac asu_max() const;
00231 Coord_frac asu_min() const;
00232
00234 bool invariant_under_change_of_hand() const;
00235
00236
00237
00238
00239
00241 String symbol_laue() const;
00242
00244 static Spacegroup p1() { return Spacegroup( P1 ); }
00246 static Spacegroup null() { return Spacegroup( Null ); }
00247
00248 void debug() const;
00249
00250 private:
00251 ObjectCache<Spgr_cacheobj>::Reference cacheref;
00252 const Symop* symops;
00253 const Isymop* isymops;
00254 data::ASUfn asufn;
00255 int nsym, nsymn, nsymi, nsymc, nsymp;
00256 };
00257
00258
00259 }
00260
00261 #endif