00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SYM_POINTGROUP
00009 #define SYM_POINTGROUP
00010
00011 #include <cctbx/crystal/symmetry.h>
00012 #include <cctbx/sgtbx/lattice_symmetry.h>
00013 #include <cctbx/uctbx/fast_minimum_reduction.h>
00014
00015
00016 using namespace cctbx;
00017
00018 #include <iostream>
00019 #include "hkl_datatypes.hh"
00020 #include "lattice.hh"
00021 #include "Output.hh"
00022 #include "controls.hh"
00023 #include "zone.hh"
00024 #include "score_datatypes.hh"
00025
00026 using scala::Chirality;
00027
00028 namespace CCtbxSym
00029 {
00030
00031
00033
00034 std::string CCTBX_SGsymbol_HorR(const std::string& SName);
00035
00036 std::string PointGroupName(const std::string& SGname);
00037
00038 std::string LaueGroupName(const std::string& SGname);
00039 void PrintCctbxSymops(const sgtbx::space_group& SpSgrp);
00040 void PrintChBOp(const sgtbx::change_of_basis_op& ChBasis);
00041 std::string UcellFormat(const uctbx::unit_cell uc);
00042 std::string ChangeBasisFormat_as_Reindex(const sgtbx::change_of_basis_op& ChB);
00043
00044 bool EnantiomorphicGroups(const std::string& SGname1, const std::string& SGname2);
00045 sgtbx::change_of_basis_op
00046 MakeChangeOfBasisOp(const scala::ReindexOp& reindex_op);
00047
00048 scala::ReindexOp SetReindexOp(const sgtbx::change_of_basis_op& ChB);
00049 std::string Reindex_as_xyz(const scala::ReindexOp& reindex);
00050
00051
00052
00053 sgtbx::change_of_basis_op GetBestCell(const sgtbx::space_group& Group,
00054 const uctbx::unit_cell& uccell,
00055 const int& AllowI2);
00056
00057
00058 class LatticeGroup
00059
00060
00061 {
00062 public:
00063 LatticeGroup(){};
00064 LatticeGroup(const sgtbx::space_group& Group);
00065 LatticeGroup(const sgtbx::space_group& Group, const char LatType);
00066
00067 CrystalSystem crystal_system() const {return CrysSys;}
00068 sgtbx::space_group lattice_group() const {return LatGroup;}
00069 bool Valid() const {return valid;}
00070
00071 private:
00072 void init(const sgtbx::space_group& Group,
00073 const char LatType);
00074 sgtbx::space_group SpaceGroup;
00075 sgtbx::space_group LatGroup;
00076 CrystalSystem CrysSys;
00077 bool valid;
00078 };
00079
00080
00081 class AlternativeBases
00082
00083
00084 {
00085 public:
00086 AlternativeBases(){};
00087 AlternativeBases(const sgtbx::change_of_basis_op& cb_op,
00088 const double& celldiff);
00089 AlternativeBases(const std::vector<sgtbx::change_of_basis_op>& cb_ops,
00090 const double& celldiff);
00091
00092 void AddOp(const sgtbx::change_of_basis_op& cb_op);
00093
00094 double CellDiff() const {return CellDiff_;}
00095
00096 int Nop() const {return CbOps.size();}
00097 sgtbx::change_of_basis_op FirstOp() const {return CbOps[0];}
00098 sgtbx::change_of_basis_op Op(const int& i) const {return CbOps[i];}
00099
00100
00101 sgtbx::change_of_basis_op SimplestOp() const;
00102
00103 friend bool operator < (const AlternativeBases& a, const AlternativeBases& b)
00104
00105 {return (a.CellDiff_ < b.CellDiff_);}
00106
00107 private:
00108 std::vector<sgtbx::change_of_basis_op> CbOps;
00109 double CellDiff_;
00110 };
00111
00112
00113
00114 class PointGroup
00115
00116 {
00117 public:
00118 PointGroup();
00119 PointGroup(const std::string& Name);
00120
00121 PointGroup(const char& LatticeType);
00122
00123
00124
00125 PointGroup(const int& Kelement1,
00126 const std::vector<double>& Rmatrix1,
00127 const int& Kelement2,
00128 const std::vector<double>& Rmatrix2,
00129 const char& LatticeType);
00130
00131
00132 PointGroup(const bool SetLatticeGroup, const PointGroup& PG);
00133
00134
00135 bool AddElement(const int& Kelement,
00136 const std::vector<double>& Rmatrix);
00137
00138
00139
00140 double SetCell(const std::vector<double>& cellin,
00141 const scala::ReindexOp& reindex_op,
00142 const int& AllowI2);
00143
00144
00145
00146 bool HasElement(const int& Kelement) const;
00147 bool HasElement(const std::vector<double>& Rmatrix) const;
00148
00149 std::vector<int> Elements() const {return ElementNums;}
00150
00151 int NElements() const {return ElementNums.size();}
00152
00153
00154 std::string RefLGname() const;
00155
00156 std::string LGname() const;
00157
00158 std::string RefPGname() const;
00159
00160
00161
00162
00163
00164 scala::ReindexOp RefSGreindex() const;
00165
00166 std::string RefSGreindexFormat() const;
00167
00168 scala::ReindexOp SGreindex() const;
00169
00170 scala::ReindexOp SGreindexOrig() const;
00171
00172
00173 CrystalSystem crystal_system() const;
00174
00175
00176
00177 double Delta() const {return delta;}
00178
00179
00180 std::vector<double> TransformedCell() const;
00181
00182 void PrintAlternativeCells(phaser_io::Output& output,
00183 const bool& OutputXML,
00184 const float& max_delta,
00185 const int& AllowI2) const;
00186
00187
00188
00189
00190 int OrderValue() const;
00191
00192
00193
00194
00195 bool Equals(const PointGroup& other) const;
00196
00197 bool EqualsRef(const PointGroup& other) const;
00198
00199
00200 friend bool operator == (const PointGroup& a,const PointGroup& b)
00201
00202 {return (a.RotGrp == b.RotGrp);}
00203
00204
00205
00206 friend bool operator != (const PointGroup& a,const PointGroup& b)
00207
00208 {return (a.RotGrp != b.RotGrp);}
00209
00210
00211 friend std::vector<scala::ReindexOp>
00212 AlternativeIndexing(const PointGroup& PG,
00213 const bool& strict,
00214 const scala::Scell target_cell,
00215 const float& max_delta,
00216 const int& AllowI2);
00217
00218 void dump() const;
00219
00220 std::vector<scala::PossibleSpaceGroup> TestSpaceGroupList
00221 (std::vector<scala::Zone>& Zones,
00222 const Chirality& chiral) const;
00223
00224
00225 std::vector<std::string> SpaceGroupList(const Chirality chiral=scala::CHIRAL,
00226 const bool AllLattice = false) const;
00227
00228
00229
00230 void PrintAllSpacegroups(phaser_io::Output& output,
00231 const Chirality chiral=scala::CHIRAL,
00232 const bool AllLattice = false) const;
00233
00234 void SetCellDiff(const double& diff) {Cell_Diff = diff;}
00235 double CellDiff() const;
00236
00237 char GetLatType() const;
00238
00239
00240
00241
00242
00243 std::vector<scala::ReindexOp>
00244 GetCloseCell(const scala::Scell& cell_target,
00245 const double& diff_tolerance,
00246 const bool& ExcludeIdentity,
00247 std::vector<double>& celldiff,
00248 const int& AllowI2);
00249
00250 private:
00251
00252 void init(const sgtbx::space_group& Pgroup, const char& LatticeType);
00253 sgtbx::space_group GetSpaceGroup() const {return RotGrp_ref;}
00254
00255 scala::SysAbsScore TestPossible(const cctbx::sgtbx::space_group& sg,
00256 std::vector<scala::Zone>& Zones) const;
00257
00258
00259
00260
00261
00262
00263
00264 sgtbx::space_group RotGrp;
00265 sgtbx::space_group RotGrp_ref;
00266 sgtbx::space_group PntGrp_ref;
00267
00268
00269 sgtbx::space_group_type LaueGrp_type;
00270 sgtbx::space_group LaueGrp_ref;
00271 sgtbx::space_group_type LaueGrp_ref_type;
00272
00273
00274
00275 std::vector<double> input_cell;
00276 uctbx::unit_cell uccell;
00277
00278
00279 scala::ReindexOp CellReindexOp;
00280 sgtbx::change_of_basis_op ChBasis_cell;
00281
00282
00283 sgtbx::change_of_basis_op ChBasis;
00284 uctbx::unit_cell uccell_ref;
00285
00286
00287 sgtbx::change_of_basis_op ChBasis_ref;
00288
00289
00290 std::vector<int> ElementNums;
00291
00292 char LatType;
00293
00294 double delta;
00295
00296 double Cell_Diff;
00297 };
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337 std::vector<AlternativeBases>
00338 GetAlternativeBases(const sgtbx::space_group& Group,
00339 const bool ExcludeIdentity, bool AnyCell,
00340 const bool BestCell,
00341 const uctbx::unit_cell& uccell,
00342 const uctbx::unit_cell& refcell,
00343 const double& tolerance,
00344 const double& angular_tolerance,
00345 const int& AllowI2);
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370 std::vector<scala::ReindexOp>
00371 AlternativeIndexing(const PointGroup& PGz1,
00372 const bool& strict,
00373 const scala::Scell target_cell,
00374 const float& max_delta,
00375 const int& AllowI2);
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392 std::vector<sgtbx::change_of_basis_op> PossibleChBOp
00393 (const LatticeGroup& LatGroup, const sgtbx::space_group& Group,
00394 const int& AllowI2);
00395
00396 }
00397 #endif